diff --git a/.openzeppelin/unknown-80002.json b/.openzeppelin/unknown-80002.json new file mode 100644 index 0000000..8a12b76 --- /dev/null +++ b/.openzeppelin/unknown-80002.json @@ -0,0 +1,1133 @@ +{ + "manifestVersion": "3.2", + "proxies": [ + { + "address": "0xB259c87EF89d06313bE83777851266b46C81370B", + "txHash": "0x6e8ebd9803a78bb92320f5f0ad48a69a4956afb91b9e70023b8c494abee8502a", + "kind": "uups" + }, + { + "address": "0x1655f419e1aD88A5c224400F57a44c7035FCD378", + "txHash": "0x4cb3071c6ccea10b4c60449fe788a3ca41ac651f1e4a634745623658de5d6211", + "kind": "uups" + }, + { + "address": "0x9888eeF4587Fc4913A58b6a6fc3754a9E2c2F9eA", + "txHash": "0x85708a7e9a5dd77a3aff03549c6dc17e82466878459ad23c122188d914103c18", + "kind": "uups" + }, + { + "address": "0x243bAd8027b9Fd3936748134Eb3882912BcD74a9", + "txHash": "0xc050fd59593be12687af71d7f698a0b6e60b22624317e7e2aeb5beaf5f7fc941", + "kind": "uups" + }, + { + "address": "0xA941dBD4B8F96D14711233f4dB8F26B0f574543F", + "txHash": "0xb319a810ab60f3feca3e64558032c42ff79b441a8054ee85b93c2ba20513f82d", + "kind": "uups" + }, + { + "address": "0x12BA43a02f4822D555e15B138eaab8Ee9cA62E28", + "txHash": "0xe4f1197fcfd5bad936e76c1d692b11e0a294ccba6de92e6f366e11b05a1da453", + "kind": "uups" + }, + { + "address": "0x1610992355627CB1BB8F8CF7E3405223b1F240af", + "txHash": "0x31d1ac1691d63fa58b3a864fc60b01bcb69c77afd2d0c5b80d9abaa1035b7711", + "kind": "uups" + }, + { + "address": "0x795c145f5628bE27E82b71bDF7055112F2c75662", + "txHash": "0x7794c4d36cd2c543df9a398583a5ba0872a747e31ee841475703597c59e56c3c", + "kind": "uups" + }, + { + "address": "0x1a58d8e8506855098A7FcEf13e81914E345f20C9", + "txHash": "0xac3efa1e8f4b5463bc0c542d3a68428a53e56425ae13e2b2bd0c3a4a833d068e", + "kind": "uups" + }, + { + "address": "0x6f413FDc97589ACe2cC4BE0E0CC4085e46625A95", + "txHash": "0x2e18ecf39052400599b4a9ec954058a55efce12a3351915e8150ac11dc690a1a", + "kind": "uups" + }, + { + "address": "0x1E4141AE3c3e2Ad131403B6848E743975D48d90c", + "txHash": "0x64f9429bc92389f8e6a3d70346dc19ace0daf24fdae23c568bea08a3bfd47b12", + "kind": "uups" + }, + { + "address": "0xBe81327666eEa07524329F840494B4Bd4695DD0D", + "txHash": "0xb3caa65b8f6a939d05b696261848d256e9b64d123ccefaf89fede88f97e6f5c4", + "kind": "uups" + }, + { + "address": "0x954916ea2628d392D16cC8441e697744623A0795", + "txHash": "0x9c536690769369505b6022138ebfaf0009c2e7b2c584b91a06bb9c4817ebfcad", + "kind": "uups" + }, + { + "address": "0xBAAefc46543D0cA5A29Cc5dAd3415B8dcC9f3eF4", + "txHash": "0x1ef877eb3a22e19d0f06282f15931f323ef4d5b85884493e97dae3f82c2aa272", + "kind": "uups" + }, + { + "address": "0x90b803628715f4f0Ce3b50965d48a15F748A154D", + "txHash": "0x4d9bd03acd6e45c8bbb771f592685cb7b67df2600cbb8a0d3dab45dc6a93e8b0", + "kind": "uups" + }, + { + "address": "0x2437d27161a82A237E8F35d6C645B1AF2A382993", + "txHash": "0xb3fea684df0995d4c1083b9581d6cb0a65d72e35e1e2ed94b495a3af58df9d3f", + "kind": "uups" + }, + { + "address": "0xD9dE5060B43d9267b465C52fF8D6A76F0dC04BDA", + "txHash": "0xd5440acdf68d51a1eccfd7d2179846f58ea3b45c8c606d9fe6ab72c29c8cd7fd", + "kind": "uups" + }, + { + "address": "0xa570bA194C0793C5aFa181031aF8471DB340dC8a", + "txHash": "0x0b6b29417da93de3babd8966cb520d8f3170002769b3e76a555e69d8e105fc19", + "kind": "uups" + }, + { + "address": "0x55FD1b5A048a363dac636F68f281F011C308aacF", + "txHash": "0xc5f94728349159aeb8d5a1254d5c405dcde582ea08fe2c51e18c40ce3c75ad49", + "kind": "uups" + }, + { + "address": "0x7A8FF4FF11F08187D7fC19E1633A86A40fE722E0", + "txHash": "0x25756a51efc2e2c3a3200331d492f8a2033c582ff8a5dace097bad6a351fed50", + "kind": "uups" + }, + { + "address": "0x4715D38f9Dbac3FAC9ACe2401fEf6a4989b31592", + "txHash": "0x743d28a8c8a7a74eb7f142ac4673dbcbd0063efc8f22f028cb07462d2992ba6f", + "kind": "uups" + }, + { + "address": "0x3E67978a3EFAf2832B684Fd1B65b62350c17683c", + "txHash": "0xbe1c043a252ea57bcf36d0fdd2523157b9ebcce651314a20283d49d28f1bd623", + "kind": "uups" + }, + { + "address": "0x78EF25AB95FC64A006Ca311285caEb3501972B9C", + "txHash": "0x7fd50229f2d018452188986a817580add58e38dd253e02080c80fc31bdb1e220", + "kind": "uups" + }, + { + "address": "0x525547CE76A52073CE5496c0835Bf2d3d36cBDC8", + "txHash": "0xad735d4b3985d5656e7447a8e988579b26e0ec7af67c91420459d68815271235", + "kind": "uups" + }, + { + "address": "0x4d8165862E8295cd0B3ca0343d8BDC1aCBdfa5d7", + "txHash": "0x9619564440ced2c3235de8180b22027fdce22a7afecd516ff6fbe699ab0fca0e", + "kind": "uups" + }, + { + "address": "0x22E945f51635232750A7c48dCA8B3E3d2249547b", + "txHash": "0x0834da37e3167ffbbc8208aee7848dec60aacce2609a4a667b71126f9f9162cf", + "kind": "uups" + }, + { + "address": "0x6c013Eb40036B82F837398A78f9A427505e23a61", + "txHash": "0xd25aa31a2b994fa762a2b81bf9f44bd1988786c8a427844c7edeae2815277e8c", + "kind": "uups" + }, + { + "address": "0x16CC8485a1f222D99a4c2b49384eF6cCb045b2Db", + "txHash": "0x3c81340f97781974ecc000bf8cbb82290d956cda58bb2730ba52756655cee58f", + "kind": "uups" + }, + { + "address": "0x37b8c36909CDC264e8F9ED1cf05B1100e5858169", + "txHash": "0x0cd5b038e411fe2047065353be4faec87f6ac917d4c1ea963f33befd78692c07", + "kind": "uups" + }, + { + "address": "0x8a3B72aF3E878437Db91fDa4A75cfA369262d23f", + "txHash": "0xf79dd76a4481a9671cf43db2db1afeae93b59f50e0ad067003844800e7b6939d", + "kind": "uups" + }, + { + "address": "0x781b34DeaDc955a151F3D994Bf1B71d63077128f", + "txHash": "0x1fb3363d8e307d63ee115e773258401c486097bf6a8b79ffe3a98241adf2f85e", + "kind": "uups" + }, + { + "address": "0x6E86Fa4D6585F8a238C87a6296414208C9f05557", + "txHash": "0xb1a4dfe63118a01d944c4e95c08bce241efb34b8499884a4d4e5cf206142f699", + "kind": "uups" + }, + { + "address": "0xEfd657B23dE79265Cf8c5BD4dA1328Fc40Da3F88", + "txHash": "0xe5af3da692d454171be0d10c4bac8be2875cdb0656f8c858cccd14587ed61f72", + "kind": "uups" + }, + { + "address": "0x1468f93BB7aBEdce9D597b9101Ad12Ee577116CF", + "txHash": "0x6bc8a80bc01c0e43ee994577d25d095fd6e4a1ffcbc1462b6510e8d1dc8cf0da", + "kind": "uups" + }, + { + "address": "0xf5D04337b3F6D680deF30928DA09356ABd6f85f9", + "txHash": "0x3968afe2b74188e5019d8bb808b2a9a64c184f43bd2d90744203fc75d6bb067e", + "kind": "uups" + }, + { + "address": "0xC51F24c66BE0FD5690405E0fD2742F3c5059d1cE", + "txHash": "0x330137c54c55fa8341c92cea2ffcb1924fa85ee8aca63f450d14d2826c4f0c37", + "kind": "uups" + }, + { + "address": "0xeC97d1f0EBECA4CAE80cfC78a39199699D356881", + "txHash": "0x21f0ef4452659dcab18c27fa7b3f86be2380e50ffd18f005fdef86be4f62e761", + "kind": "uups" + }, + { + "address": "0xd06A88934F4eaE21d13cc141D529CC6C6aa37302", + "txHash": "0xeff918fdf1995295c39b98362429b5ddef445f569368e7961f01194bf85f1d7c", + "kind": "uups" + }, + { + "address": "0x02989fAF0baBA6077C5c52eB78EE06E222e96500", + "txHash": "0x736a21aa70f1a19f874ec1e1c65cc95a486391fce9924d6643c5bfc3de81b395", + "kind": "uups" + }, + { + "address": "0xcb050Dd51ae640661D43D506B93a7573E61e254D", + "txHash": "0x5635d523a27e63073a5444112fdd617b711c3a90506c24caf957fa5c7711f289", + "kind": "uups" + }, + { + "address": "0xc17687b9Ab291d814c9d2BC146520C61754dD417", + "txHash": "0x009f44c7bb727502092ed9b3f4ca18b52659e499f3ccfbbeb12171df8bb4532c", + "kind": "uups" + }, + { + "address": "0xd3a4A5eA2eda5989a205c91c10ecE2E6763B4751", + "txHash": "0x7d4a246d7a0bc3f953043e9af1ab575e72680de3c507ab148b1036a00cfe5432", + "kind": "uups" + }, + { + "address": "0x674B9DC50eD0C4Bd2b7770B92441FE5723CDC81F", + "txHash": "0x8be76eeb0d53675af2f066c23349e4a0abf4189de986e79f16c3b5c36f304eca", + "kind": "uups" + }, + { + "address": "0x3A1086ED96F7B423Edc4DbcBDF942eDD53f2ce4E", + "txHash": "0xa17934fc3dedc5fefd6902c50e4726347579c5782c9a4c05208c45070e44d109", + "kind": "uups" + }, + { + "address": "0x69D77c1A50f3C1d554397e2e879cC1CCC11596de", + "txHash": "0xc7009f8e0e4265f41ff07d297da0cd44f764473e6e1ee03adedf8c9173062678", + "kind": "uups" + }, + { + "address": "0x41E0316A3106Bd3bCEFd0b7B293740Dd7d1C32c6", + "txHash": "0xbe45b92aa29065a912576da953a6339a66a92734c9e068bf71f90f0dde8513e8", + "kind": "uups" + }, + { + "address": "0xb79f6eD3D2AD5d07727F907d1e408bb33e488f35", + "txHash": "0xe266cae955b8485e2876750eec6cbb40dc26fba564307d86e0c361a7357045a4", + "kind": "uups" + }, + { + "address": "0x8C31BfdD7eF57f361126438b14372c099813d622", + "txHash": "0x129c5ff1b9c23c113ea8f46ef95cf25f12f441fa2ab3a1970d31611ca8c45f28", + "kind": "uups" + }, + { + "address": "0xa89Cb7Ac6B42B5740c4a1b12d6F304b5a01F7a95", + "txHash": "0xf105065680c21cd9e4e15f5678a2a9966b84ba9568b28731b156d39df44f2415", + "kind": "uups" + } + ], + "impls": { + "ffba80a60111f1737f38dce51bee86dfc90fd923770d821897056b42abfca104": { + "address": "0x385C86c1353E5343D9964Df57C40E90965e41ca0", + "txHash": "0x6abefdd935dbb313097d02b9523f69a944845b48b3f7a5bd82e2091430631110", + "layout": { + "solcVersion": "0.8.17", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:37" + }, + { + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:39" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:41" + }, + { + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:43" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:44" + }, + { + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage", + "contract": "ERC20Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:394" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20BurnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol:51" + }, + { + "label": "_paused", + "offset": 0, + "slot": "151", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "__gap", + "offset": 0, + "slot": "201", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC165Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol:41" + }, + { + "label": "_roles", + "offset": 0, + "slot": "251", + "type": "t_mapping(t_bytes32,t_struct(RoleData)34_storage)", + "contract": "AccessControlUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:61" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "AccessControlUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:259" + }, + { + "label": "_HASHED_NAME", + "offset": 0, + "slot": "301", + "type": "t_bytes32", + "contract": "EIP712Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol:32" + }, + { + "label": "_HASHED_VERSION", + "offset": 0, + "slot": "302", + "type": "t_bytes32", + "contract": "EIP712Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol:33" + }, + { + "label": "__gap", + "offset": 0, + "slot": "303", + "type": "t_array(t_uint256)50_storage", + "contract": "EIP712Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol:120" + }, + { + "label": "_nonces", + "offset": 0, + "slot": "353", + "type": "t_mapping(t_address,t_struct(Counter)4520_storage)", + "contract": "ERC20PermitUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol:28" + }, + { + "label": "_PERMIT_TYPEHASH_DEPRECATED_SLOT", + "offset": 0, + "slot": "354", + "type": "t_bytes32", + "contract": "ERC20PermitUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol:40", + "renamedFrom": "_PERMIT_TYPEHASH" + }, + { + "label": "__gap", + "offset": 0, + "slot": "355", + "type": "t_array(t_uint256)49_storage", + "contract": "ERC20PermitUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol:108" + }, + { + "label": "__gap", + "offset": 0, + "slot": "404", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC20FlashMintUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20FlashMintUpgradeable.sol:108" + }, + { + "label": "__gap", + "offset": 0, + "slot": "454", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:211" + }, + { + "label": "__gap", + "offset": 0, + "slot": "504", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107" + }, + { + "label": "_flashFee", + "offset": 0, + "slot": "554", + "type": "t_struct(Factor)11295_storage", + "contract": "Xocolatl", + "src": "contracts/Xocolatl.sol:44" + }, + { + "label": "flashFeeReceiver", + "offset": 0, + "slot": "556", + "type": "t_address", + "contract": "Xocolatl", + "src": "contracts/Xocolatl.sol:45" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)45_storage": { + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_struct(Counter)4520_storage)": { + "label": "mapping(address => struct CountersUpgradeable.Counter)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_struct(RoleData)34_storage)": { + "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Counter)4520_storage": { + "label": "struct CountersUpgradeable.Counter", + "members": [ + { + "label": "_value", + "type": "t_uint256", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Factor)11295_storage": { + "label": "struct Xocolatl.Factor", + "members": [ + { + "label": "numerator", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "denominator", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RoleData)34_storage": { + "label": "struct AccessControlUpgradeable.RoleData", + "members": [ + { + "label": "members", + "type": "t_mapping(t_address,t_bool)", + "offset": 0, + "slot": "0" + }, + { + "label": "adminRole", + "type": "t_bytes32", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + }, + "b558420db3f7bfc1b62adbe445c4629975411215b1c27958f6ffaa7786319dd4": { + "address": "0xF93019f51B501D83bCb90bb6Cd75e1D448734685", + "txHash": "0x5b1d4fee946ea46571ceaf8ba7eec42cd1d3972cfdedd609a6e5c79ea45870ba", + "layout": { + "solcVersion": "0.8.17", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC165Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol:41" + }, + { + "label": "_roles", + "offset": 0, + "slot": "101", + "type": "t_mapping(t_bytes32,t_struct(RoleData)34_storage)", + "contract": "AccessControlUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:61" + }, + { + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage", + "contract": "AccessControlUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:259" + }, + { + "label": "houseOfReserves", + "offset": 0, + "slot": "151", + "type": "t_mapping(t_uint256,t_address)", + "contract": "AssetsAccountantState", + "src": "contracts/AssetsAccountant.sol:30" + }, + { + "label": "_reservesIds", + "offset": 0, + "slot": "152", + "type": "t_mapping(t_address,t_mapping(t_address,t_array(t_uint256)dyn_storage))", + "contract": "AssetsAccountantState", + "src": "contracts/AssetsAccountant.sol:33" + }, + { + "label": "houseOfCoins", + "offset": 0, + "slot": "153", + "type": "t_mapping(t_address,t_address)", + "contract": "AssetsAccountantState", + "src": "contracts/AssetsAccountant.sol:36" + }, + { + "label": "isARegisteredHouse", + "offset": 0, + "slot": "154", + "type": "t_mapping(t_address,t_bool)", + "contract": "AssetsAccountantState", + "src": "contracts/AssetsAccountant.sol:38" + }, + { + "label": "isAValidReserveFactory", + "offset": 0, + "slot": "155", + "type": "t_mapping(t_address,t_bool)", + "contract": "AssetsAccountantState", + "src": "contracts/AssetsAccountant.sol:40" + }, + { + "label": "_balances", + "offset": 0, + "slot": "156", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "contract": "ERC1155Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol:25" + }, + { + "label": "_operatorApprovals", + "offset": 0, + "slot": "157", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))", + "contract": "ERC1155Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol:28" + }, + { + "label": "_uri", + "offset": 0, + "slot": "158", + "type": "t_string_storage", + "contract": "ERC1155Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol:31" + }, + { + "label": "__gap", + "offset": 0, + "slot": "159", + "type": "t_array(t_uint256)47_storage", + "contract": "ERC1155Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol:528" + }, + { + "label": "_totalSupply", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "ERC1155SupplyUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol:23" + }, + { + "label": "__gap", + "offset": 0, + "slot": "207", + "type": "t_array(t_uint256)49_storage", + "contract": "ERC1155SupplyUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol:76" + }, + { + "label": "__gap", + "offset": 0, + "slot": "256", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:211" + }, + { + "label": "__gap", + "offset": 0, + "slot": "306", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)47_storage": { + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_array(t_uint256)dyn_storage": { + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_address)": { + "label": "mapping(address => address)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_array(t_uint256)dyn_storage)": { + "label": "mapping(address => uint256[])", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_mapping(t_address,t_array(t_uint256)dyn_storage))": { + "label": "mapping(address => mapping(address => uint256[]))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_struct(RoleData)34_storage)": { + "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(RoleData)34_storage": { + "label": "struct AccessControlUpgradeable.RoleData", + "members": [ + { + "label": "members", + "type": "t_mapping(t_address,t_bool)", + "offset": 0, + "slot": "0" + }, + { + "label": "adminRole", + "type": "t_bytes32", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + }, + "e6fe1d4a4c420b2ac18f3dec207b1fd843018a546dae5f7dadec966fe63b9113": { + "address": "0xd4bab909A1Da3d9DbBDD3306Fd7B9b13a64522e1", + "txHash": "0x2cfeb6ef5429a16e5fe780ab3477c2ef72d3051f517fe933072f0d36bcb62674", + "layout": { + "solcVersion": "0.8.17", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:211" + }, + { + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107" + }, + { + "label": "backedAsset", + "offset": 0, + "slot": "201", + "type": "t_address", + "contract": "HouseOfCoinState", + "src": "contracts/HouseOfCoin.sol:29" + }, + { + "label": "backedAssetDecimals", + "offset": 0, + "slot": "202", + "type": "t_uint256", + "contract": "HouseOfCoinState", + "src": "contracts/HouseOfCoin.sol:31" + }, + { + "label": "assetsAccountant", + "offset": 0, + "slot": "203", + "type": "t_address", + "contract": "HouseOfCoinState", + "src": "contracts/HouseOfCoin.sol:33" + }, + { + "label": "_liqParam", + "offset": 0, + "slot": "204", + "type": "t_struct(LiquidationParam)9433_storage", + "contract": "HouseOfCoinState", + "src": "contracts/HouseOfCoin.sol:35" + }, + { + "label": "treasury", + "offset": 0, + "slot": "208", + "type": "t_address", + "contract": "HouseOfCoinState", + "src": "contracts/HouseOfCoin.sol:39" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(LiquidationParam)9433_storage": { + "label": "struct HouseOfCoinState.LiquidationParam", + "members": [ + { + "label": "marginCallThreshold", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "liquidationThreshold", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "liquidationPricePenaltyDiscount", + "type": "t_uint256", + "offset": 0, + "slot": "2" + }, + { + "label": "collateralPenalty", + "type": "t_uint256", + "offset": 0, + "slot": "3" + } + ], + "numberOfBytes": "128" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + }, + "4e3fc4e694f45cc82b82852be2c647e60e64307d212478ce4339cbc3e06c05aa": { + "address": "0x5b7212D3aE6401dbE56f45ceCE700eAD0F443a65", + "txHash": "0xb74a3437aa24c2e6198c3aa67e09db3c1dcd9e2cba658f8710c13c57c3f8fdc1", + "layout": { + "solcVersion": "0.8.17", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:211" + }, + { + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107" + }, + { + "label": "assetsAccountant", + "offset": 0, + "slot": "201", + "type": "t_contract(IAssetsAccountant)13038", + "contract": "AccountLiquidator", + "src": "contracts/AccountLiquidator.sol:45" + }, + { + "label": "houseOfCoin", + "offset": 0, + "slot": "202", + "type": "t_contract(IHouseOfCoin)13143", + "contract": "AccountLiquidator", + "src": "contracts/AccountLiquidator.sol:46" + }, + { + "label": "backedAsset", + "offset": 0, + "slot": "203", + "type": "t_contract(IERC20Extension)13068", + "contract": "AccountLiquidator", + "src": "contracts/AccountLiquidator.sol:47" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IAssetsAccountant)13038": { + "label": "contract IAssetsAccountant", + "numberOfBytes": "20" + }, + "t_contract(IERC20Extension)13068": { + "label": "contract IERC20Extension", + "numberOfBytes": "20" + }, + "t_contract(IHouseOfCoin)13143": { + "label": "contract IHouseOfCoin", + "numberOfBytes": "20" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + } + } +} diff --git a/contracts/utils/PriceFeedPythWrapperI.sol b/contracts/utils/PriceFeedPythWrapperI.sol new file mode 100644 index 0000000..8b29163 --- /dev/null +++ b/contracts/utils/PriceFeedPythWrapperI.sol @@ -0,0 +1,158 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity 0.8.17; + +/** + * @title PriceFeedPythWrapper + * @author Xocolatl.eth + * @notice Contract that wraps the IPyth price feed contract and formats the + * response to be compatible with the IPriceBulletin interface. + * @dev Refer to the IPyth.sol interface for more details: + * https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/IPyth.sol + * Reference for MXN/USD feed: + * PythId: 0xe13b1c1ffb32f34e1be9545583f01ef385fde7f42ee66049d30570dc866b77ca + */ +import {IPriceBulletin} from "../interfaces/tlatlalia/IPriceBulletin.sol"; +import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; + +interface IPyth { + struct Price { + // Price + int64 price; + // Confidence interval around the price + uint64 conf; + // Price exponent + int32 expo; + // Unix timestamp describing when the price was published + uint256 publishTime; + } + + function getPriceUnsafe(bytes32 id) external view returns (Price memory price); + function priceFeedExists(bytes32 id) external view returns (bool); +} + +contract PriceFeedPythWrapperI { + struct PriceFeedResponse { + uint80 roundId; + int256 answer; + uint256 startedAt; + uint256 updatedAt; + uint80 answeredInRound; + } + + ///@dev custom errors + error PriceFeedPythWrapper_invalidInput(); + error PriceFeedPythWrapper_fetchPythFeedFailed(); + error PriceFeedPythWrapper_fetchFeedInterFailed(); + error PriceFeedPythWrapper_lessThanOrZeroAnswer(); + error PriceFeedPythWrapper_noRoundId(); + error PriceFeedPythWrapper_noValidUpdateAt(); + error PriceFeedPythWrapper_staleFeed(); + error PriceFeedPythWrapper_invalidPriceFeedId(); + error PriceFeedPythWrapper_safeCast_overflow(); + + string public constant VERSION = "v1.0.0"; + + string private _description; + uint8 private _decimals; + uint8 private _pythPriceDecimals; + + uint256 public allowedTimeout; + bytes32 public pythPriceFeedId; + IPyth public pyth; + + constructor( + string memory description_, + uint8 decimals_, + address pyth_, + bytes32 pythPriceFeedId_, + uint256 allowedTimeout_ + ) { + _description = description_; + _decimals = decimals_; + + if (pyth_ == address(0) || allowedTimeout_ == 0) { + revert PriceFeedPythWrapper_invalidInput(); + } + if (IPyth(pyth_).priceFeedExists(pythPriceFeedId_) == false) { + revert PriceFeedPythWrapper_invalidPriceFeedId(); + } + pythPriceFeedId = pythPriceFeedId_; + + IPyth.Price memory response = IPyth(pyth_).getPriceUnsafe(pythPriceFeedId_); + _pythPriceDecimals = uint8(int8(-response.expo)); + + pyth = IPyth(pyth_); + allowedTimeout = allowedTimeout_; + } + + function decimals() external view returns (uint8) { + return _decimals; + } + + function description() external view returns (string memory) { + return _description; + } + + function latestAnswer() external view returns (int256) { + PriceFeedResponse memory pythRound = _computeLatestRoundData(); + return pythRound.answer; + } + + function latestRoundData() + external + view + returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) + { + PriceFeedResponse memory pythRound = _computeLatestRoundData(); + roundId = pythRound.roundId; + answer = pythRound.answer; + startedAt = pythRound.startedAt; + updatedAt = pythRound.updatedAt; + answeredInRound = roundId; + } + + function _computeLatestRoundData() private view returns (PriceFeedResponse memory pythLatestRound) { + return _callandCheckFeeds(); + } + + function _computeAnswer(int64 pythAnswer) private view returns (int256) { + if (_pythPriceDecimals > _decimals) { + return int256(pythAnswer / int256(10 ** (_pythPriceDecimals - _decimals))); + } else { + return int256(pythAnswer * int256(10 ** (_decimals - _pythPriceDecimals))); + } + } + + function _callandCheckFeeds() private view returns (PriceFeedResponse memory pythRound) { + // Call the pyth address with try-catch method to identify failure + try pyth.getPriceUnsafe(pythPriceFeedId) returns (IPyth.Price memory response) { + uint80 roundIdPyth = _safeCastToARoundIdPerDay(response.publishTime); + pythRound.roundId = roundIdPyth; + pythRound.answer = _computeAnswer(response.price); + pythRound.startedAt = response.publishTime; + pythRound.updatedAt = response.publishTime; + pythRound.answeredInRound = roundIdPyth; + } catch { + revert PriceFeedPythWrapper_fetchPythFeedFailed(); + } + + // Perform checks to the returned responses + if (pythRound.answer <= 0) { + revert PriceFeedPythWrapper_lessThanOrZeroAnswer(); + } else if (pythRound.roundId == 0) { + revert PriceFeedPythWrapper_noRoundId(); + } else if (pythRound.updatedAt > block.timestamp || pythRound.updatedAt == 0) { + revert PriceFeedPythWrapper_noValidUpdateAt(); + } else if (block.timestamp - pythRound.updatedAt > allowedTimeout) { + revert PriceFeedPythWrapper_staleFeed(); + } + } + + function _safeCastToARoundIdPerDay(uint256 pythPublisTimestamp) private pure returns (uint80) { + uint256 value = pythPublisTimestamp / 86400; + if (value > type(uint80).max) { + revert PriceFeedPythWrapper_safeCast_overflow(); + } + return uint80(value); + } +} diff --git a/deployments/polygonamoy/80002-version-2.0.0.deploy b/deployments/polygonamoy/80002-version-2.0.0.deploy new file mode 100644 index 0000000..b1c7b4c --- /dev/null +++ b/deployments/polygonamoy/80002-version-2.0.0.deploy @@ -0,0 +1,1009 @@ +{ + "Xocolatl": { + "address": "0xB259c87EF89d06313bE83777851266b46C81370B", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "numerator", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "denominator", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct Xocolatl.Factor", + "name": "newFlashFee", + "type": "tuple" + } + ], + "name": "FlashFeeChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newAddress", + "type": "address" + } + ], + "name": "FlashFeeReceiverChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "BURNER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAUSER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "UPGRADER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "flashFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "flashFeeReceiver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC3156FlashBorrowerUpgradeable", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "flashLoan", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "maxFlashLoan", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "numerator", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "denominator", + "type": "uint256" + } + ], + "internalType": "struct Xocolatl.Factor", + "name": "newFlashFee_", + "type": "tuple" + } + ], + "name": "setFlashFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_flashFeeReceiverAddr", + "type": "address" + } + ], + "name": "setFlashFeeReceiver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "bytecode": "0x60a06040523073ffffffffffffffffffffffffffffffffffffffff1660809073ffffffffffffffffffffffffffffffffffffffff168152503480156200004457600080fd5b50620000556200005b60201b60201c565b62000206565b600060019054906101000a900460ff1615620000ae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620000a590620001a9565b60405180910390fd5b60ff801660008054906101000a900460ff1660ff161015620001205760ff6000806101000a81548160ff021916908360ff1602179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860ff604051620001179190620001e9565b60405180910390a15b565b600082825260208201905092915050565b7f496e697469616c697a61626c653a20636f6e747261637420697320696e69746960008201527f616c697a696e6700000000000000000000000000000000000000000000000000602082015250565b60006200019160278362000122565b91506200019e8262000133565b604082019050919050565b60006020820190508181036000830152620001c48162000182565b9050919050565b600060ff82169050919050565b620001e381620001cb565b82525050565b6000602082019050620002006000830184620001d8565b92915050565b608051615c966200023e60003960008181610c6901528181610cf701528181610ed901528181610f6701526110a10152615c966000f3fe6080604052600436106102515760003560e01c8063613255ab11610139578063a457c2d7116100b6578063d547741f1161007a578063d547741f146108dd578063d9d98ce414610906578063dd62ed3e14610943578063e63ab1e914610980578063e7aa8638146109ab578063f72c0d8b146109d457610251565b8063a457c2d7146107e4578063a8b24f9a14610821578063a9059cbb1461084c578063d505accf14610889578063d5391393146108b257610251565b80638456cb59116100fd5780638456cb591461071157806391d148541461072857806395d89b41146107655780639dc29fac14610790578063a217fddf146107b957610251565b8063613255ab1461061a57806370a082311461065757806379cc6790146106945780637ecebe00146106bd5780638129fc1c146106fa57610251565b806336568abe116101d257806342966c681161019657806342966c68146105195780634f1ef2861461054257806352741a401461055e57806352d1902d146105875780635c975abb146105b25780635cffe9de146105dd57610251565b806336568abe1461044a5780633659cfe614610473578063395093511461049c5780633f4ba83a146104d957806340c10f19146104f057610251565b8063248a9ca311610219578063248a9ca314610363578063282c51f3146103a05780632f2ff15d146103cb578063313ce567146103f45780633644e5151461041f57610251565b806301ffc9a71461025657806306fdde0314610293578063095ea7b3146102be57806318160ddd146102fb57806323b872dd14610326575b600080fd5b34801561026257600080fd5b5061027d60048036038101906102789190613936565b6109ff565b60405161028a919061397e565b60405180910390f35b34801561029f57600080fd5b506102a8610a79565b6040516102b59190613a29565b60405180910390f35b3480156102ca57600080fd5b506102e560048036038101906102e09190613adf565b610b0b565b6040516102f2919061397e565b60405180910390f35b34801561030757600080fd5b50610310610b2e565b60405161031d9190613b2e565b60405180910390f35b34801561033257600080fd5b5061034d60048036038101906103489190613b49565b610b38565b60405161035a919061397e565b60405180910390f35b34801561036f57600080fd5b5061038a60048036038101906103859190613bd2565b610b67565b6040516103979190613c0e565b60405180910390f35b3480156103ac57600080fd5b506103b5610b87565b6040516103c29190613c0e565b60405180910390f35b3480156103d757600080fd5b506103f260048036038101906103ed9190613c29565b610bab565b005b34801561040057600080fd5b50610409610bcc565b6040516104169190613c85565b60405180910390f35b34801561042b57600080fd5b50610434610bd5565b6040516104419190613c0e565b60405180910390f35b34801561045657600080fd5b50610471600480360381019061046c9190613c29565b610be4565b005b34801561047f57600080fd5b5061049a60048036038101906104959190613ca0565b610c67565b005b3480156104a857600080fd5b506104c360048036038101906104be9190613adf565b610def565b6040516104d0919061397e565b60405180910390f35b3480156104e557600080fd5b506104ee610e26565b005b3480156104fc57600080fd5b5061051760048036038101906105129190613adf565b610e5b565b005b34801561052557600080fd5b50610540600480360381019061053b9190613ccd565b610e9c565b005b61055c60048036038101906105579190613e2f565b610ed7565b005b34801561056a57600080fd5b5061058560048036038101906105809190613ca0565b611013565b005b34801561059357600080fd5b5061059c61109d565b6040516105a99190613c0e565b60405180910390f35b3480156105be57600080fd5b506105c7611156565b6040516105d4919061397e565b60405180910390f35b3480156105e957600080fd5b5061060460048036038101906105ff9190613f29565b61116d565b604051610611919061397e565b60405180910390f35b34801561062657600080fd5b50610641600480360381019061063c9190613ca0565b61135a565b60405161064e9190613b2e565b60405180910390f35b34801561066357600080fd5b5061067e60048036038101906106799190613ca0565b6113a6565b60405161068b9190613b2e565b60405180910390f35b3480156106a057600080fd5b506106bb60048036038101906106b69190613adf565b6113ef565b005b3480156106c957600080fd5b506106e460048036038101906106df9190613ca0565b61142a565b6040516106f19190613b2e565b60405180910390f35b34801561070657600080fd5b5061070f61147b565b005b34801561071d57600080fd5b5061072661172f565b005b34801561073457600080fd5b5061074f600480360381019061074a9190613c29565b611764565b60405161075c919061397e565b60405180910390f35b34801561077157600080fd5b5061077a6117cf565b6040516107879190613a29565b60405180910390f35b34801561079c57600080fd5b506107b760048036038101906107b29190613adf565b611861565b005b3480156107c557600080fd5b506107ce61189a565b6040516107db9190613c0e565b60405180910390f35b3480156107f057600080fd5b5061080b60048036038101906108069190613adf565b6118a1565b604051610818919061397e565b60405180910390f35b34801561082d57600080fd5b50610836611918565b6040516108439190613fc0565b60405180910390f35b34801561085857600080fd5b50610873600480360381019061086e9190613adf565b61193f565b604051610880919061397e565b60405180910390f35b34801561089557600080fd5b506108b060048036038101906108ab9190614007565b611962565b005b3480156108be57600080fd5b506108c7611aa4565b6040516108d49190613c0e565b60405180910390f35b3480156108e957600080fd5b5061090460048036038101906108ff9190613c29565b611ac8565b005b34801561091257600080fd5b5061092d60048036038101906109289190613adf565b611ae9565b60405161093a9190613b2e565b60405180910390f35b34801561094f57600080fd5b5061096a600480360381019061096591906140a9565b611b84565b6040516109779190613b2e565b60405180910390f35b34801561098c57600080fd5b50610995611c0b565b6040516109a29190613c0e565b60405180910390f35b3480156109b757600080fd5b506109d260048036038101906109cd919061413e565b611c2f565b005b3480156109e057600080fd5b506109e9611cdc565b6040516109f69190613c0e565b60405180910390f35b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610a725750610a7182611d00565b5b9050919050565b606060368054610a889061419a565b80601f0160208091040260200160405190810160405280929190818152602001828054610ab49061419a565b8015610b015780601f10610ad657610100808354040283529160200191610b01565b820191906000526020600020905b815481529060010190602001808311610ae457829003601f168201915b5050505050905090565b600080610b16611d6a565b9050610b23818585611d72565b600191505092915050565b6000603554905090565b600080610b43611d6a565b9050610b50858285611f3b565b610b5b858585611fc7565b60019150509392505050565b600060fb6000838152602001908152602001600020600101549050919050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b610bb482610b67565b610bbd81612249565b610bc7838361225d565b505050565b60006012905090565b6000610bdf61233e565b905090565b610bec611d6a565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610c59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c509061423d565b60405180910390fd5b610c63828261237e565b5050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1603610cf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cec906142cf565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610d34612460565b73ffffffffffffffffffffffffffffffffffffffff1614610d8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8190614361565b60405180910390fd5b610d93816124b7565b610dec81600067ffffffffffffffff811115610db257610db1613d04565b5b6040519080825280601f01601f191660200182016040528015610de45781602001600182028036833780820191505090505b5060006124e5565b50565b600080610dfa611d6a565b9050610e1b818585610e0c8589611b84565b610e1691906143b0565b611d72565b600191505092915050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610e5081612249565b610e58612653565b50565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610e8581612249565b610e8d6126b6565b610e978383612700565b505050565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ece90614430565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1603610f65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5c906142cf565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610fa4612460565b73ffffffffffffffffffffffffffffffffffffffff1614610ffa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff190614361565b60405180910390fd5b611003826124b7565b61100f828260016124e5565b5050565b6000801b61102081612249565b8161022c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f36e94a5b0ba4f46e3ef5465dfe28bd2378ed8c67f560cc67fd890dddb5ce9907826040516110919190613fc0565b60405180910390a15050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161461112d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611124906144c2565b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b905090565b6000609760009054906101000a900460ff16905090565b60006111788561135a565b8411156111ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b190614554565b60405180910390fd5b60006111c68686611ae9565b90506111d28786612700565b7f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98773ffffffffffffffffffffffffffffffffffffffff166323e30c8b338989868a8a6040518763ffffffff1660e01b8152600401611236969594939291906145b2565b6020604051808303816000875af1158015611255573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112799190614623565b146112b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b0906146c2565b60405180910390fd5b60006112c3612860565b90506112db883084896112d691906143b0565b611f3b565b60008214806113165750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b156113355761133088838861132b91906143b0565b61288b565b61134b565b61133f888761288b565b61134a888284611fc7565b5b60019250505095945050505050565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461139657600061139f565b61139e610b2e565b5b9050919050565b6000603360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142190614430565b60405180910390fd5b600061147461016160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020612a63565b9050919050565b60008060019054906101000a900460ff161590508080156114ac5750600160008054906101000a900460ff1660ff16105b806114d957506114bb30612a71565b1580156114d85750600160008054906101000a900460ff1660ff16145b5b611518576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150f90614754565b60405180910390fd5b60016000806101000a81548160ff021916908360ff1602179055508015611555576001600060016101000a81548160ff0219169083151502179055505b6115c96040518060400160405280601781526020017f586f636f6c61746c204d584e20537461626c65636f696e0000000000000000008152506040518060400160405280600381526020017f584f430000000000000000000000000000000000000000000000000000000000815250612a94565b6115d1612af1565b6115d9612b42565b6115e1612b9b565b61161f6040518060400160405280601781526020017f586f636f6c61746c204d584e20537461626c65636f696e000000000000000000815250612bec565b611627612c7d565b61162f612cce565b61163c6000801b3361225d565b6116667f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a3361225d565b6116907f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a63361225d565b6116ba7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e33361225d565b600161022a6000018190555061271061022a60010181905550801561172c5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498600160405161172391906147b9565b60405180910390a15b50565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61175981612249565b611761612d1f565b50565b600060fb600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6060603780546117de9061419a565b80601f016020809104026020016040519081016040528092919081815260200182805461180a9061419a565b80156118575780601f1061182c57610100808354040283529160200191611857565b820191906000526020600020905b81548152906001019060200180831161183a57829003601f168201915b5050505050905090565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84861188b81612249565b611895838361288b565b505050565b6000801b81565b6000806118ac611d6a565b905060006118ba8286611b84565b9050838110156118ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f690614846565b60405180910390fd5b61190c8286868403611d72565b60019250505092915050565b61022c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008061194a611d6a565b9050611957818585611fc7565b600191505092915050565b834211156119a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199c906148b2565b60405180910390fd5b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886119d48c612d82565b896040516020016119ea969594939291906148d2565b6040516020818303038152906040528051906020012090506000611a0d82612de1565b90506000611a1d82878787612dfb565b90508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611a8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a849061497f565b60405180910390fd5b611a988a8a8a611d72565b50505050505050505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b611ad182610b67565b611ada81612249565b611ae4838361237e565b505050565b60003073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611b59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b50906149eb565b60405180910390fd5b61022a6001015461022a6000015483611b729190614a0b565b611b7c9190614a7c565b905092915050565b6000603460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6000801b611c3c81612249565b8160200151826000015110611c86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7d90614af9565b60405180910390fd5b8161022a60008201518160000155602082015181600101559050507fc019983ce9a9a2e3befe1c459ec622afdfd4ff012d2d03ecebcb7605d2a38d5582604051611cd09190614b57565b60405180910390a15050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611de1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd890614be4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611e50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4790614c76565b60405180910390fd5b80603460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611f2e9190613b2e565b60405180910390a3505050565b6000611f478484611b84565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611fc15781811015611fb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611faa90614ce2565b60405180910390fd5b611fc08484848403611d72565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612036576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202d90614d74565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036120a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161209c90614e06565b60405180910390fd5b6120b0838383612e26565b6000603360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015612137576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212e90614e98565b60405180910390fd5b818103603360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081603360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546121cc91906143b0565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516122309190613b2e565b60405180910390a3612243848484612e3e565b50505050565b61225a81612255611d6a565b612e43565b50565b6122678282611764565b61233a57600160fb600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506122df611d6a565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b60006123797f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f61236c612ee0565b612374612eeb565b612ef6565b905090565b6123888282611764565b1561245c57600060fb600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550612401611d6a565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b600061248e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b612f30565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e36124e181612249565b5050565b6125117f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd914360001b612f3a565b60000160009054906101000a900460ff16156125355761253083612f44565b61264e565b8273ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561259d57506040513d601f19601f8201168201806040525081019061259a9190614623565b60015b6125dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125d390614f2a565b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b8114612641576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161263890614fbc565b60405180910390fd5b5061264d838383612ffd565b5b505050565b61265b613029565b6000609760006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61269f611d6a565b6040516126ac9190613fc0565b60405180910390a1565b6126be611156565b156126fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126f590615028565b60405180910390fd5b565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361276f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276690615094565b60405180910390fd5b61277b60008383612e26565b806035600082825461278d91906143b0565b9250508190555080603360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546127e391906143b0565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516128489190613b2e565b60405180910390a361285c60008383612e3e565b5050565b600061022c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036128fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128f190615126565b60405180910390fd5b61290682600083612e26565b6000603360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561298d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612984906151b8565b60405180910390fd5b818103603360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081603560008282546129e591906151d8565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612a4a9190613b2e565b60405180910390a3612a5e83600084612e3e565b505050565b600081600001549050919050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16612ae3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ada9061527e565b60405180910390fd5b612aed8282613072565b5050565b600060019054906101000a900460ff16612b40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b379061527e565b60405180910390fd5b565b600060019054906101000a900460ff16612b91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b889061527e565b60405180910390fd5b612b996130e5565b565b600060019054906101000a900460ff16612bea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612be19061527e565b60405180910390fd5b565b600060019054906101000a900460ff16612c3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c329061527e565b60405180910390fd5b612c7a816040518060400160405280600181526020017f3100000000000000000000000000000000000000000000000000000000000000815250613151565b50565b600060019054906101000a900460ff16612ccc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cc39061527e565b60405180910390fd5b565b600060019054906101000a900460ff16612d1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d149061527e565b60405180910390fd5b565b612d276126b6565b6001609760006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612d6b611d6a565b604051612d789190613fc0565b60405180910390a1565b60008061016160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050612dd081612a63565b9150612ddb816131ce565b50919050565b6000612df4612dee61233e565b836131e4565b9050919050565b6000806000612e0c87878787613217565b91509150612e1981613323565b8192505050949350505050565b612e2e6126b6565b612e398383836134ef565b505050565b505050565b612e4d8282611764565b612edc57612e728173ffffffffffffffffffffffffffffffffffffffff1660146134f4565b612e808360001c60206134f4565b604051602001612e91929190615372565b6040516020818303038152906040526040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ed39190613a29565b60405180910390fd5b5050565b600061012d54905090565b600061012e54905090565b60008383834630604051602001612f119594939291906153ac565b6040516020818303038152906040528051906020012090509392505050565b6000819050919050565b6000819050919050565b612f4d81612a71565b612f8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f8390615471565b60405180910390fd5b80612fb97f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b612f30565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61300683613730565b6000825111806130135750805b1561302457613022838361377f565b505b505050565b613031611156565b613070576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613067906154dd565b60405180910390fd5b565b600060019054906101000a900460ff166130c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130b89061527e565b60405180910390fd5b81603690816130d0919061569f565b5080603790816130e0919061569f565b505050565b600060019054906101000a900460ff16613134576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161312b9061527e565b60405180910390fd5b6000609760006101000a81548160ff021916908315150217905550565b600060019054906101000a900460ff166131a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131979061527e565b60405180910390fd5b6000828051906020012090506000828051906020012090508161012d819055508061012e8190555050505050565b6001816000016000828254019250508190555050565b600082826040516020016131f99291906157de565b60405160208183030381529060405280519060200120905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c111561325257600060039150915061331a565b601b8560ff161415801561326a5750601c8560ff1614155b1561327c57600060049150915061331a565b6000600187878787604051600081526020016040526040516132a19493929190615815565b6020604051602081039080840390855afa1580156132c3573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036133115760006001925092505061331a565b80600092509250505b94509492505050565b600060048111156133375761333661585a565b5b81600481111561334a5761334961585a565b5b03156134ec57600160048111156133645761336361585a565b5b8160048111156133775761337661585a565b5b036133b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133ae906158d5565b60405180910390fd5b600260048111156133cb576133ca61585a565b5b8160048111156133de576133dd61585a565b5b0361341e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161341590615941565b60405180910390fd5b600360048111156134325761343161585a565b5b8160048111156134455761344461585a565b5b03613485576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161347c906159d3565b60405180910390fd5b6004808111156134985761349761585a565b5b8160048111156134ab576134aa61585a565b5b036134eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134e290615a65565b60405180910390fd5b5b50565b505050565b6060600060028360026135079190614a0b565b61351191906143b0565b67ffffffffffffffff81111561352a57613529613d04565b5b6040519080825280601f01601f19166020018201604052801561355c5781602001600182028036833780820191505090505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061359457613593615a85565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106135f8576135f7615a85565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060018460026136389190614a0b565b61364291906143b0565b90505b60018111156136e2577f3031323334353637383961626364656600000000000000000000000000000000600f86166010811061368457613683615a85565b5b1a60f81b82828151811061369b5761369a615a85565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806136db90615ab4565b9050613645565b5060008414613726576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161371d90615b29565b60405180910390fd5b8091505092915050565b61373981612f44565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b606061378a83612a71565b6137c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137c090615bbb565b60405180910390fd5b6000808473ffffffffffffffffffffffffffffffffffffffff16846040516137f19190615c22565b600060405180830381855af49150503d806000811461382c576040519150601f19603f3d011682016040523d82523d6000602084013e613831565b606091505b50915091506138598282604051806060016040528060278152602001615c3a60279139613863565b9250505092915050565b60608315613873578290506138c3565b6000835111156138865782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016138ba9190613a29565b60405180910390fd5b9392505050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613913816138de565b811461391e57600080fd5b50565b6000813590506139308161390a565b92915050565b60006020828403121561394c5761394b6138d4565b5b600061395a84828501613921565b91505092915050565b60008115159050919050565b61397881613963565b82525050565b6000602082019050613993600083018461396f565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156139d35780820151818401526020810190506139b8565b60008484015250505050565b6000601f19601f8301169050919050565b60006139fb82613999565b613a0581856139a4565b9350613a158185602086016139b5565b613a1e816139df565b840191505092915050565b60006020820190508181036000830152613a4381846139f0565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613a7682613a4b565b9050919050565b613a8681613a6b565b8114613a9157600080fd5b50565b600081359050613aa381613a7d565b92915050565b6000819050919050565b613abc81613aa9565b8114613ac757600080fd5b50565b600081359050613ad981613ab3565b92915050565b60008060408385031215613af657613af56138d4565b5b6000613b0485828601613a94565b9250506020613b1585828601613aca565b9150509250929050565b613b2881613aa9565b82525050565b6000602082019050613b436000830184613b1f565b92915050565b600080600060608486031215613b6257613b616138d4565b5b6000613b7086828701613a94565b9350506020613b8186828701613a94565b9250506040613b9286828701613aca565b9150509250925092565b6000819050919050565b613baf81613b9c565b8114613bba57600080fd5b50565b600081359050613bcc81613ba6565b92915050565b600060208284031215613be857613be76138d4565b5b6000613bf684828501613bbd565b91505092915050565b613c0881613b9c565b82525050565b6000602082019050613c236000830184613bff565b92915050565b60008060408385031215613c4057613c3f6138d4565b5b6000613c4e85828601613bbd565b9250506020613c5f85828601613a94565b9150509250929050565b600060ff82169050919050565b613c7f81613c69565b82525050565b6000602082019050613c9a6000830184613c76565b92915050565b600060208284031215613cb657613cb56138d4565b5b6000613cc484828501613a94565b91505092915050565b600060208284031215613ce357613ce26138d4565b5b6000613cf184828501613aca565b91505092915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613d3c826139df565b810181811067ffffffffffffffff82111715613d5b57613d5a613d04565b5b80604052505050565b6000613d6e6138ca565b9050613d7a8282613d33565b919050565b600067ffffffffffffffff821115613d9a57613d99613d04565b5b613da3826139df565b9050602081019050919050565b82818337600083830152505050565b6000613dd2613dcd84613d7f565b613d64565b905082815260208101848484011115613dee57613ded613cff565b5b613df9848285613db0565b509392505050565b600082601f830112613e1657613e15613cfa565b5b8135613e26848260208601613dbf565b91505092915050565b60008060408385031215613e4657613e456138d4565b5b6000613e5485828601613a94565b925050602083013567ffffffffffffffff811115613e7557613e746138d9565b5b613e8185828601613e01565b9150509250929050565b6000613e9682613a6b565b9050919050565b613ea681613e8b565b8114613eb157600080fd5b50565b600081359050613ec381613e9d565b92915050565b600080fd5b600080fd5b60008083601f840112613ee957613ee8613cfa565b5b8235905067ffffffffffffffff811115613f0657613f05613ec9565b5b602083019150836001820283011115613f2257613f21613ece565b5b9250929050565b600080600080600060808688031215613f4557613f446138d4565b5b6000613f5388828901613eb4565b9550506020613f6488828901613a94565b9450506040613f7588828901613aca565b935050606086013567ffffffffffffffff811115613f9657613f956138d9565b5b613fa288828901613ed3565b92509250509295509295909350565b613fba81613a6b565b82525050565b6000602082019050613fd56000830184613fb1565b92915050565b613fe481613c69565b8114613fef57600080fd5b50565b60008135905061400181613fdb565b92915050565b600080600080600080600060e0888a031215614026576140256138d4565b5b60006140348a828b01613a94565b97505060206140458a828b01613a94565b96505060406140568a828b01613aca565b95505060606140678a828b01613aca565b94505060806140788a828b01613ff2565b93505060a06140898a828b01613bbd565b92505060c061409a8a828b01613bbd565b91505092959891949750929550565b600080604083850312156140c0576140bf6138d4565b5b60006140ce85828601613a94565b92505060206140df85828601613a94565b9150509250929050565b600080fd5b600060408284031215614104576141036140e9565b5b61410e6040613d64565b9050600061411e84828501613aca565b600083015250602061413284828501613aca565b60208301525092915050565b600060408284031215614154576141536138d4565b5b6000614162848285016140ee565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806141b257607f821691505b6020821081036141c5576141c461416b565b5b50919050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b6000614227602f836139a4565b9150614232826141cb565b604082019050919050565b600060208201905081810360008301526142568161421a565b9050919050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f64656c656761746563616c6c0000000000000000000000000000000000000000602082015250565b60006142b9602c836139a4565b91506142c48261425d565b604082019050919050565b600060208201905081810360008301526142e8816142ac565b9050919050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f6163746976652070726f78790000000000000000000000000000000000000000602082015250565b600061434b602c836139a4565b9150614356826142ef565b604082019050919050565b6000602082019050818103600083015261437a8161433e565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006143bb82613aa9565b91506143c683613aa9565b92508282019050808211156143de576143dd614381565b5b92915050565b7f4e6f2073656c66206275726e2100000000000000000000000000000000000000600082015250565b600061441a600d836139a4565b9150614425826143e4565b602082019050919050565b600060208201905081810360008301526144498161440d565b9050919050565b7f555550535570677261646561626c653a206d757374206e6f742062652063616c60008201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000602082015250565b60006144ac6038836139a4565b91506144b782614450565b604082019050919050565b600060208201905081810360008301526144db8161449f565b9050919050565b7f4552433230466c6173684d696e743a20616d6f756e742065786365656473206d60008201527f6178466c6173684c6f616e000000000000000000000000000000000000000000602082015250565b600061453e602b836139a4565b9150614549826144e2565b604082019050919050565b6000602082019050818103600083015261456d81614531565b9050919050565b600082825260208201905092915050565b60006145918385614574565b935061459e838584613db0565b6145a7836139df565b840190509392505050565b600060a0820190506145c76000830189613fb1565b6145d46020830188613fb1565b6145e16040830187613b1f565b6145ee6060830186613b1f565b8181036080830152614601818486614585565b9050979650505050505050565b60008151905061461d81613ba6565b92915050565b600060208284031215614639576146386138d4565b5b60006146478482850161460e565b91505092915050565b7f4552433230466c6173684d696e743a20696e76616c69642072657475726e207660008201527f616c756500000000000000000000000000000000000000000000000000000000602082015250565b60006146ac6024836139a4565b91506146b782614650565b604082019050919050565b600060208201905081810360008301526146db8161469f565b9050919050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b600061473e602e836139a4565b9150614749826146e2565b604082019050919050565b6000602082019050818103600083015261476d81614731565b9050919050565b6000819050919050565b6000819050919050565b60006147a361479e61479984614774565b61477e565b613c69565b9050919050565b6147b381614788565b82525050565b60006020820190506147ce60008301846147aa565b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b60006148306025836139a4565b915061483b826147d4565b604082019050919050565b6000602082019050818103600083015261485f81614823565b9050919050565b7f45524332305065726d69743a206578706972656420646561646c696e65000000600082015250565b600061489c601d836139a4565b91506148a782614866565b602082019050919050565b600060208201905081810360008301526148cb8161488f565b9050919050565b600060c0820190506148e76000830189613bff565b6148f46020830188613fb1565b6149016040830187613fb1565b61490e6060830186613b1f565b61491b6080830185613b1f565b61492860a0830184613b1f565b979650505050505050565b7f45524332305065726d69743a20696e76616c6964207369676e61747572650000600082015250565b6000614969601e836139a4565b915061497482614933565b602082019050919050565b600060208201905081810360008301526149988161495c565b9050919050565b7f4552433230466c6173684d696e743a2077726f6e6720746f6b656e0000000000600082015250565b60006149d5601b836139a4565b91506149e08261499f565b602082019050919050565b60006020820190508181036000830152614a04816149c8565b9050919050565b6000614a1682613aa9565b9150614a2183613aa9565b9250828202614a2f81613aa9565b91508282048414831517614a4657614a45614381565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614a8782613aa9565b9150614a9283613aa9565b925082614aa257614aa1614a4d565b5b828204905092915050565b7f496e76616c696420696e70757421000000000000000000000000000000000000600082015250565b6000614ae3600e836139a4565b9150614aee82614aad565b602082019050919050565b60006020820190508181036000830152614b1281614ad6565b9050919050565b614b2281613aa9565b82525050565b604082016000820151614b3e6000850182614b19565b506020820151614b516020850182614b19565b50505050565b6000604082019050614b6c6000830184614b28565b92915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000614bce6024836139a4565b9150614bd982614b72565b604082019050919050565b60006020820190508181036000830152614bfd81614bc1565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000614c606022836139a4565b9150614c6b82614c04565b604082019050919050565b60006020820190508181036000830152614c8f81614c53565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b6000614ccc601d836139a4565b9150614cd782614c96565b602082019050919050565b60006020820190508181036000830152614cfb81614cbf565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000614d5e6025836139a4565b9150614d6982614d02565b604082019050919050565b60006020820190508181036000830152614d8d81614d51565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000614df06023836139a4565b9150614dfb82614d94565b604082019050919050565b60006020820190508181036000830152614e1f81614de3565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000614e826026836139a4565b9150614e8d82614e26565b604082019050919050565b60006020820190508181036000830152614eb181614e75565b9050919050565b7f45524331393637557067726164653a206e657720696d706c656d656e7461746960008201527f6f6e206973206e6f742055555053000000000000000000000000000000000000602082015250565b6000614f14602e836139a4565b9150614f1f82614eb8565b604082019050919050565b60006020820190508181036000830152614f4381614f07565b9050919050565b7f45524331393637557067726164653a20756e737570706f727465642070726f7860008201527f6961626c65555549440000000000000000000000000000000000000000000000602082015250565b6000614fa66029836139a4565b9150614fb182614f4a565b604082019050919050565b60006020820190508181036000830152614fd581614f99565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b60006150126010836139a4565b915061501d82614fdc565b602082019050919050565b6000602082019050818103600083015261504181615005565b9050919050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b600061507e601f836139a4565b915061508982615048565b602082019050919050565b600060208201905081810360008301526150ad81615071565b9050919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b60006151106021836139a4565b915061511b826150b4565b604082019050919050565b6000602082019050818103600083015261513f81615103565b9050919050565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b60006151a26022836139a4565b91506151ad82615146565b604082019050919050565b600060208201905081810360008301526151d181615195565b9050919050565b60006151e382613aa9565b91506151ee83613aa9565b925082820390508181111561520657615205614381565b5b92915050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b6000615268602b836139a4565b91506152738261520c565b604082019050919050565b600060208201905081810360008301526152978161525b565b9050919050565b600081905092915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b60006152df60178361529e565b91506152ea826152a9565b601782019050919050565b600061530082613999565b61530a818561529e565b935061531a8185602086016139b5565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b600061535c60118361529e565b915061536782615326565b601182019050919050565b600061537d826152d2565b915061538982856152f5565b91506153948261534f565b91506153a082846152f5565b91508190509392505050565b600060a0820190506153c16000830188613bff565b6153ce6020830187613bff565b6153db6040830186613bff565b6153e86060830185613b1f565b6153f56080830184613fb1565b9695505050505050565b7f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60008201527f6f74206120636f6e747261637400000000000000000000000000000000000000602082015250565b600061545b602d836139a4565b9150615466826153ff565b604082019050919050565b6000602082019050818103600083015261548a8161544e565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b60006154c76014836139a4565b91506154d282615491565b602082019050919050565b600060208201905081810360008301526154f6816154ba565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261555f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82615522565b6155698683615522565b95508019841693508086168417925050509392505050565b600061559c61559761559284613aa9565b61477e565b613aa9565b9050919050565b6000819050919050565b6155b683615581565b6155ca6155c2826155a3565b84845461552f565b825550505050565b600090565b6155df6155d2565b6155ea8184846155ad565b505050565b5b8181101561560e576156036000826155d7565b6001810190506155f0565b5050565b601f82111561565357615624816154fd565b61562d84615512565b8101602085101561563c578190505b61565061564885615512565b8301826155ef565b50505b505050565b600082821c905092915050565b600061567660001984600802615658565b1980831691505092915050565b600061568f8383615665565b9150826002028217905092915050565b6156a882613999565b67ffffffffffffffff8111156156c1576156c0613d04565b5b6156cb825461419a565b6156d6828285615612565b600060209050601f83116001811461570957600084156156f7578287015190505b6157018582615683565b865550615769565b601f198416615717866154fd565b60005b8281101561573f5784890151825560018201915060208501945060208101905061571a565b8683101561575c5784890151615758601f891682615665565b8355505b6001600288020188555050505b505050505050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b60006157a760028361529e565b91506157b282615771565b600282019050919050565b6000819050919050565b6157d86157d382613b9c565b6157bd565b82525050565b60006157e98261579a565b91506157f582856157c7565b60208201915061580582846157c7565b6020820191508190509392505050565b600060808201905061582a6000830187613bff565b6158376020830186613c76565b6158446040830185613bff565b6158516060830184613bff565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b60006158bf6018836139a4565b91506158ca82615889565b602082019050919050565b600060208201905081810360008301526158ee816158b2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b600061592b601f836139a4565b9150615936826158f5565b602082019050919050565b6000602082019050818103600083015261595a8161591e565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b60006159bd6022836139a4565b91506159c882615961565b604082019050919050565b600060208201905081810360008301526159ec816159b0565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000615a4f6022836139a4565b9150615a5a826159f3565b604082019050919050565b60006020820190508181036000830152615a7e81615a42565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000615abf82613aa9565b915060008203615ad257615ad1614381565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b6000615b136020836139a4565b9150615b1e82615add565b602082019050919050565b60006020820190508181036000830152615b4281615b06565b9050919050565b7f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60008201527f6e74726163740000000000000000000000000000000000000000000000000000602082015250565b6000615ba56026836139a4565b9150615bb082615b49565b604082019050919050565b60006020820190508181036000830152615bd481615b98565b9050919050565b600081519050919050565b600081905092915050565b6000615bfc82615bdb565b615c068185615be6565b9350615c168185602086016139b5565b80840191505092915050565b6000615c2e8284615bf1565b91508190509291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220390601e879cd780d9f61a5c151b0b4a0c57ed6b16a3c0109020b2eea7d4fe8fb64736f6c63430008110033" + } +} \ No newline at end of file diff --git a/hardhat.config.js b/hardhat.config.js index 42b826c..66ab9f6 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -60,7 +60,7 @@ module.exports = { }, polygonzkevm: { chainId: 1101, - url: `https://zkevm-rpc.com`, + url: `https://polygonzkevm-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_ID}`, accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : {mnemonic: mnemonic()}, }, arbitrum: { @@ -108,6 +108,11 @@ module.exports = { url: `https://rpc.scroll.io/`, accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : {mnemonic: mnemonic()}, }, + polygonamoy: { + chainId: 80002, + url: `https://polygon-amoy.infura.io/v3/${process.env.INFURA_ID}`, + accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : {mnemonic: mnemonic()}, + }, }, sourcify: { enabled: true, diff --git a/scripts/const.js b/scripts/const.js index 427e1d8..c214f08 100644 --- a/scripts/const.js +++ b/scripts/const.js @@ -8,8 +8,9 @@ const LADAO_MULTISIGS = { sepolia: "0xbd9e84Da78228039867E1687F824a106310c029D", base: "0x571131167e1A16D9879FA605319944Ba6E993Dd7", linea: "", - polygonzkevm: "", + polygonzkevm: "0xBB22D8dD78FcfD15D0ad2aef3B2f595a24461026", scroll: "0x840A6f02e31eBa9761Ceb18471524B71B506E7F4", + polygonamoy: "0x3839FaE2cF838F8Ed6EAEB65b8c98fad72Cca7EA", // TODO - change address }; const CONTRACT_DEPLOYER_FACTORY = "0xF8faF9319e5CDDfda173B0a6461f19765AAAbf03"; @@ -192,6 +193,14 @@ const ASSETS = { }, }, }, + polygonamoy: { + wpol: { + address: "0x96388dDB8C35799D14D5DcBb05AD98b80F0D1d11", + storageSlots: { + balanceOf: 3, + }, + }, + }, }; const ORACLE_CONTRACTS = { @@ -254,6 +263,14 @@ const ORACLE_CONTRACTS = { pyth: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729", ethusd: "0x6bF14CB0A831078629D993FDeBcB182b21A8774C", }, + polygonzkevm: { + pyth: "0xC5E56d6b40F3e3B5fbfa266bCd35C37426537c65", + ethusd: "0x97d9F9A00dEE0004BE8ca0A8fa374d486567eE2D", + }, + polygonamoy: { + pyth: "0x2880aB155794e7179c9eE2e38200202908C17B43", + ethusd: "0x8eFDBF61C74179Bb670d4529E1BD61C69ebdaE0A", + }, }; const TLATLALIANI_CONTRACTS = { @@ -272,6 +289,7 @@ const TLATLALIANI_CONTRACTS = { sepolia: { mxnusd: "0xada8c0eaba7ad722f4b5555b216f8f11a81593d8", }, + // TODO - add Polygon Amoy + zkEVM contracts here??? }; module.exports = { diff --git a/scripts/polygonamoy/00_deploy_xocolatl.js b/scripts/polygonamoy/00_deploy_xocolatl.js new file mode 100644 index 0000000..90a2e9c --- /dev/null +++ b/scripts/polygonamoy/00_deploy_xocolatl.js @@ -0,0 +1,28 @@ +const {NETWORK, setDeploymentsPath, setPublishPath, publishUpdates} = require("../utils"); +const {VERSION} = require("./utils_polygonamoy"); + +const {deployXocolatl} = require("../tasks/deployXocolatl"); +const {handOverDefaultAdmin} = require("../tasks/rolesHandOver"); + +const deployBackedAsset = async () => { + console.log("\n\n 📡 Deploying...\n"); + const xoc = await deployXocolatl(); + await handOverDefaultAdmin(xoc); +}; + +const main = async () => { + if (NETWORK !== "polygonamoy") { + throw new Error("Set 'NETWORK=polygonamoy' in .env file"); + } + await setDeploymentsPath(VERSION); + await setPublishPath(VERSION); + await deployBackedAsset(); + await publishUpdates(); +}; + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(`\n${error}\n`); + process.exit(1); + }); diff --git a/scripts/polygonamoy/01_deploy_system.js b/scripts/polygonamoy/01_deploy_system.js new file mode 100644 index 0000000..0b92a9b --- /dev/null +++ b/scripts/polygonamoy/01_deploy_system.js @@ -0,0 +1,97 @@ +const {NETWORK, getContract, setDeploymentsPath, setPublishPath, publishUpdates} = require("../utils"); +const {TREASURY, RESERVE_CAPS, VERSION, WNATIVE} = require("./utils_polygonamoy"); +const {deployAccountLiquidator} = require("../tasks/deployAccountLiquidator"); +const {deployAssetsAccountant} = require("../tasks/deployAssetsAccountant"); +const {deployHouseOfCoin} = require("../tasks/deployHouseOfCoin"); +const {deployHouseOfReserveImplementation} = require("../tasks/deployHouseOfReserve"); +const {deployOracleFactoryL2} = require("../tasks/deployOracleFactoryL2"); +const {deployOracleImplementations} = require("../tasks/deployOracleImplementations"); +const {deployReserveBeaconFactory} = require("../tasks/deployReserveBeaconFactory"); +const {ASSETS, ORACLE_CONTRACTS} = require("../const"); +const {rolesHandOverAssetsAccountant, handOverOwnership} = require("../tasks/rolesHandOver"); +const {setUpAssetsAccountant} = require("../tasks/setUpAssetsAccountant"); +const {setupOracleFactory} = require("../tasks/setupOracleFactory"); +const {deployUsdMxnPythWrapper} = require("../tasks/deployUsdMxnPythWrapper"); +const {deployReserveViaFactory} = require("../tasks/deployReserveViaFactory"); +const {deployOracleFactory} = require("../tasks/deployOracleFactory"); + +const deploySystemContracts = async () => { + console.log("\n\n 📡 Deploying...\n"); + xoc = await getContract("Xocolatl", "Xocolatl"); + console.log("xoc", await xoc.getAddress()); + const accountant = await deployAssetsAccountant(); + const coinhouse = await deployHouseOfCoin(await xoc.getAddress(), await accountant.getAddress(), TREASURY); + const reservehouseImpl = await deployHouseOfReserveImplementation(); + const factory = await deployReserveBeaconFactory( + await reservehouseImpl.getAddress(), + await xoc.getAddress(), + await accountant.getAddress(), + WNATIVE, + ); + const liquidator = await deployAccountLiquidator(await coinhouse.getAddress(), await accountant.getAddress()); + + await setUpAssetsAccountant( + accountant, + await coinhouse.getAddress(), + await liquidator.getAddress(), + await factory.getAddress(), + ); + + const {computedPriceFeedImpl, invPriceFeedImpl, priceFeedPythWrapperImpl} = await deployOracleImplementations([ + "ComputedPriceFeedWithSequencer", + "InversePriceFeed", + "PriceFeedPythWrapper", + ]); + // TODO - check error for oracleFactory implementation + // const oracleFactory = await deployOracleFactoryL2(); + const oracleFactory = await deployOracleFactory(); + + await setupOracleFactory(oracleFactory, computedPriceFeedImpl, invPriceFeedImpl, priceFeedPythWrapperImpl); + + const pythWrapperUsdMxn = await deployUsdMxnPythWrapper(oracleFactory, ORACLE_CONTRACTS[NETWORK].pyth); + + const reservehouseWpol = await deployReserveViaFactory( + factory, + oracleFactory, + WNATIVE, + RESERVE_CAPS.wpol.defaultInitialLimit, + ethers.parseUnits("0.8", 18), + ethers.parseUnits("0.85", 18), + 15000, + await pythWrapperUsdMxn.getAddress(), + ORACLE_CONTRACTS[NETWORK].ethusd, + ); + + await rolesHandOverAssetsAccountant(accountant); + await handOverOwnership(coinhouse); + await handOverOwnership(factory); + await handOverOwnership(oracleFactory); + await handOverOwnership(liquidator); + await handOverOwnership(reservehouseWpol); + + // In addition the multisig needs to queue + // 1.- Xocolatl contract grants minter role to Coinhouse + // 2.- Xocolatl contract grants burner role to Coinhouse + // 3.- Xocolatl contract grants burner role to Liquidator + // For example: + // await xoc.grantRole(minter, await coinhouse.getAddress()); + // await xoc.grantRole(burner, await coinhouse.getAddress()); + // await xoc.grantRole(burner, await liquidator.getAddress()); +}; + +const main = async () => { + if (NETWORK !== "polygonamoy") { + throw new Error("Set 'NETWORK=polygonamoy' in .env file"); + } + await setDeploymentsPath(VERSION); + await setPublishPath(VERSION); + await deploySystemContracts(); + await publishUpdates(); +}; + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(`\n${error}\n`); + process.exit(1); + }); diff --git a/scripts/polygonamoy/utils_polygonamoy.js b/scripts/polygonamoy/utils_polygonamoy.js new file mode 100644 index 0000000..44c476c --- /dev/null +++ b/scripts/polygonamoy/utils_polygonamoy.js @@ -0,0 +1,21 @@ +const {ethers} = require("hardhat"); +const {ASSETS, LADAO_MULTISIGS} = require("../const"); + +const VERSION = "2.0.0"; + +const RESERVE_CAPS = { + wpol: { + defaultInitialLimit: ethers.parseUnits("5", 18), + }, +}; + +const WNATIVE = ASSETS.polygonamoy.wpol.address; +const TREASURY = LADAO_MULTISIGS.polygonamoy; + +module.exports = { + VERSION, + WNATIVE, + RESERVE_CAPS, + ASSETS, + TREASURY, +}; diff --git a/scripts/polygonzkevm/01_deploy_system.js b/scripts/polygonzkevm/01_deploy_system.js new file mode 100644 index 0000000..9d47d6b --- /dev/null +++ b/scripts/polygonzkevm/01_deploy_system.js @@ -0,0 +1,94 @@ +const {NETWORK, getContract, setDeploymentsPath, setPublishPath, publishUpdates} = require("../utils"); +const {TREASURY, RESERVE_CAPS, VERSION, WNATIVE} = require("./utils_polygonzkevm"); +const {deployAccountLiquidator} = require("../tasks/deployAccountLiquidator"); +const {deployAssetsAccountant} = require("../tasks/deployAssetsAccountant"); +const {deployHouseOfCoin} = require("../tasks/deployHouseOfCoin"); +const {deployHouseOfReserveImplementation} = require("../tasks/deployHouseOfReserve"); +const {deployOracleFactory} = require("../tasks/deployOracleFactory"); +const {deployOracleImplementations} = require("../tasks/deployOracleImplementations"); +const {deployReserveBeaconFactory} = require("../tasks/deployReserveBeaconFactory"); +const {ORACLE_CONTRACTS} = require("../const"); +const {rolesHandOverAssetsAccountant, handOverOwnership} = require("../tasks/rolesHandOver"); +const {setUpAssetsAccountant} = require("../tasks/setUpAssetsAccountant"); +const {setupOracleFactory} = require("../tasks/setupOracleFactory"); +const {deployUsdMxnPythWrapper} = require("../tasks/deployUsdMxnPythWrapper"); +const {deployReserveViaFactory} = require("../tasks/deployReserveViaFactory"); + +const deploySystemContracts = async () => { + console.log("\n\n 📡 Deploying...\n"); + xoc = await getContract("Xocolatl", "Xocolatl"); + console.log("xoc", await xoc.getAddress()); + const accountant = await deployAssetsAccountant(); + const coinhouse = await deployHouseOfCoin(await xoc.getAddress(), await accountant.getAddress(), TREASURY); + const reservehouseImpl = await deployHouseOfReserveImplementation(); + const factory = await deployReserveBeaconFactory( + await reservehouseImpl.getAddress(), + await xoc.getAddress(), + await accountant.getAddress(), + WNATIVE, + ); + const liquidator = await deployAccountLiquidator(await coinhouse.getAddress(), await accountant.getAddress()); + + await setUpAssetsAccountant( + accountant, + await coinhouse.getAddress(), + await liquidator.getAddress(), + await factory.getAddress(), + ); + + const {computedPriceFeedImpl, invPriceFeedImpl, priceFeedPythWrapperImpl} = await deployOracleImplementations([ + "ComputedPriceFeedWithSequencer", + "InversePriceFeed", + "PriceFeedPythWrapper", + ]); + const oracleFactory = await deployOracleFactory(); + await setupOracleFactory(oracleFactory, computedPriceFeedImpl, invPriceFeedImpl, priceFeedPythWrapperImpl); + + const pythWrapperUsdMxn = await deployUsdMxnPythWrapper(oracleFactory, ORACLE_CONTRACTS[NETWORK].pyth); + + const reservehouseWeth = await deployReserveViaFactory( + factory, + oracleFactory, + WNATIVE, + RESERVE_CAPS.weth.defaultInitialLimit, + ethers.parseUnits("0.8", 18), + ethers.parseUnits("0.85", 18), + 15000, + await pythWrapperUsdMxn.getAddress(), + ORACLE_CONTRACTS[NETWORK].ethusd, + "weth/mxn", + ); + + await rolesHandOverAssetsAccountant(accountant); + await handOverOwnership(coinhouse); + await handOverOwnership(factory); + await handOverOwnership(oracleFactory); + await handOverOwnership(liquidator); + await handOverOwnership(reservehouseWeth); + + // In addition the multisig needs to queue + // 1.- Xocolatl contract grants minter role to Coinhouse + // 2.- Xocolatl contract grants burner role to Coinhouse + // 3.- Xocolatl contract grants burner role to Liquidator + // For example: + // await xoc.grantRole(minter, await coinhouse.getAddress()); + // await xoc.grantRole(burner, await coinhouse.getAddress()); + // await xoc.grantRole(burner, await liquidator.getAddress()); +}; + +const main = async () => { + if (NETWORK !== "polygonzkevm") { + throw new Error("Set 'NETWORK=polygonzkevm' in .env file"); + } + await setDeploymentsPath(VERSION); + await setPublishPath(VERSION); + await deploySystemContracts(); + await publishUpdates(); +}; + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(`\n${error}\n`); + process.exit(1); + }); diff --git a/scripts/tasks/deployReserveViaFactory.js b/scripts/tasks/deployReserveViaFactory.js index b5a2dcc..b00bb56 100644 --- a/scripts/tasks/deployReserveViaFactory.js +++ b/scripts/tasks/deployReserveViaFactory.js @@ -22,6 +22,7 @@ const deployReserveViaFactory = async ( const allowedTimeout = 234000; // Due to market closure on weekends if (pricefeedAddr2 !== ethers.ZeroAddress) { console.log("ComputedPriceFeed" + ": Deploying..."); + // TODO - error seems to happen here const computedPriceAddr = await oracleFactory.createComputedPriceFeed.staticCall( `computed ${priceFeedName}`, 8,