@ensuro/core 2.8.3 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +2 -3
  2. package/build/contracts/AccessManager.sol/AccessManager.json +2 -15
  3. package/build/contracts/ERC4626AssetManager.sol/ERC4626AssetManager.json +2 -2
  4. package/build/contracts/ERC4626PlusVaultAssetManager.sol/ERC4626PlusVaultAssetManager.json +2 -2
  5. package/build/contracts/EToken.sol/EToken.json +7 -85
  6. package/build/contracts/FullSignedBucketRiskModule.sol/FullSignedBucketRiskModule.json +1484 -0
  7. package/build/contracts/LPManualWhitelist.sol/LPManualWhitelist.json +7 -85
  8. package/build/contracts/Policy.sol/Policy.json +2 -2
  9. package/build/contracts/PolicyPool.sol/PolicyPool.json +2 -15
  10. package/build/contracts/PolicyPoolComponent.sol/PolicyPoolComponent.json +5 -83
  11. package/build/contracts/PremiumsAccount.sol/PremiumsAccount.json +7 -85
  12. package/build/contracts/Reserve.sol/Reserve.json +5 -83
  13. package/build/contracts/RiskModule.sol/RiskModule.json +5 -96
  14. package/build/contracts/SignedBucketRiskModule.sol/SignedBucketRiskModule.json +7 -150
  15. package/build/contracts/SignedQuoteRiskModule.sol/SignedQuoteRiskModule.json +7 -98
  16. package/build/contracts/TimeScaled.sol/TimeScaled.json +2 -2
  17. package/build/contracts/TrustfulRiskModule.sol/TrustfulRiskModule.json +7 -98
  18. package/build/contracts/dependencies/WadRayMath.sol/WadRayMath.json +2 -2
  19. package/build/contracts/migration/LPManualWhitelistV20.sol/LPManualWhitelistV20.json +5 -83
  20. package/build/contracts/migration/LPManualWhitelistV20Upgraded.sol/LPManualWhitelistV20Upgraded.json +7 -85
  21. package/build/contracts/mocks/FixedRateVault.sol/FixedRateVault.json +2 -2
  22. package/build/contracts/mocks/ForwardProxy.sol/ForwardProxy.json +2 -2
  23. package/build/contracts/mocks/InterfaceIdCalculator.sol/InterfaceIdCalculator.json +2 -2
  24. package/build/contracts/mocks/PolicyHolderMock.sol/PolicyHolderMock.json +2 -2
  25. package/build/contracts/mocks/PolicyPoolComponentMock.sol/PolicyPoolComponentMock.json +2 -2
  26. package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMock.json +2 -2
  27. package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMockForward.json +2 -2
  28. package/build/contracts/mocks/RiskModuleMock.sol/RiskModuleMock.json +7 -98
  29. package/build/contracts/mocks/TestCurrency.sol/TestCurrency.json +2 -2
  30. package/build/contracts/mocks/TestNFT.sol/TestNFT.json +2 -2
  31. package/contracts/AccessManager.sol +0 -1
  32. package/contracts/EToken.sol +2 -20
  33. package/contracts/FullSignedBucketRiskModule.sol +204 -0
  34. package/contracts/PolicyPool.sol +0 -1
  35. package/contracts/PolicyPoolComponent.sol +7 -44
  36. package/contracts/PremiumsAccount.sol +3 -3
  37. package/contracts/RiskModule.sol +10 -21
  38. package/contracts/SignedBucketRiskModule.sol +15 -9
  39. package/contracts/SignedQuoteRiskModule.sol +7 -4
  40. package/js/test-utils.js +1 -2
  41. package/js/utils.js +65 -0
  42. package/package.json +1 -1
  43. package/scripts/deploySmokeTest-fork.sh +1 -1
  44. package/scripts/deploySmokeTest.sh +1 -1
@@ -381,8 +381,8 @@
381
381
  "type": "function"
382
382
  }
383
383
  ],
384
- "bytecode": "0x60806040523480156200001157600080fd5b50604051620016eb380380620016eb833981016040819052620000349162000136565b818160006200004483826200022f565b5060016200005382826200022f565b5050600680546001600160a01b0319163317905550620002fb915050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200009957600080fd5b81516001600160401b0380821115620000b657620000b662000071565b604051601f8301601f19908116603f01168101908282118183101715620000e157620000e162000071565b81604052838152602092508683858801011115620000fe57600080fd5b600091505b8382101562000122578582018301518183018401529082019062000103565b600093810190920192909252949350505050565b600080604083850312156200014a57600080fd5b82516001600160401b03808211156200016257600080fd5b620001708683870162000087565b935060208501519150808211156200018757600080fd5b50620001968582860162000087565b9150509250929050565b600181811c90821680620001b557607f821691505b602082108103620001d657634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200022a57600081815260208120601f850160051c81016020861015620002055750805b601f850160051c820191505b81811015620002265782815560010162000211565b5050505b505050565b81516001600160401b038111156200024b576200024b62000071565b62000263816200025c8454620001a0565b84620001dc565b602080601f8311600181146200029b5760008415620002825750858301515b600019600386901b1c1916600185901b17855562000226565b600085815260208120601f198616915b82811015620002cc57888601518255948401946001909101908401620002ab565b5085821015620002eb5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6113e0806200030b6000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806342966c6811610097578063a22cb46511610066578063a22cb465146101ff578063b88d4fde14610212578063c87b56dd14610225578063e985e9c51461023857600080fd5b806342966c68146101b05780636352211e146101c357806370a08231146101d657806395d89b41146101f757600080fd5b8063095ea7b3116100d3578063095ea7b31461016257806323b872dd1461017757806340c10f191461018a57806342842e0e1461019d57600080fd5b806301ffc9a7146100fa57806306fdde0314610122578063081812fc14610137575b600080fd5b61010d610108366004610f6c565b610274565b60405190151581526020015b60405180910390f35b61012a6102c6565b6040516101199190610fd9565b61014a610145366004610fec565b610358565b6040516001600160a01b039091168152602001610119565b610175610170366004611021565b61037f565b005b61017561018536600461104b565b610499565b610175610198366004611021565b6104ca565b6101756101ab36600461104b565b6104d8565b6101756101be366004610fec565b6104f3565b61014a6101d1366004610fec565b61056d565b6101e96101e4366004611087565b6105cd565b604051908152602001610119565b61012a610653565b61017561020d3660046110a2565b610662565b6101756102203660046110f4565b61066d565b61012a610233366004610fec565b6106a5565b61010d6102463660046111d0565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60006001600160e01b031982166380ac58cd60e01b14806102a557506001600160e01b03198216635b5e139f60e01b145b806102c057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546102d590611203565b80601f016020809104026020016040519081016040528092919081815260200182805461030190611203565b801561034e5780601f106103235761010080835404028352916020019161034e565b820191906000526020600020905b81548152906001019060200180831161033157829003601f168201915b5050505050905090565b600061036382610719565b506000908152600460205260409020546001600160a01b031690565b600061038a8261056d565b9050806001600160a01b0316836001600160a01b0316036103fc5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061041857506104188133610246565b61048a5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016103f3565b6104948383610778565b505050565b6104a333826107e6565b6104bf5760405162461bcd60e51b81526004016103f39061123d565b610494838383610865565b6104d482826109c9565b5050565b6104948383836040518060200160405280600081525061066d565b336104fd8261056d565b6001600160a01b0316146105615760405162461bcd60e51b815260206004820152602560248201527f4552433732313a206275726e206f6620746f6b656e2074686174206973206e6f6044820152643a1037bbb760d91b60648201526084016103f3565b61056a81610b54565b50565b6000818152600260205260408120546001600160a01b0316806102c05760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103f3565b60006001600160a01b0382166106375760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016103f3565b506001600160a01b031660009081526003602052604090205490565b6060600180546102d590611203565b6104d4338383610be9565b61067733836107e6565b6106935760405162461bcd60e51b81526004016103f39061123d565b61069f84848484610cb7565b50505050565b60606106b082610719565b60006106c760408051602081019091526000815290565b905060008151116106e75760405180602001604052806000815250610712565b806106f184610cea565b60405160200161070292919061128a565b6040516020818303038152906040525b9392505050565b6000818152600260205260409020546001600160a01b031661056a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103f3565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906107ad8261056d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806107f28361056d565b9050806001600160a01b0316846001600160a01b0316148061083957506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b8061085d5750836001600160a01b031661085284610358565b6001600160a01b0316145b949350505050565b826001600160a01b03166108788261056d565b6001600160a01b03161461089e5760405162461bcd60e51b81526004016103f3906112b9565b6001600160a01b0382166109005760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016103f3565b826001600160a01b03166109138261056d565b6001600160a01b0316146109395760405162461bcd60e51b81526004016103f3906112b9565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216610a1f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016103f3565b6000818152600260205260409020546001600160a01b031615610a845760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103f3565b6000818152600260205260409020546001600160a01b031615610ae95760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103f3565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000610b5f8261056d565b9050610b6a8261056d565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b031603610c4a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016103f3565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b610cc2848484610865565b610cce84848484610d7d565b61069f5760405162461bcd60e51b81526004016103f3906112fe565b60606000610cf783610e7e565b600101905060008167ffffffffffffffff811115610d1757610d176110de565b6040519080825280601f01601f191660200182016040528015610d41576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084610d4b57509392505050565b60006001600160a01b0384163b15610e7357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290610dc1903390899088908890600401611350565b6020604051808303816000875af1925050508015610dfc575060408051601f3d908101601f19168201909252610df99181019061138d565b60015b610e59573d808015610e2a576040519150601f19603f3d011682016040523d82523d6000602084013e610e2f565b606091505b508051600003610e515760405162461bcd60e51b81526004016103f3906112fe565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061085d565b506001949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310610ebd5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310610ee9576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610f0757662386f26fc10000830492506010015b6305f5e1008310610f1f576305f5e100830492506008015b6127108310610f3357612710830492506004015b60648310610f45576064830492506002015b600a83106102c05760010192915050565b6001600160e01b03198116811461056a57600080fd5b600060208284031215610f7e57600080fd5b813561071281610f56565b60005b83811015610fa4578181015183820152602001610f8c565b50506000910152565b60008151808452610fc5816020860160208601610f89565b601f01601f19169290920160200192915050565b6020815260006107126020830184610fad565b600060208284031215610ffe57600080fd5b5035919050565b80356001600160a01b038116811461101c57600080fd5b919050565b6000806040838503121561103457600080fd5b61103d83611005565b946020939093013593505050565b60008060006060848603121561106057600080fd5b61106984611005565b925061107760208501611005565b9150604084013590509250925092565b60006020828403121561109957600080fd5b61071282611005565b600080604083850312156110b557600080fd5b6110be83611005565b9150602083013580151581146110d357600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561110a57600080fd5b61111385611005565b935061112160208601611005565b925060408501359150606085013567ffffffffffffffff8082111561114557600080fd5b818701915087601f83011261115957600080fd5b81358181111561116b5761116b6110de565b604051601f8201601f19908116603f01168101908382118183101715611193576111936110de565b816040528281528a60208487010111156111ac57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600080604083850312156111e357600080fd5b6111ec83611005565b91506111fa60208401611005565b90509250929050565b600181811c9082168061121757607f821691505b60208210810361123757634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b6000835161129c818460208801610f89565b8351908301906112b0818360208801610f89565b01949350505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061138390830184610fad565b9695505050505050565b60006020828403121561139f57600080fd5b815161071281610f5656fea264697066735822122032e948b2b08ed23fad1436490d9de8e4837b9f460507f13c2e7e469d771dd0f264736f6c63430008100033",
385
- "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806342966c6811610097578063a22cb46511610066578063a22cb465146101ff578063b88d4fde14610212578063c87b56dd14610225578063e985e9c51461023857600080fd5b806342966c68146101b05780636352211e146101c357806370a08231146101d657806395d89b41146101f757600080fd5b8063095ea7b3116100d3578063095ea7b31461016257806323b872dd1461017757806340c10f191461018a57806342842e0e1461019d57600080fd5b806301ffc9a7146100fa57806306fdde0314610122578063081812fc14610137575b600080fd5b61010d610108366004610f6c565b610274565b60405190151581526020015b60405180910390f35b61012a6102c6565b6040516101199190610fd9565b61014a610145366004610fec565b610358565b6040516001600160a01b039091168152602001610119565b610175610170366004611021565b61037f565b005b61017561018536600461104b565b610499565b610175610198366004611021565b6104ca565b6101756101ab36600461104b565b6104d8565b6101756101be366004610fec565b6104f3565b61014a6101d1366004610fec565b61056d565b6101e96101e4366004611087565b6105cd565b604051908152602001610119565b61012a610653565b61017561020d3660046110a2565b610662565b6101756102203660046110f4565b61066d565b61012a610233366004610fec565b6106a5565b61010d6102463660046111d0565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60006001600160e01b031982166380ac58cd60e01b14806102a557506001600160e01b03198216635b5e139f60e01b145b806102c057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546102d590611203565b80601f016020809104026020016040519081016040528092919081815260200182805461030190611203565b801561034e5780601f106103235761010080835404028352916020019161034e565b820191906000526020600020905b81548152906001019060200180831161033157829003601f168201915b5050505050905090565b600061036382610719565b506000908152600460205260409020546001600160a01b031690565b600061038a8261056d565b9050806001600160a01b0316836001600160a01b0316036103fc5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061041857506104188133610246565b61048a5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016103f3565b6104948383610778565b505050565b6104a333826107e6565b6104bf5760405162461bcd60e51b81526004016103f39061123d565b610494838383610865565b6104d482826109c9565b5050565b6104948383836040518060200160405280600081525061066d565b336104fd8261056d565b6001600160a01b0316146105615760405162461bcd60e51b815260206004820152602560248201527f4552433732313a206275726e206f6620746f6b656e2074686174206973206e6f6044820152643a1037bbb760d91b60648201526084016103f3565b61056a81610b54565b50565b6000818152600260205260408120546001600160a01b0316806102c05760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103f3565b60006001600160a01b0382166106375760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016103f3565b506001600160a01b031660009081526003602052604090205490565b6060600180546102d590611203565b6104d4338383610be9565b61067733836107e6565b6106935760405162461bcd60e51b81526004016103f39061123d565b61069f84848484610cb7565b50505050565b60606106b082610719565b60006106c760408051602081019091526000815290565b905060008151116106e75760405180602001604052806000815250610712565b806106f184610cea565b60405160200161070292919061128a565b6040516020818303038152906040525b9392505050565b6000818152600260205260409020546001600160a01b031661056a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103f3565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906107ad8261056d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806107f28361056d565b9050806001600160a01b0316846001600160a01b0316148061083957506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b8061085d5750836001600160a01b031661085284610358565b6001600160a01b0316145b949350505050565b826001600160a01b03166108788261056d565b6001600160a01b03161461089e5760405162461bcd60e51b81526004016103f3906112b9565b6001600160a01b0382166109005760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016103f3565b826001600160a01b03166109138261056d565b6001600160a01b0316146109395760405162461bcd60e51b81526004016103f3906112b9565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216610a1f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016103f3565b6000818152600260205260409020546001600160a01b031615610a845760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103f3565b6000818152600260205260409020546001600160a01b031615610ae95760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103f3565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000610b5f8261056d565b9050610b6a8261056d565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b031603610c4a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016103f3565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b610cc2848484610865565b610cce84848484610d7d565b61069f5760405162461bcd60e51b81526004016103f3906112fe565b60606000610cf783610e7e565b600101905060008167ffffffffffffffff811115610d1757610d176110de565b6040519080825280601f01601f191660200182016040528015610d41576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084610d4b57509392505050565b60006001600160a01b0384163b15610e7357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290610dc1903390899088908890600401611350565b6020604051808303816000875af1925050508015610dfc575060408051601f3d908101601f19168201909252610df99181019061138d565b60015b610e59573d808015610e2a576040519150601f19603f3d011682016040523d82523d6000602084013e610e2f565b606091505b508051600003610e515760405162461bcd60e51b81526004016103f3906112fe565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061085d565b506001949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310610ebd5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310610ee9576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610f0757662386f26fc10000830492506010015b6305f5e1008310610f1f576305f5e100830492506008015b6127108310610f3357612710830492506004015b60648310610f45576064830492506002015b600a83106102c05760010192915050565b6001600160e01b03198116811461056a57600080fd5b600060208284031215610f7e57600080fd5b813561071281610f56565b60005b83811015610fa4578181015183820152602001610f8c565b50506000910152565b60008151808452610fc5816020860160208601610f89565b601f01601f19169290920160200192915050565b6020815260006107126020830184610fad565b600060208284031215610ffe57600080fd5b5035919050565b80356001600160a01b038116811461101c57600080fd5b919050565b6000806040838503121561103457600080fd5b61103d83611005565b946020939093013593505050565b60008060006060848603121561106057600080fd5b61106984611005565b925061107760208501611005565b9150604084013590509250925092565b60006020828403121561109957600080fd5b61071282611005565b600080604083850312156110b557600080fd5b6110be83611005565b9150602083013580151581146110d357600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561110a57600080fd5b61111385611005565b935061112160208601611005565b925060408501359150606085013567ffffffffffffffff8082111561114557600080fd5b818701915087601f83011261115957600080fd5b81358181111561116b5761116b6110de565b604051601f8201601f19908116603f01168101908382118183101715611193576111936110de565b816040528281528a60208487010111156111ac57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600080604083850312156111e357600080fd5b6111ec83611005565b91506111fa60208401611005565b90509250929050565b600181811c9082168061121757607f821691505b60208210810361123757634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b6000835161129c818460208801610f89565b8351908301906112b0818360208801610f89565b01949350505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061138390830184610fad565b9695505050505050565b60006020828403121561139f57600080fd5b815161071281610f5656fea264697066735822122032e948b2b08ed23fad1436490d9de8e4837b9f460507f13c2e7e469d771dd0f264736f6c63430008100033",
384
+ "bytecode": "0x608060405234801561000f575f5ffd5b5060405161162938038061162983398101604081905261002e91610102565b81815f61003b83826101eb565b50600161004882826101eb565b5050600680546001600160a01b03191633179055506102a5915050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112610088575f5ffd5b81516001600160401b038111156100a1576100a1610065565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100cf576100cf610065565b6040528181528382016020018510156100e6575f5ffd5b8160208501602083015e5f918101602001919091529392505050565b5f5f60408385031215610113575f5ffd5b82516001600160401b03811115610128575f5ffd5b61013485828601610079565b602085015190935090506001600160401b03811115610151575f5ffd5b61015d85828601610079565b9150509250929050565b600181811c9082168061017b57607f821691505b60208210810361019957634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156101e657805f5260205f20601f840160051c810160208510156101c45750805b601f840160051c820191505b818110156101e3575f81556001016101d0565b50505b505050565b81516001600160401b0381111561020457610204610065565b610218816102128454610167565b8461019f565b6020601f82116001811461024a575f83156102335750848201515b5f19600385901b1c1916600184901b1784556101e3565b5f84815260208120601f198516915b828110156102795787850151825560209485019460019092019101610259565b508482101561029657868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b611377806102b25f395ff3fe608060405234801561000f575f5ffd5b50600436106100f0575f3560e01c806342966c6811610093578063a22cb46511610063578063a22cb465146101f9578063b88d4fde1461020c578063c87b56dd1461021f578063e985e9c514610232575f5ffd5b806342966c68146101aa5780636352211e146101bd57806370a08231146101d057806395d89b41146101f1575f5ffd5b8063095ea7b3116100ce578063095ea7b31461015c57806323b872dd1461017157806340c10f191461018457806342842e0e14610197575f5ffd5b806301ffc9a7146100f457806306fdde031461011c578063081812fc14610131575b5f5ffd5b610107610102366004610f40565b61026d565b60405190151581526020015b60405180910390f35b6101246102be565b6040516101139190610f89565b61014461013f366004610f9b565b61034d565b6040516001600160a01b039091168152602001610113565b61016f61016a366004610fcd565b610372565b005b61016f61017f366004610ff5565b61048b565b61016f610192366004610fcd565b6104bc565b61016f6101a5366004610ff5565b6104ca565b61016f6101b8366004610f9b565b6104e4565b6101446101cb366004610f9b565b61055e565b6101e36101de36600461102f565b6105bd565b604051908152602001610113565b610124610641565b61016f610207366004611048565b610650565b61016f61021a366004611095565b61065b565b61012461022d366004610f9b565b610693565b610107610240366004611172565b6001600160a01b039182165f90815260056020908152604080832093909416825291909152205460ff1690565b5f6001600160e01b031982166380ac58cd60e01b148061029d57506001600160e01b03198216635b5e139f60e01b145b806102b857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60605f80546102cc906111a3565b80601f01602080910402602001604051908101604052809291908181526020018280546102f8906111a3565b80156103435780601f1061031a57610100808354040283529160200191610343565b820191905f5260205f20905b81548152906001019060200180831161032657829003601f168201915b5050505050905090565b5f61035782610703565b505f908152600460205260409020546001600160a01b031690565b5f61037c8261055e565b9050806001600160a01b0316836001600160a01b0316036103ee5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061040a575061040a8133610240565b61047c5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016103e5565b6104868383610761565b505050565b61049533826107ce565b6104b15760405162461bcd60e51b81526004016103e5906111db565b61048683838361084b565b6104c682826109ad565b5050565b61048683838360405180602001604052805f81525061065b565b336104ee8261055e565b6001600160a01b0316146105525760405162461bcd60e51b815260206004820152602560248201527f4552433732313a206275726e206f6620746f6b656e2074686174206973206e6f6044820152643a1037bbb760d91b60648201526084016103e5565b61055b81610b35565b50565b5f818152600260205260408120546001600160a01b0316806102b85760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103e5565b5f6001600160a01b0382166106265760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016103e5565b506001600160a01b03165f9081526003602052604090205490565b6060600180546102cc906111a3565b6104c6338383610bc7565b61066533836107ce565b6106815760405162461bcd60e51b81526004016103e5906111db565b61068d84848484610c94565b50505050565b606061069e82610703565b5f6106b360408051602081019091525f815290565b90505f8151116106d15760405180602001604052805f8152506106fc565b806106db84610cc7565b6040516020016106ec92919061123f565b6040516020818303038152906040525b9392505050565b5f818152600260205260409020546001600160a01b031661055b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103e5565b5f81815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906107958261055e565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f5f6107d98361055e565b9050806001600160a01b0316846001600160a01b0316148061081f57506001600160a01b038082165f9081526005602090815260408083209388168352929052205460ff165b806108435750836001600160a01b03166108388461034d565b6001600160a01b0316145b949350505050565b826001600160a01b031661085e8261055e565b6001600160a01b0316146108845760405162461bcd60e51b81526004016103e590611253565b6001600160a01b0382166108e65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016103e5565b826001600160a01b03166108f98261055e565b6001600160a01b03161461091f5760405162461bcd60e51b81526004016103e590611253565b5f81815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080545f1901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216610a035760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016103e5565b5f818152600260205260409020546001600160a01b031615610a675760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103e5565b5f818152600260205260409020546001600160a01b031615610acb5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103e5565b6001600160a01b0382165f81815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b5f610b3f8261055e565b9050610b4a8261055e565b5f83815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080545f190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b031603610c285760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016103e5565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b610c9f84848461084b565b610cab84848484610d57565b61068d5760405162461bcd60e51b81526004016103e590611298565b60605f610cd383610e54565b60010190505f8167ffffffffffffffff811115610cf257610cf2611081565b6040519080825280601f01601f191660200182016040528015610d1c576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084610d2657509392505050565b5f6001600160a01b0384163b15610e4957604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290610d9a9033908990889088906004016112ea565b6020604051808303815f875af1925050508015610dd4575060408051601f3d908101601f19168201909252610dd191810190611326565b60015b610e2f573d808015610e01576040519150601f19603f3d011682016040523d82523d5f602084013e610e06565b606091505b5080515f03610e275760405162461bcd60e51b81526004016103e590611298565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610843565b506001949350505050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310610e925772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310610ebe576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610edc57662386f26fc10000830492506010015b6305f5e1008310610ef4576305f5e100830492506008015b6127108310610f0857612710830492506004015b60648310610f1a576064830492506002015b600a83106102b85760010192915050565b6001600160e01b03198116811461055b575f5ffd5b5f60208284031215610f50575f5ffd5b81356106fc81610f2b565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6106fc6020830184610f5b565b5f60208284031215610fab575f5ffd5b5035919050565b80356001600160a01b0381168114610fc8575f5ffd5b919050565b5f5f60408385031215610fde575f5ffd5b610fe783610fb2565b946020939093013593505050565b5f5f5f60608486031215611007575f5ffd5b61101084610fb2565b925061101e60208501610fb2565b929592945050506040919091013590565b5f6020828403121561103f575f5ffd5b6106fc82610fb2565b5f5f60408385031215611059575f5ffd5b61106283610fb2565b915060208301358015158114611076575f5ffd5b809150509250929050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f5f608085870312156110a8575f5ffd5b6110b185610fb2565b93506110bf60208601610fb2565b925060408501359150606085013567ffffffffffffffff8111156110e1575f5ffd5b8501601f810187136110f1575f5ffd5b803567ffffffffffffffff81111561110b5761110b611081565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561113a5761113a611081565b604052818152828201602001891015611151575f5ffd5b816020840160208301375f6020838301015280935050505092959194509250565b5f5f60408385031215611183575f5ffd5b61118c83610fb2565b915061119a60208401610fb2565b90509250929050565b600181811c908216806111b757607f821691505b6020821081036111d557634e487b7160e01b5f52602260045260245ffd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b5f81518060208401855e5f93019283525090919050565b5f61084361124d8386611228565b84611228565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f9061131c90830184610f5b565b9695505050505050565b5f60208284031215611336575f5ffd5b81516106fc81610f2b56fea264697066735822122009d08b38a08341b4445cbd1b89b6d087ed617c214c25ba53062a396e4a59618264736f6c634300081c0033",
385
+ "deployedBytecode": "0x608060405234801561000f575f5ffd5b50600436106100f0575f3560e01c806342966c6811610093578063a22cb46511610063578063a22cb465146101f9578063b88d4fde1461020c578063c87b56dd1461021f578063e985e9c514610232575f5ffd5b806342966c68146101aa5780636352211e146101bd57806370a08231146101d057806395d89b41146101f1575f5ffd5b8063095ea7b3116100ce578063095ea7b31461015c57806323b872dd1461017157806340c10f191461018457806342842e0e14610197575f5ffd5b806301ffc9a7146100f457806306fdde031461011c578063081812fc14610131575b5f5ffd5b610107610102366004610f40565b61026d565b60405190151581526020015b60405180910390f35b6101246102be565b6040516101139190610f89565b61014461013f366004610f9b565b61034d565b6040516001600160a01b039091168152602001610113565b61016f61016a366004610fcd565b610372565b005b61016f61017f366004610ff5565b61048b565b61016f610192366004610fcd565b6104bc565b61016f6101a5366004610ff5565b6104ca565b61016f6101b8366004610f9b565b6104e4565b6101446101cb366004610f9b565b61055e565b6101e36101de36600461102f565b6105bd565b604051908152602001610113565b610124610641565b61016f610207366004611048565b610650565b61016f61021a366004611095565b61065b565b61012461022d366004610f9b565b610693565b610107610240366004611172565b6001600160a01b039182165f90815260056020908152604080832093909416825291909152205460ff1690565b5f6001600160e01b031982166380ac58cd60e01b148061029d57506001600160e01b03198216635b5e139f60e01b145b806102b857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60605f80546102cc906111a3565b80601f01602080910402602001604051908101604052809291908181526020018280546102f8906111a3565b80156103435780601f1061031a57610100808354040283529160200191610343565b820191905f5260205f20905b81548152906001019060200180831161032657829003601f168201915b5050505050905090565b5f61035782610703565b505f908152600460205260409020546001600160a01b031690565b5f61037c8261055e565b9050806001600160a01b0316836001600160a01b0316036103ee5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061040a575061040a8133610240565b61047c5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016103e5565b6104868383610761565b505050565b61049533826107ce565b6104b15760405162461bcd60e51b81526004016103e5906111db565b61048683838361084b565b6104c682826109ad565b5050565b61048683838360405180602001604052805f81525061065b565b336104ee8261055e565b6001600160a01b0316146105525760405162461bcd60e51b815260206004820152602560248201527f4552433732313a206275726e206f6620746f6b656e2074686174206973206e6f6044820152643a1037bbb760d91b60648201526084016103e5565b61055b81610b35565b50565b5f818152600260205260408120546001600160a01b0316806102b85760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103e5565b5f6001600160a01b0382166106265760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016103e5565b506001600160a01b03165f9081526003602052604090205490565b6060600180546102cc906111a3565b6104c6338383610bc7565b61066533836107ce565b6106815760405162461bcd60e51b81526004016103e5906111db565b61068d84848484610c94565b50505050565b606061069e82610703565b5f6106b360408051602081019091525f815290565b90505f8151116106d15760405180602001604052805f8152506106fc565b806106db84610cc7565b6040516020016106ec92919061123f565b6040516020818303038152906040525b9392505050565b5f818152600260205260409020546001600160a01b031661055b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103e5565b5f81815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906107958261055e565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f5f6107d98361055e565b9050806001600160a01b0316846001600160a01b0316148061081f57506001600160a01b038082165f9081526005602090815260408083209388168352929052205460ff165b806108435750836001600160a01b03166108388461034d565b6001600160a01b0316145b949350505050565b826001600160a01b031661085e8261055e565b6001600160a01b0316146108845760405162461bcd60e51b81526004016103e590611253565b6001600160a01b0382166108e65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016103e5565b826001600160a01b03166108f98261055e565b6001600160a01b03161461091f5760405162461bcd60e51b81526004016103e590611253565b5f81815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080545f1901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216610a035760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016103e5565b5f818152600260205260409020546001600160a01b031615610a675760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103e5565b5f818152600260205260409020546001600160a01b031615610acb5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103e5565b6001600160a01b0382165f81815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b5f610b3f8261055e565b9050610b4a8261055e565b5f83815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080545f190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b031603610c285760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016103e5565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b610c9f84848461084b565b610cab84848484610d57565b61068d5760405162461bcd60e51b81526004016103e590611298565b60605f610cd383610e54565b60010190505f8167ffffffffffffffff811115610cf257610cf2611081565b6040519080825280601f01601f191660200182016040528015610d1c576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084610d2657509392505050565b5f6001600160a01b0384163b15610e4957604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290610d9a9033908990889088906004016112ea565b6020604051808303815f875af1925050508015610dd4575060408051601f3d908101601f19168201909252610dd191810190611326565b60015b610e2f573d808015610e01576040519150601f19603f3d011682016040523d82523d5f602084013e610e06565b606091505b5080515f03610e275760405162461bcd60e51b81526004016103e590611298565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610843565b506001949350505050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310610e925772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310610ebe576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610edc57662386f26fc10000830492506010015b6305f5e1008310610ef4576305f5e100830492506008015b6127108310610f0857612710830492506004015b60648310610f1a576064830492506002015b600a83106102b85760010192915050565b6001600160e01b03198116811461055b575f5ffd5b5f60208284031215610f50575f5ffd5b81356106fc81610f2b565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6106fc6020830184610f5b565b5f60208284031215610fab575f5ffd5b5035919050565b80356001600160a01b0381168114610fc8575f5ffd5b919050565b5f5f60408385031215610fde575f5ffd5b610fe783610fb2565b946020939093013593505050565b5f5f5f60608486031215611007575f5ffd5b61101084610fb2565b925061101e60208501610fb2565b929592945050506040919091013590565b5f6020828403121561103f575f5ffd5b6106fc82610fb2565b5f5f60408385031215611059575f5ffd5b61106283610fb2565b915060208301358015158114611076575f5ffd5b809150509250929050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f5f608085870312156110a8575f5ffd5b6110b185610fb2565b93506110bf60208601610fb2565b925060408501359150606085013567ffffffffffffffff8111156110e1575f5ffd5b8501601f810187136110f1575f5ffd5b803567ffffffffffffffff81111561110b5761110b611081565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561113a5761113a611081565b604052818152828201602001891015611151575f5ffd5b816020840160208301375f6020838301015280935050505092959194509250565b5f5f60408385031215611183575f5ffd5b61118c83610fb2565b915061119a60208401610fb2565b90509250929050565b600181811c908216806111b757607f821691505b6020821081036111d557634e487b7160e01b5f52602260045260245ffd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b5f81518060208401855e5f93019283525090919050565b5f61084361124d8386611228565b84611228565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f9061131c90830184610f5b565b9695505050505050565b5f60208284031215611336575f5ffd5b81516106fc81610f2b56fea264697066735822122009d08b38a08341b4445cbd1b89b6d087ed617c214c25ba53062a396e4a59618264736f6c634300081c0033",
386
386
  "linkReferences": {},
387
387
  "deployedLinkReferences": {}
388
388
  }
@@ -35,7 +35,6 @@ contract AccessManager is Initializable, AccessControlUpgradeable, UUPSUpgradeab
35
35
  bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");
36
36
  bytes32 public constant LEVEL1_ROLE = keccak256("LEVEL1_ROLE");
37
37
  bytes32 public constant LEVEL2_ROLE = keccak256("LEVEL2_ROLE");
38
- bytes32 public constant LEVEL3_ROLE = keccak256("LEVEL3_ROLE");
39
38
 
40
39
  //
41
40
  /**
@@ -697,31 +697,14 @@ contract EToken is Reserve, IERC20Metadata, IEToken {
697
697
  return _4toWad(_params.internalLoanInterestRate);
698
698
  }
699
699
 
700
- function setParam(Parameter param, uint256 newValue) external onlyGlobalOrComponentRole2(LEVEL2_ROLE, LEVEL3_ROLE) {
701
- bool tweak = !hasPoolRole(LEVEL2_ROLE);
700
+ function setParam(Parameter param, uint256 newValue) external onlyGlobalOrComponentRole(LEVEL2_ROLE) {
702
701
  if (param == Parameter.liquidityRequirement) {
703
- require(
704
- !tweak || _isTweakWad(liquidityRequirement(), newValue, 1e17),
705
- "Tweak exceeded: liquidityRequirement tweaks only up to 10%"
706
- );
707
702
  _params.liquidityRequirement = _wadTo4(newValue);
708
703
  } else if (param == Parameter.minUtilizationRate) {
709
- require(
710
- !tweak || _isTweakWad(minUtilizationRate(), newValue, 3e17),
711
- "Tweak exceeded: minUtilizationRate tweaks only up to 30%"
712
- );
713
704
  _params.minUtilizationRate = _wadTo4(newValue);
714
705
  } else if (param == Parameter.maxUtilizationRate) {
715
- require(
716
- !tweak || _isTweakWad(maxUtilizationRate(), newValue, 3e17),
717
- "Tweak exceeded: maxUtilizationRate tweaks only up to 30%"
718
- );
719
706
  _params.maxUtilizationRate = _wadTo4(newValue);
720
707
  } else if (param == Parameter.internalLoanInterestRate) {
721
- require(
722
- !tweak || _isTweakWad(internalLoanInterestRate(), newValue, 3e17),
723
- "Tweak exceeded: internalLoanInterestRate tweaks only up to 30%"
724
- );
725
708
  // This call changes the interest rate without updating the current loans up to this point
726
709
  // So, if interest rate goes from 5% to 6%, this change will be retroactive to the lastUpdate of each
727
710
  // loan. Since it's a permissioned call, I'm ok with this. If a caller wants to reduce the impact, it can
@@ -732,8 +715,7 @@ contract EToken is Reserve, IERC20Metadata, IEToken {
732
715
  IAccessManager.GovernanceActions(
733
716
  uint256(IAccessManager.GovernanceActions.setLiquidityRequirement) + uint256(param)
734
717
  ),
735
- newValue,
736
- tweak
718
+ newValue
737
719
  );
738
720
  }
739
721
 
@@ -0,0 +1,204 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.0;
3
+
4
+ import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
5
+
6
+ import {IPolicyPool} from "./interfaces/IPolicyPool.sol";
7
+ import {IPremiumsAccount} from "./interfaces/IPremiumsAccount.sol";
8
+ import {Policy} from "./Policy.sol";
9
+ import {SignedBucketRiskModule} from "./SignedBucketRiskModule.sol";
10
+
11
+ /**
12
+ * @title FullSignedBucket Risk Module
13
+ * @dev Variation of SignedBucketRiskModule that also supports the creation of policies receiving all the
14
+ parameters that affect the price (not just the lossProb). And validates the signature.
15
+ It requires a new permission, the FULL_PRICER_ROLE.
16
+ * @custom:security-contact security@ensuro.co
17
+ * @author Ensuro
18
+ */
19
+ contract FullSignedBucketRiskModule is SignedBucketRiskModule {
20
+ bytes32 internal constant FULL_PRICER_ROLE = keccak256("FULL_PRICER_ROLE");
21
+
22
+ /// @custom:oz-upgrades-unsafe-allow constructor
23
+ constructor(
24
+ IPolicyPool policyPool_,
25
+ IPremiumsAccount premiumsAccount_
26
+ ) SignedBucketRiskModule(policyPool_, premiumsAccount_) {}
27
+
28
+ function _paramsAsUint256(PackedParams memory overrideParams) internal pure returns (uint256) {
29
+ return
30
+ (uint256(overrideParams.moc) << 240) |
31
+ (uint256(overrideParams.jrCollRatio) << 224) |
32
+ (uint256(overrideParams.collRatio) << 208) |
33
+ (uint256(overrideParams.ensuroPpFee) << 192) |
34
+ (uint256(overrideParams.ensuroCocFee) << 176) |
35
+ (uint256(overrideParams.jrRoc) << 160) |
36
+ (uint256(overrideParams.srRoc) << 144);
37
+ }
38
+
39
+ function _checkFullSignature(
40
+ uint256 payout,
41
+ uint256 premium,
42
+ uint256 lossProb,
43
+ uint40 expiration,
44
+ bytes32 policyData,
45
+ PackedParams memory params,
46
+ bytes32 quoteSignatureR,
47
+ bytes32 quoteSignatureVS,
48
+ uint40 quoteValidUntil
49
+ ) internal view {
50
+ if (quoteValidUntil < block.timestamp) revert QuoteExpired();
51
+
52
+ /**
53
+ * Checks the quote has been signed by an authorized user
54
+ * The "quote" is computed as hash of the following fields (encodePacked):
55
+ * - address(this): the address of this RiskModule
56
+ * - payout, premium, lossProb, expiration: the base parameters of the policy
57
+ * - policyData: a hash of the private details of the policy. The calculation should include some
58
+ * unique id (quoteId), so each policyData identifies a policy.
59
+ * - params: packed as a uint256
60
+ * - quoteValidUntil: the maximum validity of the quote
61
+ */
62
+ bytes32 quoteHash = ECDSA.toEthSignedMessageHash(
63
+ abi.encodePacked(
64
+ address(this),
65
+ payout,
66
+ premium,
67
+ lossProb,
68
+ expiration,
69
+ policyData,
70
+ _paramsAsUint256(params),
71
+ quoteValidUntil
72
+ )
73
+ );
74
+ address signer = ECDSA.recover(quoteHash, quoteSignatureR, quoteSignatureVS);
75
+ _policyPool.access().checkComponentRole(address(this), FULL_PRICER_ROLE, signer, false);
76
+ }
77
+
78
+ /**
79
+ * @dev Creates a new Policy using a full signed quote that overrides params.
80
+ * The caller is the payer of the policy.
81
+ *
82
+ * Requirements:
83
+ * - The caller approved the spending of the premium to the PolicyPool
84
+ * - The quote has been signed by an address with the component role PRICER_ROLE
85
+ *
86
+ * Emits:
87
+ * - {PolicyPool.NewPolicy}
88
+ * - {NewSignedPolicy}
89
+ *
90
+ * @param payout The exposure (maximum payout) of the policy
91
+ * @param premium The premium that will be paid by the payer
92
+ * @param lossProb The probability of having to pay the maximum payout (wad)
93
+ * @param expiration The expiration of the policy (timestamp)
94
+ * @param onBehalfOf The policy holder
95
+ * @param policyData A hash of the private details of the policy. The last 96 bits will be used as internalId
96
+ * @param params The parameters for the policy creation (coll ratios, RoCs, fees, etc.)
97
+ * @param quoteSignatureR The signature of the quote. R component (EIP-2098 signature)
98
+ * @param quoteSignatureVS The signature of the quote. VS component (EIP-2098 signature)
99
+ * @param quoteValidUntil The expiration of the quote
100
+ * @return createdPolicy Returns the created policy
101
+ */
102
+ function newPolicyFullParams(
103
+ uint256 payout,
104
+ uint256 premium,
105
+ uint256 lossProb,
106
+ uint40 expiration,
107
+ address onBehalfOf,
108
+ bytes32 policyData,
109
+ PackedParams memory params,
110
+ bytes32 quoteSignatureR,
111
+ bytes32 quoteSignatureVS,
112
+ uint40 quoteValidUntil
113
+ ) external whenNotPaused onlyComponentRole(POLICY_CREATOR_ROLE) returns (Policy.PolicyData memory createdPolicy) {
114
+ _checkFullSignature(
115
+ payout,
116
+ premium,
117
+ lossProb,
118
+ expiration,
119
+ policyData,
120
+ params,
121
+ quoteSignatureR,
122
+ quoteSignatureVS,
123
+ quoteValidUntil
124
+ );
125
+ createdPolicy = _newPolicyWithParams(
126
+ payout,
127
+ premium,
128
+ lossProb,
129
+ expiration,
130
+ _msgSender(),
131
+ onBehalfOf,
132
+ _makeInternalId(policyData),
133
+ _unpackParams(params)
134
+ );
135
+ emit NewSignedPolicy(createdPolicy.id, policyData);
136
+ }
137
+
138
+ /**
139
+ * @dev Replace a policy with a new one, reusing the premium and the capital locked
140
+ *
141
+ * Requirements:
142
+ * - The caller approved the spending of the premium to the PolicyPool
143
+ * - The quote has been signed by an address with the component role PRICER_ROLE
144
+ * - The caller has been granted component role REPLACER_ROLE or creation is open
145
+ *
146
+ * Emits:
147
+ * - {PolicyPool.PolicyReplaced}
148
+ * - {PolicyPool.NewPolicy}
149
+ *
150
+ * @param oldPolicy The policy to be replaced
151
+ * @param payout The exposure (maximum payout) of the new policy
152
+ * @param premium The premium that will be paid by the caller
153
+ * @param lossProb The probability of having to pay the maximum payout (wad)
154
+ * @param expiration The expiration of the policy (timestamp)
155
+ * @param policyData A hash of the private details of the policy. The last 96 bits will be used as internalId
156
+ * @param params The parameters for the policy creation (coll ratios, RoCs, fees, etc.)
157
+ * @param quoteSignatureR The signature of the quote. R component (EIP-2098 signature)
158
+ * @param quoteSignatureVS The signature of the quote. VS component (EIP-2098 signature)
159
+ * @param quoteValidUntil The expiration of the quote
160
+ * @return Returns the id of the created policy
161
+ */
162
+ function replacePolicyFullParams(
163
+ Policy.PolicyData calldata oldPolicy,
164
+ uint256 payout,
165
+ uint256 premium,
166
+ uint256 lossProb,
167
+ uint40 expiration,
168
+ bytes32 policyData,
169
+ PackedParams memory params,
170
+ bytes32 quoteSignatureR,
171
+ bytes32 quoteSignatureVS,
172
+ uint40 quoteValidUntil
173
+ ) external whenNotPaused onlyComponentRole(REPLACER_ROLE) returns (uint256) {
174
+ _checkFullSignature(
175
+ payout,
176
+ premium,
177
+ lossProb,
178
+ expiration,
179
+ policyData,
180
+ params,
181
+ quoteSignatureR,
182
+ quoteSignatureVS,
183
+ quoteValidUntil
184
+ );
185
+ return
186
+ _replacePolicy(
187
+ oldPolicy,
188
+ payout,
189
+ premium,
190
+ lossProb,
191
+ expiration,
192
+ _msgSender(),
193
+ _makeInternalId(policyData),
194
+ _unpackParams(params)
195
+ ).id;
196
+ }
197
+
198
+ /**
199
+ * @dev This empty reserved space is put in place to allow future versions to add new
200
+ * variables without shifting down storage in the inheritance chain.
201
+ * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
202
+ */
203
+ uint256[50] private __gap;
204
+ }
@@ -42,7 +42,6 @@ contract PolicyPool is IPolicyPool, PausableUpgradeable, UUPSUpgradeable, ERC721
42
42
  bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");
43
43
  bytes32 public constant LEVEL1_ROLE = keccak256("LEVEL1_ROLE");
44
44
  bytes32 public constant LEVEL2_ROLE = keccak256("LEVEL2_ROLE");
45
- bytes32 public constant LEVEL3_ROLE = keccak256("LEVEL3_ROLE");
46
45
 
47
46
  uint256 internal constant HOLDER_GAS_LIMIT = 150000;
48
47
 
@@ -17,7 +17,6 @@ import {WadRayMath} from "./dependencies/WadRayMath.sol";
17
17
  * Holds the reference to _policyPool as immutable, also provides access to common admin roles:
18
18
  * - LEVEL1_ROLE: High impact changes like upgrades, adding or removing components or other critical operations
19
19
  * - LEVEL2_ROLE: Mid-impact changes like changing some parameters
20
- * - LEVEL3_ROLE: Low-impact changes like changing some parameters up to given percentage (tweaks)
21
20
  * - GUARDIAN_ROLE: For emergency operations oriented to protect the protocol in case of attacks or hacking.
22
21
  *
23
22
  * This contract also keeps track of the tweaks to avoid two tweaks of the same type are done in a short period.
@@ -27,26 +26,22 @@ import {WadRayMath} from "./dependencies/WadRayMath.sol";
27
26
  abstract contract PolicyPoolComponent is UUPSUpgradeable, PausableUpgradeable, IPolicyPoolComponent {
28
27
  using WadRayMath for uint256;
29
28
 
30
- bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");
31
- bytes32 public constant LEVEL1_ROLE = keccak256("LEVEL1_ROLE");
32
- bytes32 public constant LEVEL2_ROLE = keccak256("LEVEL2_ROLE");
33
- bytes32 public constant LEVEL3_ROLE = keccak256("LEVEL3_ROLE");
34
-
35
- uint40 public constant TWEAK_EXPIRATION = 1 days;
29
+ bytes32 internal constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");
30
+ bytes32 internal constant LEVEL1_ROLE = keccak256("LEVEL1_ROLE");
31
+ bytes32 internal constant LEVEL2_ROLE = keccak256("LEVEL2_ROLE");
36
32
 
37
33
  /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
38
34
  IPolicyPool internal immutable _policyPool;
39
- uint40 internal _lastTweakTimestamp;
40
- uint56 internal _lastTweakActions; // bitwise map of applied actions
41
35
 
42
36
  event GovernanceAction(IAccessManager.GovernanceActions indexed action, uint256 value);
43
37
  event ComponentChanged(IAccessManager.GovernanceActions indexed action, address value);
44
38
 
45
39
  error NoZeroPolicyPool();
46
40
  error UpgradeCannotChangePolicyPool();
41
+ error OnlyPolicyPool();
47
42
 
48
43
  modifier onlyPolicyPool() {
49
- require(_msgSender() == address(_policyPool), "The caller must be the PolicyPool");
44
+ require(_msgSender() == address(_policyPool), OnlyPolicyPool());
50
45
  _;
51
46
  }
52
47
 
@@ -65,18 +60,6 @@ abstract contract PolicyPoolComponent is UUPSUpgradeable, PausableUpgradeable, I
65
60
  _;
66
61
  }
67
62
 
68
- modifier onlyGlobalOrComponentRole3(
69
- bytes32 role1,
70
- bytes32 role2,
71
- bytes32 role3
72
- ) {
73
- IAccessManager access = _policyPool.access();
74
- if (!access.hasComponentRole(address(this), role1, _msgSender(), true)) {
75
- _policyPool.access().checkComponentRole2(address(this), role2, role3, _msgSender(), true);
76
- }
77
- _;
78
- }
79
-
80
63
  /// @custom:oz-upgrades-unsafe-allow constructor
81
64
  constructor(IPolicyPool policyPool_) {
82
65
  if (address(policyPool_) == address(0)) revert NoZeroPolicyPool();
@@ -141,9 +124,8 @@ abstract contract PolicyPoolComponent is UUPSUpgradeable, PausableUpgradeable, I
141
124
  // solhint-disable-next-line no-empty-blocks
142
125
  function _validateParameters() internal view virtual {} // Must be reimplemented with specific validations
143
126
 
144
- function _parameterChanged(IAccessManager.GovernanceActions action, uint256 value, bool tweak) internal {
127
+ function _parameterChanged(IAccessManager.GovernanceActions action, uint256 value) internal {
145
128
  _validateParameters();
146
- if (tweak) _registerTweak(action);
147
129
  emit GovernanceAction(action, value);
148
130
  }
149
131
 
@@ -152,29 +134,10 @@ abstract contract PolicyPoolComponent is UUPSUpgradeable, PausableUpgradeable, I
152
134
  emit ComponentChanged(action, value);
153
135
  }
154
136
 
155
- function lastTweak() external view returns (uint40, uint56) {
156
- return (_lastTweakTimestamp, _lastTweakActions);
157
- }
158
-
159
- function _registerTweak(IAccessManager.GovernanceActions action) internal {
160
- uint56 actionBitMap = uint56(1 << (uint8(action) - 1));
161
- if ((uint40(block.timestamp) - _lastTweakTimestamp) > TWEAK_EXPIRATION) {
162
- _lastTweakTimestamp = uint40(block.timestamp);
163
- _lastTweakActions = actionBitMap;
164
- } else {
165
- if ((actionBitMap & _lastTweakActions) == 0) {
166
- _lastTweakActions |= actionBitMap;
167
- _lastTweakTimestamp = uint40(block.timestamp); // Updates the expiration
168
- } else {
169
- revert("You already tweaked this parameter recently. Wait before tweaking again");
170
- }
171
- }
172
- }
173
-
174
137
  /**
175
138
  * @dev This empty reserved space is put in place to allow future versions to add new
176
139
  * variables without shifting down storage in the inheritance chain.
177
140
  * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
178
141
  */
179
- uint256[49] private __gap;
142
+ uint256[50] private __gap;
180
143
  }
@@ -329,7 +329,7 @@ contract PremiumsAccount is IPremiumsAccount, Reserve {
329
329
  _borrowFromEtk(borrow, address(this), address(_juniorEtk) != address(0));
330
330
  action = IAccessManager.GovernanceActions.setDeficitRatioWithAdjustment;
331
331
  }
332
- _parameterChanged(action, newRatio, false);
332
+ _parameterChanged(action, newRatio);
333
333
  }
334
334
 
335
335
  /**
@@ -350,12 +350,12 @@ contract PremiumsAccount is IPremiumsAccount, Reserve {
350
350
  if (newLimitJr != type(uint256).max) {
351
351
  _params.jrLoanLimit = _toZeroDecimals(newLimitJr);
352
352
  require(_toAmount(_params.jrLoanLimit) == newLimitJr, "Validation: no decimals allowed");
353
- _parameterChanged(IAccessManager.GovernanceActions.setJrLoanLimit, newLimitJr, false);
353
+ _parameterChanged(IAccessManager.GovernanceActions.setJrLoanLimit, newLimitJr);
354
354
  }
355
355
  if (newLimitSr != type(uint256).max) {
356
356
  _params.srLoanLimit = _toZeroDecimals(newLimitSr);
357
357
  require(_toAmount(_params.srLoanLimit) == newLimitSr, "Validation: no decimals allowed");
358
- _parameterChanged(IAccessManager.GovernanceActions.setSrLoanLimit, newLimitSr, false);
358
+ _parameterChanged(IAccessManager.GovernanceActions.setSrLoanLimit, newLimitSr);
359
359
  }
360
360
  }
361
361
 
@@ -30,7 +30,7 @@ abstract contract RiskModule is IRiskModule, PolicyPoolComponent {
30
30
  uint16 internal constant MAX_MOC = 4e4; // 400%
31
31
 
32
32
  // For parameters that can be changed by the risk module provider
33
- bytes32 public constant RM_PROVIDER_ROLE = keccak256("RM_PROVIDER_ROLE");
33
+ bytes32 internal constant RM_PROVIDER_ROLE = keccak256("RM_PROVIDER_ROLE");
34
34
 
35
35
  /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
36
36
  IPremiumsAccount internal immutable _premiumsAccount;
@@ -206,48 +206,33 @@ abstract contract RiskModule is IRiskModule, PolicyPoolComponent {
206
206
  return _wallet;
207
207
  }
208
208
 
209
- function setParam(
210
- Parameter param,
211
- uint256 newValue
212
- ) external onlyGlobalOrComponentRole3(LEVEL1_ROLE, LEVEL2_ROLE, LEVEL3_ROLE) {
213
- bool tweak = !hasPoolRole(LEVEL2_ROLE) && !hasPoolRole(LEVEL1_ROLE);
209
+ function setParam(Parameter param, uint256 newValue) external onlyGlobalOrComponentRole2(LEVEL1_ROLE, LEVEL2_ROLE) {
214
210
  if (param == Parameter.moc) {
215
- require(!tweak || _isTweakWad(_4toWad(_params.moc), newValue, 1e17), "Tweak exceeded");
216
211
  _params.moc = _wadTo4(newValue);
217
212
  } else if (param == Parameter.jrCollRatio) {
218
- require(!tweak || _isTweakWad(_4toWad(_params.jrCollRatio), newValue, 1e17), "Tweak exceeded");
219
213
  _params.jrCollRatio = _wadTo4(newValue);
220
214
  } else if (param == Parameter.collRatio) {
221
- require(!tweak || _isTweakWad(_4toWad(_params.collRatio), newValue, 1e17), "Tweak exceeded");
222
215
  _params.collRatio = _wadTo4(newValue);
223
216
  } else if (param == Parameter.ensuroPpFee) {
224
- require(!tweak || _isTweakWad(_4toWad(_params.ensuroPpFee), newValue, 1e17), "Tweak exceeded");
225
217
  _params.ensuroPpFee = _wadTo4(newValue);
226
218
  } else if (param == Parameter.ensuroCocFee) {
227
- require(!tweak || _isTweakWad(_4toWad(_params.ensuroCocFee), newValue, 1e17), "Tweak exceeded");
228
219
  _params.ensuroCocFee = _wadTo4(newValue);
229
220
  } else if (param == Parameter.jrRoc) {
230
- require(!tweak || _isTweakWad(_4toWad(_params.jrRoc), newValue, 1e17), "Tweak exceeded");
231
221
  _params.jrRoc = _wadTo4(newValue);
232
222
  } else if (param == Parameter.srRoc) {
233
- require(!tweak || _isTweakWad(_4toWad(_params.srRoc), newValue, 1e17), "Tweak exceeded");
234
223
  _params.srRoc = _wadTo4(newValue);
235
224
  } else if (param == Parameter.maxPayoutPerPolicy) {
236
- require(!tweak || _isTweakWad(maxPayoutPerPolicy(), newValue, 1e17), "Tweak exceeded");
237
225
  _params.maxPayoutPerPolicy = _amountToX(2, newValue);
238
226
  } else if (param == Parameter.exposureLimit) {
239
227
  require(newValue >= _activeExposure, "Can't set exposureLimit less than active exposure");
240
- require(!tweak || _isTweakWad(exposureLimit(), newValue, 1e17), "Tweak exceeded");
241
- require(newValue <= exposureLimit() || hasPoolRole(LEVEL1_ROLE), "Tweak exceeded: Increase requires LEVEL1_ROLE");
228
+ require(newValue <= exposureLimit() || hasPoolRole(LEVEL1_ROLE), "Increase requires LEVEL1_ROLE");
242
229
  _params.exposureLimit = _amountToX(0, newValue);
243
230
  } else if (param == Parameter.maxDuration) {
244
- require(!tweak, "Tweak exceeded");
245
231
  _params.maxDuration = newValue.toUint16();
246
232
  }
247
233
  _parameterChanged(
248
234
  IAccessManager.GovernanceActions(uint256(IAccessManager.GovernanceActions.setMoc) + uint256(param)),
249
- newValue,
250
- tweak
235
+ newValue
251
236
  );
252
237
  }
253
238
 
@@ -255,7 +240,7 @@ abstract contract RiskModule is IRiskModule, PolicyPoolComponent {
255
240
  return _unpackParams(_params);
256
241
  }
257
242
 
258
- function _unpackParams(PackedParams storage params_) internal view returns (Params memory ret) {
243
+ function _unpackParams(PackedParams memory params_) internal pure returns (Params memory ret) {
259
244
  return
260
245
  Params({
261
246
  moc: _4toWad(params_.moc),
@@ -268,12 +253,16 @@ abstract contract RiskModule is IRiskModule, PolicyPoolComponent {
268
253
  });
269
254
  }
270
255
 
256
+ function _makeInternalId(bytes32 policyData) internal pure returns (uint96) {
257
+ return uint96(uint256(policyData) % 2 ** 96);
258
+ }
259
+
271
260
  function setWallet(address wallet_) external onlyComponentRole(RM_PROVIDER_ROLE) {
272
261
  if (wallet_ == address(0)) {
273
262
  revert NoZeroWallet();
274
263
  }
275
264
  _wallet = wallet_;
276
- _parameterChanged(IAccessManager.GovernanceActions.setWallet, uint256(uint160(wallet_)), false);
265
+ _parameterChanged(IAccessManager.GovernanceActions.setWallet, uint256(uint160(wallet_)));
277
266
  }
278
267
 
279
268
  function getMinimumPremium(
@@ -18,10 +18,10 @@ import {RiskModule} from "./RiskModule.sol";
18
18
  * @author Ensuro
19
19
  */
20
20
  contract SignedBucketRiskModule is RiskModule {
21
- bytes32 public constant POLICY_CREATOR_ROLE = keccak256("POLICY_CREATOR_ROLE");
22
- bytes32 public constant REPLACER_ROLE = keccak256("REPLACER_ROLE");
23
- bytes32 public constant PRICER_ROLE = keccak256("PRICER_ROLE");
24
- bytes32 public constant RESOLVER_ROLE = keccak256("RESOLVER_ROLE");
21
+ bytes32 internal constant POLICY_CREATOR_ROLE = keccak256("POLICY_CREATOR_ROLE");
22
+ bytes32 internal constant REPLACER_ROLE = keccak256("REPLACER_ROLE");
23
+ bytes32 internal constant PRICER_ROLE = keccak256("PRICER_ROLE");
24
+ bytes32 internal constant RESOLVER_ROLE = keccak256("RESOLVER_ROLE");
25
25
 
26
26
  mapping(uint256 => PackedParams) internal _buckets;
27
27
 
@@ -114,7 +114,6 @@ contract SignedBucketRiskModule is RiskModule {
114
114
  address payer,
115
115
  address onBehalfOf
116
116
  ) internal returns (Policy.PolicyData memory createdPolicy) {
117
- uint96 internalId = uint96(uint256(policyData) % 2 ** 96);
118
117
  createdPolicy = _newPolicyWithParams(
119
118
  payout,
120
119
  premium,
@@ -122,7 +121,7 @@ contract SignedBucketRiskModule is RiskModule {
122
121
  expiration,
123
122
  payer,
124
123
  onBehalfOf,
125
- internalId,
124
+ _makeInternalId(policyData),
126
125
  bucketParams(bucketId)
127
126
  );
128
127
  emit NewSignedPolicy(createdPolicy.id, policyData);
@@ -225,10 +224,17 @@ contract SignedBucketRiskModule is RiskModule {
225
224
  quoteSignatureVS,
226
225
  quoteValidUntil
227
226
  );
228
- uint96 internalId = uint96(uint256(policyData) % 2 ** 96);
229
227
  return
230
- _replacePolicy(oldPolicy, payout, premium, lossProb, expiration, _msgSender(), internalId, bucketParams(bucketId))
231
- .id;
228
+ _replacePolicy(
229
+ oldPolicy,
230
+ payout,
231
+ premium,
232
+ lossProb,
233
+ expiration,
234
+ _msgSender(),
235
+ _makeInternalId(policyData),
236
+ bucketParams(bucketId)
237
+ ).id;
232
238
  }
233
239
 
234
240
  function resolvePolicy(
@@ -91,11 +91,14 @@ contract SignedQuoteRiskModule is RiskModule {
91
91
  bytes32 quoteHash = ECDSA.toEthSignedMessageHash(
92
92
  abi.encodePacked(address(this), payout, premium, lossProb, expiration, policyData, quoteValidUntil)
93
93
  );
94
- address signer = ECDSA.recover(quoteHash, quoteSignatureR, quoteSignatureVS);
95
- _policyPool.access().checkComponentRole(address(this), PRICER_ROLE, signer, false);
96
- uint96 internalId = uint96(uint256(policyData) % 2 ** 96);
94
+ _policyPool.access().checkComponentRole(
95
+ address(this),
96
+ PRICER_ROLE,
97
+ ECDSA.recover(quoteHash, quoteSignatureR, quoteSignatureVS),
98
+ false
99
+ );
97
100
 
98
- createdPolicy = _newPolicy(payout, premium, lossProb, expiration, payer, onBehalfOf, internalId);
101
+ createdPolicy = _newPolicy(payout, premium, lossProb, expiration, payer, onBehalfOf, _makeInternalId(policyData));
99
102
  emit NewSignedPolicy(createdPolicy.id, policyData);
100
103
  return createdPolicy;
101
104
  }