Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xeb489E829fF10419a8E808fC8e0003134536AD71
Balance 0 ETH
Nonce 1
Code Size 20645 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

20645 bytes
0x60806040526004361061023b5760003560e01c806391d148541161012e578063ca15c873116100ab578063d7a9cd791161006f578063d7a9cd7914610892578063edc20c3c146108bd578063f8c39e44146108e6578063fe4648f414610923578063ffaac0eb1461094e5761023b565b8063ca15c873146107b1578063cb10f215146107ee578063cdb0f73a14610817578063d15ef64e14610840578063d547741f146108695761023b565b8063a217fddf116100f2578063a217fddf146106cc578063a9cf69fa146106f7578063bd2a182014610734578063c0331b3e1461075d578063c5ec8970146107865761023b565b806391d14854146105e5578063926d7d7f146106225780639d82dd631461064d5780639dd694f4146106765780639debb3bd146106a15761023b565b80635c975abb116101bc57806380ae1c281161018057806380ae1c281461050257806384db809f146105195780638b63aebf146105565780638c0c26311461057f5780639010d07c146105a85761023b565b80635c975abb1461042a5780635e1fab0f1461045557806373c45c981461047e5780637febe63f1461049a578063802aabe8146104d75761023b565b80634b0b919d116102035780634b0b919d146103215780634e0560051461035e5780634e0df3f614610387578063541d5548146103c45780635a1ad87c146104015761023b565b806317f03ce514610240578063206a98fd14610269578063248a9ca3146102925780632f2ff15d146102cf57806336568abe146102f8575b600080fd5b34801561024c57600080fd5b5061026760048036038101906102629190613411565b610965565b005b34801561027557600080fd5b50610290600480360381019061028b9190613501565b610d53565b005b34801561029e57600080fd5b506102b960048036038101906102b4919061359b565b6110a9565b6040516102c691906135d7565b60405180910390f35b3480156102db57600080fd5b506102f660048036038101906102f19190613650565b6110c9565b005b34801561030457600080fd5b5061031f600480360381019061031a9190613650565b61113d565b005b34801561032d57600080fd5b5061034860048036038101906103439190613690565b6111c0565b60405161035591906136cc565b60405180910390f35b34801561036a57600080fd5b506103856004803603810190610380919061371d565b6111e7565b005b34801561039357600080fd5b506103ae60048036038101906103a99190613650565b61124c565b6040516103bb9190613759565b60405180910390f35b3480156103d057600080fd5b506103eb60048036038101906103e69190613774565b61129d565b6040516103f891906137b0565b60405180910390f35b34801561040d57600080fd5b5061042860048036038101906104239190613823565b6112d0565b005b34801561043657600080fd5b5061043f6113ab565b60405161044c91906137b0565b60405180910390f35b34801561046157600080fd5b5061047c60048036038101906104779190613774565b6113c1565b005b610498600480360381019061049391906138b0565b611462565b005b3480156104a657600080fd5b506104c160048036038101906104bc9190613998565b6117c0565b6040516104ce91906137b0565b60405180910390f35b3480156104e357600080fd5b506104ec6118ff565b6040516104f99190613759565b60405180910390f35b34801561050e57600080fd5b5061051761192f565b005b34801561052557600080fd5b50610540600480360381019061053b919061359b565b611949565b60405161054d91906139fa565b60405180910390f35b34801561056257600080fd5b5061057d60048036038101906105789190613774565b61197c565b005b34801561058b57600080fd5b506105a660048036038101906105a19190613a15565b6119ff565b005b3480156105b457600080fd5b506105cf60048036038101906105ca9190613a55565b611a7c565b6040516105dc91906139fa565b60405180910390f35b3480156105f157600080fd5b5061060c60048036038101906106079190613650565b611aae565b60405161061991906137b0565b60405180910390f35b34801561062e57600080fd5b50610637611ae0565b60405161064491906135d7565b60405180910390f35b34801561065957600080fd5b50610674600480360381019061066f9190613774565b611b04565b005b34801561068257600080fd5b5061068b611bd1565b6040516106989190613aa4565b60405180910390f35b3480156106ad57600080fd5b506106b6611be4565b6040516106c39190613759565b60405180910390f35b3480156106d857600080fd5b506106e1611be9565b6040516106ee91906135d7565b60405180910390f35b34801561070357600080fd5b5061071e60048036038101906107199190613411565b611bf0565b60405161072b9190613bee565b60405180910390f35b34801561074057600080fd5b5061075b60048036038101906107569190613d4a565b611d50565b005b34801561076957600080fd5b50610784600480360381019061077f9190613da6565b611dcd565b005b34801561079257600080fd5b5061079b612596565b6040516107a89190613e3d565b60405180910390f35b3480156107bd57600080fd5b506107d860048036038101906107d3919061359b565b6125ab565b6040516107e59190613759565b60405180910390f35b3480156107fa57600080fd5b5061081560048036038101906108109190613e58565b6125d2565b005b34801561082357600080fd5b5061083e60048036038101906108399190613774565b6126a4565b005b34801561084c57600080fd5b5061086760048036038101906108629190613eab565b6127bc565b005b34801561087557600080fd5b50610890600480360381019061088b9190613650565b61281f565b005b34801561089e57600080fd5b506108a7612893565b6040516108b49190613aa4565b60405180910390f35b3480156108c957600080fd5b506108e460048036038101906108df9190613eeb565b6128a6565b005b3480156108f257600080fd5b5061090d60048036038101906109089190613774565b612975565b60405161091a91906137b0565b60405180910390f35b34801561092f57600080fd5b50610938612995565b6040516109459190613f8a565b60405180910390f35b34801561095a57600080fd5b506109636129bb565b005b61096d612ad5565b60008360ff1660088467ffffffffffffffff1668ffffffffffffffffff16901b1790506000600660008368ffffffffffffffffff1668ffffffffffffffffff16815260200190815260200160002060008481526020019081526020016000206040518060800160405290816000820160009054906101000a900460ff1660048111156109fc576109fb613abf565b5b6004811115610a0e57610a0d613abf565b5b81526020016000820160019054906101000a900478ffffffffffffffffffffffffffffffffffffffffffffffffff1678ffffffffffffffffffffffffffffffffffffffffffffffffff1678ffffffffffffffffffffffffffffffffffffffffffffffffff16815260200160008201601a9054906101000a900460ff1660ff1660ff16815260200160008201601b9054906101000a900464ffffffffff1664ffffffffff1664ffffffffff1681525050905060008160000151905060016004811115610adc57610adb613abf565b5b816004811115610aef57610aee613abf565b5b1480610b1f575060026004811115610b0a57610b09613abf565b5b816004811115610b1d57610b1c613abf565b5b145b610b5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5590614002565b60405180910390fd5b60028054906101000a900464ffffffffff1664ffffffffff16610b8c43846060015164ffffffffff16612b61565b64ffffffffff1611610bd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bca9061406e565b60405180910390fd5b600482600001906004811115610bec57610beb613abf565b5b90816004811115610c0057610bff613abf565b5b8152505081600660008568ffffffffffffffffff1668ffffffffffffffffff168152602001908152602001600020600086815260200190815260200160002060008201518160000160006101000a81548160ff02191690836004811115610c6a57610c69613abf565b5b021790555060208201518160000160016101000a81548178ffffffffffffffffffffffffffffffffffffffffffffffffff021916908378ffffffffffffffffffffffffffffffffffffffffffffffffff160217905550604082015181600001601a6101000a81548160ff021916908360ff160217905550606082015181600001601b6101000a81548164ffffffffff021916908364ffffffffff1602179055509050507f968626a768e76ba1363efe44e322a6c4900c5f084e0b45f35e294dfddaa9e0d58686600487604051610d43949392919061409d565b60405180910390a1505050505050565b610d5b612bab565b610d63612c1d565b60006004600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008760ff1660088867ffffffffffffffff1668ffffffffffffffffff16901b1790506000828787604051602001610dd59392919061415a565b6040516020818303038152906040528051906020012090506000600660008468ffffffffffffffffff1668ffffffffffffffffff1681526020019081526020016000206000838152602001908152602001600020905060026004811115610e3f57610e3e613abf565b5b8160000160009054906101000a900460ff166004811115610e6357610e62613abf565b5b14610ea3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9a906141d0565b60405180910390fd5b60038160000160006101000a81548160ff02191690836004811115610ecb57610eca613abf565b5b021790555060008490508515610f4f578073ffffffffffffffffffffffffffffffffffffffff1663e248cff2888b8b6040518463ffffffff1660e01b8152600401610f189392919061422e565b600060405180830381600087803b158015610f3257600080fd5b505af1158015610f46573d6000803e3d6000fd5b5050505061105d565b8073ffffffffffffffffffffffffffffffffffffffff1663e248cff2888b8b6040518463ffffffff1660e01b8152600401610f8c9392919061422e565b600060405180830381600087803b158015610fa657600080fd5b505af1925050508015610fb7575060015b61105c573d8060008114610fe7576040519150601f19603f3d011682016040523d82523d6000602084013e610fec565b606091505b5060028360000160006101000a81548160ff0219169083600481111561101557611014613abf565b5b02179055507fbd37c1f0d53bb2f33fe4c2104de272fcdeb4d2fef3acdbf1e4ddc3d6833ca3768160405161104991906142d7565b60405180910390a15050505050506110a1565b5b7f968626a768e76ba1363efe44e322a6c4900c5f084e0b45f35e294dfddaa9e0d58b8b600386604051611093949392919061409d565b60405180910390a150505050505b505050505050565b600060016000838152602001908152602001600020600201549050919050565b6110f060016000848152602001908152602001600020600201546110eb612c6d565b611aae565b61112f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111269061436b565b60405180910390fd5b6111398282612ce8565b5050565b611145612c6d565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a9906143fd565b60405180910390fd5b6111bc8282612d7c565b5050565b60036020528060005260406000206000915054906101000a900467ffffffffffffffff1681565b6111ef612e10565b6111f8816129d5565b600260016101000a81548160ff021916908360ff1602179055507fa20d6b84cd798a24038be305eff8a45ca82ef54a2aa2082005d8e14c0a4746c8816040516112419190613759565b60405180910390a150565b60006001600084815260200190815260200160002060000160000160010160008373ffffffffffffffffffffffffffffffffffffffff1660001b815260200190815260200160002054905092915050565b60006112c97fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc483611aae565b9050919050565b6112d8612e10565b856004600087815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008690508073ffffffffffffffffffffffffffffffffffffffff1663de319d9987878787876040518663ffffffff1660e01b815260040161137095949392919061442c565b600060405180830381600087803b15801561138a57600080fd5b505af115801561139e573d6000803e3d6000fd5b5050505050505050505050565b60008060009054906101000a900460ff16905090565b6113c9612e10565b60006113d3612c6d565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143b906144cb565b60405180910390fd5b6114516000801b836110c9565b61145e6000801b8261113d565b5050565b61146a612c1d565b6000611474612c6d565b9050600073ffffffffffffffffffffffffffffffffffffffff16600260079054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156115155760003414611510576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150790614537565b60405180910390fd5b6115c1565b600260079054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663253070653483600260009054906101000a900460ff168b8b8b8b8b8b6040518a63ffffffff1660e01b815260040161158e989796959493929190614557565b6000604051808303818588803b1580156115a757600080fd5b505af11580156115bb573d6000803e3d6000fd5b50505050505b60006004600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611669576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166090614616565b60405180910390fd5b6000600360008a60ff1660ff168152602001908152602001600020600081819054906101000a900467ffffffffffffffff166116a490614665565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790559050600082905060008173ffffffffffffffffffffffffffffffffffffffff1663b07e54bb8b878c8c6040518563ffffffff1660e01b81526004016117119493929190614696565b6000604051808303816000875af1158015611730573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906117599190614746565b90508473ffffffffffffffffffffffffffffffffffffffff167f17bc3181e17a9620a479c24e6c606e474ba84fc036877b768926872e8cd0e11f8c8c868d8d876040516117ab9695949392919061478f565b60405180910390a25050505050505050505050565b60006118f6600660008668ffffffffffffffffff1668ffffffffffffffffff16815260200190815260200160002060008581526020019081526020016000206040518060800160405290816000820160009054906101000a900460ff16600481111561182f5761182e613abf565b5b600481111561184157611840613abf565b5b81526020016000820160019054906101000a900478ffffffffffffffffffffffffffffffffffffffffffffffffff1678ffffffffffffffffffffffffffffffffffffffffffffffffff1678ffffffffffffffffffffffffffffffffffffffffffffffffff16815260200160008201601a9054906101000a900460ff1660ff1660ff16815260200160008201601b9054906101000a900464ffffffffff1664ffffffffff1664ffffffffff168152505083612e65565b90509392505050565b600061192a7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc46125ab565b905090565b611937612e10565b611947611942612c6d565b612e9b565b565b60046020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611984612e10565b80600260076101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f729170bd142e4965055b26a285faeedf03baf2b915bfc5a7c75d24b45815ff2c816040516119f491906139fa565b60405180910390a150565b611a07612e10565b60008290508073ffffffffffffffffffffffffffffffffffffffff166307b7ed99836040518263ffffffff1660e01b8152600401611a4591906139fa565b600060405180830381600087803b158015611a5f57600080fd5b505af1158015611a73573d6000803e3d6000fd5b50505050505050565b6000611aa68260016000868152602001908152602001600020600001612ef790919063ffffffff16565b905092915050565b6000611ad88260016000868152602001908152602001600020600001612aa590919063ffffffff16565b905092915050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b611b2e7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc482611aae565b611b6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b649061483e565b60405180910390fd5b611b977fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc48261281f565b7f10e1f7ce9fd7d1b90a66d13a2ab3cb8dd7f29f3f8d520b143b063ccfbab6906b81604051611bc691906139fa565b60405180910390a150565b600260009054906101000a900460ff1681565b60c881565b6000801b81565b611bf86132ef565b60008460ff1660088567ffffffffffffffff1668ffffffffffffffffff16901b179050600660008268ffffffffffffffffff1668ffffffffffffffffff16815260200190815260200160002060008481526020019081526020016000206040518060800160405290816000820160009054906101000a900460ff166004811115611c8557611c84613abf565b5b6004811115611c9757611c96613abf565b5b81526020016000820160019054906101000a900478ffffffffffffffffffffffffffffffffffffffffffffffffff1678ffffffffffffffffffffffffffffffffffffffffffffffffff1678ffffffffffffffffffffffffffffffffffffffffffffffffff16815260200160008201601a9054906101000a900460ff1660ff1660ff16815260200160008201601b9054906101000a900464ffffffffff1664ffffffffff1664ffffffffff16815250509150509392505050565b611d58612e10565b60008290508073ffffffffffffffffffffffffffffffffffffffff16630968f264836040518263ffffffff1660e01b8152600401611d9691906142d7565b600060405180830381600087803b158015611db057600080fd5b505af1158015611dc4573d6000803e3d6000fd5b50505050505050565b611dd5612bab565b611ddd612c1d565b60006004600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008660ff1660088767ffffffffffffffff1668ffffffffffffffffff16901b1790506000828585604051602001611e4f9392919061415a565b6040516020818303038152906040528051906020012090506000600660008468ffffffffffffffffff1668ffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206040518060800160405290816000820160009054906101000a900460ff166004811115611ed357611ed2613abf565b5b6004811115611ee557611ee4613abf565b5b81526020016000820160019054906101000a900478ffffffffffffffffffffffffffffffffffffffffffffffffff1678ffffffffffffffffffffffffffffffffffffffffffffffffff1678ffffffffffffffffffffffffffffffffffffffffffffffffff16815260200160008201601a9054906101000a900460ff1660ff1660ff16815260200160008201601b9054906101000a900464ffffffffff1664ffffffffff1664ffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff166004600089815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612039576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612030906148aa565b60405180910390fd5b6002600481111561204d5761204c613abf565b5b8160000151600481111561206457612063613abf565b5b141561208257612079898988888b6001610d53565b5050505061258f565b600061208c612c6d565b90506001826000015160048111156120a7576120a6613abf565b5b11156120e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120df9061493c565b60405180910390fd5b6120f28282612e65565b15612132576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612129906149a8565b60405180910390fd5b6000600481111561214657612145613abf565b5b8260000151600481111561215d5761215c613abf565b5b14156122035760405180608001604052806001600481111561218257612181613abf565b5b8152602001600078ffffffffffffffffffffffffffffffffffffffffffffffffff168152602001600060ff1681526020014364ffffffffff1681525091507f968626a768e76ba1363efe44e322a6c4900c5f084e0b45f35e294dfddaa9e0d58a8a6001866040516121f6949392919061409d565b60405180910390a16122af565b60028054906101000a900464ffffffffff1664ffffffffff1661223143846060015164ffffffffff16612b61565b64ffffffffff1611156122ae5760048260000190600481111561225757612256613abf565b5b9081600481111561226b5761226a613abf565b5b815250507f968626a768e76ba1363efe44e322a6c4900c5f084e0b45f35e294dfddaa9e0d58a8a6004866040516122a5949392919061409d565b60405180910390a15b5b6004808111156122c2576122c1613abf565b5b826000015160048111156122d9576122d8613abf565b5b1461243f576123106122ea82612f11565b836020015178ffffffffffffffffffffffffffffffffffffffffffffffffff1617612f52565b826020019078ffffffffffffffffffffffffffffffffffffffffffffffffff16908178ffffffffffffffffffffffffffffffffffffffffffffffffff1681525050816040018051809190612363906149c8565b60ff1660ff16815250507f25f8daaa4635a7729927ba3f5b3d59cc3320aca7c32c9db4e7ca7b95743436408a8a8460000151866040516123a6949392919061409d565b60405180910390a1600260019054906101000a900460ff1660ff16826040015160ff161061243e576002826000019060048111156123e7576123e6613abf565b5b908160048111156123fb576123fa613abf565b5b815250507f968626a768e76ba1363efe44e322a6c4900c5f084e0b45f35e294dfddaa9e0d58a8a600286604051612435949392919061409d565b60405180910390a15b5b81600660008668ffffffffffffffffff1668ffffffffffffffffff168152602001908152602001600020600085815260200190815260200160002060008201518160000160006101000a81548160ff021916908360048111156124a5576124a4613abf565b5b021790555060208201518160000160016101000a81548178ffffffffffffffffffffffffffffffffffffffffffffffffff021916908378ffffffffffffffffffffffffffffffffffffffffffffffffff160217905550604082015181600001601a6101000a81548160ff021916908360ff160217905550606082015181600001601b6101000a81548164ffffffffff021916908364ffffffffff1602179055509050506002600481111561255c5761255b613abf565b5b8260000151600481111561257357612572613abf565b5b1415612589576125888a8a89898c6000610d53565b5b50505050505b5050505050565b60028054906101000a900464ffffffffff1681565b60006125cb60016000848152602001908152602001600020600001612fb8565b9050919050565b6125da612e10565b826004600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008390508073ffffffffffffffffffffffffffffffffffffffff1663b8fa373684846040518363ffffffff1660e01b815260040161266c9291906149f2565b600060405180830381600087803b15801561268657600080fd5b505af115801561269a573d6000803e3d6000fd5b5050505050505050565b6126ce7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc482611aae565b1561270e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161270590614a67565b60405180910390fd5b60c86127186118ff565b10612758576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161274f90614ad3565b60405180910390fd5b6127827fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4826110c9565b7f03580ee9f53a62b7cb409a2cb56f9be87747dd15017afc5cef6eef321e4fb2c5816040516127b191906139fa565b60405180910390a150565b6127c4612e10565b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6128466001600084815260200190815260200160002060020154612841612c6d565b611aae565b612885576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161287c90614b65565b60405180910390fd5b61288f8282612d7c565b5050565b600260019054906101000a900460ff1681565b6128ae612e10565b600360008360ff1660ff16815260200190815260200160002060009054906101000a900467ffffffffffffffff1667ffffffffffffffff168167ffffffffffffffff1611612931576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161292890614bf7565b60405180910390fd5b80600360008460ff1660ff16815260200190815260200160002060006101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505050565b60056020528060005260406000206000915054906101000a900460ff1681565b600260079054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6129c3612e10565b6129d36129ce612c6d565b612fcd565b565b60006101008210612a1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1290614c63565b60405180910390fd5b819050919050565b6000650100000000008210612a6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a6490614ccf565b60405180910390fd5b819050919050565b6000612a9d836000018373ffffffffffffffffffffffffffffffffffffffff1660001b613029565b905092915050565b6000612acd836000018373ffffffffffffffffffffffffffffffffffffffff1660001b613099565b905092915050565b6000612adf612c6d565b9050612aee6000801b82611aae565b80612b1f5750612b1e7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc482611aae565b5b612b5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b5590614d3b565b60405180910390fd5b50565b6000612ba383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506130bc565b905092915050565b612bdc7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4612bd7612c6d565b611aae565b612c1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1290614da7565b60405180910390fd5b565b60008054906101000a900460ff1615612c6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c6290614e13565b60405180910390fd5b565b6000803390506014600036905010158015612cd15750600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ce157601436033560601c90505b8091505090565b612d108160016000858152602001908152602001600020600001612a7590919063ffffffff16565b15612d7857612d1d612c6d565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b612da4816001600085815260200190815260200160002060000161312090919063ffffffff16565b15612e0c57612db1612c6d565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b612e246000801b612e1f612c6d565b611aae565b612e63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e5a90614e7f565b60405180910390fd5b565b600080836020015178ffffffffffffffffffffffffffffffffffffffffffffffffff16612e9184612f11565b1611905092915050565b612ea3612c1d565b60016000806101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25881604051612eec91906139fa565b60405180910390a150565b6000612f068360000183613150565b60001c905092915050565b6000612f47612f407fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc48461124c565b6001612b61565b6001901b9050919050565b60007901000000000000000000000000000000000000000000000000008210612fb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fa790614eeb565b60405180910390fd5b819050919050565b6000612fc68260000161317b565b9050919050565b612fd561318c565b60008060006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa8160405161301e91906139fa565b60405180910390a150565b60006130358383613099565b61308e578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050613093565b600090505b92915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000838311158290613104576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130fb9190614f4f565b60405180910390fd5b50600083856131139190614f71565b9050809150509392505050565b6000613148836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6131db565b905092915050565b600082600001828154811061316857613167614fa5565b5b9060005260206000200154905092915050565b600081600001805490509050919050565b60008054906101000a900460ff166131d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131d090615020565b60405180910390fd5b565b600080836001016000848152602001908152602001600020549050600081146132e357600060018261320d9190614f71565b90506000600186600001805490506132259190614f71565b905081811461329457600086600001828154811061324657613245614fa5565b5b906000526020600020015490508087600001848154811061326a57613269614fa5565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b856000018054806132a8576132a7615040565b5b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506132e9565b60009150505b92915050565b60405180608001604052806000600481111561330e5761330d613abf565b5b8152602001600078ffffffffffffffffffffffffffffffffffffffffffffffffff168152602001600060ff168152602001600064ffffffffff1681525090565b6000604051905090565b600080fd5b600080fd5b600060ff82169050919050565b61337881613362565b811461338357600080fd5b50565b6000813590506133958161336f565b92915050565b600067ffffffffffffffff82169050919050565b6133b88161339b565b81146133c357600080fd5b50565b6000813590506133d5816133af565b92915050565b6000819050919050565b6133ee816133db565b81146133f957600080fd5b50565b60008135905061340b816133e5565b92915050565b60008060006060848603121561342a57613429613358565b5b600061343886828701613386565b9350506020613449868287016133c6565b925050604061345a868287016133fc565b9150509250925092565b600080fd5b600080fd5b600080fd5b60008083601f84011261348957613488613464565b5b8235905067ffffffffffffffff8111156134a6576134a5613469565b5b6020830191508360018202830111156134c2576134c161346e565b5b9250929050565b60008115159050919050565b6134de816134c9565b81146134e957600080fd5b50565b6000813590506134fb816134d5565b92915050565b60008060008060008060a0878903121561351e5761351d613358565b5b600061352c89828a01613386565b965050602061353d89828a016133c6565b955050604087013567ffffffffffffffff81111561355e5761355d61335d565b5b61356a89828a01613473565b9450945050606061357d89828a016133fc565b925050608061358e89828a016134ec565b9150509295509295509295565b6000602082840312156135b1576135b0613358565b5b60006135bf848285016133fc565b91505092915050565b6135d1816133db565b82525050565b60006020820190506135ec60008301846135c8565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061361d826135f2565b9050919050565b61362d81613612565b811461363857600080fd5b50565b60008135905061364a81613624565b92915050565b6000806040838503121561366757613666613358565b5b6000613675858286016133fc565b92505060206136868582860161363b565b9150509250929050565b6000602082840312156136a6576136a5613358565b5b60006136b484828501613386565b91505092915050565b6136c68161339b565b82525050565b60006020820190506136e160008301846136bd565b92915050565b6000819050919050565b6136fa816136e7565b811461370557600080fd5b50565b600081359050613717816136f1565b92915050565b60006020828403121561373357613732613358565b5b600061374184828501613708565b91505092915050565b613753816136e7565b82525050565b600060208201905061376e600083018461374a565b92915050565b60006020828403121561378a57613789613358565b5b60006137988482850161363b565b91505092915050565b6137aa816134c9565b82525050565b60006020820190506137c560008301846137a1565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613800816137cb565b811461380b57600080fd5b50565b60008135905061381d816137f7565b92915050565b60008060008060008060c087890312156138405761383f613358565b5b600061384e89828a0161363b565b965050602061385f89828a016133fc565b955050604061387089828a0161363b565b945050606061388189828a0161380e565b935050608061389289828a01613708565b92505060a06138a389828a0161380e565b9150509295509295509295565b600080600080600080608087890312156138cd576138cc613358565b5b60006138db89828a01613386565b96505060206138ec89828a016133fc565b955050604087013567ffffffffffffffff81111561390d5761390c61335d565b5b61391989828a01613473565b9450945050606087013567ffffffffffffffff81111561393c5761393b61335d565b5b61394889828a01613473565b92509250509295509295509295565b600068ffffffffffffffffff82169050919050565b61397581613957565b811461398057600080fd5b50565b6000813590506139928161396c565b92915050565b6000806000606084860312156139b1576139b0613358565b5b60006139bf86828701613983565b93505060206139d0868287016133fc565b92505060406139e18682870161363b565b9150509250925092565b6139f481613612565b82525050565b6000602082019050613a0f60008301846139eb565b92915050565b60008060408385031215613a2c57613a2b613358565b5b6000613a3a8582860161363b565b9250506020613a4b8582860161363b565b9150509250929050565b60008060408385031215613a6c57613a6b613358565b5b6000613a7a858286016133fc565b9250506020613a8b85828601613708565b9150509250929050565b613a9e81613362565b82525050565b6000602082019050613ab96000830184613a95565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60058110613aff57613afe613abf565b5b50565b6000819050613b1082613aee565b919050565b6000613b2082613b02565b9050919050565b613b3081613b15565b82525050565b600078ffffffffffffffffffffffffffffffffffffffffffffffffff82169050919050565b613b6481613b36565b82525050565b613b7381613362565b82525050565b600064ffffffffff82169050919050565b613b9381613b79565b82525050565b608082016000820151613baf6000850182613b27565b506020820151613bc26020850182613b5b565b506040820151613bd56040850182613b6a565b506060820151613be86060850182613b8a565b50505050565b6000608082019050613c036000830184613b99565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613c5782613c0e565b810181811067ffffffffffffffff82111715613c7657613c75613c1f565b5b80604052505050565b6000613c8961334e565b9050613c958282613c4e565b919050565b600067ffffffffffffffff821115613cb557613cb4613c1f565b5b613cbe82613c0e565b9050602081019050919050565b82818337600083830152505050565b6000613ced613ce884613c9a565b613c7f565b905082815260208101848484011115613d0957613d08613c09565b5b613d14848285613ccb565b509392505050565b600082601f830112613d3157613d30613464565b5b8135613d41848260208601613cda565b91505092915050565b60008060408385031215613d6157613d60613358565b5b6000613d6f8582860161363b565b925050602083013567ffffffffffffffff811115613d9057613d8f61335d565b5b613d9c85828601613d1c565b9150509250929050565b600080600080600060808688031215613dc257613dc1613358565b5b6000613dd088828901613386565b9550506020613de1888289016133c6565b9450506040613df2888289016133fc565b935050606086013567ffffffffffffffff811115613e1357613e1261335d565b5b613e1f88828901613473565b92509250509295509295909350565b613e3781613b79565b82525050565b6000602082019050613e526000830184613e2e565b92915050565b600080600060608486031215613e7157613e70613358565b5b6000613e7f8682870161363b565b9350506020613e90868287016133fc565b9250506040613ea18682870161363b565b9150509250925092565b60008060408385031215613ec257613ec1613358565b5b6000613ed08582860161363b565b9250506020613ee1858286016134ec565b9150509250929050565b60008060408385031215613f0257613f01613358565b5b6000613f1085828601613386565b9250506020613f21858286016133c6565b9150509250929050565b6000819050919050565b6000613f50613f4b613f46846135f2565b613f2b565b6135f2565b9050919050565b6000613f6282613f35565b9050919050565b6000613f7482613f57565b9050919050565b613f8481613f69565b82525050565b6000602082019050613f9f6000830184613f7b565b92915050565b600082825260208201905092915050565b7f50726f706f73616c2063616e6e6f742062652063616e63656c6c656400000000600082015250565b6000613fec601c83613fa5565b9150613ff782613fb6565b602082019050919050565b6000602082019050818103600083015261401b81613fdf565b9050919050565b7f50726f706f73616c206e6f7420617420657870697279207468726573686f6c64600082015250565b6000614058602083613fa5565b915061406382614022565b602082019050919050565b600060208201905081810360008301526140878161404b565b9050919050565b61409781613b15565b82525050565b60006080820190506140b26000830187613a95565b6140bf60208301866136bd565b6140cc604083018561408e565b6140d960608301846135c8565b95945050505050565b60008160601b9050919050565b60006140fa826140e2565b9050919050565b600061410c826140ef565b9050919050565b61412461411f82613612565b614101565b82525050565b600081905092915050565b6000614141838561412a565b935061414e838584613ccb565b82840190509392505050565b60006141668286614113565b601482019150614177828486614135565b9150819050949350505050565b7f50726f706f73616c206d75737420686176652050617373656420737461747573600082015250565b60006141ba602083613fa5565b91506141c582614184565b602082019050919050565b600060208201905081810360008301526141e9816141ad565b9050919050565b600082825260208201905092915050565b600061420d83856141f0565b935061421a838584613ccb565b61422383613c0e565b840190509392505050565b600060408201905061424360008301866135c8565b8181036020830152614256818486614201565b9050949350505050565b600081519050919050565b60005b8381101561428957808201518184015260208101905061426e565b83811115614298576000848401525b50505050565b60006142a982614260565b6142b381856141f0565b93506142c381856020860161426b565b6142cc81613c0e565b840191505092915050565b600060208201905081810360008301526142f1818461429e565b905092915050565b7f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60008201527f2061646d696e20746f206772616e740000000000000000000000000000000000602082015250565b6000614355602f83613fa5565b9150614360826142f9565b604082019050919050565b6000602082019050818103600083015261438481614348565b9050919050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b60006143e7602f83613fa5565b91506143f28261438b565b604082019050919050565b60006020820190508181036000830152614416816143da565b9050919050565b614426816137cb565b82525050565b600060a08201905061444160008301886135c8565b61444e60208301876139eb565b61445b604083018661441d565b614468606083018561374a565b614475608083018461441d565b9695505050505050565b7f43616e6e6f742072656e6f756e6365206f6e6573656c66000000000000000000600082015250565b60006144b5601783613fa5565b91506144c08261447f565b602082019050919050565b600060208201905081810360008301526144e4816144a8565b9050919050565b7f6e6f2046656548616e646c65722c206d73672e76616c756520213d2030000000600082015250565b6000614521601d83613fa5565b915061452c826144eb565b602082019050919050565b6000602082019050818103600083015261455081614514565b9050919050565b600060c08201905061456c600083018b6139eb565b614579602083018a613a95565b6145866040830189613a95565b61459360608301886135c8565b81810360808301526145a6818688614201565b905081810360a08301526145bb818486614201565b90509998505050505050505050565b7f7265736f757263654944206e6f74206d617070656420746f2068616e646c6572600082015250565b6000614600602083613fa5565b915061460b826145ca565b602082019050919050565b6000602082019050818103600083015261462f816145f3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006146708261339b565b915067ffffffffffffffff82141561468b5761468a614636565b5b600182019050919050565b60006060820190506146ab60008301876135c8565b6146b860208301866139eb565b81810360408301526146cb818486614201565b905095945050505050565b60006146e96146e484613c9a565b613c7f565b90508281526020810184848401111561470557614704613c09565b5b61471084828561426b565b509392505050565b600082601f83011261472d5761472c613464565b5b815161473d8482602086016146d6565b91505092915050565b60006020828403121561475c5761475b613358565b5b600082015167ffffffffffffffff81111561477a5761477961335d565b5b61478684828501614718565b91505092915050565b600060a0820190506147a46000830189613a95565b6147b160208301886135c8565b6147be60408301876136bd565b81810360608301526147d1818587614201565b905081810360808301526147e5818461429e565b9050979650505050505050565b7f6164647220646f65736e277420686176652072656c6179657220726f6c652100600082015250565b6000614828601f83613fa5565b9150614833826147f2565b602082019050919050565b600060208201905081810360008301526148578161481b565b9050919050565b7f6e6f2068616e646c657220666f72207265736f75726365494400000000000000600082015250565b6000614894601983613fa5565b915061489f8261485e565b602082019050919050565b600060208201905081810360008301526148c381614887565b9050919050565b7f70726f706f73616c20616c72656164792065786563757465642f63616e63656c60008201527f6c65640000000000000000000000000000000000000000000000000000000000602082015250565b6000614926602383613fa5565b9150614931826148ca565b604082019050919050565b6000602082019050818103600083015261495581614919565b9050919050565b7f72656c6179657220616c726561647920766f7465640000000000000000000000600082015250565b6000614992601583613fa5565b915061499d8261495c565b602082019050919050565b600060208201905081810360008301526149c181614985565b9050919050565b60006149d382613362565b915060ff8214156149e7576149e6614636565b5b600182019050919050565b6000604082019050614a0760008301856135c8565b614a1460208301846139eb565b9392505050565b7f6164647220616c7265616479206861732072656c6179657220726f6c65210000600082015250565b6000614a51601e83613fa5565b9150614a5c82614a1b565b602082019050919050565b60006020820190508181036000830152614a8081614a44565b9050919050565b7f72656c6179657273206c696d6974207265616368656400000000000000000000600082015250565b6000614abd601683613fa5565b9150614ac882614a87565b602082019050919050565b60006020820190508181036000830152614aec81614ab0565b9050919050565b7f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60008201527f2061646d696e20746f207265766f6b6500000000000000000000000000000000602082015250565b6000614b4f603083613fa5565b9150614b5a82614af3565b604082019050919050565b60006020820190508181036000830152614b7e81614b42565b9050919050565b7f446f6573206e6f7420616c6c6f772064656372656d656e7473206f662074686560008201527f206e6f6e63650000000000000000000000000000000000000000000000000000602082015250565b6000614be1602683613fa5565b9150614bec82614b85565b604082019050919050565b60006020820190508181036000830152614c1081614bd4565b9050919050565b7f76616c756520646f6573206e6f742066697420696e2038206269747300000000600082015250565b6000614c4d601c83613fa5565b9150614c5882614c17565b602082019050919050565b60006020820190508181036000830152614c7c81614c40565b9050919050565b7f76616c756520646f6573206e6f742066697420696e2034302062697473000000600082015250565b6000614cb9601d83613fa5565b9150614cc482614c83565b602082019050919050565b60006020820190508181036000830152614ce881614cac565b9050919050565b7f73656e646572206973206e6f742072656c61796572206f722061646d696e0000600082015250565b6000614d25601e83613fa5565b9150614d3082614cef565b602082019050919050565b60006020820190508181036000830152614d5481614d18565b9050919050565b7f73656e64657220646f65736e277420686176652072656c6179657220726f6c65600082015250565b6000614d91602083613fa5565b9150614d9c82614d5b565b602082019050919050565b60006020820190508181036000830152614dc081614d84565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000614dfd601083613fa5565b9150614e0882614dc7565b602082019050919050565b60006020820190508181036000830152614e2c81614df0565b9050919050565b7f73656e64657220646f65736e277420686176652061646d696e20726f6c650000600082015250565b6000614e69601e83613fa5565b9150614e7482614e33565b602082019050919050565b60006020820190508181036000830152614e9881614e5c565b9050919050565b7f76616c756520646f6573206e6f742066697420696e2032303020626974730000600082015250565b6000614ed5601e83613fa5565b9150614ee082614e9f565b602082019050919050565b60006020820190508181036000830152614f0481614ec8565b9050919050565b600081519050919050565b6000614f2182614f0b565b614f2b8185613fa5565b9350614f3b81856020860161426b565b614f4481613c0e565b840191505092915050565b60006020820190508181036000830152614f698184614f16565b905092915050565b6000614f7c826136e7565b9150614f87836136e7565b925082821015614f9a57614f99614636565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b600061500a601483613fa5565b915061501582614fd4565b602082019050919050565b6000602082019050818103600083015261503981614ffd565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea264697066735822122012fda925581713abf82c9d1e8423c1d9b1170f68ead0b843b160408fbd0455ac64736f6c634300080b0033

Verified Source Code Full Match

Compiler: v0.8.11+commit.d7f03943 EVM: london Optimization: No
Bridge.sol 500 lines
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

import "./utils/AccessControl.sol";
import "./utils/Pausable.sol";
import "./utils/SafeMath.sol";
import "./utils/SafeCast.sol";
import "./interfaces/IDepositExecute.sol";
import "./interfaces/IERCHandler.sol";
import "./interfaces/IGenericHandler.sol";
import "./interfaces/IFeeHandler.sol";

/**
    @title Facilitates deposits, creation and voting of deposit proposals, and deposit executions.
    @author ChainSafe Systems.
 */
contract Bridge is Pausable, AccessControl, SafeMath {
    using SafeCast for *;

    // Limit relayers number because proposal can fit only so much votes
    uint256 constant public MAX_RELAYERS = 200;

    uint8   public _domainID;
    uint8   public _relayerThreshold;
    uint40  public _expiry;

    IFeeHandler public _feeHandler;

    enum ProposalStatus {Inactive, Active, Passed, Executed, Cancelled}

    struct Proposal {
        ProposalStatus _status;
        uint200 _yesVotes;      // bitmap, 200 maximum votes
        uint8   _yesVotesTotal;
        uint40  _proposedBlock; // 1099511627775 maximum block
    }

    // destinationDomainID => number of deposits
    mapping(uint8 => uint64) public _depositCounts;
    // resourceID => handler address
    mapping(bytes32 => address) public _resourceIDToHandlerAddress;
    // forwarder address => is Valid
    mapping(address => bool) public isValidForwarder;
    // destinationDomainID + depositNonce => dataHash => Proposal
    mapping(uint72 => mapping(bytes32 => Proposal)) private _proposals;

    event RelayerThresholdChanged(uint256 newThreshold);
    event RelayerAdded(address relayer);
    event RelayerRemoved(address relayer);
    event FeeHandlerChanged(address newFeeHandler);
    event Deposit(
        uint8   destinationDomainID,
        bytes32 resourceID,
        uint64  depositNonce,
        address indexed user,
        bytes data,
        bytes handlerResponse
    );
    event ProposalEvent(
        uint8          originDomainID,
        uint64         depositNonce,
        ProposalStatus status,
        bytes32 dataHash
    );
    event ProposalVote(
        uint8   originDomainID,
        uint64  depositNonce,
        ProposalStatus status,
        bytes32 dataHash
    );
    event FailedHandlerExecution(
        bytes lowLevelData
    );

    bytes32 public constant RELAYER_ROLE = keccak256("RELAYER_ROLE");

    modifier onlyAdmin() {
        _onlyAdmin();
        _;
    }

    modifier onlyAdminOrRelayer() {
        _onlyAdminOrRelayer();
        _;
    }

    modifier onlyRelayers() {
        _onlyRelayers();
        _;
    }

    function _onlyAdminOrRelayer() private view {
        address sender = _msgSender();
        require(hasRole(DEFAULT_ADMIN_ROLE, sender) || hasRole(RELAYER_ROLE, sender),
            "sender is not relayer or admin");
    }

    function _onlyAdmin() private view {
        require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "sender doesn't have admin role");
    }

    function _onlyRelayers() private view {
        require(hasRole(RELAYER_ROLE, _msgSender()), "sender doesn't have relayer role");
    }

    function _relayerBit(address relayer) private view returns(uint) {
        return uint(1) << sub(AccessControl.getRoleMemberIndex(RELAYER_ROLE, relayer), 1);
    }

    function _hasVoted(Proposal memory proposal, address relayer) private view returns(bool) {
        return (_relayerBit(relayer) & uint(proposal._yesVotes)) > 0;
    }

    function _msgSender() internal override view returns (address) {
        address signer = msg.sender;
        if (msg.data.length >= 20 && isValidForwarder[signer]) {
            assembly {
                signer := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        }
        return signer;
    }

    /**
        @notice Initializes Bridge, creates and grants {_msgSender()} the admin role,
        creates and grants {initialRelayers} the relayer role.
        @param domainID ID of chain the Bridge contract exists on.
        @param initialRelayers Addresses that should be initially granted the relayer role.
        @param initialRelayerThreshold Number of votes needed for a deposit proposal to be considered passed.
     */
    constructor (uint8 domainID, address[] memory initialRelayers, uint256 initialRelayerThreshold, uint256 expiry) public {
        _domainID = domainID;
        _relayerThreshold = initialRelayerThreshold.toUint8();
        _expiry = expiry.toUint40();

        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());

        for (uint256 i; i < initialRelayers.length; i++) {
            grantRole(RELAYER_ROLE, initialRelayers[i]);
        }
    }

    /**
        @notice Returns true if {relayer} has voted on {destNonce} {dataHash} proposal.
        @notice Naming left unchanged for backward compatibility.
        @param destNonce destinationDomainID + depositNonce of the proposal.
        @param dataHash Hash of data to be provided when deposit proposal is executed.
        @param relayer Address to check.
     */
    function _hasVotedOnProposal(uint72 destNonce, bytes32 dataHash, address relayer) public view returns(bool) {
        return _hasVoted(_proposals[destNonce][dataHash], relayer);
    }

    /**
        @notice Returns true if {relayer} has the relayer role.
        @param relayer Address to check.
     */
    function isRelayer(address relayer) external view returns (bool) {
        return hasRole(RELAYER_ROLE, relayer);
    }

    /**
        @notice Removes admin role from {_msgSender()} and grants it to {newAdmin}.
        @notice Only callable by an address that currently has the admin role.
        @param newAdmin Address that admin role will be granted to.
     */
    function renounceAdmin(address newAdmin) external onlyAdmin {
        address sender = _msgSender();
        require(sender != newAdmin, 'Cannot renounce oneself');
        grantRole(DEFAULT_ADMIN_ROLE, newAdmin);
        renounceRole(DEFAULT_ADMIN_ROLE, sender);
    }

    /**
        @notice Pauses deposits, proposal creation and voting, and deposit executions.
        @notice Only callable by an address that currently has the admin role.
     */
    function adminPauseTransfers() external onlyAdmin {
        _pause(_msgSender());
    }

    /**
        @notice Unpauses deposits, proposal creation and voting, and deposit executions.
        @notice Only callable by an address that currently has the admin role.
     */
    function adminUnpauseTransfers() external onlyAdmin {
        _unpause(_msgSender());
    }

    /**
        @notice Modifies the number of votes required for a proposal to be considered passed.
        @notice Only callable by an address that currently has the admin role.
        @param newThreshold Value {_relayerThreshold} will be changed to.
        @notice Emits {RelayerThresholdChanged} event.
     */
    function adminChangeRelayerThreshold(uint256 newThreshold) external onlyAdmin {
        _relayerThreshold = newThreshold.toUint8();
        emit RelayerThresholdChanged(newThreshold);
    }

    /**
        @notice Grants {relayerAddress} the relayer role.
        @notice Only callable by an address that currently has the admin role, which is
                checked in grantRole().
        @param relayerAddress Address of relayer to be added.
        @notice Emits {RelayerAdded} event.
     */
    function adminAddRelayer(address relayerAddress) external {
        require(!hasRole(RELAYER_ROLE, relayerAddress), "addr already has relayer role!");
        require(_totalRelayers() < MAX_RELAYERS, "relayers limit reached");
        grantRole(RELAYER_ROLE, relayerAddress);
        emit RelayerAdded(relayerAddress);
    }

    /**
        @notice Removes relayer role for {relayerAddress}.
        @notice Only callable by an address that currently has the admin role, which is
                checked in revokeRole().
        @param relayerAddress Address of relayer to be removed.
        @notice Emits {RelayerRemoved} event.
     */
    function adminRemoveRelayer(address relayerAddress) external {
        require(hasRole(RELAYER_ROLE, relayerAddress), "addr doesn't have relayer role!");
        revokeRole(RELAYER_ROLE, relayerAddress);
        emit RelayerRemoved(relayerAddress);
    }

    /**
        @notice Sets a new resource for handler contracts that use the IERCHandler interface,
        and maps the {handlerAddress} to {resourceID} in {_resourceIDToHandlerAddress}.
        @notice Only callable by an address that currently has the admin role.
        @param handlerAddress Address of handler resource will be set for.
        @param resourceID ResourceID to be used when making deposits.
        @param tokenAddress Address of contract to be called when a deposit is made and a deposited is executed.
     */
    function adminSetResource(address handlerAddress, bytes32 resourceID, address tokenAddress) external onlyAdmin {
        _resourceIDToHandlerAddress[resourceID] = handlerAddress;
        IERCHandler handler = IERCHandler(handlerAddress);
        handler.setResource(resourceID, tokenAddress);
    }

    /**
        @notice Sets a new resource for handler contracts that use the IGenericHandler interface,
        and maps the {handlerAddress} to {resourceID} in {_resourceIDToHandlerAddress}.
        @notice Only callable by an address that currently has the admin role.
        @param handlerAddress Address of handler resource will be set for.
        @param resourceID ResourceID to be used when making deposits.
        @param contractAddress Address of contract to be called when a deposit is made and a deposited is executed.
     */
    function adminSetGenericResource(
        address handlerAddress,
        bytes32 resourceID,
        address contractAddress,
        bytes4 depositFunctionSig,
        uint256 depositFunctionDepositerOffset,
        bytes4 executeFunctionSig
    ) external onlyAdmin {
        _resourceIDToHandlerAddress[resourceID] = handlerAddress;
        IGenericHandler handler = IGenericHandler(handlerAddress);
        handler.setResource(resourceID, contractAddress, depositFunctionSig, depositFunctionDepositerOffset, executeFunctionSig);
    }

    /**
        @notice Sets a resource as burnable for handler contracts that use the IERCHandler interface.
        @notice Only callable by an address that currently has the admin role.
        @param handlerAddress Address of handler resource will be set for.
        @param tokenAddress Address of contract to be called when a deposit is made and a deposited is executed.
     */
    function adminSetBurnable(address handlerAddress, address tokenAddress) external onlyAdmin {
        IERCHandler handler = IERCHandler(handlerAddress);
        handler.setBurnable(tokenAddress);
    }

    /**
        @notice Sets the nonce for the specific domainID.
        @notice Only callable by an address that currently has the admin role.
        @param domainID Domain ID for increasing nonce.
        @param nonce The nonce value to be set.
     */
    function adminSetDepositNonce(uint8 domainID, uint64 nonce) external onlyAdmin {
        require(nonce > _depositCounts[domainID], "Does not allow decrements of the nonce");
        _depositCounts[domainID] = nonce;
    }

    /**
        @notice Set a forwarder to be used.
        @notice Only callable by an address that currently has the admin role.
        @param forwarder Forwarder address to be added.
        @param valid Decision for the specific forwarder.
     */
    function adminSetForwarder(address forwarder, bool valid) external onlyAdmin {
        isValidForwarder[forwarder] = valid;
    }

    /**
        @notice Returns a proposal.
        @param originDomainID Chain ID deposit originated from.
        @param depositNonce ID of proposal generated by proposal's origin Bridge contract.
        @param dataHash Hash of data to be provided when deposit proposal is executed.
        @return Proposal which consists of:
        - _dataHash Hash of data to be provided when deposit proposal is executed.
        - _yesVotes Number of votes in favor of proposal.
        - _noVotes Number of votes against proposal.
        - _status Current status of proposal.
     */
    function getProposal(uint8 originDomainID, uint64 depositNonce, bytes32 dataHash) external view returns (Proposal memory) {
        uint72 nonceAndID = (uint72(depositNonce) << 8) | uint72(originDomainID);
        return _proposals[nonceAndID][dataHash];
    }

    /**
        @notice Returns total relayers number.
        @notice Added for backwards compatibility.
     */
    function _totalRelayers() public view returns (uint) {
        return AccessControl.getRoleMemberCount(RELAYER_ROLE);
    }

    /**
        @notice Changes deposit fee handler contract address.
        @notice Only callable by admin.
        @param newFeeHandler Address {_feeHandler} will be updated to.
     */
    function adminChangeFeeHandler(address newFeeHandler) external onlyAdmin {
        _feeHandler = IFeeHandler(newFeeHandler);
        emit FeeHandlerChanged(newFeeHandler);
    }

    /**
        @notice Used to manually withdraw funds from ERC safes.
        @param handlerAddress Address of handler to withdraw from.
        @param data ABI-encoded withdrawal params relevant to the specified handler.
     */
    function adminWithdraw(
        address handlerAddress,
        bytes memory data
    ) external onlyAdmin {
        IERCHandler handler = IERCHandler(handlerAddress);
        handler.withdraw(data);
    }

    /**
        @notice Initiates a transfer using a specified handler contract.
        @notice Only callable when Bridge is not paused.
        @param destinationDomainID ID of chain deposit will be bridged to.
        @param resourceID ResourceID used to find address of handler to be used for deposit.
        @param depositData Additional data to be passed to specified handler.
        @param feeData Additional data to be passed to the fee handler.
        @notice Emits {Deposit} event with all necessary parameters and a handler response.
        - ERC20Handler: responds with an empty data.
        - ERC721Handler: responds with the deposited token metadata acquired by calling a tokenURI method in the token contract.
        - GenericHandler: responds with the raw bytes returned from the call to the target contract.
     */
    function deposit(uint8 destinationDomainID, bytes32 resourceID, bytes calldata depositData, bytes calldata feeData) external payable whenNotPaused {
        address sender = _msgSender();
        if (address(_feeHandler) == address(0)) {
            require(msg.value == 0, "no FeeHandler, msg.value != 0");
        } else {
            // Reverts on failure
            _feeHandler.collectFee{value: msg.value}(sender, _domainID, destinationDomainID, resourceID, depositData, feeData);
        }

        address handler = _resourceIDToHandlerAddress[resourceID];
        require(handler != address(0), "resourceID not mapped to handler");

        uint64 depositNonce = ++_depositCounts[destinationDomainID];

        IDepositExecute depositHandler = IDepositExecute(handler);
        bytes memory handlerResponse = depositHandler.deposit(resourceID, sender, depositData);

        emit Deposit(destinationDomainID, resourceID, depositNonce, sender, depositData, handlerResponse);
    }

    /**
        @notice When called, {_msgSender()} will be marked as voting in favor of proposal.
        @notice Only callable by relayers when Bridge is not paused.
        @param domainID ID of chain deposit originated from.
        @param depositNonce ID of deposited generated by origin Bridge contract.
        @param data Data originally provided when deposit was made.
        @notice Proposal must not have already been passed or executed.
        @notice {_msgSender()} must not have already voted on proposal.
        @notice Emits {ProposalEvent} event with status indicating the proposal status.
        @notice Emits {ProposalVote} event.
     */
    function voteProposal(uint8 domainID, uint64 depositNonce, bytes32 resourceID, bytes calldata data) external onlyRelayers whenNotPaused {
        address handler = _resourceIDToHandlerAddress[resourceID];
        uint72 nonceAndID = (uint72(depositNonce) << 8) | uint72(domainID);
        bytes32 dataHash = keccak256(abi.encodePacked(handler, data));
        Proposal memory proposal = _proposals[nonceAndID][dataHash];

        require(_resourceIDToHandlerAddress[resourceID] != address(0), "no handler for resourceID");

        if (proposal._status == ProposalStatus.Passed) {
            executeProposal(domainID, depositNonce, data, resourceID, true);
            return;
        }

        address sender = _msgSender();
        
        require(uint(proposal._status) <= 1, "proposal already executed/cancelled");
        require(!_hasVoted(proposal, sender), "relayer already voted");

        if (proposal._status == ProposalStatus.Inactive) {
            proposal = Proposal({
                _status : ProposalStatus.Active,
                _yesVotes : 0,
                _yesVotesTotal : 0,
                _proposedBlock : uint40(block.number) // Overflow is desired.
            });

            emit ProposalEvent(domainID, depositNonce, ProposalStatus.Active, dataHash);
        } else if (uint40(sub(block.number, proposal._proposedBlock)) > _expiry) {
            // if the number of blocks that has passed since this proposal was
            // submitted exceeds the expiry threshold set, cancel the proposal
            proposal._status = ProposalStatus.Cancelled;

            emit ProposalEvent(domainID, depositNonce, ProposalStatus.Cancelled, dataHash);
        }

        if (proposal._status != ProposalStatus.Cancelled) {
            proposal._yesVotes = (proposal._yesVotes | _relayerBit(sender)).toUint200();
            proposal._yesVotesTotal++; // TODO: check if bit counting is cheaper.

            emit ProposalVote(domainID, depositNonce, proposal._status, dataHash);

            // Finalize if _relayerThreshold has been reached
            if (proposal._yesVotesTotal >= _relayerThreshold) {
                proposal._status = ProposalStatus.Passed;
                emit ProposalEvent(domainID, depositNonce, ProposalStatus.Passed, dataHash);
            }
        }
        _proposals[nonceAndID][dataHash] = proposal;

        if (proposal._status == ProposalStatus.Passed) {
            executeProposal(domainID, depositNonce, data, resourceID, false);
        }
    }

    /**
        @notice Cancels a deposit proposal that has not been executed yet.
        @notice Only callable by relayers when Bridge is not paused.
        @param domainID ID of chain deposit originated from.
        @param depositNonce ID of deposited generated by origin Bridge contract.
        @param dataHash Hash of data originally provided when deposit was made.
        @notice Proposal must be past expiry threshold.
        @notice Emits {ProposalEvent} event with status {Cancelled}.
     */
    function cancelProposal(uint8 domainID, uint64 depositNonce, bytes32 dataHash) public onlyAdminOrRelayer {
        uint72 nonceAndID = (uint72(depositNonce) << 8) | uint72(domainID);
        Proposal memory proposal = _proposals[nonceAndID][dataHash];
        ProposalStatus currentStatus = proposal._status;

        require(currentStatus == ProposalStatus.Active || currentStatus == ProposalStatus.Passed,
            "Proposal cannot be cancelled");
        require(uint40(sub(block.number, proposal._proposedBlock)) > _expiry, "Proposal not at expiry threshold");

        proposal._status = ProposalStatus.Cancelled;
        _proposals[nonceAndID][dataHash] = proposal;

        emit ProposalEvent(domainID, depositNonce, ProposalStatus.Cancelled, dataHash);
    }

    /**
        @notice Executes a deposit proposal that is considered passed using a specified handler contract.
        @notice Only callable by relayers when Bridge is not paused.
        @param domainID ID of chain deposit originated from.
        @param resourceID ResourceID to be used when making deposits.
        @param depositNonce ID of deposited generated by origin Bridge contract.
        @param data Data originally provided when deposit was made.
        @param revertOnFail Decision if the transaction should be reverted in case of handler's executeProposal is reverted or not.
        @notice Proposal must have Passed status.
        @notice Hash of {data} must equal proposal's {dataHash}.
        @notice Emits {ProposalEvent} event with status {Executed}.
        @notice Emits {FailedExecution} event with the failed reason.
     */
    function executeProposal(uint8 domainID, uint64 depositNonce, bytes calldata data, bytes32 resourceID, bool revertOnFail) public onlyRelayers whenNotPaused {
        address handler = _resourceIDToHandlerAddress[resourceID];
        uint72 nonceAndID = (uint72(depositNonce) << 8) | uint72(domainID);
        bytes32 dataHash = keccak256(abi.encodePacked(handler, data));
        Proposal storage proposal = _proposals[nonceAndID][dataHash];

        require(proposal._status == ProposalStatus.Passed, "Proposal must have Passed status");

        proposal._status = ProposalStatus.Executed;
        IDepositExecute depositHandler = IDepositExecute(handler);

        if (revertOnFail) {
            depositHandler.executeProposal(resourceID, data);
        } else {
            try depositHandler.executeProposal(resourceID, data) {
            } catch (bytes memory lowLevelData) {
                proposal._status = ProposalStatus.Passed;
                emit FailedHandlerExecution(lowLevelData);
                return;
            }
        }
        
        emit ProposalEvent(domainID, depositNonce, ProposalStatus.Executed, dataHash);
    }
}
Pausable.sol 98 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;


/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This is a stripped down version of Open zeppelin's Pausable contract.
 * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/EnumerableSet.sol
 *
 */
contract Pausable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor () {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _whenNotPaused();
        _;
    }

    function _whenNotPaused() private view {
        require(!_paused, "Pausable: paused");
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenPaused() {
        _whenPaused();
        _;
    }

    function _whenPaused() private view {
        require(_paused, "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     * @param sender Address which executes pause.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause(address sender) internal virtual whenNotPaused {
        _paused = true;
        emit Paused(sender);
    }

    /**
     * @dev Returns to normal state.
     * @param sender Address which executes unpause.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause(address sender) internal virtual whenPaused {
        _paused = false;
        emit Unpaused(sender);
    }
}
SafeCast.sol 26 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;


library SafeCast {
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value < 2**200, "value does not fit in 200 bits");
        return uint200(value);
    }

    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value < 2**128, "value does not fit in 128 bits");
        return uint128(value);
    }

    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value < 2**40, "value does not fit in 40 bits");
        return uint40(value);
    }

    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value < 2**8, "value does not fit in 8 bits");
        return uint8(value);
    }
}
SafeMath.sol 43 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * note that this is a stripped down version of open zeppelin's safemath
 * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol
 */

contract SafeMath {

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return _sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function _sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }
}
AccessControl.sol 214 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;

// This is adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/access/AccessControl.sol
// The only difference is added getRoleMemberIndex(bytes32 role, address account) function.

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

    /**
     * @dev Returns the index of the account that have `role`.
     */
    function getRoleMemberIndex(bytes32 role, address account) public view returns (uint256) {
        return _roles[role].members._inner._indexes[bytes32(uint256(uint160(account)))];
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}
IERCHandler.sol 33 lines
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

/**
    @title Interface to be used with handlers that support ERC20s and ERC721s.
    @author ChainSafe Systems.
 */
interface IERCHandler {
    /**
        @notice Correlates {resourceID} with {contractAddress}.
        @param resourceID ResourceID to be used when making deposits.
        @param contractAddress Address of contract to be called when a deposit is made and a deposited is executed.
     */
    function setResource(bytes32 resourceID, address contractAddress) external;
    /**
        @notice Marks {contractAddress} as mintable/burnable.
        @param contractAddress Address of contract to be used when making or executing deposits.
     */
    function setBurnable(address contractAddress) external;

    /**
        @notice Withdraw funds from ERC safes.
        @param data ABI-encoded withdrawal params relevant to the handler.
     */
    function withdraw(bytes memory data) external;

    /**
        @notice Exposing getter for {_resourceIDToTokenContractAddress}.
        @param resourceID ResourceID to be used.
        @return address The {tokenContractAddress} that is currently set for the resourceID.
     */
    function _resourceIDToTokenContractAddress(bytes32 resourceID) external view returns (address);
}
IFeeHandler.sol 62 lines
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

/**
    @title Interface to be used with fee handlers.
    @author ChainSafe Systems.
 */
interface IFeeHandler {

    /**
        @notice This event is emitted when the fee is collected.
        @param sender Sender of the deposit.
        @param fromDomainID ID of the source chain.
        @param destinationDomainID ID of chain deposit will be bridged to.
        @param resourceID ResourceID to be used when making deposits.
        @param fee Collected fee amount.
        @param tokenAddress Address of the token in which the fee was collected (0 for the base currency).
     */
    event FeeCollected(
        address sender,
        uint8 fromDomainID,
        uint8 destinationDomainID,
        bytes32 resourceID,
        uint256 fee,
        address tokenAddress
    );

    /**
        @notice This event is emitted when the fee is distributed to an address.
        @param tokenAddress Address of the token in which the fee was collected (0 for the base currency).
        @param recipient Address that receives the distributed fee.
        @param amount Amount that is distributed.
     */
    event FeeDistributed(
        address tokenAddress,
        address recipient,
        uint256 amount
    );

    /**
        @notice Collects fee for deposit.
        @param sender Sender of the deposit.
        @param fromDomainID ID of the source chain.
        @param destinationDomainID ID of chain deposit will be bridged to.
        @param resourceID ResourceID to be used when making deposits.
        @param depositData Additional data to be passed to specified handler.
        @param feeData Additional data to be passed to the fee handler.
     */
    function collectFee(address sender, uint8 fromDomainID, uint8 destinationDomainID, bytes32 resourceID, bytes calldata depositData, bytes calldata feeData) payable external;

    /**
        @notice Calculates fee for deposit.
        @param sender Sender of the deposit.
        @param fromDomainID ID of the source chain.
        @param destinationDomainID ID of chain deposit will be bridged to.
        @param resourceID ResourceID to be used when making deposits.
        @param depositData Additional data to be passed to specified handler.
        @param feeData Additional data to be passed to the fee handler.
        @return Returns the fee amount.
     */
    function calculateFee(address sender, uint8 fromDomainID, uint8 destinationDomainID, bytes32 resourceID, bytes calldata depositData, bytes calldata feeData) external view returns(uint256, address);
}
IDepositExecute.sol 21 lines
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

/**
    @title Interface for handler contracts that support deposits and deposit executions.
    @author ChainSafe Systems.
 */
interface IDepositExecute {
    /**
        @notice It is intended that deposit are made using the Bridge contract.
        @param depositer Address of account making the deposit in the Bridge contract.
        @param data Consists of additional data needed for a specific deposit.
     */
    function deposit(bytes32 resourceID, address depositer, bytes calldata data) external returns (bytes memory);

    /**
        @notice It is intended that proposals are executed by the Bridge contract.
        @param data Consists of additional data needed for a specific deposit execution.
     */
    function executeProposal(bytes32 resourceID, bytes calldata data) external;
}
IGenericHandler.sol 23 lines
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.11;

/**
    @title Interface for handler that handles generic deposits and deposit executions.
    @author ChainSafe Systems.
 */
interface IGenericHandler {
    /**
        @notice Correlates {resourceID} with {contractAddress}, {depositFunctionSig}, and {executeFunctionSig}.
        @param resourceID ResourceID to be used when making deposits.
        @param contractAddress Address of contract to be called when a deposit is made and a deposited is executed.
        @param depositFunctionSig Function signature of method to be called in {contractAddress} when a deposit is made.
        @param depositFunctionDepositerOffset Depositer address position offset in the metadata, in bytes.
        @param executeFunctionSig Function signature of method to be called in {contractAddress} when a deposit is executed.
     */
    function setResource(
        bytes32 resourceID,
        address contractAddress,
        bytes4 depositFunctionSig,
        uint depositFunctionDepositerOffset,
        bytes4 executeFunctionSig) external;
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
EnumerableSet.sol 357 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

Read Contract

DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
MAX_RELAYERS 0x9debb3bd → uint256
RELAYER_ROLE 0x926d7d7f → bytes32
_depositCounts 0x4b0b919d → uint64
_domainID 0x9dd694f4 → uint8
_expiry 0xc5ec8970 → uint40
_feeHandler 0xfe4648f4 → address
_hasVotedOnProposal 0x7febe63f → bool
_relayerThreshold 0xd7a9cd79 → uint8
_resourceIDToHandlerAddress 0x84db809f → address
_totalRelayers 0x802aabe8 → uint256
getProposal 0xa9cf69fa → tuple
getRoleAdmin 0x248a9ca3 → bytes32
getRoleMember 0x9010d07c → address
getRoleMemberCount 0xca15c873 → uint256
getRoleMemberIndex 0x4e0df3f6 → uint256
hasRole 0x91d14854 → bool
isRelayer 0x541d5548 → bool
isValidForwarder 0xf8c39e44 → bool
paused 0x5c975abb → bool

Write Contract 20 functions

These functions modify contract state and require a wallet transaction to execute.

adminAddRelayer 0xcdb0f73a
address relayerAddress
adminChangeFeeHandler 0x8b63aebf
address newFeeHandler
adminChangeRelayerThreshold 0x4e056005
uint256 newThreshold
adminPauseTransfers 0x80ae1c28
No parameters
adminRemoveRelayer 0x9d82dd63
address relayerAddress
adminSetBurnable 0x8c0c2631
address handlerAddress
address tokenAddress
adminSetDepositNonce 0xedc20c3c
uint8 domainID
uint64 nonce
adminSetForwarder 0xd15ef64e
address forwarder
bool valid
adminSetGenericResource 0x5a1ad87c
address handlerAddress
bytes32 resourceID
address contractAddress
bytes4 depositFunctionSig
uint256 depositFunctionDepositerOffset
bytes4 executeFunctionSig
adminSetResource 0xcb10f215
address handlerAddress
bytes32 resourceID
address tokenAddress
adminUnpauseTransfers 0xffaac0eb
No parameters
adminWithdraw 0xbd2a1820
address handlerAddress
bytes data
cancelProposal 0x17f03ce5
uint8 domainID
uint64 depositNonce
bytes32 dataHash
deposit 0x73c45c98
uint8 destinationDomainID
bytes32 resourceID
bytes depositData
bytes feeData
executeProposal 0x206a98fd
uint8 domainID
uint64 depositNonce
bytes data
bytes32 resourceID
bool revertOnFail
grantRole 0x2f2ff15d
bytes32 role
address account
renounceAdmin 0x5e1fab0f
address newAdmin
renounceRole 0x36568abe
bytes32 role
address account
revokeRole 0xd547741f
bytes32 role
address account
voteProposal 0xc0331b3e
uint8 domainID
uint64 depositNonce
bytes32 resourceID
bytes data

Recent Transactions

No transactions found for this address