diff --git a/ethereum/smart-contract/.openzeppelin/unknown-80002.json b/ethereum/smart-contract/.openzeppelin/unknown-80002.json new file mode 100644 index 000000000..202395189 --- /dev/null +++ b/ethereum/smart-contract/.openzeppelin/unknown-80002.json @@ -0,0 +1,1016 @@ +{ + "manifestVersion": "3.2", + "proxies": [ + { + "address": "0xF65b6396dF6B7e2D8a6270E3AB6c7BB08BAEF22E", + "kind": "uups" + }, + { + "address": "0x490D0801844C41E88674F00940590D646E6948b8", + "kind": "uups" + } + ], + "impls": { + "88d3d32568aeda4f50fa13863c9f37cbe31f4167e23b940e8cefaa49d35fccf8": { + "address": "0x65Bb8eb7c66c107e379C1C5781268393303E4b50", + "layout": { + "solcVersion": "0.8.19", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:197" + }, + { + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_trustedForwarders", + "offset": 0, + "slot": "151", + "type": "t_mapping(t_address,t_bool)", + "contract": "MultiERC2771ContextUpgradeable", + "src": "contracts/MultiERC2771ContextUpgradeable.sol:10" + }, + { + "label": "_name", + "offset": 0, + "slot": "152", + "type": "t_string_storage", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:43" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "153", + "type": "t_string_storage", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:44" + }, + { + "label": "_decimals", + "offset": 0, + "slot": "154", + "type": "t_uint8", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:45" + }, + { + "label": "_tokenIdGenerator", + "offset": 0, + "slot": "155", + "type": "t_struct(Counter)1164_storage", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:46" + }, + { + "label": "_approvedValues", + "offset": 0, + "slot": "156", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:50" + }, + { + "label": "_allTokens", + "offset": 0, + "slot": "157", + "type": "t_array(t_struct(TokenData)4590_storage)dyn_storage", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:52" + }, + { + "label": "_allTokensIndex", + "offset": 0, + "slot": "158", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:55" + }, + { + "label": "_addressData", + "offset": 0, + "slot": "159", + "type": "t_mapping(t_address,t_struct(AddressData)4602_storage)", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:57" + }, + { + "label": "metadataDescriptor", + "offset": 0, + "slot": "160", + "type": "t_contract(IERC3525MetadataDescriptorUpgradeable)7285", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:59" + }, + { + "label": "__gap", + "offset": 0, + "slot": "161", + "type": "t_array(t_uint256)41_storage", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:640" + }, + { + "label": "_roleDomain", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_uint256,t_struct(RoleDomain)9454_storage)", + "contract": "ParameterizedAccessControl", + "src": "contracts/ParameterizedAccessControl.sol:60" + }, + { + "label": "_superAdmins", + "offset": 0, + "slot": "203", + "type": "t_mapping(t_address,t_bool)", + "contract": "ParameterizedAccessControl", + "src": "contracts/ParameterizedAccessControl.sol:61" + }, + { + "label": "flagsStorage", + "offset": 0, + "slot": "204", + "type": "t_contract(IFlagsStorage)10161", + "contract": "TokenBitMask", + "src": "contracts/TokenBitMask.sol:16" + }, + { + "label": "_bitmasks", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "TokenBitMask", + "src": "contracts/TokenBitMask.sol:19" + }, + { + "label": "isNetworkDAOGoverned", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_bool)", + "contract": "GatewayTokenV0", + "src": "test/contracts/v0/GatewayTokenV0.sol:53" + }, + { + "label": "_tokenStates", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_uint256,t_enum(TokenState)12644)", + "contract": "GatewayTokenV0", + "src": "test/contracts/v0/GatewayTokenV0.sol:61" + }, + { + "label": "_expirations", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "GatewayTokenV0", + "src": "test/contracts/v0/GatewayTokenV0.sol:64" + }, + { + "label": "_networks", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_string_storage)", + "contract": "GatewayTokenV0", + "src": "test/contracts/v0/GatewayTokenV0.sol:66" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(TokenData)4590_storage)dyn_storage": { + "label": "struct ERC3525Upgradeable.TokenData[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)41_storage": { + "label": "uint256[41]", + "numberOfBytes": "1312" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_array(t_uint256)dyn_storage": { + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IERC3525MetadataDescriptorUpgradeable)7285": { + "label": "contract IERC3525MetadataDescriptorUpgradeable", + "numberOfBytes": "20" + }, + "t_contract(IFlagsStorage)10161": { + "label": "contract IFlagsStorage", + "numberOfBytes": "20" + }, + "t_enum(TokenState)12644": { + "label": "enum IGatewayTokenV0.TokenState", + "members": [ + "ACTIVE", + "FROZEN", + "REVOKED" + ], + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_struct(AddressData)4602_storage)": { + "label": "mapping(address => struct ERC3525Upgradeable.AddressData)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_struct(RoleData)9448_storage)": { + "label": "mapping(bytes32 => struct ParameterizedAccessControl.RoleData)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_bool)": { + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_enum(TokenState)12644)": { + "label": "mapping(uint256 => enum IGatewayTokenV0.TokenState)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_string_storage)": { + "label": "mapping(uint256 => string)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_struct(RoleDomain)9454_storage)": { + "label": "mapping(uint256 => struct ParameterizedAccessControl.RoleDomain)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(AddressData)4602_storage": { + "label": "struct ERC3525Upgradeable.AddressData", + "members": [ + { + "label": "ownedTokens", + "type": "t_array(t_uint256)dyn_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "ownedTokensIndex", + "type": "t_mapping(t_uint256,t_uint256)", + "offset": 0, + "slot": "1" + }, + { + "label": "approvals", + "type": "t_mapping(t_address,t_bool)", + "offset": 0, + "slot": "2" + } + ], + "numberOfBytes": "96" + }, + "t_struct(Counter)1164_storage": { + "label": "struct CountersUpgradeable.Counter", + "members": [ + { + "label": "_value", + "type": "t_uint256", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(RoleData)9448_storage": { + "label": "struct ParameterizedAccessControl.RoleData", + "members": [ + { + "label": "members", + "type": "t_mapping(t_address,t_bool)", + "offset": 0, + "slot": "0" + }, + { + "label": "adminRole", + "type": "t_bytes32", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RoleDomain)9454_storage": { + "label": "struct ParameterizedAccessControl.RoleDomain", + "members": [ + { + "label": "roles", + "type": "t_mapping(t_bytes32,t_struct(RoleData)9448_storage)", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(TokenData)4590_storage": { + "label": "struct ERC3525Upgradeable.TokenData", + "members": [ + { + "label": "id", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "slot", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "balance", + "type": "t_uint256", + "offset": 0, + "slot": "2" + }, + { + "label": "owner", + "type": "t_address", + "offset": 0, + "slot": "3" + }, + { + "label": "approved", + "type": "t_address", + "offset": 0, + "slot": "4" + }, + { + "label": "valueApprovals", + "type": "t_array(t_address)dyn_storage", + "offset": 0, + "slot": "5" + } + ], + "numberOfBytes": "192" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + }, + "13836734afb45ba379b5c62c5c00cb83c301d79f18080a56cc75d8270b417b9b": { + "address": "0xe25c6C4FCAec2010bAE4B05d863BE2A5a5DB940F", + "layout": { + "solcVersion": "0.8.19", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:197" + }, + { + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107" + }, + { + "label": "_supportedFlags", + "offset": 0, + "slot": "101", + "type": "t_struct(Bytes32Set)5262_storage", + "contract": "FlagsStorage", + "src": "contracts/FlagsStorage.sol:22" + }, + { + "label": "superAdmin", + "offset": 0, + "slot": "103", + "type": "t_address", + "contract": "FlagsStorage", + "src": "contracts/FlagsStorage.sol:24" + }, + { + "label": "supportedFlagsMask", + "offset": 0, + "slot": "104", + "type": "t_uint256", + "contract": "FlagsStorage", + "src": "contracts/FlagsStorage.sol:26" + }, + { + "label": "flagIndexes", + "offset": 0, + "slot": "105", + "type": "t_mapping(t_bytes32,t_uint8)", + "contract": "FlagsStorage", + "src": "contracts/FlagsStorage.sol:28" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint8)": { + "label": "mapping(bytes32 => uint8)", + "numberOfBytes": "32" + }, + "t_struct(Bytes32Set)5262_storage": { + "label": "struct EnumerableSet.Bytes32Set", + "members": [ + { + "label": "_inner", + "type": "t_struct(Set)5068_storage", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)5068_storage": { + "label": "struct EnumerableSet.Set", + "members": [ + { + "label": "_values", + "type": "t_array(t_bytes32)dyn_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "_indexes", + "type": "t_mapping(t_bytes32,t_uint256)", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + }, + "81b4cd7e01048963fb08ccb5d81369968a50274e2c39bd76e56a995f795a0b25": { + "address": "0xEd3d38e61af46bc4a5671e52BAe4E86D54537859", + "txHash": "0x76c5399d80ab7b9ff685cb59828233ecd158140669ac8c2d7fbb03ad0500a141", + "layout": { + "solcVersion": "0.8.19", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:197" + }, + { + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36" + }, + { + "label": "_trustedForwarders", + "offset": 0, + "slot": "151", + "type": "t_mapping(t_address,t_bool)", + "contract": "MultiERC2771ContextUpgradeable", + "src": "contracts/MultiERC2771ContextUpgradeable.sol:10" + }, + { + "label": "_name", + "offset": 0, + "slot": "152", + "type": "t_string_storage", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:43" + }, + { + "label": "_symbol", + "offset": 0, + "slot": "153", + "type": "t_string_storage", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:44" + }, + { + "label": "_decimals", + "offset": 0, + "slot": "154", + "type": "t_uint8", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:45" + }, + { + "label": "_tokenIdGenerator", + "offset": 0, + "slot": "155", + "type": "t_struct(Counter)1164_storage", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:46" + }, + { + "label": "_approvedValues", + "offset": 0, + "slot": "156", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:50" + }, + { + "label": "_allTokens", + "offset": 0, + "slot": "157", + "type": "t_array(t_struct(TokenData)4590_storage)dyn_storage", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:52" + }, + { + "label": "_allTokensIndex", + "offset": 0, + "slot": "158", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:55" + }, + { + "label": "_addressData", + "offset": 0, + "slot": "159", + "type": "t_mapping(t_address,t_struct(AddressData)4602_storage)", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:57" + }, + { + "label": "metadataDescriptor", + "offset": 0, + "slot": "160", + "type": "t_contract(IERC3525MetadataDescriptorUpgradeable)7285", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:59" + }, + { + "label": "__gap", + "offset": 0, + "slot": "161", + "type": "t_array(t_uint256)41_storage", + "contract": "ERC3525Upgradeable", + "src": "@solvprotocol/erc-3525/ERC3525Upgradeable.sol:640" + }, + { + "label": "_roleDomain", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_uint256,t_struct(RoleDomain)9454_storage)", + "contract": "ParameterizedAccessControl", + "src": "contracts/ParameterizedAccessControl.sol:60" + }, + { + "label": "_superAdmins", + "offset": 0, + "slot": "203", + "type": "t_mapping(t_address,t_bool)", + "contract": "ParameterizedAccessControl", + "src": "contracts/ParameterizedAccessControl.sol:61" + }, + { + "label": "flagsStorage", + "offset": 0, + "slot": "204", + "type": "t_contract(IFlagsStorage)10161", + "contract": "TokenBitMask", + "src": "contracts/TokenBitMask.sol:16" + }, + { + "label": "_bitmasks", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "TokenBitMask", + "src": "contracts/TokenBitMask.sol:19" + }, + { + "label": "isNetworkDAOGoverned", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_bool)", + "contract": "GatewayToken", + "src": "contracts/GatewayToken.sol:59" + }, + { + "label": "_tokenStates", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_uint256,t_enum(TokenState)10169)", + "contract": "GatewayToken", + "src": "contracts/GatewayToken.sol:67" + }, + { + "label": "_expirations", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "GatewayToken", + "src": "contracts/GatewayToken.sol:70" + }, + { + "label": "_networks", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_string_storage)", + "contract": "GatewayToken", + "src": "contracts/GatewayToken.sol:72" + }, + { + "label": "_issuingGatekeepers", + "offset": 0, + "slot": "210", + "type": "t_mapping(t_uint256,t_address)", + "contract": "GatewayToken", + "src": "contracts/GatewayToken.sol:75" + }, + { + "label": "_networkFeatures", + "offset": 0, + "slot": "211", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "GatewayToken", + "src": "contracts/GatewayToken.sol:78" + }, + { + "label": "_chargeHandler", + "offset": 0, + "slot": "212", + "type": "t_contract(IChargeHandler)10003", + "contract": "GatewayToken", + "src": "contracts/GatewayToken.sol:80" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(TokenData)4590_storage)dyn_storage": { + "label": "struct ERC3525Upgradeable.TokenData[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)41_storage": { + "label": "uint256[41]", + "numberOfBytes": "1312" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_array(t_uint256)dyn_storage": { + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IChargeHandler)10003": { + "label": "contract IChargeHandler", + "numberOfBytes": "20" + }, + "t_contract(IERC3525MetadataDescriptorUpgradeable)7285": { + "label": "contract IERC3525MetadataDescriptorUpgradeable", + "numberOfBytes": "20" + }, + "t_contract(IFlagsStorage)10161": { + "label": "contract IFlagsStorage", + "numberOfBytes": "20" + }, + "t_enum(TokenState)10169": { + "label": "enum IGatewayToken.TokenState", + "members": [ + "ACTIVE", + "FROZEN", + "REVOKED" + ], + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_struct(AddressData)4602_storage)": { + "label": "mapping(address => struct ERC3525Upgradeable.AddressData)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_struct(RoleData)9448_storage)": { + "label": "mapping(bytes32 => struct ParameterizedAccessControl.RoleData)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_bool)": { + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_enum(TokenState)10169)": { + "label": "mapping(uint256 => enum IGatewayToken.TokenState)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_string_storage)": { + "label": "mapping(uint256 => string)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_struct(RoleDomain)9454_storage)": { + "label": "mapping(uint256 => struct ParameterizedAccessControl.RoleDomain)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(AddressData)4602_storage": { + "label": "struct ERC3525Upgradeable.AddressData", + "members": [ + { + "label": "ownedTokens", + "type": "t_array(t_uint256)dyn_storage", + "offset": 0, + "slot": "0" + }, + { + "label": "ownedTokensIndex", + "type": "t_mapping(t_uint256,t_uint256)", + "offset": 0, + "slot": "1" + }, + { + "label": "approvals", + "type": "t_mapping(t_address,t_bool)", + "offset": 0, + "slot": "2" + } + ], + "numberOfBytes": "96" + }, + "t_struct(Counter)1164_storage": { + "label": "struct CountersUpgradeable.Counter", + "members": [ + { + "label": "_value", + "type": "t_uint256", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(RoleData)9448_storage": { + "label": "struct ParameterizedAccessControl.RoleData", + "members": [ + { + "label": "members", + "type": "t_mapping(t_address,t_bool)", + "offset": 0, + "slot": "0" + }, + { + "label": "adminRole", + "type": "t_bytes32", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RoleDomain)9454_storage": { + "label": "struct ParameterizedAccessControl.RoleDomain", + "members": [ + { + "label": "roles", + "type": "t_mapping(t_bytes32,t_struct(RoleData)9448_storage)", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(TokenData)4590_storage": { + "label": "struct ERC3525Upgradeable.TokenData", + "members": [ + { + "label": "id", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "slot", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "balance", + "type": "t_uint256", + "offset": 0, + "slot": "2" + }, + { + "label": "owner", + "type": "t_address", + "offset": 0, + "slot": "3" + }, + { + "label": "approved", + "type": "t_address", + "offset": 0, + "slot": "4" + }, + { + "label": "valueApprovals", + "type": "t_array(t_address)dyn_storage", + "offset": 0, + "slot": "5" + } + ], + "numberOfBytes": "192" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } + } + } +} diff --git a/ethereum/smart-contract/config/networks.ts b/ethereum/smart-contract/config/networks.ts index 7e0e1450b..f9c0b67e1 100644 --- a/ethereum/smart-contract/config/networks.ts +++ b/ethereum/smart-contract/config/networks.ts @@ -26,206 +26,210 @@ export const networks = { accounts: liveAccounts, }, mainnet: { - url: `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.MAINNET_RPC ?? `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 1, }, sepolia: { - url: `https://sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.SEPOLIA_RPC ?? `https://sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 11155111, }, goerli: { - url: `https://goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.GOERLI_RPC ??`https://goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 5, }, polygonMumbai: { - url: `https://polygon-mumbai.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.POLYGONMUMBAI_RPC ??`https://polygon-mumbai.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 80001, }, polygonMainnet: { - url: `https://polygon-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.POLYGON_RPC ?? `https://polygon-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 137, }, + polygonAmoy: { + url: process.env.POLYGONAMOY_RPC ??`https://polygon-amoy.infura.io/v3/${process.env.INFURA_API_KEY}`, + accounts: liveAccounts, + chainId: 80002, + }, auroraTestnet: { - url: `https://aurora-testnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.AURORATESTNET_RPC ??`https://aurora-testnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 1313161555, }, auroraMainnet: { - url: `https://aurora-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.AURORA_RPC ??`https://aurora-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 1313161554, }, optimismGoerli: { - url: `https://optimism-goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.OPGOERLI_RPC ??`https://optimism-goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 420, // optimism goerli deployment is only reliable if a gas price is set - the gas oracles are not reliable gasPrice: 1_000_000_000, }, optimismSepolia: { - url: `https://sepolia.optimism.io`, + url: process.env.OPSEPOLIA_RPC ??`https://sepolia.optimism.io`, accounts: liveAccounts, chainId: 11155420, // optimism sepolia deployment is only reliable if a gas price is set - the gas oracles are not reliable gasPrice: 1_000_000_000, }, optimismMainnet: { - url: `https://optimism-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.OP_RPC ??`https://optimism-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 10, }, palmTestnet: { - url: `https://palm-testnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.PALMTESTNET_RPC ??`https://palm-testnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 11297108099, }, palmMainnet: { - url: `https://palm-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.PALM_RPC ??`https://palm-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 11297108109, }, arbitrumGoerli: { - url: `https://arbitrum-goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.ARBGOERLI_RPC ??`https://arbitrum-goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 421613, }, arbitrumSepolia: { - url: `https://sepolia-rollup.arbitrum.io/rpc`, + url: process.env.ARBSEPOLIA_RPC ??`https://sepolia-rollup.arbitrum.io/rpc`, accounts: liveAccounts, chainId: 421614, }, arbitrumMainnet: { - url: `https://arbitrum-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.AR_RPC ??`https://arbitrum-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 42161, }, celoMainnet: { - url: `https://celo-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.CELO_RPC ??`https://celo-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 42220, }, celoAlfajores: { - url: `https://celo-alfajores.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.CELOALFAJORES_RPC ??`https://celo-alfajores.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 44787, }, avalancheCChain: { - url: `https://avalanche-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.AVA_RPC ??`https://avalanche-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 43114, }, avalancheCChainFuji: { - url: `https://avalanche-fuji.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.AVAFUJI_RPC ??`https://avalanche-fuji.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 43113, }, starknetMainnet: { - url: `https://starknet-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.STARKNET_RPC ??`https://starknet-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 0, // not documented anywhere }, starknetGoerli: { - url: `https://starknet-goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.STARKNETGOERLI_RPC ??`https://starknet-goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 0, // not documented anywhere }, xdc: { - url: 'https://erpc.xinfin.network', + url: process.env.XDC_RPC ??'https://erpc.xinfin.network', accounts: liveAccounts, chainId: 50, }, xdcApothem: { - url: 'https://erpc.apothem.network', + url: process.env.XDCAPOTHEM_RPC ??'https://erpc.apothem.network', accounts: liveAccounts, chainId: 51, }, polygonZkEVM: { - url: 'https://zkevm-rpc.com', + url: process.env.POLYGONZKEVM_RPC ??'https://zkevm-rpc.com', accounts: liveAccounts, chainId: 1101, }, polygonZkEVMTestnet: { - url: 'https://rpc.public.zkevm-test.net', + url: process.env.POLYGONZKEVMTESTNET_RPC ??'https://rpc.public.zkevm-test.net', accounts: liveAccounts, chainId: 1442, }, fantom: { - url: 'https://rpcapi.fantom.network', + url: process.env.FANTOM_RPC ??'https://rpcapi.fantom.network', accounts: liveAccounts, chainId: 250, }, fantomTestnet: { - url: 'https://rpc.testnet.fantom.network', + url: process.env.FANTOMTESTNET_RPC ??'https://rpc.testnet.fantom.network', accounts: liveAccounts, chainId: 4002, }, baseSepolia: { - url: 'https://sepolia.base.org', + url: process.env.BASESEPOLIA_RPC ??'https://sepolia.base.org', accounts: liveAccounts, chainId: 84532, // set a gas price - the gas oracles are not reliable gasPrice: 150000005, }, base: { - url: 'https://base.llamarpc.com', + url: process.env.BASE_RPC ??'https://base.llamarpc.com', accounts: liveAccounts, chainId: 8453, }, bsc: { - // url: `https://bnbsmartchain-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, - url: 'https://bsc-dataseed1.bnbchain.org', + url: process.env.BSC_RPC ??'https://bsc-dataseed1.bnbchain.org', accounts: liveAccounts, chainId: 56, }, bscTestnet: { // url: `https://bnbsmartchain-testnet.infura.io/v3/${process.env.INFURA_API_KEY}`, - url: 'https://bsc-testnet.publicnode.com', + url: process.env.BSCTESTNET_RPC ?? 'https://bsc-testnet.publicnode.com', accounts: liveAccounts, chainId: 97, }, linea: { - url: `https://linea-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.LINEA_RPC ?? `https://linea-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 59144, }, lineaGoerli: { - url: `https://linea-goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, + url: process.env.LINEAGOERLI_RPC ?? `https://linea-goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: liveAccounts, chainId: 59140, }, gnosis: { - url: 'https://rpc.gnosischain.com', + url: process.env.GNOSIS_RPC ?? 'https://rpc.gnosischain.com', accounts: liveAccounts, chainId: 100 }, gnosisChiado: { - url: 'https://rpc.chiadochain.net', + url: process.env.GNOSISCHIADO_RPC ?? 'https://rpc.chiadochain.net', accounts: liveAccounts, chainId: 10200, gasPrice: 1500000005, }, klaytn: { - url: 'https://public-en-cypress.klaytn.net', + url: process.env.KLAYTN_RPC ?? 'https://public-en-cypress.klaytn.net', accounts: liveAccounts, chainId: 8217, }, klaytnBaobab: { - url: 'https://api.baobab.klaytn.net:8651', + url: process.env.KLAYTONBAOBAB_RPC ?? 'https://api.baobab.klaytn.net:8651', accounts: liveAccounts, chainId: 1001, }, zkSync: { - url: 'https://mainnet.era.zksync.io', + url: process.env.ZKSYNC_RPC ?? 'https://mainnet.era.zksync.io', accounts: liveAccounts, chainId: 324, }, zkSyncGoerli: { - url: 'https://testnet.era.zksync.dev', + url: process.env.ZKSYNCGOERLI_RPC ?? 'https://testnet.era.zksync.dev', accounts: liveAccounts, chainId: 280, }, diff --git a/ethereum/smart-contract/config/tasks.ts b/ethereum/smart-contract/config/tasks.ts index 80031835d..265b1dd92 100644 --- a/ethereum/smart-contract/config/tasks.ts +++ b/ethereum/smart-contract/config/tasks.ts @@ -10,6 +10,7 @@ import {createWallet} from "../tasks/createWallet"; import {addForwarder} from "../tasks/addForwarder"; import {execute} from "../tasks/execute"; import {getBalance} from "../tasks/getBalance"; +import {getFees} from "../tasks/getFees"; const defaultPath = './contracts'; const testContractsPath = './test/contracts'; @@ -62,6 +63,7 @@ task('execute', 'sign and send a transaction') .addParam('value', 'the amount to send with the transaction') .setAction(execute); task('get-balance', 'get the balance of the deployer').setAction(getBalance); +task('get-fees', 'get the current fees on the selected network').setAction(getFees); // Override the default "compile" task to compile both main and test contracts task('compile', 'Compiles the entire project, including main and test contracts') diff --git a/ethereum/smart-contract/deployments/polygonAmoy/.chainId b/ethereum/smart-contract/deployments/polygonAmoy/.chainId new file mode 100644 index 000000000..b8ca3095d --- /dev/null +++ b/ethereum/smart-contract/deployments/polygonAmoy/.chainId @@ -0,0 +1 @@ +80002 \ No newline at end of file diff --git a/ethereum/smart-contract/deployments/polygonAmoy/ChargeHandler.json b/ethereum/smart-contract/deployments/polygonAmoy/ChargeHandler.json new file mode 100644 index 000000000..e23ca8b7b --- /dev/null +++ b/ethereum/smart-contract/deployments/polygonAmoy/ChargeHandler.json @@ -0,0 +1,871 @@ +{ + "address": "0xc02Dd133Ca4cE341A9a9280d8FA8e9433C16A13A", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "allowance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expectedAllowance", + "type": "uint256" + } + ], + "name": "Charge__IncorrectAllowance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expectedValue", + "type": "uint256" + } + ], + "name": "Charge__IncorrectValue", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Charge__TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "Common__MissingAccount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "gatewayTokenAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "ApprovalSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "enum ChargeType", + "name": "chargeType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenSender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "indexed": false, + "internalType": "struct Charge", + "name": "", + "type": "tuple" + } + ], + "name": "ChargePaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "CHARGE_CALLER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "enum ChargeType", + "name": "chargeType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenSender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "internalType": "struct Charge", + "name": "charge", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "handleCharge", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "gatewayTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "setApproval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "setRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x8a9e037b1625cc3d82ec73e8452a52655b461c74decd74a04dc007ce327f60b8", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x74489ac99AE3cE1428Ce8C8dBE374CFFc009081E", + "contractAddress": null, + "transactionIndex": 0, + "gasUsed": "1574101", + "logsBloom": "0x00000000000000000000000000000000000000010000000000000000000000000000000000000008000000000000000000008000000000000000010000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000800000000000000080000000000000400000000000000000000000000000000000004000000080000000000000000000200000800000000000000000000400000000000000000000000000000000004000000000000000000001008000040000000000000000000000100000000000000000000000000000000000010000000000000000000000000000000000100000", + "blockHash": "0x7bf114166510c53ec43fa74edc30844f9a68ac04efd8c6e0c8b731637925c010", + "transactionHash": "0x8a9e037b1625cc3d82ec73e8452a52655b461c74decd74a04dc007ce327f60b8", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 6047506, + "transactionHash": "0x8a9e037b1625cc3d82ec73e8452a52655b461c74decd74a04dc007ce327f60b8", + "address": "0xc02Dd133Ca4cE341A9a9280d8FA8e9433C16A13A", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 0, + "blockHash": "0x7bf114166510c53ec43fa74edc30844f9a68ac04efd8c6e0c8b731637925c010" + }, + { + "transactionIndex": 0, + "blockNumber": 6047506, + "transactionHash": "0x8a9e037b1625cc3d82ec73e8452a52655b461c74decd74a04dc007ce327f60b8", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x00000000000000000000000074489ac99ae3ce1428ce8c8dbe374cffc009081e", + "0x00000000000000000000000009207a6efee346cb3e4a54ac18523e3715d38b3f" + ], + "data": "0x0000000000000000000000000000000000000000000000000012746689cf2bfa0000000000000000000000000000000000000000000000000676426723d8b3730000000000000000000000000000000000000000000000ae750c11b61d480a610000000000000000000000000000000000000000000000000663ce009a0987790000000000000000000000000000000000000000000000ae751e861ca717365b", + "logIndex": 1, + "blockHash": "0x7bf114166510c53ec43fa74edc30844f9a68ac04efd8c6e0c8b731637925c010" + } + ], + "blockNumber": 6047506, + "cumulativeGasUsed": "1574101", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "4a6763d5d7b481587f46311ce6697e8c", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"allowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expectedAllowance\",\"type\":\"uint256\"}],\"name\":\"Charge__IncorrectAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expectedValue\",\"type\":\"uint256\"}],\"name\":\"Charge__IncorrectValue\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Charge__TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Common__MissingAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"gatewayTokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokens\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"ApprovalSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"enum ChargeType\",\"name\":\"chargeType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"indexed\":false,\"internalType\":\"struct Charge\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"ChargePaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CHARGE_CALLER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"enum ChargeType\",\"name\":\"chargeType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"internalType\":\"struct Charge\",\"name\":\"charge\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"handleCharge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"gatewayTokenAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"setApproval\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"setRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The ChargeHandler contract is an internal library used by the Gatekeeper to handle charges made to the gatekeeper on gateway token issuance or refresh. The charge functionality operates in conjunction with the forwarder to allow a transaction to be a) signed by a gatekeeper, but b) sent from a gateway token recipient This is necessary for the ETH charge type, as the charge payer must sign the transaction. For ERC20 transactions, it is sufficient for the charge payer to sign an approval transaction beforehand. Note: The sender address of the charge can differ between the ETH and ERC20 charge types. ETH: The funds are sent via the \\\"value\\\" property of an eth transaction, and are forwarded on to the recipient address. ERC20: The sender address is specified as `tokenSender` in the Charge object. This will typically be, the gateway token recipient, but it can be any address. Setting this value explicitly is necessary, as it cannot be reliably derived from within the GatewayToken contract. Options would be: _msgSender() (ERC2771) - This is the inner transaction sender - the gatekeeper msg.sender - This is the forwarder contract tx.origin - This is the EOA (Externally Owned Account) that signed the outer transaction. While this is typically the gateway token recipient, using tx.origin precludes the use of smart contract wallets, as well as being discouraged for other security reasons.\",\"events\":{\"AdminChanged(address,address)\":{\"details\":\"Emitted when the admin account has changed.\"},\"ApprovalSet(address,address,uint256,uint256)\":{\"details\":\"Emitted when tokens are approved to be drawn by this contract in the context of a gateway token contract and a specific gatekeeper network.\"},\"BeaconUpgraded(address)\":{\"details\":\"Emitted when the beacon is changed.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"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`)\"},\"Upgraded(address)\":{\"details\":\"Emitted when the implementation is upgraded.\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"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. May emit a {RoleGranted} event.\"},\"handleCharge((uint256,uint8,address,address,address),uint256)\":{\"details\":\"Send a fee either in ETH (wei) or ERC20 to the gatekeeper. Note, ERC20 requires that the sender has approved the amount. This function uses the CEI (checks-effects-interactions) pattern to avoid reentrancy when sending ETH to the recipient (if the recipient is a smart contract)\",\"params\":{\"charge\":\"The charge details*\"}},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"renounceRole(bytes32,address)\":{\"details\":\"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 revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"}},\"version\":1},\"userdoc\":{\"errors\":{\"Common__MissingAccount()\":[{\"notice\":\"The passed-in account is the zero-address\"}]},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ChargeHandler.sol\":\"ChargeHandler\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlUpgradeable.sol\\\";\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it.\\n */\\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\\n function __AccessControl_init() internal onlyInitializing {\\n }\\n\\n function __AccessControl_init_unchained() internal onlyInitializing {\\n }\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n StringsUpgradeable.toHexString(account),\\n \\\" is missing role \\\",\\n StringsUpgradeable.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xe8f27a3e3e25067334e76799f03d4de6d8f8535c3fc4806468228a9ebd5de51a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.3) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.9._\\n */\\ninterface IERC1967Upgradeable {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0xb8d68221343ed784c7b76edb6a686cb65e49c476d9e22bb89a5c0c3947ff14db\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822ProxiableUpgradeable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.3) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeaconUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC1967Upgradeable.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/StorageSlotUpgradeable.sol\\\";\\nimport \\\"../utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\\n function __ERC1967Upgrade_init() internal onlyInitializing {\\n }\\n\\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\\n }\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(AddressUpgradeable.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(AddressUpgradeable.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\\n }\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\\n require(AddressUpgradeable.isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return AddressUpgradeable.verifyCallResult(success, returndata, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x1599637b52d20dc3954cea44914b2a4a9a8a5caade58d9da947e0b6c9acc07ba\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeaconUpgradeable {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x037c334add4b033ad3493038c25be1682d78c00992e1acb0e2795caff3925271\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../ERC1967/ERC1967UpgradeUpgradeable.sol\\\";\\nimport \\\"./Initializable.sol\\\";\\n\\n/**\\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSUpgradeable` with a custom implementation of upgrades.\\n *\\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\\n function __UUPSUpgradeable_init() internal onlyInitializing {\\n }\\n\\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\\n }\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n address private immutable __self = address(this);\\n\\n /**\\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\\n * fail.\\n */\\n modifier onlyProxy() {\\n require(address(this) != __self, \\\"Function must be called through delegatecall\\\");\\n require(_getImplementation() == __self, \\\"Function must be called through active proxy\\\");\\n _;\\n }\\n\\n /**\\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\\n * callable on the implementing contract but not through proxies.\\n */\\n modifier notDelegated() {\\n require(address(this) == __self, \\\"UUPSUpgradeable: must not be called through delegatecall\\\");\\n _;\\n }\\n\\n /**\\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\\n */\\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\\n return _IMPLEMENTATION_SLOT;\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeTo(address newImplementation) external virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\\n * encoded in `data`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\\n * {upgradeTo} and {upgradeToAndCall}.\\n *\\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\\n *\\n * ```solidity\\n * function _authorizeUpgrade(address) internal override onlyOwner {}\\n * ```\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x7967d130887c4b40666cd88f8744691d4527039a1b2a38aa0de41481ef646778\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlotUpgradeable {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0x09864aea84f01e39313375b5610c73a3c1c68abbdc51e5ccdd25ff977fdadf9a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0x6b9a5d35b744b25529a2856a8093e7c03fb35a34b1c4fb5499e560f8ade140da\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc1bd5b53319c68f84e3becd75694d941e8f4be94049903232cd8bc7c535aaa5a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"contracts/ChargeHandler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19; // Fixed version for concrete contracts\\n\\nimport {UUPSUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\\\";\\nimport {AccessControlUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport {Charge, ChargeType} from \\\"./library/Charge.sol\\\";\\nimport {InternalTokenApproval} from \\\"./library/InternalTokenApproval.sol\\\";\\nimport {IChargeHandler} from \\\"./interfaces/IChargeHandler.sol\\\";\\nimport {Common__MissingAccount} from \\\"./library/CommonErrors.sol\\\";\\n\\n/**\\n * @dev The ChargeHandler contract is an internal library used by the Gatekeeper\\n * to handle charges made to the gatekeeper on gateway token issuance or refresh.\\n *\\n * The charge functionality operates in conjunction with the forwarder to allow a transaction to be\\n * a) signed by a gatekeeper, but\\n * b) sent from a gateway token recipient\\n * This is necessary for the ETH charge type, as the charge payer must sign the transaction. For ERC20\\n * transactions, it is sufficient for the charge payer to sign an approval transaction beforehand.\\n *\\n * Note: The sender address of the charge can differ between the ETH and ERC20 charge types.\\n * ETH: The funds are sent via the \\\"value\\\" property of an eth transaction, and are forwarded on to the\\n * recipient address.\\n * ERC20: The sender address is specified as `tokenSender` in the Charge object. This will typically be,\\n * the gateway token recipient, but it can be any address. Setting this value explicitly is necessary, as\\n * it cannot be reliably derived from within the GatewayToken contract. Options would be:\\n * _msgSender() (ERC2771) - This is the inner transaction sender - the gatekeeper\\n * msg.sender - This is the forwarder contract\\n * tx.origin - This is the EOA (Externally Owned Account) that signed the outer transaction. While this is\\n * typically the gateway token recipient, using tx.origin precludes the use of smart contract wallets, as well as\\n * being discouraged for other security reasons.\\n */\\ncontract ChargeHandler is\\n Initializable,\\n UUPSUpgradeable,\\n AccessControlUpgradeable,\\n IChargeHandler,\\n InternalTokenApproval\\n{\\n using SafeERC20 for IERC20;\\n bytes32 public constant CHARGE_CALLER_ROLE = keccak256(\\\"CHARGE_CALLER_ROLE\\\");\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n // empty constructor in line with the UUPS upgradeable proxy pattern\\n // solhint-disable-next-line no-empty-blocks\\n constructor() {\\n _disableInitializers();\\n }\\n\\n function initialize(address owner) external initializer {\\n if (owner == address(0)) revert Common__MissingAccount();\\n\\n __AccessControl_init();\\n __UUPSUpgradeable_init();\\n\\n _setupRole(DEFAULT_ADMIN_ROLE, owner);\\n }\\n\\n function setRole(bytes32 role, address recipient) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _setupRole(role, recipient);\\n }\\n\\n /**\\n * @dev Send a fee either in ETH (wei) or ERC20 to the gatekeeper.\\n * Note, ERC20 requires that the sender has approved the amount.\\n * This function uses the CEI (checks-effects-interactions) pattern to avoid reentrancy\\n * when sending ETH to the recipient (if the recipient is a smart contract)\\n * @param charge The charge details\\n **/\\n function handleCharge(Charge calldata charge, uint network) external payable onlyRole(CHARGE_CALLER_ROLE) {\\n if (charge.chargeType == ChargeType.ETH) {\\n _handleEthCharge(charge);\\n } else if (charge.chargeType == ChargeType.ERC20) {\\n _handleERC20Charge(charge, network);\\n }\\n }\\n\\n function setApproval(address gatewayTokenAddress, address tokenAddress, uint256 tokens, uint256 network) external {\\n _setApproval(gatewayTokenAddress, tokenAddress, tokens, network);\\n emit ApprovalSet(gatewayTokenAddress, tokenAddress, tokens, network);\\n }\\n\\n function _handleEthCharge(Charge calldata charge) internal {\\n // CHECKS\\n // send wei if the charge type is ETH\\n if (msg.value != charge.value) {\\n revert Charge__IncorrectValue(msg.value, charge.value);\\n }\\n\\n // EFFECTS\\n emit ChargePaid(charge);\\n\\n // INTERACTIONS\\n (bool success, ) = payable(charge.recipient).call{value: charge.value}(\\\"\\\");\\n if (!success) {\\n revert Charge__TransferFailed(charge.value);\\n }\\n }\\n\\n function _handleERC20Charge(Charge calldata charge, uint network) internal {\\n if (msg.value > 0) {\\n // if the charge type is ERC20, the eth value should be zero\\n revert Charge__IncorrectValue(msg.value, 0);\\n }\\n // send tokens if the charge type is ERC20\\n IERC20 token = IERC20(charge.token);\\n\\n // CHECKS\\n // check that the sender has approved the token transfer from this particular gatekeeper network\\n // note - for security's sake, the user has to approve the tokens to a particular\\n // gatekeeper network, to avoid front-running attacks. For more details, see\\n // InternalTokenApproval.sol\\n // Note - safeTransferFrom() additionally checks the global allowance for this contract.\\n (bool approvalValid, uint256 remainingAllowance) = _consumeApproval(\\n charge.tokenSender,\\n _msgSender(),\\n charge.token,\\n charge.value,\\n network\\n );\\n if (!approvalValid) {\\n revert Charge__IncorrectAllowance(remainingAllowance, charge.value);\\n }\\n\\n // EFFECTS\\n emit ChargePaid(charge);\\n\\n // INTERACTIONS\\n token.safeTransferFrom(charge.tokenSender, charge.recipient, charge.value);\\n }\\n\\n // includes the onlySuperAdmin modifier to ensure that only the super admin can call this function\\n // otherwise, no other logic.\\n // solhint-disable-next-line no-empty-blocks\\n function _authorizeUpgrade(address) internal override onlyRole(DEFAULT_ADMIN_ROLE) {}\\n}\\n\",\"keccak256\":\"0x81e12b022bd95b655249378920e50825a86a48615a6f6336ebb3ee1fc0c729d4\",\"license\":\"MIT\"},\"contracts/interfaces/IChargeHandler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport {Charge} from \\\"../library/Charge.sol\\\";\\n\\ninterface IChargeHandler {\\n /**\\n * @dev Emitted when tokens are approved to be drawn by this contract in the context of\\n * a gateway token contract and a specific gatekeeper network.\\n */\\n event ApprovalSet(address gatewayTokenAddress, address tokenAddress, uint256 tokens, uint256 network);\\n\\n event ChargePaid(Charge);\\n\\n error Charge__IncorrectAllowance(uint256 allowance, uint256 expectedAllowance);\\n\\n error Charge__IncorrectValue(uint256 value, uint256 expectedValue);\\n\\n error Charge__TransferFailed(uint256 value);\\n\\n function handleCharge(Charge calldata charge, uint network) external payable;\\n\\n function setApproval(address gatewayTokenAddress, address tokenAddress, uint256 tokens, uint256 network) external;\\n}\\n\",\"keccak256\":\"0x288a17fab522bc037e9ffabbb9ec2242536419b47dd9ecfc71ea730c60ccc3b5\",\"license\":\"MIT\"},\"contracts/library/Charge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nenum ChargeType {\\n NONE, // No charge\\n ETH, // Charge amount is in Eth (Wei)\\n ERC20 // Charge amount is in an ERC20 token (token field) in minor denomination\\n}\\n\\n/**\\n * @dev The Charge struct represents details of a charge made to the gatekeeper on\\n * gateway token issuance or refresh.\\n */\\nstruct Charge {\\n // the amount in either wei (if chargeType = ETH) or ERC20 minor denomination (if chargeType = ERC20)\\n uint256 value;\\n // whether to charge in wei or ERC20\\n ChargeType chargeType;\\n // if chargeType = ERC20, the token to charge in\\n address token;\\n // the sender of the funds if chargeType = ERC20. This is necessary as the transaction is forwarded,\\n // and the originator of the transaction is not clear inside the GatewayToken contract.\\n // More details in ChargeHandler.sol\\n address tokenSender;\\n // the recipient of the funds. Typically a wallet owned by the gatekeeper.\\n address recipient;\\n}\\n\",\"keccak256\":\"0x22e92bd41e2e5ed0e143fa1571df503324366145ef1ead29a372e7187a372abf\",\"license\":\"MIT\"},\"contracts/library/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.19;\\n\\n/// The passed-in account is the zero-address\\nerror Common__MissingAccount();\\n\\n/// The passed-in account is not a contract, where an account is expected\\n/// @param account address of the account.\\nerror Common__NotContract(address account);\\n\\n/// The passed-in account is not a super-admin\\n/// @param account address of the account.\\nerror Common__NotSuperAdmin(address account);\\n\\n/// The request was made from an unauthorized address.\\n/// @param sender address of the sender.\\n/// @param domain the domain to which the role applies.\\n/// @param role role that is required.\\nerror Common__Unauthorized(address sender, uint domain, bytes32 role);\\n\",\"keccak256\":\"0x54aece7f90d63b8e3f66e09cf02e9f15d4eff6b1e4ba31bcfb73e6ef49d9b2ad\",\"license\":\"UNLICENSED\"},\"contracts/library/InternalTokenApproval.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/**\\n * @title InternalTokenApproval\\n * @dev This contract manages token approvals for preventing front-running attacks.\\n * Users are required to specifically approve\\n * ERC20 spending for a designated gatekeeper network. This is in addition to the general\\n * approval given to the GatewayToken contract. The aim is to ensure that malicious actors\\n * cannot exploit the process by setting up rogue gatekeeper networks, and then front-running\\n * legitimate issuance transactions and siphoning ERC20 tokens from\\n * unsuspecting recipients.\\n */\\ncontract InternalTokenApproval {\\n // Mapping of user addresses to their respective internal approval configurations.\\n // prettier-ignore\\n mapping(\\n address userAddress => mapping(\\n address gatewayTokenAddress => mapping(\\n address erc20TokenAddress => mapping(\\n uint256 network => uint256 tokens\\n )))) internal _approvals;\\n\\n /**\\n * @dev Set a token approval.\\n * @param tokenAddress The address of the token to approve.\\n * @param tokens The number of tokens to approve.\\n * @param network The specific network for which the tokens are approved.\\n */\\n function _setApproval(address gatewayTokenAddress, address tokenAddress, uint256 tokens, uint256 network) internal {\\n _approvals[msg.sender][gatewayTokenAddress][tokenAddress][network] = tokens;\\n }\\n\\n /**\\n * @dev Consume a certain amount of the token approval.\\n * @param user The user for which the approval details are to be consumed.\\n * @param gatewayTokenAddress The address of the gateway token contract that the tokens are approved to be drwan by.\\n * @param tokenAddress The address of the token being spent.\\n * @param tokens The number of tokens to consume.\\n * @param network The specific network from which the tokens are consumed.\\n * @return A boolean indicating if the operation was successful.\\n */\\n function _consumeApproval(\\n address user,\\n address gatewayTokenAddress,\\n address tokenAddress,\\n uint256 tokens,\\n uint256 network\\n ) internal returns (bool, uint256) {\\n if (_approvals[user][gatewayTokenAddress][tokenAddress][network] < tokens) {\\n return (false, _approvals[user][gatewayTokenAddress][tokenAddress][network]);\\n }\\n\\n _approvals[user][gatewayTokenAddress][tokenAddress][network] -= tokens;\\n return (true, _approvals[user][gatewayTokenAddress][tokenAddress][network]);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n // solhint-disable-next-line\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x9a7c7fcac88a8bf1e2a49e5ac7a45c5110b880e59b07bd8e525ecbe2bd8aa969\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100e2565b600054610100900460ff161561008e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100e0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051611afb610119600039600081816103b4015281816103f40152818161047c015281816104bc01526105340152611afb6000f3fe6080604052600436106100c85760003560e01c806391d148541161007a57806391d14854146101ca578063a217fddf146101ea578063a2793ecd146101ff578063c4d66de814610212578063d547741f14610232578063dce5535614610252578063dff8720314610286578063f4536007146102a657600080fd5b806301ffc9a7146100cd578063248a9ca3146101025780632f2ff15d1461014057806336568abe146101625780633659cfe6146101825780634f1ef286146101a257806352d1902d146101b5575b600080fd5b3480156100d957600080fd5b506100ed6100e8366004611597565b6102c6565b60405190151581526020015b60405180910390f35b34801561010e57600080fd5b5061013261011d3660046115c1565b600090815260c9602052604090206001015490565b6040519081526020016100f9565b34801561014c57600080fd5b5061016061015b3660046115f6565b6102fd565b005b34801561016e57600080fd5b5061016061017d3660046115f6565b610327565b34801561018e57600080fd5b5061016061019d366004611622565b6103aa565b6101606101b0366004611653565b610472565b3480156101c157600080fd5b50610132610527565b3480156101d657600080fd5b506100ed6101e53660046115f6565b6105d5565b3480156101f657600080fd5b50610132600081565b61016061020d366004611715565b610600565b34801561021e57600080fd5b5061016061022d366004611622565b61068d565b34801561023e57600080fd5b5061016061024d3660046115f6565b6107d8565b34801561025e57600080fd5b506101327fe1388d384fa3f077843349f63aa6fc30015dd9877d66f232b921dd625892887f81565b34801561029257600080fd5b506101606102a13660046115f6565b6107fd565b3480156102b257600080fd5b506101606102c1366004611746565b610812565b60006001600160e01b03198216637965db0b60e01b14806102f757506301ffc9a760e01b6001600160e01b03198316145b92915050565b600082815260c96020526040902060010154610318816108a4565b61032283836108ae565b505050565b6001600160a01b038116331461039c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6103a68282610934565b5050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036103f25760405162461bcd60e51b815260040161039390611788565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661042461099b565b6001600160a01b03161461044a5760405162461bcd60e51b8152600401610393906117d4565b610453816109b7565b6040805160008082526020820190925261046f918391906109c2565b50565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036104ba5760405162461bcd60e51b815260040161039390611788565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166104ec61099b565b6001600160a01b0316146105125760405162461bcd60e51b8152600401610393906117d4565b61051b826109b7565b6103a6828260016109c2565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105c25760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608401610393565b50600080516020611a7f83398151915290565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7fe1388d384fa3f077843349f63aa6fc30015dd9877d66f232b921dd625892887f61062a816108a4565b600161063c6040850160208601611845565b600281111561064d5761064d611820565b0361065b5761032283610b2d565b600261066d6040850160208601611845565b600281111561067e5761067e611820565b03610322576103228383610c18565b600054610100900460ff16158080156106ad5750600054600160ff909116105b806106c75750303b1580156106c7575060005460ff166001145b61072a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610393565b6000805460ff19166001179055801561074d576000805461ff0019166101001790555b6001600160a01b03821661077457604051630ca2c90160e21b815260040160405180910390fd5b61077c610d23565b610784610d23565b61078f600083610d90565b80156103a6576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b600082815260c960205260409020600101546107f3816108a4565b6103228383610934565b6000610808816108a4565b6103228383610d90565b33600090815260fb602090815260408083206001600160a01b038089168552908352818420908716845282528083208484529091529020829055604080516001600160a01b03808716825285166020820152908101839052606081018290527f37ca6fb8e5d1bbdc9b33c1e1ef3c2e98b97be1409fd474a8fdde0bf612b1be2f9060800160405180910390a150505050565b61046f8133610d9a565b6108b882826105d5565b6103a657600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff191660011790556108f03390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61093e82826105d5565b156103a657600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080516020611a7f833981519152546001600160a01b031690565b60006103a6816108a4565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156109f55761032283610df3565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610a4f575060408051601f3d908101601f19168201909252610a4c91810190611860565b60015b610ab25760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610393565b600080516020611a7f8339815191528114610b215760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610393565b50610322838383610e8f565b34813514610b5757604051631e547ded60e21b815234600482015281356024820152604401610393565b7f435e19089f6ae5362a112155f011980907d2ff69b4c2bb894f8324260650ee6a81604051610b869190611879565b60405180910390a16000610ba060a0830160808401611622565b6001600160a01b0316826000013560405160006040518083038185875af1925050503d8060008114610bee576040519150601f19603f3d011682016040523d82523d6000602084013e610bf3565b606091505b50509050806103a657604051636d6cc4a760e01b815282356004820152602401610393565b3415610c4057604051631e547ded60e21b815234600482015260006024820152604401610393565b6000610c526060840160408501611622565b9050600080610c83610c6a6080870160608801611622565b33610c7b6060890160408a01611622565b883588610eba565b9150915081610caf5760405163431cec8960e11b81526004810182905285356024820152604401610393565b7f435e19089f6ae5362a112155f011980907d2ff69b4c2bb894f8324260650ee6a85604051610cde9190611879565b60405180910390a1610d1c610cf96080870160608801611622565b610d0960a0880160808901611622565b6001600160a01b03861691908835610fd4565b5050505050565b600054610100900460ff16610d8e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610393565b565b6103a682826108ae565b610da482826105d5565b6103a657610db18161102e565b610dbc836020611040565b604051602001610dcd92919061191e565b60408051601f198184030181529082905262461bcd60e51b82526103939160040161198d565b6001600160a01b0381163b610e605760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610393565b600080516020611a7f83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610e98836111e3565b600082511180610ea55750805b1561032257610eb48383611223565b50505050565b6001600160a01b03808616600090815260fb602090815260408083208885168452825280832093871683529281528282208483529052908120548190841115610f3e5750506001600160a01b03808616600090815260fb60209081526040808320888516845282528083209387168352928152828220848352905290812054610fca565b6001600160a01b03808816600090815260fb602090815260408083208a851684528252808320938916835292815282822086835290529081208054869290610f879084906119d6565b9091555050506001600160a01b03808716600090815260fb6020908152604080832089851684528252808320938816835292815282822085835290522054600191505b9550959350505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610eb4908590611317565b60606102f76001600160a01b03831660145b6060600061104f8360026119e9565b61105a906002611a00565b67ffffffffffffffff8111156110725761107261163d565b6040519080825280601f01601f19166020018201604052801561109c576020820181803683370190505b509050600360fc1b816000815181106110b7576110b7611a13565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106110e6576110e6611a13565b60200101906001600160f81b031916908160001a905350600061110a8460026119e9565b611115906001611a00565b90505b600181111561118d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061114957611149611a13565b1a60f81b82828151811061115f5761115f611a13565b60200101906001600160f81b031916908160001a90535060049490941c9361118681611a29565b9050611118565b5083156111dc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610393565b9392505050565b6111ec81610df3565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61128b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610393565b600080846001600160a01b0316846040516112a69190611a40565b600060405180830381855af49150503d80600081146112e1576040519150601f19603f3d011682016040523d82523d6000602084013e6112e6565b606091505b509150915061130e8282604051806060016040528060278152602001611a9f602791396113e9565b95945050505050565b600061136c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114029092919063ffffffff16565b805190915015610322578080602001905181019061138a9190611a5c565b6103225760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610393565b606083156113f85750816111dc565b6111dc8383611419565b60606114118484600085611443565b949350505050565b8151156114295781518083602001fd5b8060405162461bcd60e51b8152600401610393919061198d565b6060824710156114a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610393565b600080866001600160a01b031685876040516114c09190611a40565b60006040518083038185875af1925050503d80600081146114fd576040519150601f19603f3d011682016040523d82523d6000602084013e611502565b606091505b50915091506115138783838761151e565b979650505050505050565b6060831561158d578251600003611586576001600160a01b0385163b6115865760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610393565b5081611411565b6114118383611419565b6000602082840312156115a957600080fd5b81356001600160e01b0319811681146111dc57600080fd5b6000602082840312156115d357600080fd5b5035919050565b80356001600160a01b03811681146115f157600080fd5b919050565b6000806040838503121561160957600080fd5b82359150611619602084016115da565b90509250929050565b60006020828403121561163457600080fd5b6111dc826115da565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561166657600080fd5b61166f836115da565b9150602083013567ffffffffffffffff8082111561168c57600080fd5b818501915085601f8301126116a057600080fd5b8135818111156116b2576116b261163d565b604051601f8201601f19908116603f011681019083821181831017156116da576116da61163d565b816040528281528860208487010111156116f357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60008082840360c081121561172957600080fd5b60a081121561173757600080fd5b50919360a08501359350915050565b6000806000806080858703121561175c57600080fd5b611765856115da565b9350611773602086016115da565b93969395505050506040820135916060013590565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b8035600381106115f157600080fd5b60006020828403121561185757600080fd5b6111dc82611836565b60006020828403121561187257600080fd5b5051919050565b8135815260a0810161188d60208401611836565b600381106118ab57634e487b7160e01b600052602160045260246000fd5b60208301526118bc604084016115da565b6001600160a01b038181166040850152806118d9606087016115da565b166060850152806118ec608087016115da565b166080850152505092915050565b60005b838110156119155781810151838201526020016118fd565b50506000910152565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516119508160178501602088016118fa565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516119818160288401602088016118fa565b01602801949350505050565b60208152600082518060208401526119ac8160408501602087016118fa565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156102f7576102f76119c0565b80820281158282048414176102f7576102f76119c0565b808201808211156102f7576102f76119c0565b634e487b7160e01b600052603260045260246000fd5b600081611a3857611a386119c0565b506000190190565b60008251611a528184602087016118fa565b9190910192915050565b600060208284031215611a6e57600080fd5b815180151581146111dc57600080fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220f2a58237f5df9e6196e778dadd5c62a08ce64b3431db559154720a38c85f299f64736f6c63430008130033", + "deployedBytecode": "0x6080604052600436106100c85760003560e01c806391d148541161007a57806391d14854146101ca578063a217fddf146101ea578063a2793ecd146101ff578063c4d66de814610212578063d547741f14610232578063dce5535614610252578063dff8720314610286578063f4536007146102a657600080fd5b806301ffc9a7146100cd578063248a9ca3146101025780632f2ff15d1461014057806336568abe146101625780633659cfe6146101825780634f1ef286146101a257806352d1902d146101b5575b600080fd5b3480156100d957600080fd5b506100ed6100e8366004611597565b6102c6565b60405190151581526020015b60405180910390f35b34801561010e57600080fd5b5061013261011d3660046115c1565b600090815260c9602052604090206001015490565b6040519081526020016100f9565b34801561014c57600080fd5b5061016061015b3660046115f6565b6102fd565b005b34801561016e57600080fd5b5061016061017d3660046115f6565b610327565b34801561018e57600080fd5b5061016061019d366004611622565b6103aa565b6101606101b0366004611653565b610472565b3480156101c157600080fd5b50610132610527565b3480156101d657600080fd5b506100ed6101e53660046115f6565b6105d5565b3480156101f657600080fd5b50610132600081565b61016061020d366004611715565b610600565b34801561021e57600080fd5b5061016061022d366004611622565b61068d565b34801561023e57600080fd5b5061016061024d3660046115f6565b6107d8565b34801561025e57600080fd5b506101327fe1388d384fa3f077843349f63aa6fc30015dd9877d66f232b921dd625892887f81565b34801561029257600080fd5b506101606102a13660046115f6565b6107fd565b3480156102b257600080fd5b506101606102c1366004611746565b610812565b60006001600160e01b03198216637965db0b60e01b14806102f757506301ffc9a760e01b6001600160e01b03198316145b92915050565b600082815260c96020526040902060010154610318816108a4565b61032283836108ae565b505050565b6001600160a01b038116331461039c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6103a68282610934565b5050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036103f25760405162461bcd60e51b815260040161039390611788565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661042461099b565b6001600160a01b03161461044a5760405162461bcd60e51b8152600401610393906117d4565b610453816109b7565b6040805160008082526020820190925261046f918391906109c2565b50565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036104ba5760405162461bcd60e51b815260040161039390611788565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166104ec61099b565b6001600160a01b0316146105125760405162461bcd60e51b8152600401610393906117d4565b61051b826109b7565b6103a6828260016109c2565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105c25760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608401610393565b50600080516020611a7f83398151915290565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7fe1388d384fa3f077843349f63aa6fc30015dd9877d66f232b921dd625892887f61062a816108a4565b600161063c6040850160208601611845565b600281111561064d5761064d611820565b0361065b5761032283610b2d565b600261066d6040850160208601611845565b600281111561067e5761067e611820565b03610322576103228383610c18565b600054610100900460ff16158080156106ad5750600054600160ff909116105b806106c75750303b1580156106c7575060005460ff166001145b61072a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610393565b6000805460ff19166001179055801561074d576000805461ff0019166101001790555b6001600160a01b03821661077457604051630ca2c90160e21b815260040160405180910390fd5b61077c610d23565b610784610d23565b61078f600083610d90565b80156103a6576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b600082815260c960205260409020600101546107f3816108a4565b6103228383610934565b6000610808816108a4565b6103228383610d90565b33600090815260fb602090815260408083206001600160a01b038089168552908352818420908716845282528083208484529091529020829055604080516001600160a01b03808716825285166020820152908101839052606081018290527f37ca6fb8e5d1bbdc9b33c1e1ef3c2e98b97be1409fd474a8fdde0bf612b1be2f9060800160405180910390a150505050565b61046f8133610d9a565b6108b882826105d5565b6103a657600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff191660011790556108f03390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61093e82826105d5565b156103a657600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080516020611a7f833981519152546001600160a01b031690565b60006103a6816108a4565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156109f55761032283610df3565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610a4f575060408051601f3d908101601f19168201909252610a4c91810190611860565b60015b610ab25760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610393565b600080516020611a7f8339815191528114610b215760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610393565b50610322838383610e8f565b34813514610b5757604051631e547ded60e21b815234600482015281356024820152604401610393565b7f435e19089f6ae5362a112155f011980907d2ff69b4c2bb894f8324260650ee6a81604051610b869190611879565b60405180910390a16000610ba060a0830160808401611622565b6001600160a01b0316826000013560405160006040518083038185875af1925050503d8060008114610bee576040519150601f19603f3d011682016040523d82523d6000602084013e610bf3565b606091505b50509050806103a657604051636d6cc4a760e01b815282356004820152602401610393565b3415610c4057604051631e547ded60e21b815234600482015260006024820152604401610393565b6000610c526060840160408501611622565b9050600080610c83610c6a6080870160608801611622565b33610c7b6060890160408a01611622565b883588610eba565b9150915081610caf5760405163431cec8960e11b81526004810182905285356024820152604401610393565b7f435e19089f6ae5362a112155f011980907d2ff69b4c2bb894f8324260650ee6a85604051610cde9190611879565b60405180910390a1610d1c610cf96080870160608801611622565b610d0960a0880160808901611622565b6001600160a01b03861691908835610fd4565b5050505050565b600054610100900460ff16610d8e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610393565b565b6103a682826108ae565b610da482826105d5565b6103a657610db18161102e565b610dbc836020611040565b604051602001610dcd92919061191e565b60408051601f198184030181529082905262461bcd60e51b82526103939160040161198d565b6001600160a01b0381163b610e605760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610393565b600080516020611a7f83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610e98836111e3565b600082511180610ea55750805b1561032257610eb48383611223565b50505050565b6001600160a01b03808616600090815260fb602090815260408083208885168452825280832093871683529281528282208483529052908120548190841115610f3e5750506001600160a01b03808616600090815260fb60209081526040808320888516845282528083209387168352928152828220848352905290812054610fca565b6001600160a01b03808816600090815260fb602090815260408083208a851684528252808320938916835292815282822086835290529081208054869290610f879084906119d6565b9091555050506001600160a01b03808716600090815260fb6020908152604080832089851684528252808320938816835292815282822085835290522054600191505b9550959350505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610eb4908590611317565b60606102f76001600160a01b03831660145b6060600061104f8360026119e9565b61105a906002611a00565b67ffffffffffffffff8111156110725761107261163d565b6040519080825280601f01601f19166020018201604052801561109c576020820181803683370190505b509050600360fc1b816000815181106110b7576110b7611a13565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106110e6576110e6611a13565b60200101906001600160f81b031916908160001a905350600061110a8460026119e9565b611115906001611a00565b90505b600181111561118d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061114957611149611a13565b1a60f81b82828151811061115f5761115f611a13565b60200101906001600160f81b031916908160001a90535060049490941c9361118681611a29565b9050611118565b5083156111dc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610393565b9392505050565b6111ec81610df3565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61128b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610393565b600080846001600160a01b0316846040516112a69190611a40565b600060405180830381855af49150503d80600081146112e1576040519150601f19603f3d011682016040523d82523d6000602084013e6112e6565b606091505b509150915061130e8282604051806060016040528060278152602001611a9f602791396113e9565b95945050505050565b600061136c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114029092919063ffffffff16565b805190915015610322578080602001905181019061138a9190611a5c565b6103225760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610393565b606083156113f85750816111dc565b6111dc8383611419565b60606114118484600085611443565b949350505050565b8151156114295781518083602001fd5b8060405162461bcd60e51b8152600401610393919061198d565b6060824710156114a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610393565b600080866001600160a01b031685876040516114c09190611a40565b60006040518083038185875af1925050503d80600081146114fd576040519150601f19603f3d011682016040523d82523d6000602084013e611502565b606091505b50915091506115138783838761151e565b979650505050505050565b6060831561158d578251600003611586576001600160a01b0385163b6115865760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610393565b5081611411565b6114118383611419565b6000602082840312156115a957600080fd5b81356001600160e01b0319811681146111dc57600080fd5b6000602082840312156115d357600080fd5b5035919050565b80356001600160a01b03811681146115f157600080fd5b919050565b6000806040838503121561160957600080fd5b82359150611619602084016115da565b90509250929050565b60006020828403121561163457600080fd5b6111dc826115da565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561166657600080fd5b61166f836115da565b9150602083013567ffffffffffffffff8082111561168c57600080fd5b818501915085601f8301126116a057600080fd5b8135818111156116b2576116b261163d565b604051601f8201601f19908116603f011681019083821181831017156116da576116da61163d565b816040528281528860208487010111156116f357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60008082840360c081121561172957600080fd5b60a081121561173757600080fd5b50919360a08501359350915050565b6000806000806080858703121561175c57600080fd5b611765856115da565b9350611773602086016115da565b93969395505050506040820135916060013590565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b8035600381106115f157600080fd5b60006020828403121561185757600080fd5b6111dc82611836565b60006020828403121561187257600080fd5b5051919050565b8135815260a0810161188d60208401611836565b600381106118ab57634e487b7160e01b600052602160045260246000fd5b60208301526118bc604084016115da565b6001600160a01b038181166040850152806118d9606087016115da565b166060850152806118ec608087016115da565b166080850152505092915050565b60005b838110156119155781810151838201526020016118fd565b50506000910152565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516119508160178501602088016118fa565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516119818160288401602088016118fa565b01602801949350505050565b60208152600082518060208401526119ac8160408501602087016118fa565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156102f7576102f76119c0565b80820281158282048414176102f7576102f76119c0565b808201808211156102f7576102f76119c0565b634e487b7160e01b600052603260045260246000fd5b600081611a3857611a386119c0565b506000190190565b60008251611a528184602087016118fa565b9190910192915050565b600060208284031215611a6e57600080fd5b815180151581146111dc57600080fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220f2a58237f5df9e6196e778dadd5c62a08ce64b3431db559154720a38c85f299f64736f6c63430008130033", + "devdoc": { + "details": "The ChargeHandler contract is an internal library used by the Gatekeeper to handle charges made to the gatekeeper on gateway token issuance or refresh. The charge functionality operates in conjunction with the forwarder to allow a transaction to be a) signed by a gatekeeper, but b) sent from a gateway token recipient This is necessary for the ETH charge type, as the charge payer must sign the transaction. For ERC20 transactions, it is sufficient for the charge payer to sign an approval transaction beforehand. Note: The sender address of the charge can differ between the ETH and ERC20 charge types. ETH: The funds are sent via the \"value\" property of an eth transaction, and are forwarded on to the recipient address. ERC20: The sender address is specified as `tokenSender` in the Charge object. This will typically be, the gateway token recipient, but it can be any address. Setting this value explicitly is necessary, as it cannot be reliably derived from within the GatewayToken contract. Options would be: _msgSender() (ERC2771) - This is the inner transaction sender - the gatekeeper msg.sender - This is the forwarder contract tx.origin - This is the EOA (Externally Owned Account) that signed the outer transaction. While this is typically the gateway token recipient, using tx.origin precludes the use of smart contract wallets, as well as being discouraged for other security reasons.", + "events": { + "AdminChanged(address,address)": { + "details": "Emitted when the admin account has changed." + }, + "ApprovalSet(address,address,uint256,uint256)": { + "details": "Emitted when tokens are approved to be drawn by this contract in the context of a gateway token contract and a specific gatekeeper network." + }, + "BeaconUpgraded(address)": { + "details": "Emitted when the beacon is changed." + }, + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "RoleAdminChanged(bytes32,bytes32,bytes32)": { + "details": "Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._" + }, + "RoleGranted(bytes32,address,address)": { + "details": "Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}." + }, + "RoleRevoked(bytes32,address,address)": { + "details": "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`)" + }, + "Upgraded(address)": { + "details": "Emitted when the implementation is upgraded." + } + }, + "kind": "dev", + "methods": { + "constructor": { + "custom:oz-upgrades-unsafe-allow": "constructor" + }, + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "grantRole(bytes32,address)": { + "details": "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. May emit a {RoleGranted} event." + }, + "handleCharge((uint256,uint8,address,address,address),uint256)": { + "details": "Send a fee either in ETH (wei) or ERC20 to the gatekeeper. Note, ERC20 requires that the sender has approved the amount. This function uses the CEI (checks-effects-interactions) pattern to avoid reentrancy when sending ETH to the recipient (if the recipient is a smart contract)", + "params": { + "charge": "The charge details*" + } + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier." + }, + "renounceRole(bytes32,address)": { + "details": "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 revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "Common__MissingAccount()": [ + { + "notice": "The passed-in account is the zero-address" + } + ] + }, + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 811, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 814, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 793, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 1108, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 1434, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 1787, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 39, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "_roles", + "offset": 0, + "slot": "201", + "type": "t_mapping(t_bytes32,t_struct(RoleData)34_storage)" + }, + { + "astId": 334, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 12820, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "_approvals", + "offset": 0, + "slot": "251", + "type": "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_uint256,t_uint256))))" + }, + { + "astId": 12919, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_uint256,t_uint256))))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => mapping(address => mapping(uint256 => uint256))))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_address,t_mapping(t_uint256,t_uint256)))" + }, + "t_mapping(t_address,t_mapping(t_address,t_mapping(t_uint256,t_uint256)))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => mapping(uint256 => uint256)))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_bytes32,t_struct(RoleData)34_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", + "numberOfBytes": "32", + "value": "t_struct(RoleData)34_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(RoleData)34_storage": { + "encoding": "inplace", + "label": "struct AccessControlUpgradeable.RoleData", + "members": [ + { + "astId": 31, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "members", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 33, + "contract": "contracts/ChargeHandler.sol:ChargeHandler", + "label": "adminRole", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/ethereum/smart-contract/deployments/polygonAmoy/ChargeHandlerProxy.json b/ethereum/smart-contract/deployments/polygonAmoy/ChargeHandlerProxy.json new file mode 100644 index 000000000..4b5fd92a8 --- /dev/null +++ b/ethereum/smart-contract/deployments/polygonAmoy/ChargeHandlerProxy.json @@ -0,0 +1,153 @@ +{ + "address": "0xD098701586c4FDbbDf6081D2A85209C812c7D045", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x96d3b896621ae0cfb0ff04a36de696bad488313f940fc4fd9ce7a622348a1cd3", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x74489ac99AE3cE1428Ce8C8dBE374CFFc009081E", + "contractAddress": null, + "transactionIndex": 2, + "gasUsed": "302882", + "logsBloom": "0x00000004000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000008000000000000000010000000000000000000000000000000000000002800000000000000000000100000000000000000000020000000000000000000800000000000000000080000000000000400000000000000000000000000000000000204000001080000000000001000200200000800001000000000000800400000000000000000000001000000001004000000020000000000001008000040000000000000000000100100000000020000000000000000000000000010000000080000000000000000800000000100000", + "blockHash": "0x99f06e38518eb7d554b92f5adb5199b217768780d472e6916422e977f3b3bba5", + "transactionHash": "0x96d3b896621ae0cfb0ff04a36de696bad488313f940fc4fd9ce7a622348a1cd3", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 6047509, + "transactionHash": "0x96d3b896621ae0cfb0ff04a36de696bad488313f940fc4fd9ce7a622348a1cd3", + "address": "0xD098701586c4FDbbDf6081D2A85209C812c7D045", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000c02dd133ca4ce341a9a9280d8fa8e9433c16a13a" + ], + "data": "0x", + "logIndex": 6, + "blockHash": "0x99f06e38518eb7d554b92f5adb5199b217768780d472e6916422e977f3b3bba5" + }, + { + "transactionIndex": 2, + "blockNumber": 6047509, + "transactionHash": "0x96d3b896621ae0cfb0ff04a36de696bad488313f940fc4fd9ce7a622348a1cd3", + "address": "0xD098701586c4FDbbDf6081D2A85209C812c7D045", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000074489ac99ae3ce1428ce8c8dbe374cffc009081e", + "0x0000000000000000000000004e59b44847b379578588920ca78fbf26c0b4956c" + ], + "data": "0x", + "logIndex": 7, + "blockHash": "0x99f06e38518eb7d554b92f5adb5199b217768780d472e6916422e977f3b3bba5" + }, + { + "transactionIndex": 2, + "blockNumber": 6047509, + "transactionHash": "0x96d3b896621ae0cfb0ff04a36de696bad488313f940fc4fd9ce7a622348a1cd3", + "address": "0xD098701586c4FDbbDf6081D2A85209C812c7D045", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 8, + "blockHash": "0x99f06e38518eb7d554b92f5adb5199b217768780d472e6916422e977f3b3bba5" + }, + { + "transactionIndex": 2, + "blockNumber": 6047509, + "transactionHash": "0x96d3b896621ae0cfb0ff04a36de696bad488313f940fc4fd9ce7a622348a1cd3", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x00000000000000000000000074489ac99ae3ce1428ce8c8dbe374cffc009081e", + "0x00000000000000000000000009207a6efee346cb3e4a54ac18523e3715d38b3f" + ], + "data": "0x00000000000000000000000000000000000000000000000000033a68a253cefe0000000000000000000000000000000000000000000000000663ce0098a13efe0000000000000000000000000000000000000000000000ae753524565344507900000000000000000000000000000000000000000000000006609397f64d70000000000000000000000000000000000000000000000000ae75385ebef5981f77", + "logIndex": 9, + "blockHash": "0x99f06e38518eb7d554b92f5adb5199b217768780d472e6916422e977f3b3bba5" + } + ], + "blockNumber": 6047509, + "cumulativeGasUsed": "594712", + "status": 1, + "byzantium": true + }, + "args": [ + "0xc02Dd133Ca4cE341A9a9280d8FA8e9433C16A13A", + "0xc4d66de800000000000000000000000074489ac99ae3ce1428ce8c8dbe374cffc009081e" + ], + "numDeployments": 1, + "bytecode": "0x60806040526040516107353803806107358339810160408190526100229161031e565b61002e82826000610035565b505061043b565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d0838360405180606001604052806027815260200161070e602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100641760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103ec565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a0578251610299576001600160a01b0385163b6102995760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102aa565b6102aa83836102b2565b949350505050565b8151156102c25781518083602001fd5b8060405162461bcd60e51b81526004016101489190610408565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561030d5781810151838201526020016102f5565b838111156100645750506000910152565b6000806040838503121561033157600080fd5b82516001600160a01b038116811461034857600080fd5b60208401519092506001600160401b038082111561036557600080fd5b818501915085601f83011261037957600080fd5b81518181111561038b5761038b6102dc565b604051601f8201601f19908116603f011681019083821181831017156103b3576103b36102dc565b816040528281528860208487010111156103cc57600080fd5b6103dd8360208301602088016102f2565b80955050505050509250929050565b600082516103fe8184602087016102f2565b9190910192915050565b60208152600082518060208401526104278160408501602087016102f2565b601f01601f19169190910160400192915050565b6102c48061044a6000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610067565b61009f565b565b606061004e8383604051806060016040528060278152602001610268602791396100c3565b9392505050565b6001600160a01b03163b151590565b90565b600061009a7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100be573d6000f35b3d6000fd5b6060600080856001600160a01b0316856040516100e09190610218565b600060405180830381855af49150503d806000811461011b576040519150601f19603f3d011682016040523d82523d6000602084013e610120565b606091505b50915091506101318683838761013b565b9695505050505050565b606083156101ac5782516101a5576001600160a01b0385163b6101a55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b50816101b6565b6101b683836101be565b949350505050565b8151156101ce5781518083602001fd5b8060405162461bcd60e51b815260040161019c9190610234565b60005b838110156102035781810151838201526020016101eb565b83811115610212576000848401525b50505050565b6000825161022a8184602087016101e8565b9190910192915050565b60208152600082518060208401526102538160408501602087016101e8565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220ff8e6f2d761d58b3bd984933269e01a7ff1f70a460b808056daa4cff1ee8ab6964736f6c63430008090033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040523661001357610011610017565b005b6100115b610027610022610067565b61009f565b565b606061004e8383604051806060016040528060278152602001610268602791396100c3565b9392505050565b6001600160a01b03163b151590565b90565b600061009a7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100be573d6000f35b3d6000fd5b6060600080856001600160a01b0316856040516100e09190610218565b600060405180830381855af49150503d806000811461011b576040519150601f19603f3d011682016040523d82523d6000602084013e610120565b606091505b50915091506101318683838761013b565b9695505050505050565b606083156101ac5782516101a5576001600160a01b0385163b6101a55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b50816101b6565b6101b683836101be565b949350505050565b8151156101ce5781518083602001fd5b8060405162461bcd60e51b815260040161019c9190610234565b60005b838110156102035781810151838201526020016101eb565b83811115610212576000848401525b50505050565b6000825161022a8184602087016101e8565b9190910192915050565b60208152600082518060208401526102538160408501602087016101e8565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220ff8e6f2d761d58b3bd984933269e01a7ff1f70a460b808056daa4cff1ee8ab6964736f6c63430008090033" +} \ No newline at end of file diff --git a/ethereum/smart-contract/deployments/polygonAmoy/FlagsStorage.json b/ethereum/smart-contract/deployments/polygonAmoy/FlagsStorage.json new file mode 100644 index 000000000..0835b1534 --- /dev/null +++ b/ethereum/smart-contract/deployments/polygonAmoy/FlagsStorage.json @@ -0,0 +1,751 @@ +{ + "address": "0xe25c6C4FCAec2010bAE4B05d863BE2A5a5DB940F", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "Common__MissingAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Common__NotSuperAdmin", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "flag", + "type": "bytes32" + } + ], + "name": "FlagsStorage__FlagAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "flag", + "type": "bytes32" + } + ], + "name": "FlagsStorage__FlagNotSupported", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "FlagsStorage__IncorrectVariableLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "index", + "type": "uint8" + } + ], + "name": "FlagsStorage__IndexAlreadyUsed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "flag", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "index", + "type": "uint8" + } + ], + "name": "FlagAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "flag", + "type": "bytes32" + } + ], + "name": "FlagRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "prevSuperAdmin", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "superAdmin", + "type": "address" + } + ], + "name": "SuperAdminUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "flag", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "index", + "type": "uint8" + } + ], + "name": "addFlag", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "flags", + "type": "bytes32[]" + }, + { + "internalType": "uint8[]", + "name": "indexes", + "type": "uint8[]" + } + ], + "name": "addFlags", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "flagIndexes", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_superAdmin", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "flag", + "type": "bytes32" + } + ], + "name": "isFlagSupported", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "flag", + "type": "bytes32" + } + ], + "name": "removeFlag", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "flags", + "type": "bytes32[]" + } + ], + "name": "removeFlags", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "superAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "supportedFlagsMask", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newSuperAdmin", + "type": "address" + } + ], + "name": "updateSuperAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x6a063a59ef218afbe11cd573212564a7edeaee5297b59d0d3cfac01fc173c2cd", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x74489ac99AE3cE1428Ce8C8dBE374CFFc009081E", + "contractAddress": null, + "transactionIndex": 2, + "gasUsed": "1170386", + "logsBloom": "0x00000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000008000000000000080000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000400000000000000000080000000000000000000000000080000000000000000000200000800000000000000000000400000000000000000000000002000000004000000000000000000001008000040000000000010000000000100000000000000000000000000000000000000000000000000000000000000000000000100000", + "blockHash": "0x6cd63c2778eb561601f034ad8a3c2d12c74bb7f39db12405b6b2de1fa56c7096", + "transactionHash": "0x6a063a59ef218afbe11cd573212564a7edeaee5297b59d0d3cfac01fc173c2cd", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 5733382, + "transactionHash": "0x6a063a59ef218afbe11cd573212564a7edeaee5297b59d0d3cfac01fc173c2cd", + "address": "0xe25c6C4FCAec2010bAE4B05d863BE2A5a5DB940F", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 9, + "blockHash": "0x6cd63c2778eb561601f034ad8a3c2d12c74bb7f39db12405b6b2de1fa56c7096" + }, + { + "transactionIndex": 2, + "blockNumber": 5733382, + "transactionHash": "0x6a063a59ef218afbe11cd573212564a7edeaee5297b59d0d3cfac01fc173c2cd", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x00000000000000000000000074489ac99ae3ce1428ce8c8dbe374cffc009081e", + "0x0000000000000000000000006ab3d36c46ecfb9b9c0bd51cb1c3da5a2c81cea6" + ], + "data": "0x000000000000000000000000000000000000000000000000000d4e4584a65eb200000000000000000000000000000000000000000000000006ccd46763f1000000000000000000000000000000000000000000000000008c8dc2e110094d871900000000000000000000000000000000000000000000000006bf8621df4aa14e00000000000000000000000000000000000000000000008c8dd02f558df3e5cb", + "logIndex": 10, + "blockHash": "0x6cd63c2778eb561601f034ad8a3c2d12c74bb7f39db12405b6b2de1fa56c7096" + } + ], + "blockNumber": 5733382, + "cumulativeGasUsed": "1319977", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "87b3170c5841073ac3f676d17cabccfa", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"Common__MissingAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Common__NotSuperAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"flag\",\"type\":\"bytes32\"}],\"name\":\"FlagsStorage__FlagAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"flag\",\"type\":\"bytes32\"}],\"name\":\"FlagsStorage__FlagNotSupported\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"actual\",\"type\":\"uint256\"}],\"name\":\"FlagsStorage__IncorrectVariableLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"index\",\"type\":\"uint8\"}],\"name\":\"FlagsStorage__IndexAlreadyUsed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"flag\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"index\",\"type\":\"uint8\"}],\"name\":\"FlagAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"flag\",\"type\":\"bytes32\"}],\"name\":\"FlagRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"prevSuperAdmin\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"superAdmin\",\"type\":\"address\"}],\"name\":\"SuperAdminUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"flag\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"index\",\"type\":\"uint8\"}],\"name\":\"addFlag\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"flags\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8[]\",\"name\":\"indexes\",\"type\":\"uint8[]\"}],\"name\":\"addFlags\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"flagIndexes\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_superAdmin\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"flag\",\"type\":\"bytes32\"}],\"name\":\"isFlagSupported\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"flag\",\"type\":\"bytes32\"}],\"name\":\"removeFlag\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"flags\",\"type\":\"bytes32[]\"}],\"name\":\"removeFlags\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"superAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"supportedFlagsMask\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newSuperAdmin\",\"type\":\"address\"}],\"name\":\"updateSuperAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"FlagsStorage is the main contract to store KYC-related flags for Gateway Token System. KYC flags are identifiable by short identifiers in bytes32 strings. After adding flags those bit indexes could be used by GatewayToken implementations to associate flags per token.\",\"errors\":{\"Common__NotSuperAdmin(address)\":[{\"params\":{\"account\":\"address of the account.\"}}],\"FlagsStorage__FlagAlreadyExists(bytes32)\":[{\"params\":{\"flag\":\"The flag being added\"}}],\"FlagsStorage__FlagNotSupported(bytes32)\":[{\"params\":{\"flag\":\"The flag being removed\"}}],\"FlagsStorage__IncorrectVariableLength(uint256,uint256)\":[{\"params\":{\"actual\":\"The number of indexes passed in\",\"expected\":\"The number of flags passed in\"}}],\"FlagsStorage__IndexAlreadyUsed(uint8)\":[{\"params\":{\"index\":\"The flag index\"}}]},\"kind\":\"dev\",\"methods\":{\"addFlag(bytes32,uint8)\":{\"details\":\"Triggers to add new flag into gateway token system\",\"params\":{\"flag\":\"Flag short identifier\",\"index\":\"Flag index (limited to 255)\"}},\"addFlags(bytes32[],uint8[])\":{\"details\":\"Triggers to add multiple flags into gateway token system\",\"params\":{\"flags\":\"Array of flag short identifiers\",\"indexes\":\"Array of flag indexes (limited to 255)\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"isFlagSupported(bytes32)\":{\"details\":\"Triggers to check if a particular flag is supported\",\"params\":{\"flag\":\"Flag short identifier\"},\"returns\":{\"_0\":\"Boolean for flag support\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"removeFlag(bytes32)\":{\"details\":\"Triggers to remove existing flag from gateway token system\",\"params\":{\"flag\":\"Flag short identifier\"}},\"removeFlags(bytes32[])\":{\"details\":\"Triggers to remove multiple existing flags from gateway token system\",\"params\":{\"flags\":\"Array of flag short identifiers\"}},\"updateSuperAdmin(address)\":{\"details\":\"Triggers to transfer ownership of this contract to new super admin, reverts on zero address and wallet addresses\",\"params\":{\"newSuperAdmin\":\"New super admin contract address\"}},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"}},\"stateVariables\":{\"flagIndexes\":{\"details\":\"Triggers to get flag index from flags mapping\"},\"superAdmin\":{\"details\":\"Triggers to get DAO Controller address\"},\"supportedFlagsMask\":{\"details\":\"Triggers to get bitmask of all supported flags\"}},\"version\":1},\"userdoc\":{\"errors\":{\"Common__MissingAccount()\":[{\"notice\":\"The passed-in account is the zero-address\"}],\"Common__NotSuperAdmin(address)\":[{\"notice\":\"The passed-in account is not a super-admin\"}],\"FlagsStorage__FlagAlreadyExists(bytes32)\":[{\"notice\":\"The flag being added already exists\"}],\"FlagsStorage__FlagNotSupported(bytes32)\":[{\"notice\":\"The flag being removed does not exist\"}],\"FlagsStorage__IncorrectVariableLength(uint256,uint256)\":[{\"notice\":\"Multiple flags updated but the number of flags passed in does not match the number of indexes\"}],\"FlagsStorage__IndexAlreadyUsed(uint8)\":[{\"notice\":\"The flag index is already used\"}]},\"kind\":\"user\",\"methods\":{\"addFlag(bytes32,uint8)\":{\"notice\":\"Only executed by existing DAO Manager\"},\"addFlags(bytes32[],uint8[])\":{\"notice\":\"Only executed by existing DAO Manager\"},\"removeFlag(bytes32)\":{\"notice\":\"Only executed by existing DAO Manager\"},\"removeFlags(bytes32[])\":{\"notice\":\"Only executed by existing DAO Manager\"},\"updateSuperAdmin(address)\":{\"notice\":\"Only executed by existing super admin\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/FlagsStorage.sol\":\"FlagsStorage\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.3) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.9._\\n */\\ninterface IERC1967Upgradeable {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0xb8d68221343ed784c7b76edb6a686cb65e49c476d9e22bb89a5c0c3947ff14db\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822ProxiableUpgradeable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.3) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeaconUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC1967Upgradeable.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/StorageSlotUpgradeable.sol\\\";\\nimport \\\"../utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\\n function __ERC1967Upgrade_init() internal onlyInitializing {\\n }\\n\\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\\n }\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(AddressUpgradeable.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(AddressUpgradeable.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\\n }\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\\n require(AddressUpgradeable.isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return AddressUpgradeable.verifyCallResult(success, returndata, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x1599637b52d20dc3954cea44914b2a4a9a8a5caade58d9da947e0b6c9acc07ba\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeaconUpgradeable {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x037c334add4b033ad3493038c25be1682d78c00992e1acb0e2795caff3925271\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../ERC1967/ERC1967UpgradeUpgradeable.sol\\\";\\nimport \\\"./Initializable.sol\\\";\\n\\n/**\\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSUpgradeable` with a custom implementation of upgrades.\\n *\\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\\n function __UUPSUpgradeable_init() internal onlyInitializing {\\n }\\n\\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\\n }\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n address private immutable __self = address(this);\\n\\n /**\\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\\n * fail.\\n */\\n modifier onlyProxy() {\\n require(address(this) != __self, \\\"Function must be called through delegatecall\\\");\\n require(_getImplementation() == __self, \\\"Function must be called through active proxy\\\");\\n _;\\n }\\n\\n /**\\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\\n * callable on the implementing contract but not through proxies.\\n */\\n modifier notDelegated() {\\n require(address(this) == __self, \\\"UUPSUpgradeable: must not be called through delegatecall\\\");\\n _;\\n }\\n\\n /**\\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\\n */\\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\\n return _IMPLEMENTATION_SLOT;\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeTo(address newImplementation) external virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\\n * encoded in `data`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\\n * {upgradeTo} and {upgradeToAndCall}.\\n *\\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\\n *\\n * ```solidity\\n * function _authorizeUpgrade(address) internal override onlyOwner {}\\n * ```\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x7967d130887c4b40666cd88f8744691d4527039a1b2a38aa0de41481ef646778\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlotUpgradeable {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0x09864aea84f01e39313375b5610c73a3c1c68abbdc51e5ccdd25ff977fdadf9a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\n * unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\n * array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n bytes32[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0xc3ff3f5c4584e1d9a483ad7ced51ab64523201f4e3d3c65293e4ca8aeb77a961\",\"license\":\"MIT\"},\"contracts/FlagsStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport {UUPSUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\\\";\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {EnumerableSet} from \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {IFlagsStorage} from \\\"./interfaces/IFlagsStorage.sol\\\";\\nimport {BitMask} from \\\"./library/BitMask.sol\\\";\\nimport {Common__NotSuperAdmin, Common__MissingAccount} from \\\"./library/CommonErrors.sol\\\";\\n\\n/**\\n * @dev FlagsStorage is the main contract to store KYC-related flags for Gateway Token System.\\n * KYC flags are identifiable by short identifiers in bytes32 strings. After adding flags\\n * those bit indexes could be used by GatewayToken implementations to associate flags per token.\\n */\\ncontract FlagsStorage is Initializable, IFlagsStorage, UUPSUpgradeable {\\n using EnumerableSet for EnumerableSet.Bytes32Set;\\n using Address for address;\\n using BitMask for uint256;\\n\\n EnumerableSet.Bytes32Set private _supportedFlags;\\n\\n address public superAdmin;\\n\\n uint256 public supportedFlagsMask;\\n\\n mapping(bytes32 => uint8) public flagIndexes;\\n\\n /// The flag being added already exists\\n /// @param flag The flag being added\\n error FlagsStorage__FlagAlreadyExists(bytes32 flag);\\n\\n /// The flag being removed does not exist\\n /// @param flag The flag being removed\\n error FlagsStorage__FlagNotSupported(bytes32 flag);\\n\\n /// Multiple flags updated but the number of flags passed in does not match the number of indexes\\n /// @param expected The number of flags passed in\\n /// @param actual The number of indexes passed in\\n error FlagsStorage__IncorrectVariableLength(uint256 expected, uint256 actual);\\n\\n /// The flag index is already used\\n /// @param index The flag index\\n error FlagsStorage__IndexAlreadyUsed(uint8 index);\\n\\n // @dev Modifier to prevent calls from anyone except Identity.com Admin\\n modifier onlySuperAdmin() {\\n _onlySuperAdmin();\\n _;\\n }\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n // empty constructor in line with the UUPS upgradeable proxy pattern\\n // solhint-disable-next-line no-empty-blocks\\n constructor() {\\n _disableInitializers();\\n }\\n\\n function initialize(address _superAdmin) external initializer {\\n if (_superAdmin == address(0)) revert Common__MissingAccount();\\n superAdmin = _superAdmin;\\n }\\n\\n /**\\n * @dev Triggers to transfer ownership of this contract to\\n * new super admin, reverts on zero address and wallet addresses\\n * @param newSuperAdmin New super admin contract address\\n * @notice Only executed by existing super admin\\n */\\n function updateSuperAdmin(address newSuperAdmin) external onlySuperAdmin {\\n if (newSuperAdmin == address(0)) revert Common__MissingAccount();\\n\\n emit SuperAdminUpdated(superAdmin, newSuperAdmin);\\n superAdmin = newSuperAdmin;\\n }\\n\\n /**\\n * @dev Triggers to add new flag into gateway token system\\n * @param flag Flag short identifier\\n * @param index Flag index (limited to 255)\\n * @notice Only executed by existing DAO Manager\\n */\\n function addFlag(bytes32 flag, uint8 index) external onlySuperAdmin {\\n _addFlag(flag, index);\\n }\\n\\n /**\\n * @dev Triggers to add multiple flags into gateway token system\\n * @param flags Array of flag short identifiers\\n * @param indexes Array of flag indexes (limited to 255)\\n * @notice Only executed by existing DAO Manager\\n */\\n function addFlags(bytes32[] calldata flags, uint8[] calldata indexes) external onlySuperAdmin {\\n if (flags.length != indexes.length) revert FlagsStorage__IncorrectVariableLength(flags.length, indexes.length);\\n\\n uint256 length = flags.length;\\n for (uint8 i = 0; i < length; i++) {\\n _addFlag(flags[i], indexes[i]);\\n }\\n }\\n\\n /**\\n * @dev Triggers to remove existing flag from gateway token system\\n * @param flag Flag short identifier\\n * @notice Only executed by existing DAO Manager\\n */\\n function removeFlag(bytes32 flag) external onlySuperAdmin {\\n if (!_supportedFlags.contains(flag)) revert FlagsStorage__FlagNotSupported(flag);\\n\\n _removeFlag(flag);\\n }\\n\\n /**\\n * @dev Triggers to remove multiple existing flags from gateway token system\\n * @param flags Array of flag short identifiers\\n * @notice Only executed by existing DAO Manager\\n */\\n function removeFlags(bytes32[] calldata flags) external onlySuperAdmin {\\n uint256 length = flags.length;\\n for (uint8 i = 0; i < length; i++) {\\n // additional check to reduce incorrect FlagRemoved events\\n if (!_supportedFlags.contains(flags[i])) revert FlagsStorage__FlagNotSupported(flags[i]);\\n\\n _removeFlag(flags[i]);\\n }\\n }\\n\\n /**\\n * @dev Triggers to check if a particular flag is supported\\n * @param flag Flag short identifier\\n * @return Boolean for flag support\\n */\\n function isFlagSupported(bytes32 flag) external view returns (bool) {\\n return _supportedFlags.contains(flag);\\n }\\n\\n /**\\n * @dev Internal function to add new flag\\n */\\n function _addFlag(bytes32 flag, uint8 index) internal {\\n if (supportedFlagsMask.checkBit(index)) revert FlagsStorage__IndexAlreadyUsed(index);\\n if (_supportedFlags.contains(flag)) revert FlagsStorage__FlagAlreadyExists(flag);\\n\\n flagIndexes[flag] = index;\\n _supportedFlags.add(flag);\\n supportedFlagsMask = supportedFlagsMask.setBit(index);\\n\\n emit FlagAdded(flag, index);\\n }\\n\\n /**\\n * @dev Internal function to remove existing flag\\n */\\n function _removeFlag(bytes32 flag) internal {\\n _supportedFlags.remove(flag);\\n uint8 _index = flagIndexes[flag];\\n\\n supportedFlagsMask = supportedFlagsMask.clearBit(_index);\\n delete flagIndexes[flag];\\n\\n emit FlagRemoved(flag);\\n }\\n\\n // includes the onlySuperAdmin modifier to ensure that only the super admin can call this function\\n // otherwise, no other logic.\\n // solhint-disable-next-line no-empty-blocks\\n function _authorizeUpgrade(address) internal override onlySuperAdmin {}\\n\\n // separate into a private function to reduce code size\\n function _onlySuperAdmin() private view {\\n if (msg.sender != superAdmin) revert Common__NotSuperAdmin(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0x8e1e63b5fcf5eee1ea61560f85b19b00c6e0dd869efa1f2f88fecab311ef601f\",\"license\":\"MIT\"},\"contracts/interfaces/IFlagsStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\npragma experimental ABIEncoderV2;\\n\\ninterface IFlagsStorage {\\n /**\\n * @dev Emitted when DAO Controller is updated from `prevDAOController` to `daoController`.\\n */\\n event SuperAdminUpdated(address indexed prevSuperAdmin, address indexed superAdmin);\\n\\n /**\\n * @dev Emitted when new flag is added with `flag` short code and `index`.\\n */\\n event FlagAdded(bytes32 indexed flag, uint8 index);\\n\\n /**\\n * @dev Emitted when existing flag is removed from FlagsStorage by `flag` short code.\\n */\\n event FlagRemoved(bytes32 indexed flag);\\n\\n /**\\n * @dev Triggers to add new flag into gateway token system\\n * @param _flag Flag short identifier\\n * @param _index Flag index (limited to 255)\\n * @notice Only executed by existing DAO Manager\\n */\\n function addFlag(bytes32 _flag, uint8 _index) external;\\n\\n /**\\n * @dev Triggers to add multiple flags into gateway token system\\n * @param _flags Array of flag short identifiers\\n * @param _indexes Array of flag indexes (limited to 255)\\n * @notice Only executed by existing DAO Manager\\n */\\n function addFlags(bytes32[] memory _flags, uint8[] memory _indexes) external;\\n\\n /**\\n * @dev Triggers to remove existing flag from gateway token system\\n * @param _flag Flag short identifier\\n * @notice Only executed by existing DAO Manager\\n */\\n function removeFlag(bytes32 _flag) external;\\n\\n /**\\n * @dev Triggers to remove multiple existing flags from gateway token system\\n * @param _flags Array of flag short identifiers\\n * @notice Only executed by existing DAO Manager\\n */\\n function removeFlags(bytes32[] memory _flags) external;\\n\\n /**\\n * @dev Triggers to transfer ownership of this contract to new DAO Controller,\\n * reverts on zero address and wallet addresses\\n * @param _newSuperAdmin New DAO Controller contract address\\n * @notice Only executed by existing DAO Manager\\n */\\n function updateSuperAdmin(address _newSuperAdmin) external;\\n\\n /**\\n * @dev Triggers to get DAO Controller address\\n */\\n function superAdmin() external view returns (address);\\n\\n /**\\n * @dev Triggers to get flag index from flags mapping\\n */\\n function flagIndexes(bytes32) external view returns (uint8);\\n\\n /**\\n * @dev Triggers to check if a particular flag is supported\\n * @param _flag Flag short identifier\\n * @return Boolean for flag support\\n */\\n function isFlagSupported(bytes32 _flag) external view returns (bool);\\n\\n /**\\n * @dev Triggers to get bitmask of all supported flags\\n */\\n function supportedFlagsMask() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x91857a7229c4eff5a53b97652a1ddd6f4df6682b2119c7b3573b402a7fb40395\",\"license\":\"MIT\"},\"contracts/library/BitMask.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nlibrary BitMask {\\n uint internal constant _ONE = uint256(1);\\n\\n /**\\n * @dev Internal function to set 1 bit in specific `index`\\n * @return Updated bitmask with modified bit at `index`\\n */\\n function setBit(uint256 self, uint8 index) internal pure returns (uint256) {\\n return self | (_ONE << index);\\n }\\n\\n /**\\n * @dev Internal function to clear bit to 0 in specific `index`\\n * @return Updated bitmask with modified bit at `index`\\n */\\n function clearBit(uint256 self, uint8 index) internal pure returns (uint256) {\\n return self & ~(_ONE << index);\\n }\\n\\n /**\\n * @dev Internal function to check bit at specific `index`\\n * @return Returns TRUE if bit is '1', FALSE otherwise\\n */\\n function checkBit(uint256 self, uint8 index) internal pure returns (bool) {\\n return (self & (uint256(1) << index)) > 0;\\n }\\n}\\n\",\"keccak256\":\"0xce0c8b218f0f29ce45ee7b5b0c4148fbf3aa3d5605639de4d3cd813047bd9026\",\"license\":\"MIT\"},\"contracts/library/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.8.9;\\n\\n/// The passed-in account is the zero-address\\nerror Common__MissingAccount();\\n\\n/// The passed-in account is not a contract, where an account is expected\\n/// @param account address of the account.\\nerror Common__NotContract(address account);\\n\\n/// The passed-in account is not a super-admin\\n/// @param account address of the account.\\nerror Common__NotSuperAdmin(address account);\\n\\n/// The request was made from an unauthorized address.\\n/// @param sender address of the sender.\\n/// @param domain the domain to which the role applies.\\n/// @param role role that is required.\\nerror Common__Unauthorized(address sender, uint domain, bytes32 role);\\n\",\"keccak256\":\"0xa3c8ca2572011971234d2126d48bba7046923ca70f3aba0fb8539165f7d0dade\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100e2565b600054610100900460ff161561008e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100e0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516113b361011960003960008181610366015281816103a60152818161042f0152818161046f01526104eb01526113b36000f3fe6080604052600436106100b25760003560e01c8063661870b11161006f578063661870b1146101825780638e7de730146101c4578063a3d0bb2a146101e4578063a64a095614610214578063b3b48bc214610234578063c4d66de814610254578063cae43fd81461027457600080fd5b8063243da6a7146100b757806329575f6a146100e05780633551f2e3146101185780633659cfe61461013a5780634f1ef2861461015a57806352d1902d1461016d575b600080fd5b3480156100c357600080fd5b506100cd60685481565b6040519081526020015b60405180910390f35b3480156100ec57600080fd5b50606754610100906001600160a01b031681565b6040516001600160a01b0390911681526020016100d7565b34801561012457600080fd5b50610138610133366004610f63565b610294565b005b34801561014657600080fd5b50610138610155366004610fc1565b61035b565b610138610168366004610ff2565b610424565b34801561017957600080fd5b506100cd6104de565b34801561018e57600080fd5b506101b261019d3660046110b4565b60696020526000908152604090205460ff1681565b60405160ff90911681526020016100d7565b3480156101d057600080fd5b506101386101df3660046110b4565b61058c565b3480156101f057600080fd5b506102046101ff3660046110b4565b6105c8565b60405190151581526020016100d7565b34801561022057600080fd5b5061013861022f3660046110de565b6105db565b34801561024057600080fd5b5061013861024f36600461110a565b6105ed565b34801561026057600080fd5b5061013861026f366004610fc1565b610696565b34801561028057600080fd5b5061013861028f366004610fc1565b6107e1565b61029c61086c565b8060005b818160ff161015610355576102da84848360ff168181106102c3576102c3611176565b90506020020135606561089b90919063ffffffff16565b61031f5783838260ff168181106102f3576102f3611176565b905060200201356040516356f1aded60e01b815260040161031691815260200190565b60405180910390fd5b61034384848360ff1681811061033757610337611176565b905060200201356108b6565b8061034d816111a2565b9150506102a0565b50505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156103a45760405162461bcd60e51b8152600401610316906111c2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166103d661091c565b6001600160a01b0316146103fc5760405162461bcd60e51b81526004016103169061120e565b61040581610938565b6040805160008082526020820190925261042191839190610940565b50565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561046d5760405162461bcd60e51b8152600401610316906111c2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661049f61091c565b6001600160a01b0316146104c55760405162461bcd60e51b81526004016103169061120e565b6104ce82610938565b6104da82826001610940565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105795760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608401610316565b5060008051602061133783398151915290565b61059461086c565b61059f60658261089b565b6105bf576040516356f1aded60e01b815260048101829052602401610316565b610421816108b6565b60006105d560658361089b565b92915050565b6105e361086c565b6104da8282610abf565b6105f561086c565b82811461061f576040516308d351ab60e01b81526004810184905260248101829052604401610316565b8260005b818160ff16101561068e5761067c86868360ff1681811061064657610646611176565b9050602002013585858460ff1681811061066257610662611176565b9050602002016020810190610677919061125a565b610abf565b80610686816111a2565b915050610623565b505050505050565b600054610100900460ff16158080156106b65750600054600160ff909116105b806106d05750303b1580156106d0575060005460ff166001145b6107335760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610316565b6000805460ff191660011790558015610756576000805461ff0019166101001790555b6001600160a01b03821661077d57604051630ca2c90160e21b815260040160405180910390fd5b606780546001600160a01b0319166001600160a01b03841617905580156104da576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6107e961086c565b6001600160a01b03811661081057604051630ca2c90160e21b815260040160405180910390fd5b6067546040516001600160a01b038084169216907fd0f5553fb48dccd0de81c4705fa3feaf0b9a936a294741cfb724c33b8373f0c190600090a3606780546001600160a01b0319166001600160a01b0392909216919091179055565b6067546001600160a01b0316331461089957604051632957ccdd60e21b8152336004820152602401610316565b565b600081815260018301602052604081205415155b9392505050565b6108c1606582610b8a565b50600081815260696020526040808220805460688054600160ff90931692831b19169055815460ff19169091559051909183917fb4e020b0ecc1c15088dc1d0790a96729268843758491c25d3fa0450d8a9ad34d9190a25050565b600080516020611337833981519152546001600160a01b031690565b61042161086c565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156109785761097383610b96565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b157600080fd5b505afa9250505080156109e1575060408051601f3d908101601f191682019092526109de91810190611275565b60015b610a445760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610316565b6000805160206113378339815191528114610ab35760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610316565b50610973838383610c32565b606854600160ff83161b1615610aed5760405163f70e2d6b60e01b815260ff82166004820152602401610316565b610af860658361089b565b15610b19576040516313ac19e560e01b815260048101839052602401610316565b6000828152606960205260409020805460ff191660ff8316179055610b3f606583610c57565b50606854600160ff83161b1760685560405160ff8216815282907fdd0fa0fc5900cc449b60e07ecc54e117f3828a22f16d74c408c3d456d69f25fe9060200160405180910390a25050565b60006108af8383610c63565b6001600160a01b0381163b610c035760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610316565b60008051602061133783398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610c3b83610d56565b600082511180610c485750805b15610973576103558383610d96565b60006108af8383610e8a565b60008181526001830160205260408120548015610d4c576000610c8760018361128e565b8554909150600090610c9b9060019061128e565b9050818114610d00576000866000018281548110610cbb57610cbb611176565b9060005260206000200154905080876000018481548110610cde57610cde611176565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610d1157610d116112a5565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105d5565b60009150506105d5565b610d5f81610b96565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b610dfe5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610316565b600080846001600160a01b031684604051610e1991906112e7565b600060405180830381855af49150503d8060008114610e54576040519150601f19603f3d011682016040523d82523d6000602084013e610e59565b606091505b5091509150610e81828260405180606001604052806027815260200161135760279139610ed9565b95945050505050565b6000818152600183016020526040812054610ed1575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105d5565b5060006105d5565b60608315610ee85750816108af565b6108af8383815115610efd5781518083602001fd5b8060405162461bcd60e51b81526004016103169190611303565b60008083601f840112610f2957600080fd5b50813567ffffffffffffffff811115610f4157600080fd5b6020830191508360208260051b8501011115610f5c57600080fd5b9250929050565b60008060208385031215610f7657600080fd5b823567ffffffffffffffff811115610f8d57600080fd5b610f9985828601610f17565b90969095509350505050565b80356001600160a01b0381168114610fbc57600080fd5b919050565b600060208284031215610fd357600080fd5b6108af82610fa5565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561100557600080fd5b61100e83610fa5565b9150602083013567ffffffffffffffff8082111561102b57600080fd5b818501915085601f83011261103f57600080fd5b81358181111561105157611051610fdc565b604051601f8201601f19908116603f0116810190838211818310171561107957611079610fdc565b8160405282815288602084870101111561109257600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6000602082840312156110c657600080fd5b5035919050565b803560ff81168114610fbc57600080fd5b600080604083850312156110f157600080fd5b82359150611101602084016110cd565b90509250929050565b6000806000806040858703121561112057600080fd5b843567ffffffffffffffff8082111561113857600080fd5b61114488838901610f17565b9096509450602087013591508082111561115d57600080fd5b5061116a87828801610f17565b95989497509550505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff8114156111b9576111b961118c565b60010192915050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60006020828403121561126c57600080fd5b6108af826110cd565b60006020828403121561128757600080fd5b5051919050565b6000828210156112a0576112a061118c565b500390565b634e487b7160e01b600052603160045260246000fd5b60005b838110156112d65781810151838201526020016112be565b838111156103555750506000910152565b600082516112f98184602087016112bb565b9190910192915050565b60208152600082518060208401526113228160408501602087016112bb565b601f01601f1916919091016040019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212201e719dea5774070b82f10db0c95c1f485c8dbee7ffedbb49ecd18b6e4a1eabee64736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100b25760003560e01c8063661870b11161006f578063661870b1146101825780638e7de730146101c4578063a3d0bb2a146101e4578063a64a095614610214578063b3b48bc214610234578063c4d66de814610254578063cae43fd81461027457600080fd5b8063243da6a7146100b757806329575f6a146100e05780633551f2e3146101185780633659cfe61461013a5780634f1ef2861461015a57806352d1902d1461016d575b600080fd5b3480156100c357600080fd5b506100cd60685481565b6040519081526020015b60405180910390f35b3480156100ec57600080fd5b50606754610100906001600160a01b031681565b6040516001600160a01b0390911681526020016100d7565b34801561012457600080fd5b50610138610133366004610f63565b610294565b005b34801561014657600080fd5b50610138610155366004610fc1565b61035b565b610138610168366004610ff2565b610424565b34801561017957600080fd5b506100cd6104de565b34801561018e57600080fd5b506101b261019d3660046110b4565b60696020526000908152604090205460ff1681565b60405160ff90911681526020016100d7565b3480156101d057600080fd5b506101386101df3660046110b4565b61058c565b3480156101f057600080fd5b506102046101ff3660046110b4565b6105c8565b60405190151581526020016100d7565b34801561022057600080fd5b5061013861022f3660046110de565b6105db565b34801561024057600080fd5b5061013861024f36600461110a565b6105ed565b34801561026057600080fd5b5061013861026f366004610fc1565b610696565b34801561028057600080fd5b5061013861028f366004610fc1565b6107e1565b61029c61086c565b8060005b818160ff161015610355576102da84848360ff168181106102c3576102c3611176565b90506020020135606561089b90919063ffffffff16565b61031f5783838260ff168181106102f3576102f3611176565b905060200201356040516356f1aded60e01b815260040161031691815260200190565b60405180910390fd5b61034384848360ff1681811061033757610337611176565b905060200201356108b6565b8061034d816111a2565b9150506102a0565b50505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156103a45760405162461bcd60e51b8152600401610316906111c2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166103d661091c565b6001600160a01b0316146103fc5760405162461bcd60e51b81526004016103169061120e565b61040581610938565b6040805160008082526020820190925261042191839190610940565b50565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561046d5760405162461bcd60e51b8152600401610316906111c2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661049f61091c565b6001600160a01b0316146104c55760405162461bcd60e51b81526004016103169061120e565b6104ce82610938565b6104da82826001610940565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105795760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608401610316565b5060008051602061133783398151915290565b61059461086c565b61059f60658261089b565b6105bf576040516356f1aded60e01b815260048101829052602401610316565b610421816108b6565b60006105d560658361089b565b92915050565b6105e361086c565b6104da8282610abf565b6105f561086c565b82811461061f576040516308d351ab60e01b81526004810184905260248101829052604401610316565b8260005b818160ff16101561068e5761067c86868360ff1681811061064657610646611176565b9050602002013585858460ff1681811061066257610662611176565b9050602002016020810190610677919061125a565b610abf565b80610686816111a2565b915050610623565b505050505050565b600054610100900460ff16158080156106b65750600054600160ff909116105b806106d05750303b1580156106d0575060005460ff166001145b6107335760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610316565b6000805460ff191660011790558015610756576000805461ff0019166101001790555b6001600160a01b03821661077d57604051630ca2c90160e21b815260040160405180910390fd5b606780546001600160a01b0319166001600160a01b03841617905580156104da576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6107e961086c565b6001600160a01b03811661081057604051630ca2c90160e21b815260040160405180910390fd5b6067546040516001600160a01b038084169216907fd0f5553fb48dccd0de81c4705fa3feaf0b9a936a294741cfb724c33b8373f0c190600090a3606780546001600160a01b0319166001600160a01b0392909216919091179055565b6067546001600160a01b0316331461089957604051632957ccdd60e21b8152336004820152602401610316565b565b600081815260018301602052604081205415155b9392505050565b6108c1606582610b8a565b50600081815260696020526040808220805460688054600160ff90931692831b19169055815460ff19169091559051909183917fb4e020b0ecc1c15088dc1d0790a96729268843758491c25d3fa0450d8a9ad34d9190a25050565b600080516020611337833981519152546001600160a01b031690565b61042161086c565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156109785761097383610b96565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b157600080fd5b505afa9250505080156109e1575060408051601f3d908101601f191682019092526109de91810190611275565b60015b610a445760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610316565b6000805160206113378339815191528114610ab35760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610316565b50610973838383610c32565b606854600160ff83161b1615610aed5760405163f70e2d6b60e01b815260ff82166004820152602401610316565b610af860658361089b565b15610b19576040516313ac19e560e01b815260048101839052602401610316565b6000828152606960205260409020805460ff191660ff8316179055610b3f606583610c57565b50606854600160ff83161b1760685560405160ff8216815282907fdd0fa0fc5900cc449b60e07ecc54e117f3828a22f16d74c408c3d456d69f25fe9060200160405180910390a25050565b60006108af8383610c63565b6001600160a01b0381163b610c035760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610316565b60008051602061133783398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610c3b83610d56565b600082511180610c485750805b15610973576103558383610d96565b60006108af8383610e8a565b60008181526001830160205260408120548015610d4c576000610c8760018361128e565b8554909150600090610c9b9060019061128e565b9050818114610d00576000866000018281548110610cbb57610cbb611176565b9060005260206000200154905080876000018481548110610cde57610cde611176565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610d1157610d116112a5565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105d5565b60009150506105d5565b610d5f81610b96565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b610dfe5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610316565b600080846001600160a01b031684604051610e1991906112e7565b600060405180830381855af49150503d8060008114610e54576040519150601f19603f3d011682016040523d82523d6000602084013e610e59565b606091505b5091509150610e81828260405180606001604052806027815260200161135760279139610ed9565b95945050505050565b6000818152600183016020526040812054610ed1575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105d5565b5060006105d5565b60608315610ee85750816108af565b6108af8383815115610efd5781518083602001fd5b8060405162461bcd60e51b81526004016103169190611303565b60008083601f840112610f2957600080fd5b50813567ffffffffffffffff811115610f4157600080fd5b6020830191508360208260051b8501011115610f5c57600080fd5b9250929050565b60008060208385031215610f7657600080fd5b823567ffffffffffffffff811115610f8d57600080fd5b610f9985828601610f17565b90969095509350505050565b80356001600160a01b0381168114610fbc57600080fd5b919050565b600060208284031215610fd357600080fd5b6108af82610fa5565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561100557600080fd5b61100e83610fa5565b9150602083013567ffffffffffffffff8082111561102b57600080fd5b818501915085601f83011261103f57600080fd5b81358181111561105157611051610fdc565b604051601f8201601f19908116603f0116810190838211818310171561107957611079610fdc565b8160405282815288602084870101111561109257600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6000602082840312156110c657600080fd5b5035919050565b803560ff81168114610fbc57600080fd5b600080604083850312156110f157600080fd5b82359150611101602084016110cd565b90509250929050565b6000806000806040858703121561112057600080fd5b843567ffffffffffffffff8082111561113857600080fd5b61114488838901610f17565b9096509450602087013591508082111561115d57600080fd5b5061116a87828801610f17565b95989497509550505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff8114156111b9576111b961118c565b60010192915050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60006020828403121561126c57600080fd5b6108af826110cd565b60006020828403121561128757600080fd5b5051919050565b6000828210156112a0576112a061118c565b500390565b634e487b7160e01b600052603160045260246000fd5b60005b838110156112d65781810151838201526020016112be565b838111156103555750506000910152565b600082516112f98184602087016112bb565b9190910192915050565b60208152600082518060208401526113228160408501602087016112bb565b601f01601f1916919091016040019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212201e719dea5774070b82f10db0c95c1f485c8dbee7ffedbb49ecd18b6e4a1eabee64736f6c63430008090033", + "devdoc": { + "details": "FlagsStorage is the main contract to store KYC-related flags for Gateway Token System. KYC flags are identifiable by short identifiers in bytes32 strings. After adding flags those bit indexes could be used by GatewayToken implementations to associate flags per token.", + "errors": { + "Common__NotSuperAdmin(address)": [ + { + "params": { + "account": "address of the account." + } + } + ], + "FlagsStorage__FlagAlreadyExists(bytes32)": [ + { + "params": { + "flag": "The flag being added" + } + } + ], + "FlagsStorage__FlagNotSupported(bytes32)": [ + { + "params": { + "flag": "The flag being removed" + } + } + ], + "FlagsStorage__IncorrectVariableLength(uint256,uint256)": [ + { + "params": { + "actual": "The number of indexes passed in", + "expected": "The number of flags passed in" + } + } + ], + "FlagsStorage__IndexAlreadyUsed(uint8)": [ + { + "params": { + "index": "The flag index" + } + } + ] + }, + "kind": "dev", + "methods": { + "addFlag(bytes32,uint8)": { + "details": "Triggers to add new flag into gateway token system", + "params": { + "flag": "Flag short identifier", + "index": "Flag index (limited to 255)" + } + }, + "addFlags(bytes32[],uint8[])": { + "details": "Triggers to add multiple flags into gateway token system", + "params": { + "flags": "Array of flag short identifiers", + "indexes": "Array of flag indexes (limited to 255)" + } + }, + "constructor": { + "custom:oz-upgrades-unsafe-allow": "constructor" + }, + "isFlagSupported(bytes32)": { + "details": "Triggers to check if a particular flag is supported", + "params": { + "flag": "Flag short identifier" + }, + "returns": { + "_0": "Boolean for flag support" + } + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier." + }, + "removeFlag(bytes32)": { + "details": "Triggers to remove existing flag from gateway token system", + "params": { + "flag": "Flag short identifier" + } + }, + "removeFlags(bytes32[])": { + "details": "Triggers to remove multiple existing flags from gateway token system", + "params": { + "flags": "Array of flag short identifiers" + } + }, + "updateSuperAdmin(address)": { + "details": "Triggers to transfer ownership of this contract to new super admin, reverts on zero address and wallet addresses", + "params": { + "newSuperAdmin": "New super admin contract address" + } + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + } + }, + "stateVariables": { + "flagIndexes": { + "details": "Triggers to get flag index from flags mapping" + }, + "superAdmin": { + "details": "Triggers to get DAO Controller address" + }, + "supportedFlagsMask": { + "details": "Triggers to get bitmask of all supported flags" + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "Common__MissingAccount()": [ + { + "notice": "The passed-in account is the zero-address" + } + ], + "Common__NotSuperAdmin(address)": [ + { + "notice": "The passed-in account is not a super-admin" + } + ], + "FlagsStorage__FlagAlreadyExists(bytes32)": [ + { + "notice": "The flag being added already exists" + } + ], + "FlagsStorage__FlagNotSupported(bytes32)": [ + { + "notice": "The flag being removed does not exist" + } + ], + "FlagsStorage__IncorrectVariableLength(uint256,uint256)": [ + { + "notice": "Multiple flags updated but the number of flags passed in does not match the number of indexes" + } + ], + "FlagsStorage__IndexAlreadyUsed(uint8)": [ + { + "notice": "The flag index is already used" + } + ] + }, + "kind": "user", + "methods": { + "addFlag(bytes32,uint8)": { + "notice": "Only executed by existing DAO Manager" + }, + "addFlags(bytes32[],uint8[])": { + "notice": "Only executed by existing DAO Manager" + }, + "removeFlag(bytes32)": { + "notice": "Only executed by existing DAO Manager" + }, + "removeFlags(bytes32[])": { + "notice": "Only executed by existing DAO Manager" + }, + "updateSuperAdmin(address)": { + "notice": "Only executed by existing super admin" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 534, + "contract": "contracts/FlagsStorage.sol:FlagsStorage", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 537, + "contract": "contracts/FlagsStorage.sol:FlagsStorage", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 516, + "contract": "contracts/FlagsStorage.sol:FlagsStorage", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 831, + "contract": "contracts/FlagsStorage.sol:FlagsStorage", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 7721, + "contract": "contracts/FlagsStorage.sol:FlagsStorage", + "label": "_supportedFlags", + "offset": 0, + "slot": "101", + "type": "t_struct(Bytes32Set)4524_storage" + }, + { + "astId": 7723, + "contract": "contracts/FlagsStorage.sol:FlagsStorage", + "label": "superAdmin", + "offset": 0, + "slot": "103", + "type": "t_address" + }, + { + "astId": 7725, + "contract": "contracts/FlagsStorage.sol:FlagsStorage", + "label": "supportedFlagsMask", + "offset": 0, + "slot": "104", + "type": "t_uint256" + }, + { + "astId": 7729, + "contract": "contracts/FlagsStorage.sol:FlagsStorage", + "label": "flagIndexes", + "offset": 0, + "slot": "105", + "type": "t_mapping(t_bytes32,t_uint8)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "base": "t_bytes32", + "encoding": "dynamic_array", + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes32,t_uint8)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint8)", + "numberOfBytes": "32", + "value": "t_uint8" + }, + "t_struct(Bytes32Set)4524_storage": { + "encoding": "inplace", + "label": "struct EnumerableSet.Bytes32Set", + "members": [ + { + "astId": 4523, + "contract": "contracts/FlagsStorage.sol:FlagsStorage", + "label": "_inner", + "offset": 0, + "slot": "0", + "type": "t_struct(Set)4330_storage" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)4330_storage": { + "encoding": "inplace", + "label": "struct EnumerableSet.Set", + "members": [ + { + "astId": 4325, + "contract": "contracts/FlagsStorage.sol:FlagsStorage", + "label": "_values", + "offset": 0, + "slot": "0", + "type": "t_array(t_bytes32)dyn_storage" + }, + { + "astId": 4329, + "contract": "contracts/FlagsStorage.sol:FlagsStorage", + "label": "_indexes", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint256)" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/ethereum/smart-contract/deployments/polygonAmoy/FlagsStorageProxy.json b/ethereum/smart-contract/deployments/polygonAmoy/FlagsStorageProxy.json new file mode 100644 index 000000000..2248401d4 --- /dev/null +++ b/ethereum/smart-contract/deployments/polygonAmoy/FlagsStorageProxy.json @@ -0,0 +1,138 @@ +{ + "address": "0x490D0801844C41E88674F00940590D646E6948b8", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xb99cd87f7016441d50452a0cbe9d30c3f549450d5e16976f0496a447007c89eb", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x74489ac99AE3cE1428Ce8C8dBE374CFFc009081E", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "295854", + "logsBloom": "0x00000000080000000000000000000000400000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000080010000080000000000002800000000000000000000100000000000000000000000000000000000000000000000000000000200080000000000000400000000010000000000000000000000000000000000080000000000000000000200000800000000000000000000400000000000000000000000000000000004000000022000000000001008000040000000000010000000000100000000000002000000000000000000000000000000000000000000000000000000000100000", + "blockHash": "0xaf35af5f98c18d2581e07526c996e653391278e90d5d53196386cbe594ce6f76", + "transactionHash": "0xb99cd87f7016441d50452a0cbe9d30c3f549450d5e16976f0496a447007c89eb", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 5733385, + "transactionHash": "0xb99cd87f7016441d50452a0cbe9d30c3f549450d5e16976f0496a447007c89eb", + "address": "0x490D0801844C41E88674F00940590D646E6948b8", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000e25c6c4fcaec2010bae4b05d863be2a5a5db940f" + ], + "data": "0x", + "logIndex": 2, + "blockHash": "0xaf35af5f98c18d2581e07526c996e653391278e90d5d53196386cbe594ce6f76" + }, + { + "transactionIndex": 1, + "blockNumber": 5733385, + "transactionHash": "0xb99cd87f7016441d50452a0cbe9d30c3f549450d5e16976f0496a447007c89eb", + "address": "0x490D0801844C41E88674F00940590D646E6948b8", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 3, + "blockHash": "0xaf35af5f98c18d2581e07526c996e653391278e90d5d53196386cbe594ce6f76" + }, + { + "transactionIndex": 1, + "blockNumber": 5733385, + "transactionHash": "0xb99cd87f7016441d50452a0cbe9d30c3f549450d5e16976f0496a447007c89eb", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x00000000000000000000000074489ac99ae3ce1428ce8c8dbe374cffc009081e", + "0x0000000000000000000000006ab3d36c46ecfb9b9c0bd51cb1c3da5a2c81cea6" + ], + "data": "0x00000000000000000000000000000000000000000000000000a82c6c5bcbc8ce00000000000000000000000000000000000000000000000006bf8621de3ec00000000000000000000000000000000000000000000000008c8dea2b84a4e8e994000000000000000000000000000000000000000000000000061759b58272f73200000000000000000000000000000000000000000000008c8e9257f100b4b262", + "logIndex": 4, + "blockHash": "0xaf35af5f98c18d2581e07526c996e653391278e90d5d53196386cbe594ce6f76" + } + ], + "blockNumber": 5733385, + "cumulativeGasUsed": "316854", + "status": 1, + "byzantium": true + }, + "args": [ + "0xe25c6C4FCAec2010bAE4B05d863BE2A5a5DB940F", + "0xc4d66de800000000000000000000000074489ac99ae3ce1428ce8c8dbe374cffc009081e" + ], + "numDeployments": 1, + "bytecode": "0x60806040526040516107813803806107818339810160408190526100229161032b565b61004d60017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd6103f9565b60008051602061073a833981519152146100695761006961041e565b6100758282600061007c565b5050610483565b610085836100e6565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806100c65750805b156100e1576100df83836101a660201b6100291760201c565b505b505050565b6100f9816101d260201b6100551760201c565b6101605760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b8061018560008051602061073a83398151915260001b6101d860201b61005b1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b60606101cb838360405180606001604052806027815260200161075a602791396101db565b9392505050565b3b151590565b90565b6060833b61023a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610157565b600080856001600160a01b0316856040516102559190610434565b600060405180830381855af49150503d8060008114610290576040519150601f19603f3d011682016040523d82523d6000602084013e610295565b606091505b5090925090506102a68282866102b0565b9695505050505050565b606083156102bf5750816101cb565b8251156102cf5782518084602001fd5b8160405162461bcd60e51b81526004016101579190610450565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561031a578181015183820152602001610302565b838111156100df5750506000910152565b6000806040838503121561033e57600080fd5b82516001600160a01b038116811461035557600080fd5b60208401519092506001600160401b038082111561037257600080fd5b818501915085601f83011261038657600080fd5b815181811115610398576103986102e9565b604051601f8201601f19908116603f011681019083821181831017156103c0576103c06102e9565b816040528281528860208487010111156103d957600080fd5b6103ea8360208301602088016102ff565b80955050505050509250929050565b60008282101561041957634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b600082516104468184602087016102ff565b9190910192915050565b602081526000825180602084015261046f8160408501602087016102ff565b601f01601f19169190910160400192915050565b6102a8806104926000396000f3fe60806040523661001357610011610017565b005b6100115b61002761002261005e565b610096565b565b606061004e838360405180606001604052806027815260200161024c602791396100ba565b9392505050565b3b151590565b90565b60006100917f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100b5573d6000f35b3d6000fd5b6060833b61011e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b03168560405161013991906101fc565b600060405180830381855af49150503d8060008114610174576040519150601f19603f3d011682016040523d82523d6000602084013e610179565b606091505b5091509150610189828286610193565b9695505050505050565b606083156101a257508161004e565b8251156101b25782518084602001fd5b8160405162461bcd60e51b81526004016101159190610218565b60005b838110156101e75781810151838201526020016101cf565b838111156101f6576000848401525b50505050565b6000825161020e8184602087016101cc565b9190910192915050565b60208152600082518060208401526102378160408501602087016101cc565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122041f64d2ff908c9983923017ed36c949dd92697a1f359295e2ea2f809da86127664736f6c63430008090033360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040523661001357610011610017565b005b6100115b61002761002261005e565b610096565b565b606061004e838360405180606001604052806027815260200161024c602791396100ba565b9392505050565b3b151590565b90565b60006100917f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100b5573d6000f35b3d6000fd5b6060833b61011e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b03168560405161013991906101fc565b600060405180830381855af49150503d8060008114610174576040519150601f19603f3d011682016040523d82523d6000602084013e610179565b606091505b5091509150610189828286610193565b9695505050505050565b606083156101a257508161004e565b8251156101b25782518084602001fd5b8160405162461bcd60e51b81526004016101159190610218565b60005b838110156101e75781810151838201526020016101cf565b838111156101f6576000848401525b50505050565b6000825161020e8184602087016101cc565b9190910192915050565b60208152600082518060208401526102378160408501602087016101cc565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122041f64d2ff908c9983923017ed36c949dd92697a1f359295e2ea2f809da86127664736f6c63430008090033" +} \ No newline at end of file diff --git a/ethereum/smart-contract/deployments/polygonAmoy/FlexibleNonceForwarder.json b/ethereum/smart-contract/deployments/polygonAmoy/FlexibleNonceForwarder.json new file mode 100644 index 000000000..13138437a --- /dev/null +++ b/ethereum/smart-contract/deployments/polygonAmoy/FlexibleNonceForwarder.json @@ -0,0 +1,322 @@ +{ + "address": "0x8419F704CD6520E2C3EF477ef9BFA3159Ea1ACA7", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "blockAgeTolerance", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "expectedSigner", + "type": "address" + } + ], + "name": "FlexibleNonceForwarder__InvalidSigner", + "type": "error" + }, + { + "inputs": [], + "name": "FlexibleNonceForwarder__TxAlreadySeen", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockAgeTolerance", + "type": "uint256" + } + ], + "name": "FlexibleNonceForwarder__TxTooOld", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "name": "ForwardResult", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "gas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct IForwarder.ForwardRequest", + "name": "req", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "execute", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + } + ], + "name": "getNonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xd8ecb5bc45b660bd7ffcb0dd34835ca4def41b8fba7997983150db30bd9ff837", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x74489ac99AE3cE1428Ce8C8dBE374CFFc009081E", + "contractAddress": null, + "transactionIndex": 0, + "gasUsed": "854363", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100080000000000000000000000000000000000000000000000000000000080000000000000420000000000000000000000000040000000000000000000000000000000000000200000800000000000000000000000000000000000000000000000000000004000000000000000000001008000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000100000", + "blockHash": "0x107fb1bce2157e1fa902ca836dd65ce914569eb2f05d6a106e5354af9cb96b20", + "transactionHash": "0xd8ecb5bc45b660bd7ffcb0dd34835ca4def41b8fba7997983150db30bd9ff837", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 6047487, + "transactionHash": "0xd8ecb5bc45b660bd7ffcb0dd34835ca4def41b8fba7997983150db30bd9ff837", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x00000000000000000000000074489ac99ae3ce1428ce8c8dbe374cffc009081e", + "0x0000000000000000000000006dc2dd54f24979ec26212794c71afefed722280c" + ], + "data": "0x00000000000000000000000000000000000000000000000000048d8ed4afb500000000000000000000000000000000000000000000000000067b18e5b607aa610000000000000000000000000000000000000000000000fc57da2663000baf3000000000000000000000000000000000000000000000000006768b56e157f5610000000000000000000000000000000000000000000000fc57deb3f1d4bb6430", + "logIndex": 0, + "blockHash": "0x107fb1bce2157e1fa902ca836dd65ce914569eb2f05d6a106e5354af9cb96b20" + } + ], + "blockNumber": 6047487, + "cumulativeGasUsed": "854363", + "status": 1, + "byzantium": true + }, + "args": [ + 100 + ], + "numDeployments": 1, + "solcInputHash": "87b3170c5841073ac3f676d17cabccfa", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockAgeTolerance\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"expectedSigner\",\"type\":\"address\"}],\"name\":\"FlexibleNonceForwarder__InvalidSigner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FlexibleNonceForwarder__TxAlreadySeen\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockAgeTolerance\",\"type\":\"uint256\"}],\"name\":\"FlexibleNonceForwarder__TxTooOld\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"name\":\"ForwardResult\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct IForwarder.ForwardRequest\",\"name\":\"req\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"execute\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"}],\"name\":\"getNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"errors\":{\"FlexibleNonceForwarder__InvalidSigner(address,address)\":[{\"notice\":\"The tx to be forwarded is not signed by the request sender.\"}],\"FlexibleNonceForwarder__TxAlreadySeen()\":[{\"notice\":\"The tx to be forwarded has already been seen.\"}],\"FlexibleNonceForwarder__TxTooOld(uint256,uint256)\":[{\"notice\":\"The tx to be forwarded is too old.\"}]},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/FlexibleNonceForwarder.sol\":\"FlexibleNonceForwarder\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x190dd6f8d592b7e4e930feb7f4313aeb8e1c4ad3154c27ce1cf6a512fc30d8cc\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.sol\\\";\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\\n *\\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\\n *\\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\\n * ({_hashTypedDataV4}).\\n *\\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\\n * the chain id to protect against replay attacks on an eventual fork of the chain.\\n *\\n * NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method\\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\\n *\\n * _Available since v3.4._\\n */\\nabstract contract EIP712 {\\n /* solhint-disable var-name-mixedcase */\\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\\n // invalidate the cached domain separator if the chain id changes.\\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\\n uint256 private immutable _CACHED_CHAIN_ID;\\n address private immutable _CACHED_THIS;\\n\\n bytes32 private immutable _HASHED_NAME;\\n bytes32 private immutable _HASHED_VERSION;\\n bytes32 private immutable _TYPE_HASH;\\n\\n /* solhint-enable var-name-mixedcase */\\n\\n /**\\n * @dev Initializes the domain separator and parameter caches.\\n *\\n * The meaning of `name` and `version` is specified in\\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\\n *\\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\\n * - `version`: the current major version of the signing domain.\\n *\\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\\n * contract upgrade].\\n */\\n constructor(string memory name, string memory version) {\\n bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n bytes32 typeHash = keccak256(\\n \\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"\\n );\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\\n _CACHED_THIS = address(this);\\n _TYPE_HASH = typeHash;\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\\n return _CACHED_DOMAIN_SEPARATOR;\\n } else {\\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\\n }\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\\n }\\n\\n /**\\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\\n * function returns the hash of the fully encoded EIP712 message for this domain.\\n *\\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\\n *\\n * ```solidity\\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\\n * keccak256(\\\"Mail(address to,string contents)\\\"),\\n * mailTo,\\n * keccak256(bytes(mailContents))\\n * )));\\n * address signer = ECDSA.recover(digest, signature);\\n * ```\\n */\\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n}\\n\",\"keccak256\":\"0x948d8b2d18f38141ec78c5229d770d950ebc781ed3f44cc9e3ccbb9fded5846a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"contracts/FlexibleNonceForwarder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport {ECDSA} from \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport {EIP712} from \\\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {IForwarder} from \\\"./interfaces/IForwarder.sol\\\";\\n\\ncontract FlexibleNonceForwarder is IForwarder, EIP712, ReentrancyGuard {\\n using ECDSA for bytes32;\\n using Address for address payable;\\n\\n struct SigsForNonce {\\n mapping(bytes => bool) sigs;\\n }\\n\\n struct FlexibleNonce {\\n uint256 currentNonce;\\n uint256 block; // when this nonce was first used - used to age transactions\\n mapping(uint256 => SigsForNonce) sigsForNonce;\\n }\\n\\n bytes32 private constant _TYPEHASH =\\n keccak256(\\\"ForwardRequest(address from,address to,uint256 value,uint256 gas,uint256 nonce,bytes data)\\\");\\n\\n mapping(address => FlexibleNonce) private _nonces;\\n\\n uint256 private immutable _blockAgeTolerance;\\n\\n event ForwardResult(bool);\\n\\n /// The tx to be forwarded is not signed by the request sender.\\n error FlexibleNonceForwarder__InvalidSigner(address signer, address expectedSigner);\\n\\n /// The tx to be forwarded has already been seen.\\n error FlexibleNonceForwarder__TxAlreadySeen();\\n\\n /// The tx to be forwarded is too old.\\n error FlexibleNonceForwarder__TxTooOld(uint256 blockNumber, uint256 blockAgeTolerance);\\n\\n constructor(uint256 blockAgeTolerance) EIP712(\\\"FlexibleNonceForwarder\\\", \\\"0.0.1\\\") {\\n _blockAgeTolerance = blockAgeTolerance;\\n }\\n\\n function execute(\\n ForwardRequest calldata req,\\n bytes calldata signature\\n ) external payable nonReentrant returns (bool, bytes memory) {\\n _verifyFlexibleNonce(req, signature);\\n _refundExcessValue(req);\\n\\n (bool success, bytes memory returndata) = req.to.call{gas: req.gas, value: req.value}(\\n abi.encodePacked(req.data, req.from)\\n );\\n\\n // Validate that the relayer has sent enough gas for the call.\\n // See https://ronan.eth.limo/blog/ethereum-gas-dangers/\\n if (gasleft() <= req.gas / 63) {\\n // We explicitly trigger invalid opcode to consume all gas and bubble-up the effects, since\\n // neither revert or assert consume all gas since Solidity 0.8.0\\n // https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n invalid()\\n }\\n }\\n\\n emit ForwardResult(success);\\n\\n return (success, returndata);\\n }\\n\\n function getNonce(address from) external view returns (uint256) {\\n return _nonces[from].currentNonce;\\n }\\n\\n function _verifyFlexibleNonce(ForwardRequest calldata req, bytes calldata signature) internal {\\n address signer = _hashTypedDataV4(\\n keccak256(abi.encode(_TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data)))\\n ).recover(signature);\\n\\n if (signer != req.from) {\\n revert FlexibleNonceForwarder__InvalidSigner(signer, req.from);\\n }\\n\\n if (_nonces[req.from].currentNonce == req.nonce) {\\n // request nonce is expected next nonce - increment the nonce, and we are done\\n _nonces[req.from].currentNonce = req.nonce + 1;\\n _nonces[req.from].block = block.number;\\n } else {\\n // request nonce is not expected next nonce - check if we have seen this signature before\\n if (_nonces[req.from].sigsForNonce[req.nonce].sigs[signature]) {\\n revert FlexibleNonceForwarder__TxAlreadySeen();\\n }\\n\\n // check if the nonce is too old\\n if (_nonces[req.from].block + _blockAgeTolerance < block.number) {\\n revert FlexibleNonceForwarder__TxTooOld(_nonces[req.from].block, _blockAgeTolerance);\\n }\\n }\\n\\n // store the signature for this nonce to ensure no replay attacks\\n _nonces[req.from].sigsForNonce[req.nonce].sigs[signature] = true;\\n }\\n\\n function _refundExcessValue(ForwardRequest calldata req) internal {\\n // Refund the excess value sent to the forwarder if the value inside the request is less than the value sent.\\n if (msg.value > req.value) {\\n payable(msg.sender).sendValue(msg.value - req.value);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2877ec22364cd27e837fd71dcb18c92f730615b504e459ea3e9cac90042c7d56\",\"license\":\"MIT\"},\"contracts/interfaces/IForwarder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\npragma experimental ABIEncoderV2;\\n\\ninterface IForwarder {\\n struct ForwardRequest {\\n address from;\\n address to;\\n uint256 value;\\n uint256 gas;\\n uint256 nonce;\\n bytes data;\\n }\\n\\n function execute(\\n ForwardRequest calldata req,\\n bytes calldata signature\\n ) external payable returns (bool, bytes memory);\\n\\n function getNonce(address from) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x453805935f789941e19bbf9128581606ec7b151085fbafba50490ef685bd0ec3\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x61016060405234801561001157600080fd5b50604051610fb9380380610fb983398101604081905261003091610143565b604080518082018252601681527f466c657869626c654e6f6e6365466f7277617264657200000000000000000000602080830191825283518085019094526005845264302e302e3160d81b908401528151902060e08190527fae209a0b48f21c054280f2455d32cf309387644879d9acbd8ffc1991638118856101008190524660a0529192917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6101268184846040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6080523060c052610120525050600160005550506101405261015c565b60006020828403121561015557600080fd5b5051919050565b60805160a05160c05160e051610100516101205161014051610dfc6101bd600039600081816104e801526105830152600061088f015260006108de015260006108b9015260006108120152600061083c015260006108660152610dfc6000f3fe6080604052600436106100295760003560e01c80632d0335ab1461002e57806347153f8214610077575b600080fd5b34801561003a57600080fd5b50610064610049366004610b75565b6001600160a01b031660009081526001602052604090205490565b6040519081526020015b60405180910390f35b61008a610085366004610ba5565b610098565b60405161006e929190610c74565b600060606100a46101dd565b6100af85858561023c565b6100b885610648565b6000806100cb6040880160208901610b75565b6001600160a01b0316606088013560408901356100eb60a08b018b610cb0565b6100f860208d018d610b75565b60405160200161010a93929190610cf7565b60408051601f198184030181529082905261012491610d1d565b600060405180830381858888f193505050503d8060008114610162576040519150601f19603f3d011682016040523d82523d6000602084013e610167565b606091505b5090925090508161017a57805160208201fd5b61018960406060890135610d4f565b5a1161019157fe5b60405182151581527fed0603e97c834a591ced7b3c6ce727a087f9d1748098dc815b12a2516993d68c9060200160405180910390a190925090506101d56001600055565b935093915050565b600260005414156102355760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600055565b600061034e83838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061034892507fdd8f4b70b0f4393e889bd39128a30628a78b61816a9eb8199759e7a349657e4891506102ab90506020890189610b75565b6102bb60408a0160208b01610b75565b60408a013560608b013560808c01356102d760a08e018e610cb0565b6040516102e5929190610d71565b6040805191829003822060208301989098526001600160a01b0396871690820152949093166060850152608084019190915260a083015260c082015260e0810191909152610100016040516020818303038152906040528051906020012061066f565b906106c3565b905061035d6020850185610b75565b6001600160a01b0316816001600160a01b0316146103af57806103836020860186610b75565b604051635e4cf60960e11b81526001600160a01b0392831660048201529116602482015260440161022c565b6080840135600160006103c56020880188610b75565b6001600160a01b031681526020810191909152604001600020541415610458576103f460808501356001610d81565b600160006104056020880188610b75565b6001600160a01b03168152602080820192909252604001600090812092909255439160019161043690880188610b75565b6001600160a01b031681526020810191909152604001600020600101556105c5565b600160006104696020870187610b75565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020160008560800135815260200190815260200160002060000183836040516104b4929190610d71565b9081526040519081900360200190205460ff16156104e557604051630c3294e760e41b815260040160405180910390fd5b437f0000000000000000000000000000000000000000000000000000000000000000600160006105186020890189610b75565b6001600160a01b03166001600160a01b03168152602001908152602001600020600101546105469190610d81565b10156105c5576001600061055d6020870187610b75565b6001600160a01b03166001600160a01b03168152602001908152602001600020600101547f00000000000000000000000000000000000000000000000000000000000000006040516264f5c360e21b815260040161022c929190918252602082015260400190565b60018060006105d76020880188610b75565b6001600160a01b03166001600160a01b031681526020019081526020016000206002016000866080013581526020019081526020016000206000018484604051610622929190610d71565b908152604051908190036020019020805491151560ff1990921691909117905550505050565b806040013534111561066c5761066c610665604083013534610d99565b33906106e7565b50565b60006106bd61067c610805565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b92915050565b60008060006106d2858561092c565b915091506106df81610972565b509392505050565b804710156107375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161022c565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610784576040519150601f19603f3d011682016040523d82523d6000602084013e610789565b606091505b50509050806108005760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161022c565b505050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561085e57507f000000000000000000000000000000000000000000000000000000000000000046145b1561088857507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000808251604114156109635760208301516040840151606085015160001a61095787828585610abb565b9450945050505061096b565b506000905060025b9250929050565b600081600481111561098657610986610db0565b141561098f5750565b60018160048111156109a3576109a3610db0565b14156109ec5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b604482015260640161022c565b6002816004811115610a0057610a00610db0565b1415610a4e5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161022c565b6003816004811115610a6257610a62610db0565b141561066c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161022c565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115610ae85750600090506003610b6c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610b3c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610b6557600060019250925050610b6c565b9150600090505b94509492505050565b600060208284031215610b8757600080fd5b81356001600160a01b0381168114610b9e57600080fd5b9392505050565b600080600060408486031215610bba57600080fd5b833567ffffffffffffffff80821115610bd257600080fd5b9085019060c08288031215610be657600080fd5b90935060208501359080821115610bfc57600080fd5b818601915086601f830112610c1057600080fd5b813581811115610c1f57600080fd5b876020828501011115610c3157600080fd5b6020830194508093505050509250925092565b60005b83811015610c5f578181015183820152602001610c47565b83811115610c6e576000848401525b50505050565b82151581526040602082015260008251806040840152610c9b816060850160208701610c44565b601f01601f1916919091016060019392505050565b6000808335601e19843603018112610cc757600080fd5b83018035915067ffffffffffffffff821115610ce257600080fd5b60200191503681900382131561096b57600080fd5b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b60008251610d2f818460208701610c44565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b600082610d6c57634e487b7160e01b600052601260045260246000fd5b500490565b8183823760009101908152919050565b60008219821115610d9457610d94610d39565b500190565b600082821015610dab57610dab610d39565b500390565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220a46bef00eab6b67acc38a7b47bf487597a5d4922653e9c25e0928715cb628ec164736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100295760003560e01c80632d0335ab1461002e57806347153f8214610077575b600080fd5b34801561003a57600080fd5b50610064610049366004610b75565b6001600160a01b031660009081526001602052604090205490565b6040519081526020015b60405180910390f35b61008a610085366004610ba5565b610098565b60405161006e929190610c74565b600060606100a46101dd565b6100af85858561023c565b6100b885610648565b6000806100cb6040880160208901610b75565b6001600160a01b0316606088013560408901356100eb60a08b018b610cb0565b6100f860208d018d610b75565b60405160200161010a93929190610cf7565b60408051601f198184030181529082905261012491610d1d565b600060405180830381858888f193505050503d8060008114610162576040519150601f19603f3d011682016040523d82523d6000602084013e610167565b606091505b5090925090508161017a57805160208201fd5b61018960406060890135610d4f565b5a1161019157fe5b60405182151581527fed0603e97c834a591ced7b3c6ce727a087f9d1748098dc815b12a2516993d68c9060200160405180910390a190925090506101d56001600055565b935093915050565b600260005414156102355760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600055565b600061034e83838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061034892507fdd8f4b70b0f4393e889bd39128a30628a78b61816a9eb8199759e7a349657e4891506102ab90506020890189610b75565b6102bb60408a0160208b01610b75565b60408a013560608b013560808c01356102d760a08e018e610cb0565b6040516102e5929190610d71565b6040805191829003822060208301989098526001600160a01b0396871690820152949093166060850152608084019190915260a083015260c082015260e0810191909152610100016040516020818303038152906040528051906020012061066f565b906106c3565b905061035d6020850185610b75565b6001600160a01b0316816001600160a01b0316146103af57806103836020860186610b75565b604051635e4cf60960e11b81526001600160a01b0392831660048201529116602482015260440161022c565b6080840135600160006103c56020880188610b75565b6001600160a01b031681526020810191909152604001600020541415610458576103f460808501356001610d81565b600160006104056020880188610b75565b6001600160a01b03168152602080820192909252604001600090812092909255439160019161043690880188610b75565b6001600160a01b031681526020810191909152604001600020600101556105c5565b600160006104696020870187610b75565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020160008560800135815260200190815260200160002060000183836040516104b4929190610d71565b9081526040519081900360200190205460ff16156104e557604051630c3294e760e41b815260040160405180910390fd5b437f0000000000000000000000000000000000000000000000000000000000000000600160006105186020890189610b75565b6001600160a01b03166001600160a01b03168152602001908152602001600020600101546105469190610d81565b10156105c5576001600061055d6020870187610b75565b6001600160a01b03166001600160a01b03168152602001908152602001600020600101547f00000000000000000000000000000000000000000000000000000000000000006040516264f5c360e21b815260040161022c929190918252602082015260400190565b60018060006105d76020880188610b75565b6001600160a01b03166001600160a01b031681526020019081526020016000206002016000866080013581526020019081526020016000206000018484604051610622929190610d71565b908152604051908190036020019020805491151560ff1990921691909117905550505050565b806040013534111561066c5761066c610665604083013534610d99565b33906106e7565b50565b60006106bd61067c610805565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b92915050565b60008060006106d2858561092c565b915091506106df81610972565b509392505050565b804710156107375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161022c565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610784576040519150601f19603f3d011682016040523d82523d6000602084013e610789565b606091505b50509050806108005760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161022c565b505050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561085e57507f000000000000000000000000000000000000000000000000000000000000000046145b1561088857507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000808251604114156109635760208301516040840151606085015160001a61095787828585610abb565b9450945050505061096b565b506000905060025b9250929050565b600081600481111561098657610986610db0565b141561098f5750565b60018160048111156109a3576109a3610db0565b14156109ec5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b604482015260640161022c565b6002816004811115610a0057610a00610db0565b1415610a4e5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161022c565b6003816004811115610a6257610a62610db0565b141561066c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161022c565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115610ae85750600090506003610b6c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610b3c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610b6557600060019250925050610b6c565b9150600090505b94509492505050565b600060208284031215610b8757600080fd5b81356001600160a01b0381168114610b9e57600080fd5b9392505050565b600080600060408486031215610bba57600080fd5b833567ffffffffffffffff80821115610bd257600080fd5b9085019060c08288031215610be657600080fd5b90935060208501359080821115610bfc57600080fd5b818601915086601f830112610c1057600080fd5b813581811115610c1f57600080fd5b876020828501011115610c3157600080fd5b6020830194508093505050509250925092565b60005b83811015610c5f578181015183820152602001610c47565b83811115610c6e576000848401525b50505050565b82151581526040602082015260008251806040840152610c9b816060850160208701610c44565b601f01601f1916919091016060019392505050565b6000808335601e19843603018112610cc757600080fd5b83018035915067ffffffffffffffff821115610ce257600080fd5b60200191503681900382131561096b57600080fd5b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b60008251610d2f818460208701610c44565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b600082610d6c57634e487b7160e01b600052601260045260246000fd5b500490565b8183823760009101908152919050565b60008219821115610d9457610d94610d39565b500190565b600082821015610dab57610dab610d39565b500390565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220a46bef00eab6b67acc38a7b47bf487597a5d4922653e9c25e0928715cb628ec164736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "errors": { + "FlexibleNonceForwarder__InvalidSigner(address,address)": [ + { + "notice": "The tx to be forwarded is not signed by the request sender." + } + ], + "FlexibleNonceForwarder__TxAlreadySeen()": [ + { + "notice": "The tx to be forwarded has already been seen." + } + ], + "FlexibleNonceForwarder__TxTooOld(uint256,uint256)": [ + { + "notice": "The tx to be forwarded is too old." + } + ] + }, + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 2355, + "contract": "contracts/FlexibleNonceForwarder.sol:FlexibleNonceForwarder", + "label": "_status", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 8127, + "contract": "contracts/FlexibleNonceForwarder.sol:FlexibleNonceForwarder", + "label": "_nonces", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_struct(FlexibleNonce)8117_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes_memory_ptr": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_struct(FlexibleNonce)8117_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct FlexibleNonceForwarder.FlexibleNonce)", + "numberOfBytes": "32", + "value": "t_struct(FlexibleNonce)8117_storage" + }, + "t_mapping(t_bytes_memory_ptr,t_bool)": { + "encoding": "mapping", + "key": "t_bytes_memory_ptr", + "label": "mapping(bytes => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint256,t_struct(SigsForNonce)8107_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct FlexibleNonceForwarder.SigsForNonce)", + "numberOfBytes": "32", + "value": "t_struct(SigsForNonce)8107_storage" + }, + "t_struct(FlexibleNonce)8117_storage": { + "encoding": "inplace", + "label": "struct FlexibleNonceForwarder.FlexibleNonce", + "members": [ + { + "astId": 8109, + "contract": "contracts/FlexibleNonceForwarder.sol:FlexibleNonceForwarder", + "label": "currentNonce", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 8111, + "contract": "contracts/FlexibleNonceForwarder.sol:FlexibleNonceForwarder", + "label": "block", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 8116, + "contract": "contracts/FlexibleNonceForwarder.sol:FlexibleNonceForwarder", + "label": "sigsForNonce", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_struct(SigsForNonce)8107_storage)" + } + ], + "numberOfBytes": "96" + }, + "t_struct(SigsForNonce)8107_storage": { + "encoding": "inplace", + "label": "struct FlexibleNonceForwarder.SigsForNonce", + "members": [ + { + "astId": 8106, + "contract": "contracts/FlexibleNonceForwarder.sol:FlexibleNonceForwarder", + "label": "sigs", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes_memory_ptr,t_bool)" + } + ], + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/ethereum/smart-contract/deployments/polygonAmoy/GatewayToken.json b/ethereum/smart-contract/deployments/polygonAmoy/GatewayToken.json new file mode 100644 index 000000000..24be33ca2 --- /dev/null +++ b/ethereum/smart-contract/deployments/polygonAmoy/GatewayToken.json @@ -0,0 +1,2901 @@ +{ + "address": "0x65Bb8eb7c66c107e379C1C5781268393303E4b50", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "Common__MissingAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Common__NotContract", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Common__NotSuperAdmin", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "domain", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "Common__Unauthorized", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "available", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "required", + "type": "uint256" + } + ], + "name": "GatewayToken__InsufficientFunds", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "GatewayToken__NetworkAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "GatewayToken__NetworkDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "GatewayToken__NotDAOGoverned", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "GatewayToken__TokenDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "allowExpired", + "type": "bool" + } + ], + "name": "GatewayToken__TokenDoesNotExistOrIsInactive", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "enum IGatewayToken.TokenState", + "name": "state", + "type": "uint8" + }, + { + "internalType": "enum IGatewayToken.TokenState", + "name": "expectedState", + "type": "uint8" + } + ], + "name": "GatewayToken__TokenInvalidStateForOperation", + "type": "error" + }, + { + "inputs": [], + "name": "GatewayToken__TransferDisabled", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "ParameterizedAccessControl__RenounceRoleNotForSelf", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "ApprovalValue", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "bitmask", + "type": "uint256" + } + ], + "name": "BitMaskUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousDAOManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newDAOManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "DAOManagerTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "Expiration", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "flagsStorage", + "type": "address" + } + ], + "name": "FlagsStorageUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Freeze", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Revoke", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "domain", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "domain", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "domain", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "metadataDescriptor", + "type": "address" + } + ], + "name": "SetMetadataDescriptor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_oldSlot", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_newSlot", + "type": "uint256" + } + ], + "name": "SlotChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "SuperAdminAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "SuperAdminRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_fromTokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_toTokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "TransferValue", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Unfreeze", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "DAO_MANAGER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GATEKEEPER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NETWORK_AUTHORITY_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "addForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "gatekeeper", + "type": "address" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "addGatekeeper", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "authority", + "type": "address" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "addNetworkAuthority", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "operator_", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "contractURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bool", + "name": "daoGoverned", + "type": "bool" + }, + { + "internalType": "address", + "name": "daoManager", + "type": "address" + } + ], + "name": "createNetwork", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "flagsStorage", + "outputs": [ + { + "internalType": "contract IFlagsStorage", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "freeze", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getExpiration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "getNetwork", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "domain", + "type": "uint256" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getToken", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint8", + "name": "state", + "type": "uint8" + }, + { + "internalType": "string", + "name": "identity", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expiration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bitmask", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getTokenBitmask", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "getTokenIdsByOwnerAndNetwork", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "domain", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "domain", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + }, + { + "internalType": "address", + "name": "_superAdmin", + "type": "address" + }, + { + "internalType": "address", + "name": "_flagsStorage", + "type": "address" + }, + { + "internalType": "address[]", + "name": "_trustedForwarders", + "type": "address[]" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + }, + { + "internalType": "address", + "name": "operator_", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "gatekeeper", + "type": "address" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "isGatekeeper", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "authority", + "type": "address" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "isNetworkAuthority", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "isNetworkDAOGoverned", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isSuperAdmin", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "isTrustedForwarder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "metadataDescriptor", + "outputs": [ + { + "internalType": "contract IERC3525MetadataDescriptorUpgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mask", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "enum ChargeType", + "name": "chargeType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "internalType": "struct Charge", + "name": "", + "type": "tuple" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "removeForwarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "gatekeeper", + "type": "address" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "removeGatekeeper", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "authority", + "type": "address" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "removeNetworkAuthority", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "renameNetwork", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "domain", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "revoke", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "domain", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeSuperAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from_", + "type": "address" + }, + { + "internalType": "address", + "name": "to_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from_", + "type": "address" + }, + { + "internalType": "address", + "name": "to_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data_", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator_", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved_", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mask", + "type": "uint256" + } + ], + "name": "setBitmask", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "enum ChargeType", + "name": "chargeType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "internalType": "struct Charge", + "name": "", + "type": "tuple" + } + ], + "name": "setExpiration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_metadataDescriptor", + "type": "address" + } + ], + "name": "setMetadataDescriptor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "setSuperAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], + "name": "slotOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "slot_", + "type": "uint256" + } + ], + "name": "slotURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "previousManager", + "type": "address" + }, + { + "internalType": "address", + "name": "newManager", + "type": "address" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "transferDAOManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fromTokenId_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value_", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "uint256", + "name": "newTokenId", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from_", + "type": "address" + }, + { + "internalType": "address", + "name": "to_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fromTokenId_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toTokenId_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "value_", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "transfersRestricted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "unfreeze", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "flagsStorage", + "type": "address" + } + ], + "name": "updateFlagsStorage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "valueDecimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "network", + "type": "uint256" + } + ], + "name": "verifyToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "verifyToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "args": [], + "numDeployments": 1, + "solcInputHash": "87b3170c5841073ac3f676d17cabccfa", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"Common__MissingAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Common__NotContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Common__NotSuperAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"domain\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"Common__Unauthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"available\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"required\",\"type\":\"uint256\"}],\"name\":\"GatewayToken__InsufficientFunds\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"GatewayToken__NetworkAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"GatewayToken__NetworkDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"GatewayToken__NotDAOGoverned\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"GatewayToken__TokenDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"allowExpired\",\"type\":\"bool\"}],\"name\":\"GatewayToken__TokenDoesNotExistOrIsInactive\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"enum IGatewayToken.TokenState\",\"name\":\"state\",\"type\":\"uint8\"},{\"internalType\":\"enum IGatewayToken.TokenState\",\"name\":\"expectedState\",\"type\":\"uint8\"}],\"name\":\"GatewayToken__TokenInvalidStateForOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GatewayToken__TransferDisabled\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"ParameterizedAccessControl__RenounceRoleNotForSelf\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_tokenId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"ApprovalValue\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bitmask\",\"type\":\"uint256\"}],\"name\":\"BitMaskUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousDAOManager\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newDAOManager\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"DAOManagerTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"Expiration\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"flagsStorage\",\"type\":\"address\"}],\"name\":\"FlagsStorageUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Freeze\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Revoke\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"domain\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"domain\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"domain\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"metadataDescriptor\",\"type\":\"address\"}],\"name\":\"SetMetadataDescriptor\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_tokenId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_oldSlot\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_newSlot\",\"type\":\"uint256\"}],\"name\":\"SlotChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"SuperAdminAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"SuperAdminRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_fromTokenId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_toTokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"TransferValue\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Unfreeze\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DAO_MANAGER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GATEKEEPER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NETWORK_AUTHORITY_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"addForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"gatekeeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"addGatekeeper\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"addNetworkAuthority\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId_\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"operator_\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner_\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId_\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"contractURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"daoGoverned\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"daoManager\",\"type\":\"address\"}],\"name\":\"createNetwork\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"flagsStorage\",\"outputs\":[{\"internalType\":\"contract IFlagsStorage\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"freeze\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId_\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getExpiration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"getNetwork\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"domain\",\"type\":\"uint256\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"state\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"identity\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expiration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"bitmask\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getTokenBitmask\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"getTokenIdsByOwnerAndNetwork\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"domain\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"domain\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_superAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_flagsStorage\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_trustedForwarders\",\"type\":\"address[]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator_\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"gatekeeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"isGatekeeper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"isNetworkAuthority\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"isNetworkDAOGoverned\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isSuperAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"isTrustedForwarder\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"metadataDescriptor\",\"outputs\":[{\"internalType\":\"contract IERC3525MetadataDescriptorUpgradeable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"mask\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"enum ChargeType\",\"name\":\"chargeType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"internalType\":\"struct Charge\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId_\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"forwarder\",\"type\":\"address\"}],\"name\":\"removeForwarder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"gatekeeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"removeGatekeeper\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"removeNetworkAuthority\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"renameNetwork\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"domain\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"domain\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeSuperAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId_\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId_\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data_\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator_\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved_\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"mask\",\"type\":\"uint256\"}],\"name\":\"setBitmask\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"enum ChargeType\",\"name\":\"chargeType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"internalType\":\"struct Charge\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"setExpiration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_metadataDescriptor\",\"type\":\"address\"}],\"name\":\"setMetadataDescriptor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"setSuperAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId_\",\"type\":\"uint256\"}],\"name\":\"slotOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"slot_\",\"type\":\"uint256\"}],\"name\":\"slotURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index_\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index_\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId_\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"previousManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"newManager\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"transferDAOManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"fromTokenId_\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value_\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"newTokenId\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId_\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"fromTokenId_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toTokenId_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value_\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"transfersRestricted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"unfreeze\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"flagsStorage\",\"type\":\"address\"}],\"name\":\"updateFlagsStorage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"valueDecimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"network\",\"type\":\"uint256\"}],\"name\":\"verifyToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"verifyToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Gateway Token contract is responsible for managing Identity.com KYC gateway tokens those tokens represent completed KYC with attached identity. Gateway tokens using ERC721 standard with custom extensions. Contract handles multiple levels of access such as Network Authority (may represent a specific regulator body) Gatekeepers (Identity.com network parties who can mint/burn/freeze gateway tokens) and overall system Admin who can add new Gatekeepers and Network Authorities\",\"errors\":{\"Common__NotContract(address)\":[{\"params\":{\"account\":\"address of the account.\"}}],\"Common__NotSuperAdmin(address)\":[{\"params\":{\"account\":\"address of the account.\"}}],\"Common__Unauthorized(address,uint256,bytes32)\":[{\"params\":{\"domain\":\"the domain to which the role applies.\",\"role\":\"role that is required.\",\"sender\":\"address of the sender.\"}}],\"GatewayToken__InsufficientFunds(uint256,uint256)\":[{\"params\":{\"available\":\"balance available.\",\"required\":\"requested amount to transfer.\"}}],\"GatewayToken__NetworkAlreadyExists(uint256)\":[{\"params\":{\"network\":\"gatekeeper network id.\"}}],\"GatewayToken__NetworkDoesNotExist(uint256)\":[{\"params\":{\"network\":\"gatekeeper network id.\"}}],\"GatewayToken__NotDAOGoverned(uint256)\":[{\"params\":{\"network\":\"gatekeeper network id.\"}}],\"GatewayToken__TokenDoesNotExist(uint256)\":[{\"params\":{\"tokenId\":\"token id.\"}}],\"GatewayToken__TokenDoesNotExistOrIsInactive(uint256,bool)\":[{\"params\":{\"allowExpired\":\"whether to allow expired tokens.\",\"tokenId\":\"token id.\"}}],\"GatewayToken__TokenInvalidStateForOperation(uint256,uint8,uint8)\":[{\"params\":{\"expectedState\":\"expected token state.\",\"state\":\"current token state.\",\"tokenId\":\"token id.\"}}]},\"kind\":\"dev\",\"methods\":{\"addGatekeeper(address,uint256)\":{\"details\":\"Triggers to add new gatekeeper into the system.\",\"params\":{\"gatekeeper\":\"Gatekeeper address\"}},\"addNetworkAuthority(address,uint256)\":{\"details\":\"Triggers to add new network authority into the system.\",\"params\":{\"authority\":\"Network Authority address\"}},\"approve(uint256,address,uint256)\":{\"details\":\"Transfers are disabled for Gateway Tokens - override ERC3525 approve functions to revert Note - transferFrom and safeTransferFrom are disabled indirectly with the _isApprovedOrOwner function\"},\"burn(uint256)\":{\"details\":\"Triggers to burn gateway token\",\"params\":{\"tokenId\":\"Gateway token id\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"contractURI()\":{\"details\":\"This function SHOULD return the URI for this contract in JSON format, starting with header `data:application/json;`. See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for contract URI.\",\"returns\":{\"_0\":\"The JSON formatted URI of the current ERC3525 contract\"}},\"freeze(uint256)\":{\"details\":\"Triggers to freeze gateway token\",\"params\":{\"tokenId\":\"Gateway token id\"}},\"getExpiration(uint256)\":{\"details\":\"Triggers to get specified `tokenId` expiration timestamp\",\"params\":{\"tokenId\":\"Gateway token id\"}},\"getRoleAdmin(bytes32,uint256)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getToken(uint256)\":{\"details\":\"Triggers to get all information gateway token related to specified `tokenId`\",\"params\":{\"tokenId\":\"Gateway token id\"}},\"getTokenBitmask(uint256)\":{\"details\":\"Triggers to get gateway token bitmask\"},\"grantRole(bytes32,uint256,address)\":{\"details\":\"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. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,uint256,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"isGatekeeper(address,uint256)\":{\"details\":\"Triggers to verify if address has a GATEKEEPER role.\",\"params\":{\"gatekeeper\":\"Gatekeeper address\"}},\"isNetworkAuthority(address,uint256)\":{\"details\":\"Triggers to verify if authority has a NETWORK_AUTHORITY_ROLE role.\",\"params\":{\"authority\":\"Network Authority address\"}},\"mint(address,uint256,uint256,uint256,(uint256,uint8,address,address))\":{\"details\":\"Triggers to mint gateway token\",\"params\":{\"mask\":\"The bitmask for the token\",\"network\":\"Gateway token type\",\"to\":\"Gateway token owner\"}},\"name()\":{\"details\":\"Returns the token collection name.\"},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"removeGatekeeper(address,uint256)\":{\"details\":\"Triggers to remove existing gatekeeper from gateway token.\",\"params\":{\"gatekeeper\":\"Gatekeeper address\"}},\"removeNetworkAuthority(address,uint256)\":{\"details\":\"Triggers to remove existing network authority from gateway token.\",\"params\":{\"authority\":\"Network Authority address\"}},\"renounceRole(bytes32,uint256,address)\":{\"details\":\"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 revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revoke(uint256)\":{\"details\":\"Triggers to revoke gateway token\",\"params\":{\"tokenId\":\"Gateway token id\"}},\"revokeRole(bytes32,uint256,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"setBitmask(uint256,uint256)\":{\"details\":\"Triggers to set full bitmask for gateway token with `tokenId`\"},\"setExpiration(uint256,uint256,(uint256,uint8,address,address))\":{\"details\":\"Triggers to set expiration for tokenId\",\"params\":{\"tokenId\":\"Gateway token id\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"Returns the token collection symbol.\"},\"tokenURI(uint256)\":{\"details\":\"Returns the Uniform Resource Identifier (URI) for `tokenId` token.\"},\"totalSupply()\":{\"returns\":{\"_0\":\"A count of valid NFTs tracked by this contract, where each one of them has an assigned and queryable owner not equal to the zero address\"}},\"transferDAOManager(address,address,uint256)\":{\"details\":\"Transfers Gateway Token DAO Manager access from `previousManager` to `newManager` Only a current DAO Manager can do this. They can do this for any other DAO Manager. This is useful for two reasons: 1. Key rotation of the current (msg signer) DAO manager 2. Replacing a lost or compromised key of an existing DAO manager\",\"params\":{\"newManager\":\"Address to transfer DAO Manager role for.\"}},\"transfersRestricted()\":{\"details\":\"Returns true if gateway token owner transfers restricted, and false otherwise.\"},\"unfreeze(uint256)\":{\"details\":\"Triggers to unfreeze gateway token\",\"params\":{\"tokenId\":\"Gateway token id\"}},\"updateFlagsStorage(address)\":{\"details\":\"Triggers to update FlagsStorage contract address\",\"params\":{\"flagsStorage\":\"FlagsStorage contract address\"}},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"valueDecimals()\":{\"details\":\"Returns the number of decimals the token uses for value.\"},\"verifyToken(address,uint256)\":{\"details\":\"Triggered by external contract to verify the validity of the default token for `owner`. Checks owner has any token on gateway token contract, `tokenId` still active, and not expired.\"},\"verifyToken(uint256)\":{\"details\":\"Triggered by external contract to verify the validity of the default token for `owner`. Checks owner has any token on gateway token contract, `tokenId` still active, and not expired.\"}},\"version\":1},\"userdoc\":{\"errors\":{\"Common__MissingAccount()\":[{\"notice\":\"The passed-in account is the zero-address\"}],\"Common__NotContract(address)\":[{\"notice\":\"The passed-in account is not a contract, where an account is expected\"}],\"Common__NotSuperAdmin(address)\":[{\"notice\":\"The passed-in account is not a super-admin\"}],\"Common__Unauthorized(address,uint256,bytes32)\":[{\"notice\":\"The request was made from an unauthorized address.\"}],\"GatewayToken__InsufficientFunds(uint256,uint256)\":[{\"notice\":\"Insufficient funds for withdrawal. Needed `required` but only `available` available.\"}],\"GatewayToken__NetworkAlreadyExists(uint256)\":[{\"notice\":\"The gatekeeper network being created already exists.\"}],\"GatewayToken__NetworkDoesNotExist(uint256)\":[{\"notice\":\"The gatekeeper network does not exist.\"}],\"GatewayToken__NotDAOGoverned(uint256)\":[{\"notice\":\"The gatekeeper network is not dao-governed.\"}],\"GatewayToken__TokenDoesNotExist(uint256)\":[{\"notice\":\"The requested token does not exist.\"}],\"GatewayToken__TokenDoesNotExistOrIsInactive(uint256,bool)\":[{\"notice\":\"The requested token is not active or does not exist\"}],\"GatewayToken__TokenInvalidStateForOperation(uint256,uint8,uint8)\":[{\"notice\":\"The requested token state is invalid for the request\"}],\"GatewayToken__TransferDisabled()\":[{\"notice\":\"Token transfers are disabled\"}],\"ParameterizedAccessControl__RenounceRoleNotForSelf(bytes32,address)\":[{\"notice\":\"A sender can only renounce roles for themselves\"}]},\"kind\":\"user\",\"methods\":{\"addNetworkAuthority(address,uint256)\":{\"notice\":\"Can be triggered by DAO Manager or any Network Authority\"},\"contractURI()\":{\"notice\":\"Returns the Uniform Resource Identifier (URI) for the current ERC3525 contract.\"},\"removeNetworkAuthority(address,uint256)\":{\"notice\":\"Can be triggered by DAO Manager or any Network Authority\"},\"totalSupply()\":{\"notice\":\"Count NFTs tracked by this contract\"},\"transferDAOManager(address,address,uint256)\":{\"notice\":\"GatewayToken contract has to be DAO Governed\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/GatewayToken.sol\":\"GatewayToken\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.3) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.9._\\n */\\ninterface IERC1967Upgradeable {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0xb8d68221343ed784c7b76edb6a686cb65e49c476d9e22bb89a5c0c3947ff14db\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822ProxiableUpgradeable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.3) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeaconUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC1967Upgradeable.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/StorageSlotUpgradeable.sol\\\";\\nimport \\\"../utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\\n function __ERC1967Upgrade_init() internal onlyInitializing {\\n }\\n\\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\\n }\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(AddressUpgradeable.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(AddressUpgradeable.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\\n }\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\\n require(AddressUpgradeable.isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return AddressUpgradeable.verifyCallResult(success, returndata, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x1599637b52d20dc3954cea44914b2a4a9a8a5caade58d9da947e0b6c9acc07ba\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeaconUpgradeable {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x037c334add4b033ad3493038c25be1682d78c00992e1acb0e2795caff3925271\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../ERC1967/ERC1967UpgradeUpgradeable.sol\\\";\\nimport \\\"./Initializable.sol\\\";\\n\\n/**\\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSUpgradeable` with a custom implementation of upgrades.\\n *\\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\\n function __UUPSUpgradeable_init() internal onlyInitializing {\\n }\\n\\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\\n }\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n address private immutable __self = address(this);\\n\\n /**\\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\\n * fail.\\n */\\n modifier onlyProxy() {\\n require(address(this) != __self, \\\"Function must be called through delegatecall\\\");\\n require(_getImplementation() == __self, \\\"Function must be called through active proxy\\\");\\n _;\\n }\\n\\n /**\\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\\n * callable on the implementing contract but not through proxies.\\n */\\n modifier notDelegated() {\\n require(address(this) == __self, \\\"UUPSUpgradeable: must not be called through delegatecall\\\");\\n _;\\n }\\n\\n /**\\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\\n */\\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\\n return _IMPLEMENTATION_SLOT;\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeTo(address newImplementation) external virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\\n * encoded in `data`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\\n * {upgradeTo} and {upgradeToAndCall}.\\n *\\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\\n *\\n * ```solidity\\n * function _authorizeUpgrade(address) internal override onlyOwner {}\\n * ```\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x7967d130887c4b40666cd88f8744691d4527039a1b2a38aa0de41481ef646778\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Counters\\n * @author Matt Condon (@shrugs)\\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\\n *\\n * Include with `using Counters for Counters.Counter;`\\n */\\nlibrary CountersUpgradeable {\\n struct Counter {\\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\\n // this feature: see https://github.com/ethereum/solidity/issues/4637\\n uint256 _value; // default: 0\\n }\\n\\n function current(Counter storage counter) internal view returns (uint256) {\\n return counter._value;\\n }\\n\\n function increment(Counter storage counter) internal {\\n unchecked {\\n counter._value += 1;\\n }\\n }\\n\\n function decrement(Counter storage counter) internal {\\n uint256 value = counter._value;\\n require(value > 0, \\\"Counter: decrement overflow\\\");\\n unchecked {\\n counter._value = value - 1;\\n }\\n }\\n\\n function reset(Counter storage counter) internal {\\n counter._value = 0;\\n }\\n}\\n\",\"keccak256\":\"0x798741e231b22b81e2dd2eddaaf8832dee4baf5cd8e2dbaa5c1dd12a1c053c4d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlotUpgradeable {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0x09864aea84f01e39313375b5610c73a3c1c68abbdc51e5ccdd25ff977fdadf9a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0x6b9a5d35b744b25529a2856a8093e7c03fb35a34b1c4fb5499e560f8ade140da\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc1bd5b53319c68f84e3becd75694d941e8f4be94049903232cd8bc7c535aaa5a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"@solvprotocol/erc-3525/ERC3525Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\\\";\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC3525Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./IERC3525ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721EnumerableUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC3525MetadataUpgradeable.sol\\\";\\nimport \\\"./periphery/interface/IERC3525MetadataDescriptorUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\n\\ncontract ERC3525Upgradeable is Initializable, ContextUpgradeable, IERC3525MetadataUpgradeable, IERC721EnumerableUpgradeable {\\n using StringsUpgradeable for address;\\n using StringsUpgradeable for uint256;\\n using AddressUpgradeable for address;\\n using CountersUpgradeable for CountersUpgradeable.Counter;\\n\\n event SetMetadataDescriptor(address indexed metadataDescriptor);\\n\\n struct TokenData {\\n uint256 id;\\n uint256 slot;\\n uint256 balance;\\n address owner;\\n address approved;\\n address[] valueApprovals;\\n }\\n\\n struct AddressData {\\n uint256[] ownedTokens;\\n mapping(uint256 => uint256) ownedTokensIndex;\\n mapping(address => bool) approvals;\\n }\\n\\n string private _name;\\n string private _symbol;\\n uint8 private _decimals;\\n CountersUpgradeable.Counter private _tokenIdGenerator;\\n\\n // id => (approval => allowance)\\n // @dev _approvedValues cannot be defined within TokenData, cause struct containing mappings cannot be constructed.\\n mapping(uint256 => mapping(address => uint256)) private _approvedValues;\\n\\n TokenData[] private _allTokens;\\n\\n // key: id\\n mapping(uint256 => uint256) private _allTokensIndex;\\n\\n mapping(address => AddressData) private _addressData;\\n\\n IERC3525MetadataDescriptorUpgradeable public metadataDescriptor;\\n\\n function __ERC3525_init(string memory name_, string memory symbol_, uint8 decimals_) internal onlyInitializing {\\n __ERC3525_init_unchained(name_, symbol_, decimals_);\\n }\\n\\n function __ERC3525_init_unchained(string memory name_, string memory symbol_, uint8 decimals_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n _decimals = decimals_;\\n }\\n\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return\\n interfaceId == type(IERC165Upgradeable).interfaceId ||\\n interfaceId == type(IERC3525Upgradeable).interfaceId ||\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC3525MetadataUpgradeable).interfaceId ||\\n interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || \\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals the token uses for value.\\n */\\n function valueDecimals() public view virtual override returns (uint8) {\\n return _decimals;\\n }\\n\\n function balanceOf(uint256 tokenId_) public view virtual override returns (uint256) {\\n _requireMinted(tokenId_);\\n return _allTokens[_allTokensIndex[tokenId_]].balance;\\n }\\n\\n function ownerOf(uint256 tokenId_) public view virtual override returns (address owner_) {\\n _requireMinted(tokenId_);\\n owner_ = _allTokens[_allTokensIndex[tokenId_]].owner;\\n require(owner_ != address(0), \\\"ERC3525: invalid token ID\\\");\\n }\\n\\n function slotOf(uint256 tokenId_) public view virtual override returns (uint256) {\\n _requireMinted(tokenId_);\\n return _allTokens[_allTokensIndex[tokenId_]].slot;\\n }\\n\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n function contractURI() public view virtual override returns (string memory) {\\n string memory baseURI = _baseURI();\\n return \\n address(metadataDescriptor) != address(0) ? \\n metadataDescriptor.constructContractURI() :\\n bytes(baseURI).length > 0 ? \\n string(abi.encodePacked(baseURI, \\\"contract/\\\", StringsUpgradeable.toHexString(address(this)))) : \\n \\\"\\\";\\n }\\n\\n function slotURI(uint256 slot_) public view virtual override returns (string memory) {\\n string memory baseURI = _baseURI();\\n return \\n address(metadataDescriptor) != address(0) ? \\n metadataDescriptor.constructSlotURI(slot_) : \\n bytes(baseURI).length > 0 ? \\n string(abi.encodePacked(baseURI, \\\"slot/\\\", slot_.toString())) : \\n \\\"\\\";\\n }\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId_) public view virtual override returns (string memory) {\\n _requireMinted(tokenId_);\\n string memory baseURI = _baseURI();\\n return \\n address(metadataDescriptor) != address(0) ? \\n metadataDescriptor.constructTokenURI(tokenId_) : \\n bytes(baseURI).length > 0 ? \\n string(abi.encodePacked(baseURI, tokenId_.toString())) : \\n \\\"\\\";\\n }\\n\\n function approve(uint256 tokenId_, address to_, uint256 value_) public payable virtual override {\\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\\n require(to_ != owner, \\\"ERC3525: approval to current owner\\\");\\n\\n require(_isApprovedOrOwner(_msgSender(), tokenId_), \\\"ERC3525: approve caller is not owner nor approved\\\");\\n\\n _approveValue(tokenId_, to_, value_);\\n }\\n\\n function allowance(uint256 tokenId_, address operator_) public view virtual override returns (uint256) {\\n _requireMinted(tokenId_);\\n return _approvedValues[tokenId_][operator_];\\n }\\n\\n function transferFrom(\\n uint256 fromTokenId_,\\n address to_,\\n uint256 value_\\n ) public payable virtual override returns (uint256 newTokenId) {\\n _spendAllowance(_msgSender(), fromTokenId_, value_);\\n\\n newTokenId = _createDerivedTokenId(fromTokenId_);\\n _mint(to_, newTokenId, ERC3525Upgradeable.slotOf(fromTokenId_), 0);\\n _transferValue(fromTokenId_, newTokenId, value_);\\n }\\n\\n function transferFrom(\\n uint256 fromTokenId_,\\n uint256 toTokenId_,\\n uint256 value_\\n ) public payable virtual override {\\n _spendAllowance(_msgSender(), fromTokenId_, value_);\\n _transferValue(fromTokenId_, toTokenId_, value_);\\n }\\n\\n function balanceOf(address owner_) public view virtual override returns (uint256 balance) {\\n require(owner_ != address(0), \\\"ERC3525: balance query for the zero address\\\");\\n return _addressData[owner_].ownedTokens.length;\\n }\\n\\n function transferFrom(\\n address from_,\\n address to_,\\n uint256 tokenId_\\n ) public payable virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId_), \\\"ERC3525: transfer caller is not owner nor approved\\\");\\n _transferTokenId(from_, to_, tokenId_);\\n }\\n\\n function safeTransferFrom(\\n address from_,\\n address to_,\\n uint256 tokenId_,\\n bytes memory data_\\n ) public payable virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId_), \\\"ERC3525: transfer caller is not owner nor approved\\\");\\n _safeTransferTokenId(from_, to_, tokenId_, data_);\\n }\\n\\n function safeTransferFrom(\\n address from_,\\n address to_,\\n uint256 tokenId_\\n ) public payable virtual override {\\n safeTransferFrom(from_, to_, tokenId_, \\\"\\\");\\n }\\n\\n function approve(address to_, uint256 tokenId_) public payable virtual override {\\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\\n require(to_ != owner, \\\"ERC3525: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || ERC3525Upgradeable.isApprovedForAll(owner, _msgSender()),\\n \\\"ERC3525: approve caller is not owner nor approved for all\\\"\\n );\\n\\n _approve(to_, tokenId_);\\n }\\n\\n function getApproved(uint256 tokenId_) public view virtual override returns (address) {\\n _requireMinted(tokenId_);\\n return _allTokens[_allTokensIndex[tokenId_]].approved;\\n }\\n\\n function setApprovalForAll(address operator_, bool approved_) public virtual override {\\n _setApprovalForAll(_msgSender(), operator_, approved_);\\n }\\n\\n function isApprovedForAll(address owner_, address operator_) public view virtual override returns (bool) {\\n return _addressData[owner_].approvals[operator_];\\n }\\n\\n function totalSupply() public view virtual override returns (uint256) {\\n return _allTokens.length;\\n }\\n\\n function tokenByIndex(uint256 index_) public view virtual override returns (uint256) {\\n require(index_ < ERC3525Upgradeable.totalSupply(), \\\"ERC3525: global index out of bounds\\\");\\n return _allTokens[index_].id;\\n }\\n\\n function tokenOfOwnerByIndex(address owner_, uint256 index_) public view virtual override returns (uint256) {\\n require(index_ < ERC3525Upgradeable.balanceOf(owner_), \\\"ERC3525: owner index out of bounds\\\");\\n return _addressData[owner_].ownedTokens[index_];\\n }\\n\\n function _setApprovalForAll(\\n address owner_,\\n address operator_,\\n bool approved_\\n ) internal virtual {\\n require(owner_ != operator_, \\\"ERC3525: approve to caller\\\");\\n\\n _addressData[owner_].approvals[operator_] = approved_;\\n\\n emit ApprovalForAll(owner_, operator_, approved_);\\n }\\n\\n function _isApprovedOrOwner(address operator_, uint256 tokenId_) internal view virtual returns (bool) {\\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\\n return (\\n operator_ == owner ||\\n ERC3525Upgradeable.isApprovedForAll(owner, operator_) ||\\n ERC3525Upgradeable.getApproved(tokenId_) == operator_\\n );\\n }\\n\\n function _spendAllowance(address operator_, uint256 tokenId_, uint256 value_) internal virtual {\\n uint256 currentAllowance = ERC3525Upgradeable.allowance(tokenId_, operator_);\\n if (!_isApprovedOrOwner(operator_, tokenId_) && currentAllowance != type(uint256).max) {\\n require(currentAllowance >= value_, \\\"ERC3525: insufficient allowance\\\");\\n _approveValue(tokenId_, operator_, currentAllowance - value_);\\n }\\n }\\n\\n function _exists(uint256 tokenId_) internal view virtual returns (bool) {\\n return _allTokens.length != 0 && _allTokens[_allTokensIndex[tokenId_]].id == tokenId_;\\n }\\n\\n function _requireMinted(uint256 tokenId_) internal view virtual {\\n require(_exists(tokenId_), \\\"ERC3525: invalid token ID\\\");\\n }\\n\\n function _mint(address to_, uint256 slot_, uint256 value_) internal virtual returns (uint256 tokenId) {\\n tokenId = _createOriginalTokenId();\\n _mint(to_, tokenId, slot_, value_); \\n }\\n\\n function _mint(address to_, uint256 tokenId_, uint256 slot_, uint256 value_) internal virtual {\\n require(to_ != address(0), \\\"ERC3525: mint to the zero address\\\");\\n require(tokenId_ != 0, \\\"ERC3525: cannot mint zero tokenId\\\");\\n require(!_exists(tokenId_), \\\"ERC3525: token already minted\\\");\\n\\n _beforeValueTransfer(address(0), to_, 0, tokenId_, slot_, value_);\\n __mintToken(to_, tokenId_, slot_);\\n __mintValue(tokenId_, value_);\\n _afterValueTransfer(address(0), to_, 0, tokenId_, slot_, value_);\\n }\\n\\n function _mintValue(uint256 tokenId_, uint256 value_) internal virtual {\\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\\n uint256 slot = ERC3525Upgradeable.slotOf(tokenId_);\\n _beforeValueTransfer(address(0), owner, 0, tokenId_, slot, value_);\\n __mintValue(tokenId_, value_);\\n _afterValueTransfer(address(0), owner, 0, tokenId_, slot, value_);\\n }\\n\\n function __mintValue(uint256 tokenId_, uint256 value_) private {\\n _allTokens[_allTokensIndex[tokenId_]].balance += value_;\\n emit TransferValue(0, tokenId_, value_);\\n }\\n\\n function __mintToken(address to_, uint256 tokenId_, uint256 slot_) private {\\n TokenData memory tokenData = TokenData({\\n id: tokenId_,\\n slot: slot_,\\n balance: 0,\\n owner: to_,\\n approved: address(0),\\n valueApprovals: new address[](0)\\n });\\n\\n _addTokenToAllTokensEnumeration(tokenData);\\n _addTokenToOwnerEnumeration(to_, tokenId_);\\n\\n emit Transfer(address(0), to_, tokenId_);\\n emit SlotChanged(tokenId_, 0, slot_);\\n }\\n\\n function _burn(uint256 tokenId_) internal virtual {\\n _requireMinted(tokenId_);\\n\\n TokenData storage tokenData = _allTokens[_allTokensIndex[tokenId_]];\\n address owner = tokenData.owner;\\n uint256 slot = tokenData.slot;\\n uint256 value = tokenData.balance;\\n\\n _beforeValueTransfer(owner, address(0), tokenId_, 0, slot, value);\\n\\n _clearApprovedValues(tokenId_);\\n _removeTokenFromOwnerEnumeration(owner, tokenId_);\\n _removeTokenFromAllTokensEnumeration(tokenId_);\\n\\n emit TransferValue(tokenId_, 0, value);\\n emit SlotChanged(tokenId_, slot, 0);\\n emit Transfer(owner, address(0), tokenId_);\\n\\n _afterValueTransfer(owner, address(0), tokenId_, 0, slot, value);\\n }\\n\\n function _burnValue(uint256 tokenId_, uint256 burnValue_) internal virtual {\\n _requireMinted(tokenId_);\\n\\n TokenData storage tokenData = _allTokens[_allTokensIndex[tokenId_]];\\n address owner = tokenData.owner;\\n uint256 slot = tokenData.slot;\\n uint256 value = tokenData.balance;\\n\\n require(value >= burnValue_, \\\"ERC3525: burn value exceeds balance\\\");\\n\\n _beforeValueTransfer(owner, address(0), tokenId_, 0, slot, burnValue_);\\n \\n tokenData.balance -= burnValue_;\\n emit TransferValue(tokenId_, 0, burnValue_);\\n \\n _afterValueTransfer(owner, address(0), tokenId_, 0, slot, burnValue_);\\n }\\n\\n function _addTokenToOwnerEnumeration(address to_, uint256 tokenId_) private {\\n _allTokens[_allTokensIndex[tokenId_]].owner = to_;\\n\\n _addressData[to_].ownedTokensIndex[tokenId_] = _addressData[to_].ownedTokens.length;\\n _addressData[to_].ownedTokens.push(tokenId_);\\n }\\n\\n function _removeTokenFromOwnerEnumeration(address from_, uint256 tokenId_) private {\\n _allTokens[_allTokensIndex[tokenId_]].owner = address(0);\\n\\n AddressData storage ownerData = _addressData[from_];\\n uint256 lastTokenIndex = ownerData.ownedTokens.length - 1;\\n uint256 lastTokenId = ownerData.ownedTokens[lastTokenIndex];\\n uint256 tokenIndex = ownerData.ownedTokensIndex[tokenId_];\\n\\n ownerData.ownedTokens[tokenIndex] = lastTokenId;\\n ownerData.ownedTokensIndex[lastTokenId] = tokenIndex;\\n\\n delete ownerData.ownedTokensIndex[tokenId_];\\n ownerData.ownedTokens.pop();\\n }\\n\\n function _addTokenToAllTokensEnumeration(TokenData memory tokenData_) private {\\n _allTokensIndex[tokenData_.id] = _allTokens.length;\\n _allTokens.push(tokenData_);\\n }\\n\\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId_) private {\\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\\n // then delete the last slot (swap and pop).\\n\\n uint256 lastTokenIndex = _allTokens.length - 1;\\n uint256 tokenIndex = _allTokensIndex[tokenId_];\\n\\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\\n TokenData memory lastTokenData = _allTokens[lastTokenIndex];\\n\\n _allTokens[tokenIndex] = lastTokenData; // Move the last token to the slot of the to-delete token\\n _allTokensIndex[lastTokenData.id] = tokenIndex; // Update the moved token's index\\n\\n // This also deletes the contents at the last position of the array\\n delete _allTokensIndex[tokenId_];\\n _allTokens.pop();\\n }\\n\\n function _approve(address to_, uint256 tokenId_) internal virtual {\\n _allTokens[_allTokensIndex[tokenId_]].approved = to_;\\n emit Approval(ERC3525Upgradeable.ownerOf(tokenId_), to_, tokenId_);\\n }\\n\\n function _approveValue(\\n uint256 tokenId_,\\n address to_,\\n uint256 value_\\n ) internal virtual {\\n require(to_ != address(0), \\\"ERC3525: approve value to the zero address\\\");\\n if (!_existApproveValue(to_, tokenId_)) {\\n _allTokens[_allTokensIndex[tokenId_]].valueApprovals.push(to_);\\n }\\n _approvedValues[tokenId_][to_] = value_;\\n\\n emit ApprovalValue(tokenId_, to_, value_);\\n }\\n\\n function _clearApprovedValues(uint256 tokenId_) internal virtual {\\n TokenData storage tokenData = _allTokens[_allTokensIndex[tokenId_]];\\n uint256 length = tokenData.valueApprovals.length;\\n for (uint256 i = 0; i < length; i++) {\\n address approval = tokenData.valueApprovals[i];\\n delete _approvedValues[tokenId_][approval];\\n }\\n delete tokenData.valueApprovals;\\n }\\n\\n function _existApproveValue(address to_, uint256 tokenId_) internal view virtual returns (bool) {\\n uint256 length = _allTokens[_allTokensIndex[tokenId_]].valueApprovals.length;\\n for (uint256 i = 0; i < length; i++) {\\n if (_allTokens[_allTokensIndex[tokenId_]].valueApprovals[i] == to_) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n function _transferValue(\\n uint256 fromTokenId_,\\n uint256 toTokenId_,\\n uint256 value_\\n ) internal virtual {\\n require(_exists(fromTokenId_), \\\"ERC3525: transfer from invalid token ID\\\");\\n require(_exists(toTokenId_), \\\"ERC3525: transfer to invalid token ID\\\");\\n\\n TokenData storage fromTokenData = _allTokens[_allTokensIndex[fromTokenId_]];\\n TokenData storage toTokenData = _allTokens[_allTokensIndex[toTokenId_]];\\n\\n require(fromTokenData.balance >= value_, \\\"ERC3525: insufficient balance for transfer\\\");\\n require(fromTokenData.slot == toTokenData.slot, \\\"ERC3525: transfer to token with different slot\\\");\\n\\n _beforeValueTransfer(\\n fromTokenData.owner,\\n toTokenData.owner,\\n fromTokenId_,\\n toTokenId_,\\n fromTokenData.slot,\\n value_\\n );\\n\\n fromTokenData.balance -= value_;\\n toTokenData.balance += value_;\\n\\n emit TransferValue(fromTokenId_, toTokenId_, value_);\\n\\n _afterValueTransfer(\\n fromTokenData.owner,\\n toTokenData.owner,\\n fromTokenId_,\\n toTokenId_,\\n fromTokenData.slot,\\n value_\\n );\\n\\n require(\\n _checkOnERC3525Received(fromTokenId_, toTokenId_, value_, \\\"\\\"),\\n \\\"ERC3525: transfer rejected by ERC3525Receiver\\\"\\n );\\n }\\n\\n function _transferTokenId(\\n address from_,\\n address to_,\\n uint256 tokenId_\\n ) internal virtual {\\n require(ERC3525Upgradeable.ownerOf(tokenId_) == from_, \\\"ERC3525: transfer from invalid owner\\\");\\n require(to_ != address(0), \\\"ERC3525: transfer to the zero address\\\");\\n\\n uint256 slot = ERC3525Upgradeable.slotOf(tokenId_);\\n uint256 value = ERC3525Upgradeable.balanceOf(tokenId_);\\n\\n _beforeValueTransfer(from_, to_, tokenId_, tokenId_, slot, value);\\n\\n _approve(address(0), tokenId_);\\n _clearApprovedValues(tokenId_);\\n\\n _removeTokenFromOwnerEnumeration(from_, tokenId_);\\n _addTokenToOwnerEnumeration(to_, tokenId_);\\n\\n emit Transfer(from_, to_, tokenId_);\\n\\n _afterValueTransfer(from_, to_, tokenId_, tokenId_, slot, value);\\n }\\n\\n function _safeTransferTokenId(\\n address from_,\\n address to_,\\n uint256 tokenId_,\\n bytes memory data_\\n ) internal virtual {\\n _transferTokenId(from_, to_, tokenId_);\\n require(\\n _checkOnERC721Received(from_, to_, tokenId_, data_),\\n \\\"ERC3525: transfer to non ERC721Receiver\\\"\\n );\\n }\\n\\n function _checkOnERC3525Received( \\n uint256 fromTokenId_, \\n uint256 toTokenId_, \\n uint256 value_, \\n bytes memory data_\\n ) private returns (bool) {\\n address to = ERC3525Upgradeable.ownerOf(toTokenId_);\\n if (to.isContract() && IERC165Upgradeable(to).supportsInterface(type(IERC3525ReceiverUpgradeable).interfaceId)) {\\n bytes4 retval = IERC3525ReceiverUpgradeable(to).onERC3525Received(_msgSender(), fromTokenId_, toTokenId_, value_, data_);\\n return retval == IERC3525ReceiverUpgradeable.onERC3525Received.selector;\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from_ address representing the previous owner of the given token ID\\n * @param to_ target address that will receive the tokens\\n * @param tokenId_ uint256 ID of the token to be transferred\\n * @param data_ bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from_,\\n address to_,\\n uint256 tokenId_,\\n bytes memory data_\\n ) private returns (bool) {\\n if (to_.isContract()) {\\n try \\n IERC721ReceiverUpgradeable(to_).onERC721Received(_msgSender(), from_, tokenId_, data_) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /* solhint-disable */\\n function _beforeValueTransfer(\\n address from_,\\n address to_,\\n uint256 fromTokenId_,\\n uint256 toTokenId_,\\n uint256 slot_,\\n uint256 value_\\n ) internal virtual {}\\n\\n function _afterValueTransfer(\\n address from_,\\n address to_,\\n uint256 fromTokenId_,\\n uint256 toTokenId_,\\n uint256 slot_,\\n uint256 value_\\n ) internal virtual {}\\n /* solhint-enable */\\n\\n function _setMetadataDescriptor(address metadataDescriptor_) internal virtual {\\n metadataDescriptor = IERC3525MetadataDescriptorUpgradeable(metadataDescriptor_);\\n emit SetMetadataDescriptor(metadataDescriptor_);\\n }\\n\\n function _createOriginalTokenId() internal virtual returns (uint256) {\\n _tokenIdGenerator.increment();\\n return _tokenIdGenerator.current();\\n }\\n\\n function _createDerivedTokenId(uint256 fromTokenId_) internal virtual returns (uint256) {\\n fromTokenId_;\\n return _createOriginalTokenId();\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[41] private __gap;\\n}\\n\",\"keccak256\":\"0x2eadd90956b55f2cce0bca0e53cd563df79ba2c500e77889b03a43cb307ec083\",\"license\":\"MIT\"},\"@solvprotocol/erc-3525/IERC3525.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./IERC721.sol\\\";\\n\\n/**\\n * @title ERC-3525 Semi-Fungible Token Standard\\n * @dev See https://eips.ethereum.org/EIPS/eip-3525\\n * Note: the ERC-165 identifier for this interface is 0xd5358140.\\n */\\ninterface IERC3525 is IERC165, IERC721 {\\n /**\\n * @dev MUST emit when value of a token is transferred to another token with the same slot,\\n * including zero value transfers (_value == 0) as well as transfers when tokens are created\\n * (`_fromTokenId` == 0) or destroyed (`_toTokenId` == 0).\\n * @param _fromTokenId The token id to transfer value from\\n * @param _toTokenId The token id to transfer value to\\n * @param _value The transferred value\\n */\\n event TransferValue(uint256 indexed _fromTokenId, uint256 indexed _toTokenId, uint256 _value);\\n\\n /**\\n * @dev MUST emits when the approval value of a token is set or changed.\\n * @param _tokenId The token to approve\\n * @param _operator The operator to approve for\\n * @param _value The maximum value that `_operator` is allowed to manage\\n */\\n event ApprovalValue(uint256 indexed _tokenId, address indexed _operator, uint256 _value);\\n\\n /**\\n * @dev MUST emit when the slot of a token is set or changed.\\n * @param _tokenId The token of which slot is set or changed\\n * @param _oldSlot The previous slot of the token\\n * @param _newSlot The updated slot of the token\\n */ \\n event SlotChanged(uint256 indexed _tokenId, uint256 indexed _oldSlot, uint256 indexed _newSlot);\\n\\n /**\\n * @notice Get the number of decimals the token uses for value - e.g. 6, means the user\\n * representation of the value of a token can be calculated by dividing it by 1,000,000.\\n * Considering the compatibility with third-party wallets, this function is defined as\\n * `valueDecimals()` instead of `decimals()` to avoid conflict with ERC20 tokens.\\n * @return The number of decimals for value\\n */\\n function valueDecimals() external view returns (uint8);\\n\\n /**\\n * @notice Get the value of a token.\\n * @param _tokenId The token for which to query the balance\\n * @return The value of `_tokenId`\\n */\\n function balanceOf(uint256 _tokenId) external view returns (uint256);\\n\\n /**\\n * @notice Get the slot of a token.\\n * @param _tokenId The identifier for a token\\n * @return The slot of the token\\n */\\n function slotOf(uint256 _tokenId) external view returns (uint256);\\n\\n /**\\n * @notice Allow an operator to manage the value of a token, up to the `_value` amount.\\n * @dev MUST revert unless caller is the current owner, an authorized operator, or the approved\\n * address for `_tokenId`.\\n * MUST emit ApprovalValue event.\\n * @param _tokenId The token to approve\\n * @param _operator The operator to be approved\\n * @param _value The maximum value of `_toTokenId` that `_operator` is allowed to manage\\n */\\n function approve(\\n uint256 _tokenId,\\n address _operator,\\n uint256 _value\\n ) external payable;\\n\\n /**\\n * @notice Get the maximum value of a token that an operator is allowed to manage.\\n * @param _tokenId The token for which to query the allowance\\n * @param _operator The address of an operator\\n * @return The current approval value of `_tokenId` that `_operator` is allowed to manage\\n */\\n function allowance(uint256 _tokenId, address _operator) external view returns (uint256);\\n\\n /**\\n * @notice Transfer value from a specified token to another specified token with the same slot.\\n * @dev Caller MUST be the current owner, an authorized operator or an operator who has been\\n * approved the whole `_fromTokenId` or part of it.\\n * MUST revert if `_fromTokenId` or `_toTokenId` is zero token id or does not exist.\\n * MUST revert if slots of `_fromTokenId` and `_toTokenId` do not match.\\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\\n * operator.\\n * MUST emit `TransferValue` event.\\n * @param _fromTokenId The token to transfer value from\\n * @param _toTokenId The token to transfer value to\\n * @param _value The transferred value\\n */\\n function transferFrom(\\n uint256 _fromTokenId,\\n uint256 _toTokenId,\\n uint256 _value\\n ) external payable;\\n\\n /**\\n * @notice Transfer value from a specified token to an address. The caller should confirm that\\n * `_to` is capable of receiving ERC3525 tokens.\\n * @dev This function MUST create a new ERC3525 token with the same slot for `_to` to receive\\n * the transferred value.\\n * MUST revert if `_fromTokenId` is zero token id or does not exist.\\n * MUST revert if `_to` is zero address.\\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\\n * operator.\\n * MUST emit `Transfer` and `TransferValue` events.\\n * @param _fromTokenId The token to transfer value from\\n * @param _to The address to transfer value to\\n * @param _value The transferred value\\n * @return ID of the new token created for `_to` which receives the transferred value\\n */\\n function transferFrom(\\n uint256 _fromTokenId,\\n address _to,\\n uint256 _value\\n ) external payable returns (uint256);\\n}\\n\",\"keccak256\":\"0x901207b3c61837eeae24c25271533a0dd684745dad978235053fe4d9d86a9ded\",\"license\":\"MIT\"},\"@solvprotocol/erc-3525/IERC3525ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @title EIP-3525 token receiver interface\\n * @dev Interface for a smart contract that wants to be informed by EIP-3525 contracts when \\n * receiving values from ANY addresses or EIP-3525 tokens.\\n * Note: the EIP-165 identifier for this interface is 0x009ce20b.\\n */\\ninterface IERC3525ReceiverUpgradeable {\\n /**\\n * @notice Handle the receipt of an EIP-3525 token value.\\n * @dev An EIP-3525 smart contract MUST check whether this function is implemented by the \\n * recipient contract, if the recipient contract implements this function, the EIP-3525 \\n * contract MUST call this function after a value transfer (i.e. `transferFrom(uint256,\\n * uint256,uint256,bytes)`).\\n * MUST return 0x009ce20b (i.e. `bytes4(keccak256('onERC3525Received(address,uint256,uint256,\\n * uint256,bytes)'))`) if the transfer is accepted.\\n * MUST revert or return any value other than 0x009ce20b if the transfer is rejected.\\n * @param _operator The address which triggered the transfer\\n * @param _fromTokenId The token id to transfer value from\\n * @param _toTokenId The token id to transfer value to\\n * @param _value The transferred value\\n * @param _data Additional data with no specified format\\n * @return `bytes4(keccak256('onERC3525Received(address,uint256,uint256,uint256,bytes)'))` \\n * unless the transfer is rejected.\\n */\\n function onERC3525Received(address _operator, uint256 _fromTokenId, uint256 _toTokenId, uint256 _value, bytes calldata _data) external returns (bytes4);\\n\\n}\",\"keccak256\":\"0x2a8ce467d124fa2edce6c5204f497acafd1e0dc8f62064c64795dac657a9ab07\",\"license\":\"MIT\"},\"@solvprotocol/erc-3525/IERC3525Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\\\";\\nimport \\\"./IERC721Upgradeable.sol\\\";\\n\\n/**\\n * @title ERC-3525 Semi-Fungible Token Standard\\n * @dev See https://eips.ethereum.org/EIPS/eip-3525\\n * Note: the ERC-165 identifier for this interface is 0xd5358140.\\n */\\ninterface IERC3525Upgradeable is IERC165Upgradeable, IERC721Upgradeable {\\n /**\\n * @dev MUST emit when value of a token is transferred to another token with the same slot,\\n * including zero value transfers (_value == 0) as well as transfers when tokens are created\\n * (`_fromTokenId` == 0) or destroyed (`_toTokenId` == 0).\\n * @param _fromTokenId The token id to transfer value from\\n * @param _toTokenId The token id to transfer value to\\n * @param _value The transferred value\\n */\\n event TransferValue(uint256 indexed _fromTokenId, uint256 indexed _toTokenId, uint256 _value);\\n\\n /**\\n * @dev MUST emits when the approval value of a token is set or changed.\\n * @param _tokenId The token to approve\\n * @param _operator The operator to approve for\\n * @param _value The maximum value that `_operator` is allowed to manage\\n */\\n event ApprovalValue(uint256 indexed _tokenId, address indexed _operator, uint256 _value);\\n\\n /**\\n * @dev MUST emit when the slot of a token is set or changed.\\n * @param _tokenId The token of which slot is set or changed\\n * @param _oldSlot The previous slot of the token\\n * @param _newSlot The updated slot of the token\\n */ \\n event SlotChanged(uint256 indexed _tokenId, uint256 indexed _oldSlot, uint256 indexed _newSlot);\\n\\n /**\\n * @notice Get the number of decimals the token uses for value - e.g. 6, means the user\\n * representation of the value of a token can be calculated by dividing it by 1,000,000.\\n * Considering the compatibility with third-party wallets, this function is defined as\\n * `valueDecimals()` instead of `decimals()` to avoid conflict with ERC20 tokens.\\n * @return The number of decimals for value\\n */\\n function valueDecimals() external view returns (uint8);\\n\\n /**\\n * @notice Get the value of a token.\\n * @param _tokenId The token for which to query the balance\\n * @return The value of `_tokenId`\\n */\\n function balanceOf(uint256 _tokenId) external view returns (uint256);\\n\\n /**\\n * @notice Get the slot of a token.\\n * @param _tokenId The identifier for a token\\n * @return The slot of the token\\n */\\n function slotOf(uint256 _tokenId) external view returns (uint256);\\n\\n /**\\n * @notice Allow an operator to manage the value of a token, up to the `_value` amount.\\n * @dev MUST revert unless caller is the current owner, an authorized operator, or the approved\\n * address for `_tokenId`.\\n * MUST emit ApprovalValue event.\\n * @param _tokenId The token to approve\\n * @param _operator The operator to be approved\\n * @param _value The maximum value of `_toTokenId` that `_operator` is allowed to manage\\n */\\n function approve(\\n uint256 _tokenId,\\n address _operator,\\n uint256 _value\\n ) external payable;\\n\\n /**\\n * @notice Get the maximum value of a token that an operator is allowed to manage.\\n * @param _tokenId The token for which to query the allowance\\n * @param _operator The address of an operator\\n * @return The current approval value of `_tokenId` that `_operator` is allowed to manage\\n */\\n function allowance(uint256 _tokenId, address _operator) external view returns (uint256);\\n\\n /**\\n * @notice Transfer value from a specified token to another specified token with the same slot.\\n * @dev Caller MUST be the current owner, an authorized operator or an operator who has been\\n * approved the whole `_fromTokenId` or part of it.\\n * MUST revert if `_fromTokenId` or `_toTokenId` is zero token id or does not exist.\\n * MUST revert if slots of `_fromTokenId` and `_toTokenId` do not match.\\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\\n * operator.\\n * MUST emit `TransferValue` event.\\n * @param _fromTokenId The token to transfer value from\\n * @param _toTokenId The token to transfer value to\\n * @param _value The transferred value\\n */\\n function transferFrom(\\n uint256 _fromTokenId,\\n uint256 _toTokenId,\\n uint256 _value\\n ) external payable;\\n\\n /**\\n * @notice Transfer value from a specified token to an address. The caller should confirm that\\n * `_to` is capable of receiving ERC3525 tokens.\\n * @dev This function MUST create a new ERC3525 token with the same slot for `_to` to receive\\n * the transferred value.\\n * MUST revert if `_fromTokenId` is zero token id or does not exist.\\n * MUST revert if `_to` is zero address.\\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\\n * operator.\\n * MUST emit `Transfer` and `TransferValue` events.\\n * @param _fromTokenId The token to transfer value from\\n * @param _to The address to transfer value to\\n * @param _value The transferred value\\n * @return ID of the new token created for `_to` which receives the transferred value\\n */\\n function transferFrom(\\n uint256 _fromTokenId,\\n address _to,\\n uint256 _value\\n ) external payable returns (uint256);\\n}\\n\",\"keccak256\":\"0xba988600d0ee1fb8e2807832844c6c708b34688470d9a2f7687aa1da91ee9606\",\"license\":\"MIT\"},\"@solvprotocol/erc-3525/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.1;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\n/** \\n * @title ERC-721 Non-Fungible Token Standard\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n * Note: the ERC-165 identifier for this interface is 0x80ac58cd.\\n */\\ninterface IERC721 is IERC165 {\\n /** \\n * @dev This emits when ownership of any NFT changes by any mechanism.\\n * This event emits when NFTs are created (`from` == 0) and destroyed\\n * (`to` == 0). Exception: during contract creation, any number of NFTs\\n * may be created and assigned without emitting Transfer. At the time of\\n * any transfer, the approved address for that NFT (if any) is reset to none.\\n */\\n event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);\\n\\n /**\\n * @dev This emits when the approved address for an NFT is changed or\\n * reaffirmed. The zero address indicates there is no approved address.\\n * When a Transfer event emits, this also indicates that the approved\\n * address for that NFT (if any) is reset to none.\\n */\\n event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);\\n\\n /**\\n * @dev This emits when an operator is enabled or disabled for an owner.\\n * The operator can manage all NFTs of the owner.\\n */\\n event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);\\n\\n /**\\n * @notice Count all NFTs assigned to an owner\\n * @dev NFTs assigned to the zero address are considered invalid, and this\\n * function throws for queries about the zero address.\\n * @param _owner An address for whom to query the balance\\n * @return The number of NFTs owned by `_owner`, possibly zero\\n */\\n function balanceOf(address _owner) external view returns (uint256);\\n\\n /**\\n * @notice Find the owner of an NFT\\n * @dev NFTs assigned to zero address are considered invalid, and queries\\n * about them do throw.\\n * @param _tokenId The identifier for an NFT\\n * @return The address of the owner of the NFT\\n */\\n function ownerOf(uint256 _tokenId) external view returns (address);\\n\\n /**\\n * @notice Transfers the ownership of an NFT from one address to another address\\n * @dev Throws unless `msg.sender` is the current owner, an authorized\\n * operator, or the approved address for this NFT. Throws if `_from` is\\n * not the current owner. Throws if `_to` is the zero address. Throws if\\n * `_tokenId` is not a valid NFT. When transfer is complete, this function\\n * checks if `_to` is a smart contract (code size > 0). If so, it calls\\n * `onERC721Received` on `_to` and throws if the return value is not\\n * `bytes4(keccak256(\\\"onERC721Received(address,address,uint256,bytes)\\\"))`.\\n * @param _from The current owner of the NFT\\n * @param _to The new owner\\n * @param _tokenId The NFT to transfer\\n * @param data Additional data with no specified format, sent in call to `_to`\\n */\\n function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes calldata data) external payable;\\n\\n /**\\n * @notice Transfers the ownership of an NFT from one address to another address\\n * @dev This works identically to the other function with an extra data parameter,\\n * except this function just sets data to \\\"\\\".\\n * @param _from The current owner of the NFT\\n * @param _to The new owner\\n * @param _tokenId The NFT to transfer\\n */\\n function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;\\n\\n /**\\n * @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\\n * TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\\n * THEY MAY BE PERMANENTLY LOST\\n * @dev Throws unless `msg.sender` is the current owner, an authorized\\n * operator, or the approved address for this NFT. Throws if `_from` is\\n * not the current owner. Throws if `_to` is the zero address. Throws if\\n * `_tokenId` is not a valid NFT.\\n * @param _from The current owner of the NFT\\n * @param _to The new owner\\n * @param _tokenId The NFT to transfer\\n */\\n function transferFrom(address _from, address _to, uint256 _tokenId) external payable;\\n\\n /**\\n * @notice Change or reaffirm the approved address for an NFT\\n * @dev The zero address indicates there is no approved address.\\n * Throws unless `msg.sender` is the current NFT owner, or an authorized\\n * operator of the current owner.\\n * @param _approved The new approved NFT controller\\n * @param _tokenId The NFT to approve\\n */\\n function approve(address _approved, uint256 _tokenId) external payable;\\n\\n /**\\n * @notice Enable or disable approval for a third party (\\\"operator\\\") to manage\\n * all of `msg.sender`'s assets\\n * @dev Emits the ApprovalForAll event. The contract MUST allow\\n * multiple operators per owner.\\n * @param _operator Address to add to the set of authorized operators\\n * @param _approved True if the operator is approved, false to revoke approval\\n */\\n function setApprovalForAll(address _operator, bool _approved) external;\\n\\n /**\\n * @notice Get the approved address for a single NFT\\n * @dev Throws if `_tokenId` is not a valid NFT.\\n * @param _tokenId The NFT to find the approved address for\\n * @return The approved address for this NFT, or the zero address if there is none\\n */\\n function getApproved(uint256 _tokenId) external view returns (address);\\n\\n /**\\n * @notice Query if an address is an authorized operator for another address\\n * @param _owner The address that owns the NFTs\\n * @param _operator The address that acts on behalf of the owner\\n * @return True if `_operator` is an approved operator for `_owner`, false otherwise\\n */\\n function isApprovedForAll(address _owner, address _operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x3553276ca123c09e0ebc3232afb0452dff1d2841e767e221deffe0633867f5e8\",\"license\":\"MIT\"},\"@solvprotocol/erc-3525/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers from ERC721 asset contracts.\\n * Note: the ERC-165 identifier for this interface is 0x150b7a02.\\n */\\ninterface IERC721ReceiverUpgradeable {\\n /** \\n * @notice Handle the receipt of an NFT\\n * @dev The ERC721 smart contract calls this function on the recipient\\n * after a `transfer`. This function MAY throw to revert and reject the\\n * transfer. Return of other than the magic value MUST result in the\\n * transaction being reverted.\\n * Note: the contract address is always the message sender.\\n * @param _operator The address which called `safeTransferFrom` function\\n * @param _from The address which previously owned the token\\n * @param _tokenId The NFT identifier which is being transferred\\n * @param _data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC721Received(address,address,uint256,bytes)\\\"))`\\n * unless throwing\\n */\\n function onERC721Received(\\n address _operator, \\n address _from, \\n uint256 _tokenId, \\n bytes calldata _data\\n ) external returns(bytes4);\\n}\\n\",\"keccak256\":\"0x6cd7a37a4a516941845319f17f08f57d762cb290b85871b5e510875ec964f3e8\",\"license\":\"MIT\"},\"@solvprotocol/erc-3525/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.1;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/** \\n * @title ERC-721 Non-Fungible Token Standard\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n * Note: the ERC-165 identifier for this interface is 0x80ac58cd.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\n /** \\n * @dev This emits when ownership of any NFT changes by any mechanism.\\n * This event emits when NFTs are created (`from` == 0) and destroyed\\n * (`to` == 0). Exception: during contract creation, any number of NFTs\\n * may be created and assigned without emitting Transfer. At the time of\\n * any transfer, the approved address for that NFT (if any) is reset to none.\\n */\\n event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);\\n\\n /**\\n * @dev This emits when the approved address for an NFT is changed or\\n * reaffirmed. The zero address indicates there is no approved address.\\n * When a Transfer event emits, this also indicates that the approved\\n * address for that NFT (if any) is reset to none.\\n */\\n event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);\\n\\n /**\\n * @dev This emits when an operator is enabled or disabled for an owner.\\n * The operator can manage all NFTs of the owner.\\n */\\n event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);\\n\\n /**\\n * @notice Count all NFTs assigned to an owner\\n * @dev NFTs assigned to the zero address are considered invalid, and this\\n * function throws for queries about the zero address.\\n * @param _owner An address for whom to query the balance\\n * @return The number of NFTs owned by `_owner`, possibly zero\\n */\\n function balanceOf(address _owner) external view returns (uint256);\\n\\n /**\\n * @notice Find the owner of an NFT\\n * @dev NFTs assigned to zero address are considered invalid, and queries\\n * about them do throw.\\n * @param _tokenId The identifier for an NFT\\n * @return The address of the owner of the NFT\\n */\\n function ownerOf(uint256 _tokenId) external view returns (address);\\n\\n /**\\n * @notice Transfers the ownership of an NFT from one address to another address\\n * @dev Throws unless `msg.sender` is the current owner, an authorized\\n * operator, or the approved address for this NFT. Throws if `_from` is\\n * not the current owner. Throws if `_to` is the zero address. Throws if\\n * `_tokenId` is not a valid NFT. When transfer is complete, this function\\n * checks if `_to` is a smart contract (code size > 0). If so, it calls\\n * `onERC721Received` on `_to` and throws if the return value is not\\n * `bytes4(keccak256(\\\"onERC721Received(address,address,uint256,bytes)\\\"))`.\\n * @param _from The current owner of the NFT\\n * @param _to The new owner\\n * @param _tokenId The NFT to transfer\\n * @param data Additional data with no specified format, sent in call to `_to`\\n */\\n function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes calldata data) external payable;\\n\\n /**\\n * @notice Transfers the ownership of an NFT from one address to another address\\n * @dev This works identically to the other function with an extra data parameter,\\n * except this function just sets data to \\\"\\\".\\n * @param _from The current owner of the NFT\\n * @param _to The new owner\\n * @param _tokenId The NFT to transfer\\n */\\n function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;\\n\\n /**\\n * @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\\n * TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\\n * THEY MAY BE PERMANENTLY LOST\\n * @dev Throws unless `msg.sender` is the current owner, an authorized\\n * operator, or the approved address for this NFT. Throws if `_from` is\\n * not the current owner. Throws if `_to` is the zero address. Throws if\\n * `_tokenId` is not a valid NFT.\\n * @param _from The current owner of the NFT\\n * @param _to The new owner\\n * @param _tokenId The NFT to transfer\\n */\\n function transferFrom(address _from, address _to, uint256 _tokenId) external payable;\\n\\n /**\\n * @notice Change or reaffirm the approved address for an NFT\\n * @dev The zero address indicates there is no approved address.\\n * Throws unless `msg.sender` is the current NFT owner, or an authorized\\n * operator of the current owner.\\n * @param _approved The new approved NFT controller\\n * @param _tokenId The NFT to approve\\n */\\n function approve(address _approved, uint256 _tokenId) external payable;\\n\\n /**\\n * @notice Enable or disable approval for a third party (\\\"operator\\\") to manage\\n * all of `msg.sender`'s assets\\n * @dev Emits the ApprovalForAll event. The contract MUST allow\\n * multiple operators per owner.\\n * @param _operator Address to add to the set of authorized operators\\n * @param _approved True if the operator is approved, false to revoke approval\\n */\\n function setApprovalForAll(address _operator, bool _approved) external;\\n\\n /**\\n * @notice Get the approved address for a single NFT\\n * @dev Throws if `_tokenId` is not a valid NFT.\\n * @param _tokenId The NFT to find the approved address for\\n * @return The approved address for this NFT, or the zero address if there is none\\n */\\n function getApproved(uint256 _tokenId) external view returns (address);\\n\\n /**\\n * @notice Query if an address is an authorized operator for another address\\n * @param _owner The address that owns the NFTs\\n * @param _operator The address that acts on behalf of the owner\\n * @return True if `_operator` is an approved operator for `_owner`, false otherwise\\n */\\n function isApprovedForAll(address _owner, address _operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xfed540aa2671b614e3ffb1be0fc20f1f32d9fa2926eadbc62a43b97625050446\",\"license\":\"MIT\"},\"@solvprotocol/erc-3525/extensions/IERC3525MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.1;\\n\\nimport \\\"../IERC3525Upgradeable.sol\\\";\\nimport \\\"./IERC721MetadataUpgradeable.sol\\\";\\n\\n/**\\n * @title ERC-3525 Semi-Fungible Token Standard, optional extension for metadata\\n * @dev Interfaces for any contract that wants to support query of the Uniform Resource Identifier\\n * (URI) for the ERC3525 contract as well as a specified slot.\\n * Because of the higher reliability of data stored in smart contracts compared to data stored in\\n * centralized systems, it is recommended that metadata, including `contractURI`, `slotURI` and\\n * `tokenURI`, be directly returned in JSON format, instead of being returned with a url pointing\\n * to any resource stored in a centralized system.\\n * See https://eips.ethereum.org/EIPS/eip-3525\\n * Note: the ERC-165 identifier for this interface is 0xe1600902.\\n */\\ninterface IERC3525MetadataUpgradeable is IERC3525Upgradeable, IERC721MetadataUpgradeable {\\n /**\\n * @notice Returns the Uniform Resource Identifier (URI) for the current ERC3525 contract.\\n * @dev This function SHOULD return the URI for this contract in JSON format, starting with\\n * header `data:application/json;`.\\n * See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for contract URI.\\n * @return The JSON formatted URI of the current ERC3525 contract\\n */\\n function contractURI() external view returns (string memory);\\n\\n /**\\n * @notice Returns the Uniform Resource Identifier (URI) for the specified slot.\\n * @dev This function SHOULD return the URI for `_slot` in JSON format, starting with header\\n * `data:application/json;`.\\n * See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for slot URI.\\n * @return The JSON formatted URI of `_slot`\\n */\\n function slotURI(uint256 _slot) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ba530840b3eb25b4175cf8423c0cfe8d2da75d8c4dc88ecf85204a8940d047e\",\"license\":\"MIT\"},\"@solvprotocol/erc-3525/extensions/IERC721EnumerableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.1;\\n\\nimport \\\"../IERC721Upgradeable.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n * Note: the ERC-165 identifier for this interface is 0x780e9d63.\\n */\\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\\n /** \\n * @notice Count NFTs tracked by this contract\\n * @return A count of valid NFTs tracked by this contract, where each one of\\n * them has an assigned and queryable owner not equal to the zero address\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /** \\n * @notice Enumerate valid NFTs\\n * @dev Throws if `_index` >= `totalSupply()`.\\n * @param _index A counter less than `totalSupply()`\\n * @return The token identifier for the `_index`th NFT,\\n * (sort order not specified)\\n */\\n function tokenByIndex(uint256 _index) external view returns (uint256);\\n\\n /** \\n * @notice Enumerate NFTs assigned to an owner\\n * @dev Throws if `_index` >= `balanceOf(_owner)` or if\\n * `_owner` is the zero address, representing invalid NFTs.\\n * @param _owner An address where we are interested in NFTs owned by them\\n * @param _index A counter less than `balanceOf(_owner)`\\n * @return The token identifier for the `_index`th NFT assigned to `_owner`,\\n * (sort order not specified)\\n */\\n function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xcdff30c7dcc40c98f6dec4507584bb560d08b7bfcce791f731c11098f8cca3ab\",\"license\":\"MIT\"},\"@solvprotocol/erc-3525/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.1;\\n\\nimport \\\"../IERC721Upgradeable.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n * Note: the ERC-165 identifier for this interface is 0x5b5e139f.\\n */\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\n /**\\n * @notice A descriptive name for a collection of NFTs in this contract\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @notice An abbreviated name for NFTs in this contract\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @notice A distinct Uniform Resource Identifier (URI) for a given asset.\\n * @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC\\n * 3986. The URI may point to a JSON file that conforms to the \\\"ERC721\\n * Metadata JSON Schema\\\".\\n */\\n function tokenURI(uint256 _tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x94599f6f4e0106919c549625cf71353ea433cf47837ecbc33ce57a81d5c65b92\",\"license\":\"MIT\"},\"@solvprotocol/erc-3525/periphery/interface/IERC3525MetadataDescriptorUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC3525MetadataDescriptorUpgradeable {\\n\\n function constructContractURI() external view returns (string memory);\\n\\n function constructSlotURI(uint256 slot) external view returns (string memory);\\n \\n function constructTokenURI(uint256 tokenId) external view returns (string memory);\\n\\n}\",\"keccak256\":\"0xa40c93b0968840218c1febb1d73c1fc6cfa5f40786f1c4e3115674f997733089\",\"license\":\"MIT\"},\"contracts/GatewayToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport {UUPSUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\\\";\\nimport {ContextUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {ERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport {IERC3525MetadataUpgradeable} from \\\"@solvprotocol/erc-3525/extensions/IERC3525MetadataUpgradeable.sol\\\";\\nimport {ERC3525Upgradeable} from \\\"@solvprotocol/erc-3525/ERC3525Upgradeable.sol\\\";\\nimport {IERC721} from \\\"@solvprotocol/erc-3525/IERC721.sol\\\";\\nimport {IERC3525} from \\\"@solvprotocol/erc-3525/IERC3525.sol\\\";\\nimport {TokenBitMask} from \\\"./TokenBitMask.sol\\\";\\nimport {IGatewayToken} from \\\"./interfaces/IGatewayToken.sol\\\";\\nimport {IERC721Freezable} from \\\"./interfaces/IERC721Freezable.sol\\\";\\nimport {IERC721Expirable} from \\\"./interfaces/IERC721Expirable.sol\\\";\\nimport {IERC721Revokable} from \\\"./interfaces/IERC721Revokable.sol\\\";\\nimport {MultiERC2771Context} from \\\"./MultiERC2771Context.sol\\\";\\nimport {Charge} from \\\"./library/Charge.sol\\\";\\nimport {ParameterizedAccessControl} from \\\"./ParameterizedAccessControl.sol\\\";\\nimport {Common__MissingAccount, Common__NotContract, Common__Unauthorized} from \\\"./library/CommonErrors.sol\\\";\\n\\n/**\\n * @dev Gateway Token contract is responsible for managing Identity.com KYC gateway tokens\\n * those tokens represent completed KYC with attached identity.\\n * Gateway tokens using ERC721 standard with custom extensions.\\n *\\n * Contract handles multiple levels of access such as Network Authority\\n * (may represent a specific regulator body)\\n * Gatekeepers (Identity.com network parties who can mint/burn/freeze gateway tokens)\\n * and overall system Admin who can add\\n * new Gatekeepers and Network Authorities\\n */\\ncontract GatewayToken is\\n UUPSUpgradeable,\\n MultiERC2771Context,\\n ERC3525Upgradeable,\\n ParameterizedAccessControl,\\n IERC721Freezable,\\n IERC721Expirable,\\n IERC721Revokable,\\n IGatewayToken,\\n TokenBitMask\\n{\\n using Address for address;\\n using Strings for uint;\\n\\n // Off-chain DAO governance access control\\n mapping(uint => bool) public isNetworkDAOGoverned;\\n\\n // Access control roles\\n bytes32 public constant DAO_MANAGER_ROLE = keccak256(\\\"DAO_MANAGER_ROLE\\\");\\n bytes32 public constant GATEKEEPER_ROLE = keccak256(\\\"GATEKEEPER_ROLE\\\");\\n bytes32 public constant NETWORK_AUTHORITY_ROLE = keccak256(\\\"NETWORK_AUTHORITY_ROLE\\\");\\n\\n // Optional mapping for gateway token bitmaps\\n mapping(uint => TokenState) internal _tokenStates;\\n\\n // Optional Mapping from token ID to expiration date\\n mapping(uint => uint) internal _expirations;\\n\\n mapping(uint => string) internal _networks;\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n // constructor is \\\"empty\\\" as we are using the proxy pattern,\\n // where setup code is in the initialize function\\n // called by the proxy contract\\n constructor() {\\n _disableInitializers();\\n }\\n\\n function initialize(\\n string calldata _name,\\n string calldata _symbol,\\n address _superAdmin,\\n address _flagsStorage,\\n address[] calldata _trustedForwarders\\n ) external initializer {\\n // Check for zero addresses\\n if (_superAdmin == address(0)) {\\n revert Common__MissingAccount();\\n }\\n\\n if (_flagsStorage == address(0)) {\\n revert Common__MissingAccount();\\n }\\n\\n // Check for zero addresses in the trusted forwarders array\\n for (uint256 i = 0; i < _trustedForwarders.length; i++) {\\n if (_trustedForwarders[i] == address(0)) {\\n revert Common__MissingAccount();\\n }\\n }\\n\\n __ERC3525_init(_name, _symbol, 0);\\n __MultiERC2771Context_init(_trustedForwarders);\\n\\n _setFlagsStorage(_flagsStorage);\\n _superAdmins[_superAdmin] = true;\\n }\\n\\n function setMetadataDescriptor(address _metadataDescriptor) external onlySuperAdmin {\\n _setMetadataDescriptor(_metadataDescriptor);\\n }\\n\\n function addForwarder(address forwarder) external onlySuperAdmin {\\n _addForwarder(forwarder);\\n }\\n\\n function removeForwarder(address forwarder) external onlySuperAdmin {\\n _removeForwarder(forwarder);\\n }\\n\\n /**\\n * @dev Triggers to update FlagsStorage contract address\\n * @param flagsStorage FlagsStorage contract address\\n */\\n function updateFlagsStorage(address flagsStorage) external onlySuperAdmin {\\n _setFlagsStorage(flagsStorage);\\n }\\n\\n /**\\n * @dev Triggers to burn gateway token\\n * @param tokenId Gateway token id\\n */\\n function burn(uint tokenId) external virtual {\\n _checkGatekeeper(slotOf(tokenId));\\n _burn(tokenId);\\n }\\n\\n /**\\n * @dev Triggers to mint gateway token\\n * @param to Gateway token owner\\n * @param network Gateway token type\\n * @param mask The bitmask for the token\\n */\\n function mint(address to, uint network, uint expiration, uint mask, Charge calldata) external virtual {\\n _checkGatekeeper(network);\\n\\n uint tokenId = ERC3525Upgradeable._mint(to, network, 1);\\n\\n if (expiration > 0) {\\n _expirations[tokenId] = expiration;\\n }\\n\\n if (mask > 0) {\\n _setBitMask(tokenId, mask);\\n }\\n }\\n\\n function revoke(uint tokenId) external virtual override {\\n _checkGatekeeper(slotOf(tokenId));\\n\\n _tokenStates[tokenId] = TokenState.REVOKED;\\n\\n emit Revoke(tokenId);\\n }\\n\\n /**\\n * @dev Triggers to freeze gateway token\\n * @param tokenId Gateway token id\\n */\\n function freeze(uint tokenId) external virtual {\\n _checkGatekeeper(slotOf(tokenId));\\n\\n _freeze(tokenId);\\n }\\n\\n /**\\n * @dev Triggers to unfreeze gateway token\\n * @param tokenId Gateway token id\\n */\\n function unfreeze(uint tokenId) external virtual {\\n _checkGatekeeper(slotOf(tokenId));\\n\\n _unfreeze(tokenId);\\n }\\n\\n /**\\n * @dev Triggers to set expiration for tokenId\\n * @param tokenId Gateway token id\\n */\\n function setExpiration(uint tokenId, uint timestamp, Charge calldata) external virtual {\\n _checkGatekeeper(slotOf(tokenId));\\n\\n _setExpiration(tokenId, timestamp);\\n }\\n\\n /**\\n * @dev Transfers Gateway Token DAO Manager access from `previousManager` to `newManager`\\n * Only a current DAO Manager can do this. They can do this for any other DAO Manager.\\n * This is useful for two reasons:\\n * 1. Key rotation of the current (msg signer) DAO manager\\n * 2. Replacing a lost or compromised key of an existing DAO manager\\n * @param newManager Address to transfer DAO Manager role for.\\n * @notice GatewayToken contract has to be DAO Governed\\n */\\n function transferDAOManager(address previousManager, address newManager, uint network) external {\\n if (!isNetworkDAOGoverned[network]) revert GatewayToken__NotDAOGoverned(network);\\n\\n // check the previous manager is a current dao manager\\n _checkRole(DAO_MANAGER_ROLE, network, previousManager);\\n\\n if (newManager == address(0)) revert Common__MissingAccount();\\n\\n // grant the new manager the relevant roles\\n grantRole(DAO_MANAGER_ROLE, network, newManager);\\n grantRole(NETWORK_AUTHORITY_ROLE, network, newManager);\\n grantRole(GATEKEEPER_ROLE, network, newManager);\\n\\n // revoke the relevant roles from the previous manager\\n revokeRole(GATEKEEPER_ROLE, network, previousManager);\\n revokeRole(NETWORK_AUTHORITY_ROLE, network, previousManager);\\n revokeRole(DAO_MANAGER_ROLE, network, previousManager);\\n\\n emit DAOManagerTransferred(previousManager, newManager, network);\\n }\\n\\n function createNetwork(uint network, string calldata name, bool daoGoverned, address daoManager) external virtual {\\n if (bytes(_networks[network]).length != 0) {\\n revert GatewayToken__NetworkAlreadyExists(network);\\n }\\n\\n _networks[network] = name;\\n\\n if (daoGoverned) {\\n isNetworkDAOGoverned[network] = daoGoverned;\\n\\n if (daoManager == address(0)) {\\n revert Common__MissingAccount();\\n }\\n if (!daoManager.isContract()) {\\n revert Common__NotContract(daoManager);\\n }\\n\\n // use the internal function to avoid the check for the network authority role\\n // since this network does not exist yet, it has no existing network authority\\n _grantRole(DAO_MANAGER_ROLE, network, daoManager);\\n _grantRole(NETWORK_AUTHORITY_ROLE, network, daoManager);\\n\\n // DAO managers can assign and revoke network authorities and gatekeepers\\n _setRoleAdmin(NETWORK_AUTHORITY_ROLE, network, DAO_MANAGER_ROLE);\\n _setRoleAdmin(GATEKEEPER_ROLE, network, DAO_MANAGER_ROLE);\\n // DAO Managers can administrate themselves\\n _setRoleAdmin(DAO_MANAGER_ROLE, network, DAO_MANAGER_ROLE);\\n } else {\\n // use the internal function to avoid the check for the network authority role\\n // since this network does not exist yet, it has no existing network authority\\n _grantRole(NETWORK_AUTHORITY_ROLE, network, _msgSender());\\n\\n _setRoleAdmin(NETWORK_AUTHORITY_ROLE, network, NETWORK_AUTHORITY_ROLE);\\n _setRoleAdmin(GATEKEEPER_ROLE, network, NETWORK_AUTHORITY_ROLE);\\n }\\n }\\n\\n function renameNetwork(uint network, string calldata name) external virtual {\\n if (bytes(_networks[network]).length == 0) {\\n revert GatewayToken__NetworkDoesNotExist(network);\\n }\\n if (!hasRole(NETWORK_AUTHORITY_ROLE, network, _msgSender())) {\\n revert Common__Unauthorized(_msgSender(), network, NETWORK_AUTHORITY_ROLE);\\n }\\n\\n _networks[network] = name;\\n }\\n\\n /**\\n * @dev Triggers to add new gatekeeper into the system.\\n * @param gatekeeper Gatekeeper address\\n */\\n function addGatekeeper(address gatekeeper, uint network) external virtual {\\n grantRole(GATEKEEPER_ROLE, network, gatekeeper);\\n }\\n\\n /**\\n * @dev Triggers to remove existing gatekeeper from gateway token.\\n * @param gatekeeper Gatekeeper address\\n */\\n function removeGatekeeper(address gatekeeper, uint network) external virtual {\\n revokeRole(GATEKEEPER_ROLE, network, gatekeeper);\\n }\\n\\n /**\\n * @dev Triggers to add new network authority into the system.\\n * @param authority Network Authority address\\n *\\n * @notice Can be triggered by DAO Manager or any Network Authority\\n */\\n function addNetworkAuthority(address authority, uint network) external virtual {\\n grantRole(NETWORK_AUTHORITY_ROLE, network, authority);\\n }\\n\\n /**\\n * @dev Triggers to remove existing network authority from gateway token.\\n * @param authority Network Authority address\\n *\\n * @notice Can be triggered by DAO Manager or any Network Authority\\n */\\n function removeNetworkAuthority(address authority, uint network) external virtual {\\n revokeRole(NETWORK_AUTHORITY_ROLE, network, authority);\\n }\\n\\n /**\\n * @dev Triggers to set full bitmask for gateway token with `tokenId`\\n */\\n function setBitmask(uint tokenId, uint mask) external virtual {\\n _checkSenderRole(GATEKEEPER_ROLE, slotOf(tokenId));\\n _setBitMask(tokenId, mask);\\n }\\n\\n function getNetwork(uint network) external view virtual returns (string memory) {\\n return _networks[network];\\n }\\n\\n function getTokenIdsByOwnerAndNetwork(address owner, uint network) external view virtual returns (uint[] memory) {\\n (uint[] memory tokenIds, uint count) = _getTokenIdsByOwnerAndNetwork(owner, network);\\n uint[] memory tokenIdsResized = new uint[](count);\\n for (uint i = 0; i < count; i++) {\\n tokenIdsResized[i] = tokenIds[i];\\n }\\n return tokenIdsResized;\\n }\\n\\n /**\\n * @dev Triggered by external contract to verify the validity of the default token for `owner`.\\n *\\n * Checks owner has any token on gateway token contract, `tokenId` still active, and not expired.\\n */\\n function verifyToken(address owner, uint network) external view virtual returns (bool) {\\n (uint[] memory tokenIds, uint count) = _getTokenIdsByOwnerAndNetwork(owner, network);\\n\\n for (uint i = 0; i < count; i++) {\\n if (_existsAndActive(tokenIds[i], false)) return true;\\n }\\n\\n return false;\\n }\\n\\n /**\\n * @dev Triggered by external contract to verify the validity of the default token for `owner`.\\n *\\n * Checks owner has any token on gateway token contract, `tokenId` still active, and not expired.\\n */\\n function verifyToken(uint tokenId) external view virtual returns (bool) {\\n return _existsAndActive(tokenId, false);\\n }\\n\\n /**\\n * @dev Triggers to get all information gateway token related to specified `tokenId`\\n * @param tokenId Gateway token id\\n */\\n function getToken(\\n uint tokenId\\n )\\n external\\n view\\n virtual\\n returns (address owner, uint8 state, string memory identity, uint expiration, uint bitmask)\\n {\\n owner = ownerOf(tokenId);\\n state = uint8(_tokenStates[tokenId]);\\n expiration = _expirations[tokenId];\\n bitmask = _getBitMask(tokenId);\\n\\n return (owner, state, identity, expiration, bitmask);\\n }\\n\\n /**\\n * @dev Triggers to get specified `tokenId` expiration timestamp\\n * @param tokenId Gateway token id\\n */\\n function getExpiration(uint tokenId) external view virtual returns (uint) {\\n _checkTokenExists(tokenId);\\n\\n return _expirations[tokenId];\\n }\\n\\n /**\\n * @dev Triggers to verify if address has a GATEKEEPER role.\\n * @param gatekeeper Gatekeeper address\\n */\\n function isGatekeeper(address gatekeeper, uint network) external view virtual returns (bool) {\\n return hasRole(GATEKEEPER_ROLE, network, gatekeeper);\\n }\\n\\n /**\\n * @dev Triggers to verify if authority has a NETWORK_AUTHORITY_ROLE role.\\n * @param authority Network Authority address\\n */\\n function isNetworkAuthority(address authority, uint network) external view virtual returns (bool) {\\n return hasRole(NETWORK_AUTHORITY_ROLE, network, authority);\\n }\\n\\n /**\\n * @dev Triggers to get gateway token bitmask\\n */\\n function getTokenBitmask(uint tokenId) external view virtual returns (uint) {\\n return _getBitMask(tokenId);\\n }\\n\\n /**\\n * @dev Returns true if gateway token owner transfers restricted, and false otherwise.\\n */\\n function transfersRestricted() external pure virtual returns (bool) {\\n return true;\\n }\\n\\n /**\\n * @dev Transfers are disabled for Gateway Tokens - override ERC3525 approve functions to revert\\n * Note - transferFrom and safeTransferFrom are disabled indirectly with the _isApprovedOrOwner function\\n */\\n function approve(uint256, address, uint256) public payable virtual override {\\n revert GatewayToken__TransferDisabled();\\n }\\n\\n function approve(address, uint256) public payable virtual override {\\n revert GatewayToken__TransferDisabled();\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC3525Upgradeable, ParameterizedAccessControl) returns (bool) {\\n return\\n interfaceId == type(IERC3525).interfaceId ||\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC3525MetadataUpgradeable).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Freezes `tokenId` and it's usage by gateway token owner.\\n *\\n * Emits a {Freeze} event.\\n */\\n function _freeze(uint tokenId) internal virtual {\\n _checkActiveToken(tokenId, true);\\n\\n _tokenStates[tokenId] = TokenState.FROZEN;\\n\\n emit Freeze(tokenId);\\n }\\n\\n /**\\n * @dev Unfreezes `tokenId` and it's usage by gateway token owner.\\n *\\n * Emits a {Unfreeze} event.\\n */\\n function _unfreeze(uint tokenId) internal virtual {\\n _checkTokenExists(tokenId);\\n if (_tokenStates[tokenId] != TokenState.FROZEN) {\\n revert GatewayToken__TokenInvalidStateForOperation(tokenId, _tokenStates[tokenId], TokenState.FROZEN);\\n }\\n\\n _tokenStates[tokenId] = TokenState.ACTIVE;\\n\\n emit Unfreeze(tokenId);\\n }\\n\\n /**\\n * @dev Sets expiration time for `tokenId`.\\n */\\n function _setExpiration(uint tokenId, uint timestamp) internal virtual {\\n _checkActiveToken(tokenId, true);\\n\\n _expirations[tokenId] = timestamp;\\n emit Expiration(tokenId, timestamp);\\n }\\n\\n // includes the onlySuperAdmin modifier to ensure that only the super admin can call this function\\n // otherwise, no other logic.\\n // solhint-disable-next-line no-empty-blocks\\n function _authorizeUpgrade(address) internal override onlySuperAdmin {}\\n\\n function _msgSender()\\n internal\\n view\\n virtual\\n override(MultiERC2771Context, ContextUpgradeable)\\n returns (address sender)\\n {\\n return MultiERC2771Context._msgSender();\\n }\\n\\n function _msgData()\\n internal\\n view\\n virtual\\n override(MultiERC2771Context, ContextUpgradeable)\\n returns (bytes calldata)\\n {\\n return MultiERC2771Context._msgData();\\n }\\n\\n function _getTokenIdsByOwnerAndNetwork(address owner, uint network) internal view returns (uint[] memory, uint) {\\n uint length = balanceOf(owner);\\n uint[] memory tokenIds = new uint[](length);\\n uint count = 0;\\n\\n for (uint i = 0; i < length; i++) {\\n uint tokenId = tokenOfOwnerByIndex(owner, i);\\n if (slotOf(tokenId) == network) {\\n tokenIds[count++] = tokenId;\\n }\\n }\\n\\n return (tokenIds, count);\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists and not frozen.\\n */\\n function _existsAndActive(uint tokenId, bool allowExpired) internal view virtual returns (bool) {\\n // check state before anything else. This reduces the overhead,\\n // and avoids a revert, if the token does not exist.\\n TokenState state = _tokenStates[tokenId];\\n if (state != TokenState.ACTIVE) return false;\\n\\n address owner = ownerOf(tokenId);\\n if (_expirations[tokenId] != 0 && !allowExpired) {\\n return owner != address(0) && block.timestamp <= _expirations[tokenId];\\n } else {\\n return owner != address(0);\\n }\\n }\\n\\n function _isApprovedOrOwner(address, uint) internal view virtual override returns (bool) {\\n return false; // transfers are restricted, so this can never pass\\n }\\n\\n /// @dev Checks if the sender has the specified role on the specified network and revert otherwise\\n function _checkSenderRole(bytes32 role, uint network) internal view {\\n _checkRole(role, network, _msgSender());\\n }\\n\\n function _checkGatekeeper(uint network) internal view {\\n _checkSenderRole(GATEKEEPER_ROLE, network);\\n }\\n\\n /// @dev Checks if the token exists and is active. Optionally ignore expiry.\\n /// Use this when you need to check if a token exists, and is not frozen or revoked\\n /// But you don't care about its expiry, e.g. you are extending the expiry.\\n function _checkActiveToken(uint tokenId, bool allowExpired) internal view {\\n if (!_existsAndActive(tokenId, allowExpired)) {\\n revert GatewayToken__TokenDoesNotExistOrIsInactive(tokenId, allowExpired);\\n }\\n }\\n\\n /// @dev Checks if the token exists - ignore if it is active or not.\\n function _checkTokenExists(uint tokenId) internal view {\\n if (!_exists(tokenId)) {\\n revert GatewayToken__TokenDoesNotExist(tokenId);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7a6bcafb2a9450ccf109f14dfcc085e98d9515733dc7864589fc1ae367043525\",\"license\":\"MIT\"},\"contracts/MultiERC2771Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport {ContextUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\n\\n/**\\n * @dev Context variant with ERC2771 support for multiple trusted forwarders.\\n */\\nabstract contract MultiERC2771Context is ContextUpgradeable {\\n mapping(address => bool) private _trustedForwarders;\\n\\n function isTrustedForwarder(address forwarder) public view virtual returns (bool) {\\n return _trustedForwarders[forwarder];\\n }\\n\\n // because MultiERC2771Context is abstract we don't implement a\\n // constructor. It's the responsibility of the derived contract to\\n // disable the Initializers with \\\"_disableInitializers()\\\"\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function __MultiERC2771Context_init(address[] calldata trustedForwarders) internal initializer {\\n __Context_init_unchained();\\n __MultiERC2771Context_init_unchained(trustedForwarders);\\n }\\n\\n // solhint-disable-next-line func-name-mixedcase\\n function __MultiERC2771Context_init_unchained(address[] calldata trustedForwarders) internal initializer {\\n for (uint i = 0; i < trustedForwarders.length; i++) {\\n _trustedForwarders[trustedForwarders[i]] = true;\\n }\\n }\\n\\n // The overridden function should declare the appropriate access control//\\n // keep init functions at the top by the constructor\\n function _addForwarder(address forwarder) internal virtual {\\n _trustedForwarders[forwarder] = true;\\n }\\n\\n // The overridden function should declare the appropriate access control\\n function _removeForwarder(address forwarder) internal virtual {\\n _trustedForwarders[forwarder] = false;\\n }\\n\\n function _msgSender() internal view virtual override returns (address sender) {\\n if (isTrustedForwarder(msg.sender)) {\\n // The assembly code is more direct than the Solidity version using `abi.decode`.\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\\n }\\n } else {\\n return super._msgSender();\\n }\\n }\\n\\n function _msgData() internal view virtual override returns (bytes calldata) {\\n if (isTrustedForwarder(msg.sender)) {\\n return msg.data[:msg.data.length - 20];\\n } else {\\n return super._msgData();\\n }\\n }\\n}\\n\",\"keccak256\":\"0x89dcfe6bcfba6e4430c6ef21e240ab7065de97f7dbb1929e1511cd4b9b4267a8\",\"license\":\"MIT\"},\"contracts/ParameterizedAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)\\n\\npragma solidity 0.8.9;\\n\\nimport {ContextUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {ERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport {IParameterizedAccessControl} from \\\"./interfaces/IParameterizedAccessControl.sol\\\";\\nimport {Common__Unauthorized, Common__NotSuperAdmin} from \\\"./library/CommonErrors.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it.\\n */\\nabstract contract ParameterizedAccessControl is ContextUpgradeable, IParameterizedAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n struct RoleDomain {\\n mapping(bytes32 => RoleData) roles;\\n }\\n\\n mapping(uint256 => RoleDomain) private _roleDomain;\\n mapping(address => bool) internal _superAdmins;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role.\\n */\\n modifier onlyRole(bytes32 role, uint256 domain) {\\n _checkRole(role, domain);\\n _;\\n }\\n\\n /**\\n * @dev Modifier that checks that an account is a super admin. Reverts if not.\\n */\\n modifier onlySuperAdmin() {\\n _onlySuperAdmin();\\n _;\\n }\\n\\n function setSuperAdmin(address account) external onlySuperAdmin {\\n emit SuperAdminAdded(account);\\n _superAdmins[account] = true;\\n }\\n\\n function revokeSuperAdmin(address account) external onlySuperAdmin {\\n emit SuperAdminRemoved(account);\\n _superAdmins[account] = false;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(\\n bytes32 role,\\n uint256 domain,\\n address account\\n ) public virtual override onlyRole(getRoleAdmin(role, domain), domain) {\\n _grantRole(role, domain, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(\\n bytes32 role,\\n uint256 domain,\\n address account\\n ) public virtual override onlyRole(getRoleAdmin(role, domain), domain) {\\n _revokeRole(role, domain, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, uint256 domain, address account) public virtual override {\\n if (account != _msgSender()) revert ParameterizedAccessControl__RenounceRoleNotForSelf(role, account);\\n\\n _revokeRole(role, domain, account);\\n }\\n\\n function isSuperAdmin(address account) public view returns (bool) {\\n return _superAdmins[account];\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IParameterizedAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, uint256 domain, address account) public view virtual override returns (bool) {\\n return _roleDomain[domain].roles[role].members[account];\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role, uint256 domain) public view virtual override returns (bytes32) {\\n return _roleDomain[domain].roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Internal function without access restriction.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from when setting\\n * up the initial roles for the system or domain.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {ParameterizedAccessControl}.\\n * ====\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, uint256 domain, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role, domain);\\n _roleDomain[domain].roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, domain, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from when setting\\n * up the initial roles for the system or domain.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {ParameterizedAccessControl}.\\n * ====\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, uint256 domain, address account) internal virtual {\\n if (!hasRole(role, domain, account)) {\\n _roleDomain[domain].roles[role].members[account] = true;\\n emit RoleGranted(role, domain, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, uint256 domain, address account) internal virtual {\\n if (hasRole(role, domain, account)) {\\n _roleDomain[domain].roles[role].members[account] = false;\\n emit RoleRevoked(role, domain, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revert if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role, uint256 domain) internal view virtual {\\n _checkRole(role, domain, _msgSender());\\n }\\n\\n /**\\n * @dev Revert if `account` is missing `role`.\\n *\\n */\\n function _checkRole(bytes32 role, uint256 domain, address account) internal view virtual {\\n if (!hasRole(role, domain, account)) {\\n revert Common__Unauthorized(account, domain, role);\\n }\\n }\\n\\n /**\\n * @dev Revert if `account` is not a super admin\\n */\\n function _checkAdmin(address account) internal view virtual {\\n if (!isSuperAdmin(account)) revert Common__NotSuperAdmin(account);\\n }\\n\\n // separate into a private function to reduce code size\\n function _onlySuperAdmin() private view {\\n _checkAdmin(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0x8c1e05f48bb7c3bad413ce7b77a7b8159a2d0d8f7c02d0108b89c33330e8ded1\",\"license\":\"MIT\"},\"contracts/TokenBitMask.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport {BitMask} from \\\"./library/BitMask.sol\\\";\\nimport {IFlagsStorage} from \\\"./interfaces/IFlagsStorage.sol\\\";\\n\\n/**\\n * @dev TokenBitMask contract is an internal smart contract for Gateway Token\\n * implementation that stores KYC flags per identity token in a bitmask\\n */\\ncontract TokenBitMask {\\n using BitMask for uint256;\\n\\n // Gateway Token system FlagsStorage contract address\\n IFlagsStorage public flagsStorage;\\n\\n // Mapping for gateway token id to bitmask\\n mapping(uint256 => uint256) private _bitmasks;\\n\\n /**\\n * @dev Emitted when token BitMask associated with `tokenId` updated to `bitmask`.\\n */\\n event BitMaskUpdated(uint256 tokenId, uint256 bitmask);\\n\\n /**\\n * @dev Emitted when Identity.com Admin updated FlagsStorage\\n * contract address from `previousFlagsStorage` to `flagsStorage`.\\n */\\n event FlagsStorageUpdated(address indexed flagsStorage);\\n\\n /**\\n * @dev Internal funciton to set FlagsStorage contract address\\n * @param _flagsStorage FlagsStorage contract address\\n */\\n function _setFlagsStorage(address _flagsStorage) internal {\\n flagsStorage = IFlagsStorage(_flagsStorage);\\n\\n emit FlagsStorageUpdated(_flagsStorage);\\n }\\n\\n /**\\n * @dev Internal function to set full bitmask for gateway token\\n * @notice This function rewrites previous bitmask, use _addBitmask if you need to add flags to existing bitmask\\n */\\n function _setBitMask(uint256 tokenId, uint256 mask) internal {\\n _bitmasks[tokenId] = mask;\\n\\n emit BitMaskUpdated(tokenId, mask);\\n }\\n\\n /**\\n * @dev Internal function to get gateway token bitmask\\n */\\n function _getBitMask(uint256 tokenId) internal view returns (uint256) {\\n return _bitmasks[tokenId];\\n }\\n}\\n\",\"keccak256\":\"0x426980625c149ea8497551186a54cc5d3f25ab47f86bd947a995f23f874ef549\",\"license\":\"MIT\"},\"contracts/interfaces/IERC721Expirable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport {Charge} from \\\"../library/Charge.sol\\\";\\n\\ninterface IERC721Expirable {\\n /**\\n * @dev Emitted when expiration set to `tokenId`\\n */\\n event Expiration(uint256 indexed tokenId, uint256 timestamp);\\n\\n /**\\n * @dev Set the gateway token expiry\\n * @param tokenId Gateway token id\\n * @param tokenId Expiration timestamp\\n * @param charge The charge details for token issuance (ignored here - handled if at all by the forwarding contract)\\n */\\n function setExpiration(uint256 tokenId, uint256 timestamp, Charge calldata charge) external;\\n\\n /**\\n * @dev Get the gateway token expiry\\n * @param tokenId Gateway token id\\n */\\n function getExpiration(uint256 tokenId) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x992542604f968de1ca258799422086c46b78a1479dc88845755e618a252aaf1e\",\"license\":\"MIT\"},\"contracts/interfaces/IERC721Freezable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\ninterface IERC721Freezable {\\n /**\\n * @dev Emitted when a token is frozen by gatekeeper\\n */\\n event Freeze(uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when a token is unfrozen by gatekeeper\\n */\\n event Unfreeze(uint256 indexed tokenId);\\n\\n /**\\n * @dev Triggers to freeze gateway token\\n * @param tokenId Gateway token id\\n */\\n function freeze(uint256 tokenId) external;\\n\\n /**\\n * @dev Triggers to unfreeze gateway token\\n * @param tokenId Gateway token id\\n */\\n function unfreeze(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x6d4bf7381c70c194f3e183c09954e81e35a4178a5daac31fe8cb214ca3603838\",\"license\":\"MIT\"},\"contracts/interfaces/IERC721Revokable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\ninterface IERC721Revokable {\\n /**\\n * @dev Emitted when GatewayToken is revoked.\\n */\\n event Revoke(uint256 indexed tokenId);\\n\\n /**\\n * @dev Triggers to revoke gateway token\\n * @param tokenId Gateway token id\\n */\\n function revoke(uint256 tokenId) external;\\n}\\n\",\"keccak256\":\"0x7a8c1333036799d920011cf5f14b6dfaa2a017a6191e8cf8ed1e2e4c8967e62a\",\"license\":\"MIT\"},\"contracts/interfaces/IFlagsStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\npragma experimental ABIEncoderV2;\\n\\ninterface IFlagsStorage {\\n /**\\n * @dev Emitted when DAO Controller is updated from `prevDAOController` to `daoController`.\\n */\\n event SuperAdminUpdated(address indexed prevSuperAdmin, address indexed superAdmin);\\n\\n /**\\n * @dev Emitted when new flag is added with `flag` short code and `index`.\\n */\\n event FlagAdded(bytes32 indexed flag, uint8 index);\\n\\n /**\\n * @dev Emitted when existing flag is removed from FlagsStorage by `flag` short code.\\n */\\n event FlagRemoved(bytes32 indexed flag);\\n\\n /**\\n * @dev Triggers to add new flag into gateway token system\\n * @param _flag Flag short identifier\\n * @param _index Flag index (limited to 255)\\n * @notice Only executed by existing DAO Manager\\n */\\n function addFlag(bytes32 _flag, uint8 _index) external;\\n\\n /**\\n * @dev Triggers to add multiple flags into gateway token system\\n * @param _flags Array of flag short identifiers\\n * @param _indexes Array of flag indexes (limited to 255)\\n * @notice Only executed by existing DAO Manager\\n */\\n function addFlags(bytes32[] memory _flags, uint8[] memory _indexes) external;\\n\\n /**\\n * @dev Triggers to remove existing flag from gateway token system\\n * @param _flag Flag short identifier\\n * @notice Only executed by existing DAO Manager\\n */\\n function removeFlag(bytes32 _flag) external;\\n\\n /**\\n * @dev Triggers to remove multiple existing flags from gateway token system\\n * @param _flags Array of flag short identifiers\\n * @notice Only executed by existing DAO Manager\\n */\\n function removeFlags(bytes32[] memory _flags) external;\\n\\n /**\\n * @dev Triggers to transfer ownership of this contract to new DAO Controller,\\n * reverts on zero address and wallet addresses\\n * @param _newSuperAdmin New DAO Controller contract address\\n * @notice Only executed by existing DAO Manager\\n */\\n function updateSuperAdmin(address _newSuperAdmin) external;\\n\\n /**\\n * @dev Triggers to get DAO Controller address\\n */\\n function superAdmin() external view returns (address);\\n\\n /**\\n * @dev Triggers to get flag index from flags mapping\\n */\\n function flagIndexes(bytes32) external view returns (uint8);\\n\\n /**\\n * @dev Triggers to check if a particular flag is supported\\n * @param _flag Flag short identifier\\n * @return Boolean for flag support\\n */\\n function isFlagSupported(bytes32 _flag) external view returns (bool);\\n\\n /**\\n * @dev Triggers to get bitmask of all supported flags\\n */\\n function supportedFlagsMask() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x91857a7229c4eff5a53b97652a1ddd6f4df6682b2119c7b3573b402a7fb40395\",\"license\":\"MIT\"},\"contracts/interfaces/IGatewayToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nimport {Charge} from \\\"../library/Charge.sol\\\";\\n\\ninterface IGatewayToken {\\n enum TokenState {\\n ACTIVE,\\n FROZEN,\\n REVOKED\\n }\\n\\n /**\\n * @dev Emitted when GatewayToken DAO Manager transferred to `newDAOManager` address.\\n */\\n event DAOManagerTransferred(address previousDAOManager, address newDAOManager, uint256 network);\\n\\n /// Insufficient funds for withdrawal. Needed `required` but only\\n /// `available` available.\\n /// @param available balance available.\\n /// @param required requested amount to transfer.\\n error GatewayToken__InsufficientFunds(uint256 available, uint256 required);\\n\\n /// The gatekeeper network being created already exists.\\n /// @param network gatekeeper network id.\\n error GatewayToken__NetworkAlreadyExists(uint network);\\n\\n /// The gatekeeper network does not exist.\\n /// @param network gatekeeper network id.\\n error GatewayToken__NetworkDoesNotExist(uint network);\\n\\n /// The gatekeeper network is not dao-governed.\\n /// @param network gatekeeper network id.\\n error GatewayToken__NotDAOGoverned(uint network);\\n\\n /// The requested token does not exist.\\n /// @param tokenId token id.\\n error GatewayToken__TokenDoesNotExist(uint256 tokenId);\\n\\n /// The requested token is not active or does not exist\\n /// @param tokenId token id.\\n /// @param allowExpired whether to allow expired tokens.\\n error GatewayToken__TokenDoesNotExistOrIsInactive(uint256 tokenId, bool allowExpired);\\n\\n /// The requested token state is invalid for the request\\n /// @param tokenId token id.\\n /// @param state current token state.\\n /// @param expectedState expected token state.\\n error GatewayToken__TokenInvalidStateForOperation(uint256 tokenId, TokenState state, TokenState expectedState);\\n\\n /// Token transfers are disabled\\n error GatewayToken__TransferDisabled();\\n\\n /**\\n * @dev Triggers to verify if address has a GATEKEEPER role.\\n * @param gatekeeper Gatekeeper address\\n * @param network GatekeeperNetwork id\\n */\\n function isGatekeeper(address gatekeeper, uint256 network) external returns (bool);\\n\\n function createNetwork(uint256 network, string memory name, bool daoGoverned, address daoManager) external;\\n\\n function renameNetwork(uint256 network, string memory name) external;\\n\\n /**\\n * @dev Triggers to add new network authority into the system.\\n * @param authority Network Authority address\\n * @param network GatekeeperNetwork id\\n *\\n * @notice Only triggered by Identity.com Admin\\n */\\n function addNetworkAuthority(address authority, uint256 network) external;\\n\\n /**\\n * @dev Triggers to remove existing network authority from gateway token.\\n * @param authority Network Authority address\\n * @param network GatekeeperNetwork id\\n *\\n * @notice Only triggered by Identity.com Admin\\n */\\n function removeNetworkAuthority(address authority, uint256 network) external;\\n\\n /**\\n * @dev Triggers to verify if authority has a NETWORK_AUTHORITY_ROLE role.\\n * @param authority Network Authority address\\n * @param network GatekeeperNetwork id\\n */\\n function isNetworkAuthority(address authority, uint256 network) external returns (bool);\\n\\n /**\\n * @dev Transfers Gateway Token DAO Manager access from daoManager to `newManager`\\n * @param newManager Address to transfer DAO Manager role for.\\n */\\n function transferDAOManager(address previousManager, address newManager, uint256 network) external;\\n\\n function mint(address to, uint256 network, uint256 expiration, uint256 mask, Charge calldata charge) external;\\n\\n /**\\n * @dev Triggers to get all information relating to gateway `tokenId`\\n * @param tokenId Gateway token id\\n */\\n function getToken(\\n uint256 tokenId\\n ) external view returns (address owner, uint8 state, string memory identity, uint256 expiration, uint256 bitmask);\\n\\n function getNetwork(uint256 network) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x785b3786674112e6711324bd5207a85700b3fa9a5ae5f524a1b21042a9fc1502\",\"license\":\"MIT\"},\"contracts/interfaces/IParameterizedAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity 0.8.9;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IParameterizedAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(\\n bytes32 indexed role,\\n uint256 domain,\\n bytes32 indexed previousAdminRole,\\n bytes32 indexed newAdminRole\\n );\\n\\n event SuperAdminAdded(address indexed account);\\n\\n event SuperAdminRemoved(address indexed account);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, uint256 domain, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, uint256 domain, address indexed account, address indexed sender);\\n\\n /// A sender can only renounce roles for themselves\\n error ParameterizedAccessControl__RenounceRoleNotForSelf(bytes32 role, address account);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, uint256 domain, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, uint256 domain, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, uint256 domain, address account) external;\\n\\n function setSuperAdmin(address account) external;\\n\\n function revokeSuperAdmin(address account) external;\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, uint256 domain, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role, uint256 domain) external view returns (bytes32);\\n\\n function isSuperAdmin(address account) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc00fa605810bae35ee0d8b7673bcedf3fcb85149f21cf3c6606785e36706a668\",\"license\":\"MIT\"},\"contracts/library/BitMask.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nlibrary BitMask {\\n uint internal constant _ONE = uint256(1);\\n\\n /**\\n * @dev Internal function to set 1 bit in specific `index`\\n * @return Updated bitmask with modified bit at `index`\\n */\\n function setBit(uint256 self, uint8 index) internal pure returns (uint256) {\\n return self | (_ONE << index);\\n }\\n\\n /**\\n * @dev Internal function to clear bit to 0 in specific `index`\\n * @return Updated bitmask with modified bit at `index`\\n */\\n function clearBit(uint256 self, uint8 index) internal pure returns (uint256) {\\n return self & ~(_ONE << index);\\n }\\n\\n /**\\n * @dev Internal function to check bit at specific `index`\\n * @return Returns TRUE if bit is '1', FALSE otherwise\\n */\\n function checkBit(uint256 self, uint8 index) internal pure returns (bool) {\\n return (self & (uint256(1) << index)) > 0;\\n }\\n}\\n\",\"keccak256\":\"0xce0c8b218f0f29ce45ee7b5b0c4148fbf3aa3d5605639de4d3cd813047bd9026\",\"license\":\"MIT\"},\"contracts/library/Charge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.9;\\n\\nenum ChargeType {\\n NONE, // No charge\\n ETH, // Charge amount is in Eth (Wei)\\n ERC20 // Charge amount is in an ERC20 token (token field) in minor denomination\\n}\\n\\n/**\\n * @dev The Charge struct represents details of a charge made to the gatekeeper on\\n * gateway token issuance or refresh.\\n */\\nstruct Charge {\\n uint256 value;\\n ChargeType chargeType;\\n address token;\\n address recipient;\\n}\\n\",\"keccak256\":\"0x0edbba60750c90a0d22ae3d48a5eec0e4c5f20e09defec1b11f5d73c1fa77c75\",\"license\":\"MIT\"},\"contracts/library/CommonErrors.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.8.9;\\n\\n/// The passed-in account is the zero-address\\nerror Common__MissingAccount();\\n\\n/// The passed-in account is not a contract, where an account is expected\\n/// @param account address of the account.\\nerror Common__NotContract(address account);\\n\\n/// The passed-in account is not a super-admin\\n/// @param account address of the account.\\nerror Common__NotSuperAdmin(address account);\\n\\n/// The request was made from an unauthorized address.\\n/// @param sender address of the sender.\\n/// @param domain the domain to which the role applies.\\n/// @param role role that is required.\\nerror Common__Unauthorized(address sender, uint domain, bytes32 role);\\n\",\"keccak256\":\"0xa3c8ca2572011971234d2126d48bba7046923ca70f3aba0fb8539165f7d0dade\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e8565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516157d162000120600039600081816114aa015281816114ea0152818161162301528181611663015261179601526157d16000f3fe6080604052600436106103b65760003560e01c806370f08160116101f9578063b4bd85791161011e578063df2a7fe1116100b6578063e71fb1101161007a578063e71fb11014610c32578063e8a3d48514610c52578063e985e9c514610c67578063ff17e23214610cb4578063ff85a97514610cd457600080fd5b8063df2a7fe114610b68578063df7f453b14610b88578063e0ed6a3114610bc1578063e345e0bc14610be1578063e4b50cb814610c0157600080fd5b8063b4bd857914610a53578063b5d6163514610a73578063b88d4fde14610a93578063babb898d14610aa6578063c2a366fb14610ac6578063c58dbbed14610ae6578063c87b56dd14610b06578063d6fd317514610b26578063d7a78db814610b4857600080fd5b806395d89b411161019157806395d89b411461093957806395ea57171461094e5780639c7525e61461096e5780639cc7f7081461098e578063a05b775f146109ae578063a217fddf146109ce578063a22cb465146109e3578063a578c09314610a03578063a8fa8e0d14610a3357600080fd5b806370f08160146108355780637dbded281461085557806381e9ff191461087557806382d66d5f14610897578063840f7113146108b75780638423df79146108d75780638cb0a511146108eb5780638eb7a776146108f957806390eddd521461091957600080fd5b80633659cfe6116102df57806352d1902d1161027757806352d1902d14610705578063572b6c051461071a5780635c41d2fe146107535780635e79b726146107735780636352211e146107935780636623fc46146107b35780636dba2729146107d35780636f7caf41146107f357806370a082311461081557600080fd5b80633659cfe6146105fd57806336e450411461061d5780633e7e86691461063d57806342842e0e1461065f57806342966c68146106725780634d93172d146106925780634f1ef286146106b25780634f6ccce7146106c557806351da912d146106e557600080fd5b806320c5429b1161035257806320c5429b146104f757806323b872dd14610517578063263f3e7e1461052a5780632d33d27a1461054a5780632f745c591461056a578063310ed7f01461058a57806331416a291461059d57806334e37b8a146105bd5780633568dd29146105dd57600080fd5b806301ffc9a7146103bb57806306fdde03146103f0578063081812fc14610412578063095ea7b31461043f57806309c3dd87146104545780630f485c02146104745780631442f5211461049557806315700052146104c257806318160ddd146104e2575b600080fd5b3480156103c757600080fd5b506103db6103d6366004614a64565b610cf4565b60405190151581526020015b60405180910390f35b3480156103fc57600080fd5b50610405610d55565b6040516103e79190614ad9565b34801561041e57600080fd5b5061043261042d366004614aec565b610de7565b6040516103e79190614b05565b61045261044d366004614b30565b610e39565b005b34801561046057600080fd5b5061040561046f366004614aec565b610e52565b610487610482366004614b5a565b610f53565b6040519081526020016103e7565b3480156104a157600080fd5b506104b56104b0366004614b30565b610f92565b6040516103e79190614b8f565b3480156104ce57600080fd5b506104526104dd366004614bd3565b611049565b3480156104ee57600080fd5b50609d54610487565b34801561050357600080fd5b50610452610512366004614aec565b6110a9565b610452610525366004614bee565b6110fd565b34801561053657600080fd5b50610487610545366004614aec565b611143565b34801561055657600080fd5b5060cc54610432906001600160a01b031681565b34801561057657600080fd5b50610487610585366004614b30565b61118b565b610452610598366004614c1a565b61122c565b3480156105a957600080fd5b506104526105b8366004614c87565b611249565b3480156105c957600080fd5b506104526105d8366004614bd3565b61146e565b3480156105e957600080fd5b506104526105f8366004614b30565b611482565b34801561060957600080fd5b50610452610618366004614bd3565b61149f565b34801561062957600080fd5b50610452610638366004614d74565b611565565b34801561064957600080fd5b50609a5460405160ff90911681526020016103e7565b61045261066d366004614bee565b6115bb565b34801561067e57600080fd5b5061045261068d366004614aec565b6115d6565b34801561069e57600080fd5b506104526106ad366004614bd3565b6115eb565b6104526106c0366004614e6c565b611618565b3480156106d157600080fd5b506104876106e0366004614aec565b6116ce565b3480156106f157600080fd5b50610452610700366004614eb9565b61175f565b34801561071157600080fd5b50610487611789565b34801561072657600080fd5b506103db610735366004614bd3565b6001600160a01b031660009081526097602052604090205460ff1690565b34801561075f57600080fd5b5061045261076e366004614bd3565b611837565b34801561077f57600080fd5b5061045261078e366004614ef3565b611867565b34801561079f57600080fd5b506104326107ae366004614aec565b61187d565b3480156107bf57600080fd5b506104526107ce366004614aec565b6118ed565b3480156107df57600080fd5b506103db6107ee366004614b30565b611902565b3480156107ff57600080fd5b5061048760008051602061571583398151915281565b34801561082157600080fd5b50610487610830366004614bd3565b61191d565b34801561084157600080fd5b50610452610850366004614b30565b6119a5565b34801561086157600080fd5b50610452610870366004614f2e565b6119be565b34801561088157600080fd5b5061048760008051602061569583398151915281565b3480156108a357600080fd5b506104526108b2366004614b30565b611bad565b3480156108c357600080fd5b5060a054610432906001600160a01b031681565b3480156108e357600080fd5b5060016103db565b61045261044d366004614b5a565b34801561090557600080fd5b50610452610914366004614d74565b611bc2565b34801561092557600080fd5b50610452610934366004614b30565b611be2565b34801561094557600080fd5b50610405611bfb565b34801561095a57600080fd5b50610405610969366004614aec565b611c0a565b34801561097a57600080fd5b50610452610989366004614f9d565b611cac565b34801561099a57600080fd5b506104876109a9366004614aec565b611d5b565b3480156109ba57600080fd5b506104876109c9366004614aec565b611da3565b3480156109da57600080fd5b50610487600081565b3480156109ef57600080fd5b506104526109fe366004614fe8565b611dc1565b348015610a0f57600080fd5b506103db610a1e366004614aec565b60ce6020526000908152604090205460ff1681565b348015610a3f57600080fd5b50610452610a4e366004614bee565b611dd3565b348015610a5f57600080fd5b50610487610a6e366004614aec565b611f2c565b348015610a7f57600080fd5b50610452610a8e366004614d74565b611f40565b610452610aa136600461501f565b611f60565b348015610ab257600080fd5b506103db610ac1366004614d74565b611f93565b348015610ad257600080fd5b506103db610ae1366004614b30565b611fc4565b348015610af257600080fd5b50610452610b01366004614bd3565b611fdf565b348015610b1257600080fd5b50610405610b21366004614aec565b61203c565b348015610b3257600080fd5b506104876000805160206156b583398151915281565b348015610b5457600080fd5b50610452610b63366004614aec565b6120db565b348015610b7457600080fd5b50610487610b83366004614eb9565b6120f0565b348015610b9457600080fd5b506103db610ba3366004614bd3565b6001600160a01b0316600090815260cb602052604090205460ff1690565b348015610bcd57600080fd5b50610452610bdc366004615086565b61210f565b348015610bed57600080fd5b50610487610bfc3660046150cc565b612158565b348015610c0d57600080fd5b50610c21610c1c366004614aec565b61218c565b6040516103e79594939291906150f8565b348015610c3e57600080fd5b50610452610c4d366004614bd3565b6121ec565b348015610c5e57600080fd5b506104056121fd565b348015610c7357600080fd5b506103db610c82366004615139565b6001600160a01b039182166000908152609f602090815260408083209390941682526002909201909152205460ff1690565b348015610cc057600080fd5b506103db610ccf366004614b30565b612306565b348015610ce057600080fd5b506103db610cef366004614aec565b612377565b60006001600160e01b03198216630354d60560e61b1480610d2557506001600160e01b031982166380ac58cd60e01b145b80610d4057506001600160e01b031982166370b0048160e11b145b80610d4f5750610d4f82612384565b92915050565b606060988054610d6490615163565b80601f0160208091040260200160405190810160405280929190818152602001828054610d9090615163565b8015610ddd5780601f10610db257610100808354040283529160200191610ddd565b820191906000526020600020905b815481529060010190602001808311610dc057829003601f168201915b5050505050905090565b6000610df2826123b9565b6000828152609e6020526040902054609d80549091908110610e1657610e16615198565b60009182526020909120600460069092020101546001600160a01b031692915050565b60405163c03a3ff560e01b815260040160405180910390fd5b60606000610e6b60408051602081019091526000815290565b60a0549091506001600160a01b0316610ecb576000815111610e9c5760405180602001604052806000815250610f4c565b80610ea6846123de565b604051602001610eb79291906151ae565b604051602081830303815290604052610f4c565b60a054604051633601bfc560e11b8152600481018590526001600160a01b0390911690636c037f8a906024015b60006040518083038186803b158015610f1057600080fd5b505afa158015610f24573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f4c91908101906151ee565b9392505050565b6000610f67610f6061247a565b8584612489565b610f7084612504565b9050610f878382610f8087611143565b600061250e565b610f4c848284612635565b6060600080610fa18585612914565b915091506000816001600160401b03811115610fbf57610fbf614da9565b604051908082528060200260200182016040528015610fe8578160200160208202803683370190505b50905060005b8281101561103f5783818151811061100857611008615198565b602002602001015182828151811061102257611022615198565b60209081029190910101528061103781615271565b915050610fee565b5095945050505050565b6110516129e1565b6040516001600160a01b038216907f286f82d2b1e37b5e9f33e455d014b4a5f6c29388e6e41e1281d4c83e04f4265590600090a26001600160a01b0316600090815260cb60205260409020805460ff19166001179055565b6110ba6110b582611143565b6129f3565b600081815260cf6020526040808220805460ff191660021790555182917fdb43aa42235c8d63908794a952603e8d43a549383d13123c3d893a3fc2e6249591a250565b61110e61110861247a565b50600090565b6111335760405162461bcd60e51b815260040161112a906152a2565b60405180910390fd5b61113e838383612a0b565b505050565b600061114e826123b9565b6000828152609e6020526040902054609d8054909190811061117257611172615198565b9060005260206000209060060201600101549050919050565b60006111968361191d565b82106111ef5760405162461bcd60e51b815260206004820152602260248201527f455243333532353a206f776e657220696e646578206f7574206f6620626f756e604482015261647360f01b606482015260840161112a565b6001600160a01b0383166000908152609f6020526040902080548390811061121957611219615198565b9060005260206000200154905092915050565b61123e61123761247a565b8483612489565b61113e838383612635565b600054610100900460ff16158080156112695750600054600160ff909116105b8061128a575061127830612b5a565b15801561128a575060005460ff166001145b6112a65760405162461bcd60e51b815260040161112a906152f4565b6000805460ff1916600117905580156112c9576000805461ff0019166101001790555b6001600160a01b0385166112f057604051630ca2c90160e21b815260040160405180910390fd5b6001600160a01b03841661131757604051630ca2c90160e21b815260040160405180910390fd5b60005b8281101561138557600084848381811061133657611336615198565b905060200201602081019061134b9190614bd3565b6001600160a01b0316141561137357604051630ca2c90160e21b815260040160405180910390fd5b8061137d81615271565b91505061131a565b506113f989898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b815292508b91508a908190840183828082843760009201829052509250612b69915050565b6114038383612b9b565b61140c84612c5d565b6001600160a01b038516600090815260cb60205260409020805460ff191660011790558015611463576000805461ff0019169055604051600181526000805160206157358339815191529060200160405180910390a15b505050505050505050565b6114766129e1565b61147f81612c5d565b50565b61149b6000805160206156b58339815191528284611bc2565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156114e85760405162461bcd60e51b815260040161112a90615342565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661151a612ca7565b6001600160a01b0316146115405760405162461bcd60e51b815260040161112a9061538e565b61154981612cc3565b6040805160008082526020820190925261147f91839190612ccb565b61156d61247a565b6001600160a01b0316816001600160a01b0316146115b0576040516307ca099360e31b8152600481018490526001600160a01b038216602482015260440161112a565b61113e838383612e45565b61113e83838360405180602001604052806000815250611f60565b6115e26110b582611143565b61147f81612ee1565b6115f36129e1565b61147f816001600160a01b03166000908152609760205260409020805460ff19169055565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156116615760405162461bcd60e51b815260040161112a90615342565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611693612ca7565b6001600160a01b0316146116b95760405162461bcd60e51b815260040161112a9061538e565b6116c282612cc3565b61149b82826001612ccb565b60006116d9609d5490565b82106117335760405162461bcd60e51b815260206004820152602360248201527f455243333532353a20676c6f62616c20696e646578206f7574206f6620626f756044820152626e647360e81b606482015260840161112a565b609d828154811061174657611746615198565b9060005260206000209060060201600001549050919050565b61177f6000805160206156b583398151915261177a84611143565b612fde565b61149b8282612ff0565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118245760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b606482015260840161112a565b506000805160206156f583398151915290565b61183f6129e1565b61147f816001600160a01b03166000908152609760205260409020805460ff19166001179055565b6118736110b584611143565b61113e838361303f565b6000611888826123b9565b6000828152609e6020526040902054609d805490919081106118ac576118ac615198565b60009182526020909120600360069092020101546001600160a01b03169050806118e85760405162461bcd60e51b815260040161112a906153da565b919050565b6118f96110b582611143565b61147f8161309b565b6000610f4c6000805160206156b58339815191528385611f93565b60006001600160a01b0382166119895760405162461bcd60e51b815260206004820152602b60248201527f455243333532353a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b606482015260840161112a565b506001600160a01b03166000908152609f602052604090205490565b61149b6000805160206156b58339815191528284611f40565b600085815260d16020526040902080546119d790615163565b1590506119fa57604051636f55f62b60e01b81526004810186905260240161112a565b600085815260d160205260409020611a139085856148ce565b508115611b3857600085815260ce60205260409020805460ff19168315151790556001600160a01b038116611a5b57604051630ca2c90160e21b815260040160405180910390fd5b611a6d816001600160a01b0316612b5a565b611a8c578060405163d4daafa160e01b815260040161112a9190614b05565b611aa56000805160206156958339815191528683613142565b611abe6000805160206157158339815191528683613142565b611ae5600080516020615715833981519152866000805160206156958339815191526131d3565b611b0c6000805160206156b5833981519152866000805160206156958339815191526131d3565b611b33600080516020615695833981519152866000805160206156958339815191526131d3565b611ba6565b611b5860008051602061571583398151915286611b5361247a565b613142565b611b7f600080516020615715833981519152866000805160206157158339815191526131d3565b611ba66000805160206156b5833981519152866000805160206157158339815191526131d3565b5050505050565b61149b60008051602061571583398151915282845b611bcc83836120f0565b82611bd78282612fde565b611ba6858585612e45565b61149b6000805160206157158339815191528284611f40565b606060998054610d6490615163565b600081815260d160205260409020805460609190611c2790615163565b80601f0160208091040260200160405190810160405280929190818152602001828054611c5390615163565b8015611ca05780601f10611c7557610100808354040283529160200191611ca0565b820191906000526020600020905b815481529060010190602001808311611c8357829003601f168201915b50505050509050919050565b600083815260d1602052604090208054611cc590615163565b15159050611ce957604051630817886d60e41b81526004810184905260240161112a565b611d0460008051602061571583398151915284610ac161247a565b611d3c57611d1061247a565b8360008051602061571583398151915260405163c8c801a760e01b815260040161112a9392919061540d565b600083815260d160205260409020611d559083836148ce565b50505050565b6000611d66826123b9565b6000828152609e6020526040902054609d80549091908110611d8a57611d8a615198565b9060005260206000209060060201600201549050919050565b6000611dae8261323e565b50600090815260d0602052604090205490565b61149b611dcc61247a565b8383613267565b600081815260ce602052604090205460ff16611e055760405163db53ce7160e01b81526004810182905260240161112a565b611e1e600080516020615695833981519152828561333b565b6001600160a01b038216611e4557604051630ca2c90160e21b815260040160405180910390fd5b611e5e6000805160206156958339815191528284611f40565b611e776000805160206157158339815191528284611f40565b611e906000805160206156b58339815191528284611f40565b611ea96000805160206156b58339815191528285611bc2565b611ec26000805160206157158339815191528285611bc2565b611edb6000805160206156958339815191528285611bc2565b604080516001600160a01b038086168252841660208201529081018290527f744258a28673e8738e2812c0ab8e8dbd70352f8871b1febac0dd753d96d79f58906060015b60405180910390a1505050565b600081815260cd6020526040812054610d4f565b611f4a83836120f0565b82611f558282612fde565b611ba6858585613142565b611f6b61110861247a565b611f875760405162461bcd60e51b815260040161112a906152a2565b611d5584848484613369565b600091825260ca602090815260408084209484529381528383206001600160a01b0392909216835252205460ff1690565b6000610f4c6000805160206157158339815191528385611f93565b611fe76129e1565b6040516001600160a01b038216907ffb445f6ec07647d2bb7af72821e6b8b7303ec375e934d4a338d38ed5846c2d5690600090a26001600160a01b0316600090815260cb60205260409020805460ff19169055565b6060612047826123b9565b600061205e60408051602081019091526000815290565b60a0549091506001600160a01b03166120aa57600081511161208f5760405180602001604052806000815250610f4c565b80612099846123de565b604051602001610eb792919061542e565b60a0546040516344a5a61760e11b8152600481018590526001600160a01b039091169063894b4c2e90602401610ef8565b6120e76110b582611143565b61147f816133dc565b600090815260ca60209081526040808320938352929052206001015490565b612118846129f3565b60006121268686600161342a565b9050831561214057600081815260d0602052604090208490555b8215612150576121508184612ff0565b505050505050565b6000612163836123b9565b506000918252609c602090815260408084206001600160a01b0393909316845291905290205490565b600080606060008061219d8661187d565b600087815260cf602052604090205490955060ff1660028111156121c3576121c361528c565b600096875260d0602090815260408089205460cd90925290972054959790969395939450915050565b6121f46129e1565b61147f81613442565b6060600061221660408051602081019091526000815290565b60a0549091506001600160a01b03166122765760008151116122475760405180602001604052806000815250612300565b806122513061348c565b60405160200161226292919061545d565b604051602081830303815290604052612300565b60a060009054906101000a90046001600160a01b03166001600160a01b031663725fa09c6040518163ffffffff1660e01b815260040160006040518083038186803b1580156122c457600080fd5b505afa1580156122d8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261230091908101906151ee565b91505090565b60008060006123158585612914565b9150915060005b8181101561236b5761234883828151811061233957612339615198565b602002602001015160006134a2565b156123595760019350505050610d4f565b8061236381615271565b91505061231c565b50600095945050505050565b6000610d4f8260006134a2565b60006001600160e01b031982166333cb74f560e11b1480610d4f57506301ffc9a760e01b6001600160e01b0319831614610d4f565b6123c281613547565b61147f5760405162461bcd60e51b815260040161112a906153da565b606060006123eb83613593565b60010190506000816001600160401b0381111561240a5761240a614da9565b6040519080825280601f01601f191660200182016040528015612434576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461246d57612472565b61243e565b509392505050565b600061248461366b565b905090565b60006124958385612158565b90506000198114611d5557818110156124f05760405162461bcd60e51b815260206004820152601f60248201527f455243333532353a20696e73756666696369656e7420616c6c6f77616e636500604482015260640161112a565b611d5583856124ff85856154a1565b613695565b6000610d4f6137c4565b6001600160a01b03841661256e5760405162461bcd60e51b815260206004820152602160248201527f455243333532353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b606482015260840161112a565b826125c55760405162461bcd60e51b815260206004820152602160248201527f455243333532353a2063616e6e6f74206d696e74207a65726f20746f6b656e496044820152601960fa1b606482015260840161112a565b6125ce83613547565b1561261b5760405162461bcd60e51b815260206004820152601d60248201527f455243333532353a20746f6b656e20616c7265616479206d696e746564000000604482015260640161112a565b6126268484846137db565b612630838261388f565b611d55565b61263e83613547565b61269a5760405162461bcd60e51b815260206004820152602760248201527f455243333532353a207472616e736665722066726f6d20696e76616c696420746044820152661bdad95b88125160ca1b606482015260840161112a565b6126a382613547565b6126fd5760405162461bcd60e51b815260206004820152602560248201527f455243333532353a207472616e7366657220746f20696e76616c696420746f6b604482015264195b88125160da1b606482015260840161112a565b6000838152609e6020526040812054609d8054909190811061272157612721615198565b906000526020600020906006020190506000609d609e6000868152602001908152602001600020548154811061275957612759615198565b9060005260206000209060060201905082826002015410156127d05760405162461bcd60e51b815260206004820152602a60248201527f455243333532353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161112a565b806001015482600101541461283e5760405162461bcd60e51b815260206004820152602e60248201527f455243333532353a207472616e7366657220746f20746f6b656e20776974682060448201526d191a5999995c995b9d081cdb1bdd60921b606482015260840161112a565b8282600201600082825461285291906154a1565b925050819055508281600201600082825461286d91906154b8565b9091555050604051838152849086906000805160206156d58339815191529060200160405180910390a36128b285858560405180602001604052806000815250613902565b611ba65760405162461bcd60e51b815260206004820152602d60248201527f455243333532353a207472616e736665722072656a656374656420627920455260448201526c21999a991aa932b1b2b4bb32b960991b606482015260840161112a565b60606000806129228561191d565b90506000816001600160401b0381111561293e5761293e614da9565b604051908082528060200260200182016040528015612967578160200160208202803683370190505b5090506000805b838110156129d2576000612982898361118b565b90508761298e82611143565b14156129bf578084846129a081615271565b9550815181106129b2576129b2615198565b6020026020010181815250505b50806129ca81615271565b91505061296e565b509093509150505b9250929050565b6129f16129ec61247a565b613a63565b565b61147f6000805160206156b583398151915282612fde565b826001600160a01b0316612a1e8261187d565b6001600160a01b031614612a805760405162461bcd60e51b8152602060048201526024808201527f455243333532353a207472616e736665722066726f6d20696e76616c6964206f6044820152633bb732b960e11b606482015260840161112a565b6001600160a01b038216612ae45760405162461bcd60e51b815260206004820152602560248201527f455243333532353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161112a565b6000612aef82611143565b90506000612afc83611d5b565b9050612b09600084613a9e565b612b1283613b35565b612b1c8584613be0565b612b268484613d01565b82846001600160a01b0316866001600160a01b031660008051602061577c83398151915260405160405180910390a4611ba6565b6001600160a01b03163b151590565b600054610100900460ff16612b905760405162461bcd60e51b815260040161112a906154d0565b61113e838383613d8a565b600054610100900460ff1615808015612bbb5750600054600160ff909116105b80612bdc5750612bca30612b5a565b158015612bdc575060005460ff166001145b612bf85760405162461bcd60e51b815260040161112a906152f4565b6000805460ff191660011790558015612c1b576000805461ff0019166101001790555b612c23613df1565b612c2d8383613e18565b801561113e576000805461ff00191690556040516001815260008051602061573583398151915290602001611f1f565b60cc80546001600160a01b0319166001600160a01b0383169081179091556040517f5e4a30f4224898dbac86adca855a5edd3b8341a3aeb2b6ff0f0b5a82c013b65a90600090a250565b6000805160206156f5833981519152546001600160a01b031690565b61147f6129e1565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612cfe5761113e83613f3b565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d3757600080fd5b505afa925050508015612d67575060408051601f3d908101601f19168201909252612d649181019061551b565b60015b612dca5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161112a565b6000805160206156f58339815191528114612e395760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161112a565b5061113e838383613fd5565b612e50838383611f93565b1561113e57600082815260ca6020908152604080832086845282528083206001600160a01b03851684529091529020805460ff19169055612e8f61247a565b6001600160a01b0316816001600160a01b0316847f6f9148fcdc32766ca802c14716295d56eab7ed848d0dba113966f40087c8839085604051612ed491815260200190565b60405180910390a4505050565b612eea816123b9565b6000818152609e6020526040812054609d80549091908110612f0e57612f0e615198565b60009182526020909120600691909102016003810154600182015460028301549293506001600160a01b0390911691612f4685613b35565b612f508386613be0565b612f5985613ffa565b6000856000805160206156d583398151915283604051612f7b91815260200190565b60405180910390a3600082867fe4f48c240d3b994948aa54f3e2f5fca59263dfe1d52b6e4cf39a5d249b5ccb6560405160405180910390a460405185906000906001600160a01b0386169060008051602061577c833981519152908390a4611ba6565b61149b8282612feb61247a565b61333b565b600082815260cd602090815260409182902083905581518481529081018390527f5e07998cef9cea674942c66f0ea7b0bce89ab9473ce240cc93d616c3491f8aeb910160405180910390a15050565b61304a826001614208565b600082815260d06020526040908190208290555182907f1ebc57da8b3ebab98506502fbb73232ea29fbe86e4963a5a8c004810ad11190d9061308f9084815260200190565b60405180910390a25050565b6130a48161323e565b6001600082815260cf602052604090205460ff1660028111156130c9576130c961528c565b1461310257600081815260cf6020526040908190205490516308c9ef2d60e11b815261112a91839160ff90911690600190600401615556565b600081815260cf6020526040808220805460ff191690555182917fe2babfd5e77285a3c3dbc4b25592cbe4a7a26e97a7ac63067a22ebdaa9b82add91a250565b61314d838383611f93565b61113e57600082815260ca6020908152604080832086845282528083206001600160a01b03851684529091529020805460ff1916600117905561318e61247a565b6001600160a01b0316816001600160a01b0316847f4dc88bd74ca601684356789d5b3dbc9cd44275b2544e8d35041203703b76823285604051612ed491815260200190565b60006131df84846120f0565b600084815260ca6020908152604080832088845282529182902060010185905590518581529192508391839187917f15f4a36186b2284157fe71215a07487f6c8bdc1203b3307c3e1fd9693011d3d3910160405180910390a450505050565b61324781613547565b61147f576040516321fbdd2b60e11b81526004810182905260240161112a565b816001600160a01b0316836001600160a01b031614156132c95760405162461bcd60e51b815260206004820152601a60248201527f455243333532353a20617070726f766520746f2063616c6c6572000000000000604482015260640161112a565b6001600160a01b038381166000818152609f602090815260408083209487168084526002909501825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3191015b60405180910390a3505050565b613346838383611f93565b61113e5780828460405163c8c801a760e01b815260040161112a9392919061540d565b613374848484612a0b565b6133808484848461423a565b611d555760405162461bcd60e51b815260206004820152602760248201527f455243333532353a207472616e7366657220746f206e6f6e204552433732315260448201526632b1b2b4bb32b960c91b606482015260840161112a565b6133e7816001614208565b600081815260cf6020526040808220805460ff191660011790555182917f779fbee689bbd6f006ecb329206d35c7db7380f9837a8826fb8dc5cfcd3d33dd91a250565b60006134346137c4565b9050610f4c8482858561250e565b60a080546001600160a01b0319166001600160a01b0383169081179091556040517f5252f52e45fc8ee6a7b43cef3645d23e9a470a34182b8b3a12627556635bfc9c90600090a250565b6060610d4f6001600160a01b038316601461439d565b600082815260cf602052604081205460ff16818160028111156134c7576134c761528c565b146134d6576000915050610d4f565b60006134e18561187d565b600086815260d06020526040902054909150158015906134ff575083155b15613533576001600160a01b0381161580159061352a5750600085815260d060205260409020544211155b92505050610d4f565b6001600160a01b031615159150610d4f9050565b609d5460009015801590610d4f57506000828152609e6020526040902054609d8054849290811061357a5761357a615198565b9060005260206000209060060201600001541492915050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106135d25772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106135fe576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061361c57662386f26fc10000830492506010015b6305f5e1008310613634576305f5e100830492506008015b612710831061364857612710830492506004015b6064831061365a576064830492506002015b600a8310610d4f5760010192915050565b3360009081526097602052604081205460ff1615613690575060131936013560601c90565b503390565b6001600160a01b0382166136fe5760405162461bcd60e51b815260206004820152602a60248201527f455243333532353a20617070726f76652076616c756520746f20746865207a65604482015269726f206164647265737360b01b606482015260840161112a565b6137088284614538565b61376e576000838152609e6020526040902054609d8054909190811061373057613730615198565b60009182526020808320600692909202909101600501805460018101825590835291200180546001600160a01b0319166001600160a01b0384161790555b6000838152609c602090815260408083206001600160a01b038616808552908352928190208490555183815285917f621b050de0ad08b51d19b48b3e6df75348c4de6bdd93e81b252ca62e28265b1b910161332e565b60006137d4609b80546001019055565b50609b5490565b6040805160c081018252838152602080820184905260008284018190526001600160a01b038716606084015260808301819052835181815291820190935260a082015290506138298161460c565b6138338484613d01565b60405183906001600160a01b0386169060009060008051602061577c833981519152908290a4816000847fe4f48c240d3b994948aa54f3e2f5fca59263dfe1d52b6e4cf39a5d249b5ccb6560405160405180910390a450505050565b6000828152609e6020526040902054609d805483929081106138b3576138b3615198565b906000526020600020906006020160020160008282546138d391906154b8565b909155505060405181815282906000906000805160206156d58339815191529060200160405180910390a35050565b60008061390e8561187d565b9050613922816001600160a01b0316612b5a565b80156139a657506040516301ffc9a760e01b8152629ce20b60e01b60048201526001600160a01b038216906301ffc9a79060240160206040518083038186803b15801561396e57600080fd5b505afa158015613982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139a69190615577565b15613a55576000816001600160a01b0316629ce20b6139c361247a565b898989896040518663ffffffff1660e01b81526004016139e7959493929190615594565b602060405180830381600087803b158015613a0157600080fd5b505af1158015613a15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a3991906155d2565b6001600160e01b031916629ce20b60e01b149250613a5b915050565b60019150505b949350505050565b6001600160a01b038116600090815260cb602052604090205460ff1661147f5780604051632957ccdd60e21b815260040161112a9190614b05565b6000818152609e6020526040902054609d80548492908110613ac257613ac2615198565b6000918252602090912060069091020160040180546001600160a01b0319166001600160a01b0392831617905581908316613afc8261187d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152609e6020526040812054609d80549091908110613b5957613b59615198565b600091825260208220600560069092020190810154909250905b81811015613bd1576000836005018281548110613b9257613b92615198565b6000918252602080832090910154878352609c825260408084206001600160a01b03909216845291528120555080613bc981615271565b915050613b73565b5061113e600583016000614952565b6000818152609e6020526040812054609d80549091908110613c0457613c04615198565b6000918252602080832060069290920290910160030180546001600160a01b0319166001600160a01b039485161790559184168152609f909152604081208054909190613c53906001906154a1565b90506000826000018281548110613c6c57613c6c615198565b90600052602060002001549050600083600101600086815260200190815260200160002054905081846000018281548110613ca957613ca9615198565b60009182526020808320909101929092558381526001860190915260408082208390558682528120558354849080613ce357613ce36155ef565b60019003818190600052602060002001600090559055505050505050565b6000818152609e6020526040902054609d80548492908110613d2557613d25615198565b6000918252602080832060069290920290910160030180546001600160a01b0319166001600160a01b03948516179055939091168152609f80845260408083208054858552600182810188529285208190559286529082018155825292902090910155565b600054610100900460ff16613db15760405162461bcd60e51b815260040161112a906154d0565b8251613dc4906098906020860190614970565b508151613dd8906099906020850190614970565b50609a805460ff191660ff929092169190911790555050565b600054610100900460ff166129f15760405162461bcd60e51b815260040161112a906154d0565b600054610100900460ff1615808015613e385750600054600160ff909116105b80613e595750613e4730612b5a565b158015613e59575060005460ff166001145b613e755760405162461bcd60e51b815260040161112a906152f4565b6000805460ff191660011790558015613e98576000805461ff0019166101001790555b60005b82811015613f0a57600160976000868685818110613ebb57613ebb615198565b9050602002016020810190613ed09190614bd3565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580613f0281615271565b915050613e9b565b50801561113e576000805461ff00191690556040516001815260008051602061573583398151915290602001611f1f565b613f4481612b5a565b613fa65760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161112a565b6000805160206156f583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b613fde8361475e565b600082511180613feb5750805b1561113e57611d55838361479e565b609d5460009061400c906001906154a1565b6000838152609e6020526040812054609d805493945090928490811061403457614034615198565b60009182526020918290206040805160c08101825260069093029091018054835260018101548385015260028101548383015260038101546001600160a01b03908116606085015260048201541660808401526005810180548351818702810187019094528084529394919360a0860193928301828280156140df57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116140c1575b505050505081525050905080609d83815481106140fe576140fe615198565b600091825260209182902083516006909202019081558282015160018201556040830151600282015560608301516003820180546001600160a01b039283166001600160a01b031991821617909155608085015160048401805491909316911617905560a08301518051919261417c926005850192909101906149e4565b505081516000908152609e602052604080822085905586825281205550609d8054806141aa576141aa6155ef565b60008281526020812060066000199093019283020181815560018101829055600281018290556003810180546001600160a01b03199081169091556004820180549091169055906141fe6005830182614952565b5050905550505050565b61421282826134a2565b61149b576040516316af84a960e21b815260048101839052811515602482015260440161112a565b600061424e846001600160a01b0316612b5a565b1561439557836001600160a01b031663150b7a0261426a61247a565b8786866040518563ffffffff1660e01b815260040161428c9493929190615605565b602060405180830381600087803b1580156142a657600080fd5b505af19250505080156142d6575060408051601f3d908101601f191682019092526142d3918101906155d2565b60015b61437b573d808015614304576040519150601f19603f3d011682016040523d82523d6000602084013e614309565b606091505b5080516143735760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161112a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613a5b565b506001613a5b565b606060006143ac836002615642565b6143b79060026154b8565b6001600160401b038111156143ce576143ce614da9565b6040519080825280601f01601f1916602001820160405280156143f8576020820181803683370190505b509050600360fc1b8160008151811061441357614413615198565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061444257614442615198565b60200101906001600160f81b031916908160001a9053506000614466846002615642565b6144719060016154b8565b90505b60018111156144e9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106144a5576144a5615198565b1a60f81b8282815181106144bb576144bb615198565b60200101906001600160f81b031916908160001a90535060049490941c936144e281615661565b9050614474565b508315610f4c5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161112a565b6000818152609e6020526040812054609d8054839290811061455c5761455c615198565b6000918252602082206005600690920201015491505b81811015614601576000848152609e6020526040902054609d80546001600160a01b038816929081106145a7576145a7615198565b906000526020600020906006020160050182815481106145c9576145c9615198565b6000918252602090912001546001600160a01b031614156145ef57600192505050610d4f565b806145f981615271565b915050614572565b506000949350505050565b609d805482516000908152609e6020908152604080832084905560018401855593909152835160069092027fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7b8101928355818501517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7c820155928401517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7d84015560608401517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7e840180546001600160a01b039283166001600160a01b03199182161790915560808601517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7f8601805491909316911617905560a084015180518594611d55937fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf809091019201906149e4565b61476781613f3b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606147a983612b5a565b6148045760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161112a565b600080846001600160a01b03168460405161481f9190615678565b600060405180830381855af49150503d806000811461485a576040519150601f19603f3d011682016040523d82523d6000602084013e61485f565b606091505b5091509150614887828260405180606001604052806027815260200161575560279139614890565b95945050505050565b6060831561489f575081610f4c565b610f4c83838151156148b45781518083602001fd5b8060405162461bcd60e51b815260040161112a9190614ad9565b8280546148da90615163565b90600052602060002090601f0160209004810192826148fc5760008555614942565b82601f106149155782800160ff19823516178555614942565b82800160010185558215614942579182015b82811115614942578235825591602001919060010190614927565b5061494e929150614a39565b5090565b508054600082559060005260206000209081019061147f9190614a39565b82805461497c90615163565b90600052602060002090601f01602090048101928261499e5760008555614942565b82601f106149b757805160ff1916838001178555614942565b82800160010185558215614942579182015b828111156149425782518255916020019190600101906149c9565b828054828255906000526020600020908101928215614942579160200282015b8281111561494257825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614a04565b5b8082111561494e5760008155600101614a3a565b6001600160e01b03198116811461147f57600080fd5b600060208284031215614a7657600080fd5b8135610f4c81614a4e565b60005b83811015614a9c578181015183820152602001614a84565b83811115611d555750506000910152565b60008151808452614ac5816020860160208601614a81565b601f01601f19169290920160200192915050565b602081526000610f4c6020830184614aad565b600060208284031215614afe57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b80356001600160a01b03811681146118e857600080fd5b60008060408385031215614b4357600080fd5b614b4c83614b19565b946020939093013593505050565b600080600060608486031215614b6f57600080fd5b83359250614b7f60208501614b19565b9150604084013590509250925092565b6020808252825182820181905260009190848201906040850190845b81811015614bc757835183529284019291840191600101614bab565b50909695505050505050565b600060208284031215614be557600080fd5b610f4c82614b19565b600080600060608486031215614c0357600080fd5b614c0c84614b19565b9250614b7f60208501614b19565b600080600060608486031215614c2f57600080fd5b505081359360208301359350604090920135919050565b60008083601f840112614c5857600080fd5b5081356001600160401b03811115614c6f57600080fd5b6020830191508360208285010111156129da57600080fd5b60008060008060008060008060a0898b031215614ca357600080fd5b88356001600160401b0380821115614cba57600080fd5b614cc68c838d01614c46565b909a50985060208b0135915080821115614cdf57600080fd5b614ceb8c838d01614c46565b9098509650869150614cff60408c01614b19565b9550614d0d60608c01614b19565b945060808b0135915080821115614d2357600080fd5b818b0191508b601f830112614d3757600080fd5b813581811115614d4657600080fd5b8c60208260051b8501011115614d5b57600080fd5b6020830194508093505050509295985092959890939650565b600080600060608486031215614d8957600080fd5b8335925060208401359150614da060408501614b19565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614de757614de7614da9565b604052919050565b60006001600160401b03821115614e0857614e08614da9565b50601f01601f191660200190565b600082601f830112614e2757600080fd5b8135614e3a614e3582614def565b614dbf565b818152846020838601011115614e4f57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215614e7f57600080fd5b614e8883614b19565b915060208301356001600160401b03811115614ea357600080fd5b614eaf85828601614e16565b9150509250929050565b60008060408385031215614ecc57600080fd5b50508035926020909101359150565b600060808284031215614eed57600080fd5b50919050565b600080600060c08486031215614f0857600080fd5b8335925060208401359150614da08560408601614edb565b801515811461147f57600080fd5b600080600080600060808688031215614f4657600080fd5b8535945060208601356001600160401b03811115614f6357600080fd5b614f6f88828901614c46565b9095509350506040860135614f8381614f20565b9150614f9160608701614b19565b90509295509295909350565b600080600060408486031215614fb257600080fd5b8335925060208401356001600160401b03811115614fcf57600080fd5b614fdb86828701614c46565b9497909650939450505050565b60008060408385031215614ffb57600080fd5b61500483614b19565b9150602083013561501481614f20565b809150509250929050565b6000806000806080858703121561503557600080fd5b61503e85614b19565b935061504c60208601614b19565b92506040850135915060608501356001600160401b0381111561506e57600080fd5b61507a87828801614e16565b91505092959194509250565b6000806000806000610100868803121561509f57600080fd5b6150a886614b19565b9450602086013593506040860135925060608601359150614f918760808801614edb565b600080604083850312156150df57600080fd5b823591506150ef60208401614b19565b90509250929050565b6001600160a01b038616815260ff8516602082015260a06040820181905260009061512590830186614aad565b606083019490945250608001529392505050565b6000806040838503121561514c57600080fd5b61515583614b19565b91506150ef60208401614b19565b600181811c9082168061517757607f821691505b60208210811415614eed57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600083516151c0818460208801614a81565b64736c6f742f60d81b90830190815283516151e2816005840160208801614a81565b01600501949350505050565b60006020828403121561520057600080fd5b81516001600160401b0381111561521657600080fd5b8201601f8101841361522757600080fd5b8051615235614e3582614def565b81815285602083850101111561524a57600080fd5b614887826020830160208601614a81565b634e487b7160e01b600052601160045260246000fd5b60006000198214156152855761528561525b565b5060010190565b634e487b7160e01b600052602160045260246000fd5b60208082526032908201527f455243333532353a207472616e736665722063616c6c6572206973206e6f74206040820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b602080825260199082015278115490cccd4c8d4e881a5b9d985b1a59081d1bdad95b881251603a1b604082015260600190565b6001600160a01b039390931683526020830191909152604082015260600190565b60008351615440818460208801614a81565b835190830190615454818360208801614a81565b01949350505050565b6000835161546f818460208801614a81565b68636f6e74726163742f60b81b9083019081528351615495816009840160208801614a81565b01600901949350505050565b6000828210156154b3576154b361525b565b500390565b600082198211156154cb576154cb61525b565b500190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006020828403121561552d57600080fd5b5051919050565b6003811061555257634e487b7160e01b600052602160045260246000fd5b9052565b8381526060810161556a6020830185615534565b613a5b6040830184615534565b60006020828403121561558957600080fd5b8151610f4c81614f20565b60018060a01b038616815284602082015283604082015282606082015260a0608082015260006155c760a0830184614aad565b979650505050505050565b6000602082840312156155e457600080fd5b8151610f4c81614a4e565b634e487b7160e01b600052603160045260246000fd5b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061563890830184614aad565b9695505050505050565b600081600019048311821515161561565c5761565c61525b565b500290565b6000816156705761567061525b565b506000190190565b6000825161568a818460208701614a81565b919091019291505056fefca69b310bd19d275687ebe00b254b0772cf7a367c3f81a9a5a433f831fdc1dc3c63e605be3290ab6b04cfc46c6e1516e626d43236b034f09d7ede1d017beb0c0b2aac84f3ec956911fd78eae5311062972ff949f38412e8da39069d9f068cc6360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc449b0a7e0acc0a95c71947cb19fdd122b42abca9bdfbd6707ca4f1e3fdaef05e7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220ead6216325538c621fa2da89aa6b41f76bb46c073e45678d8b50cdd05f141d4b64736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106103b65760003560e01c806370f08160116101f9578063b4bd85791161011e578063df2a7fe1116100b6578063e71fb1101161007a578063e71fb11014610c32578063e8a3d48514610c52578063e985e9c514610c67578063ff17e23214610cb4578063ff85a97514610cd457600080fd5b8063df2a7fe114610b68578063df7f453b14610b88578063e0ed6a3114610bc1578063e345e0bc14610be1578063e4b50cb814610c0157600080fd5b8063b4bd857914610a53578063b5d6163514610a73578063b88d4fde14610a93578063babb898d14610aa6578063c2a366fb14610ac6578063c58dbbed14610ae6578063c87b56dd14610b06578063d6fd317514610b26578063d7a78db814610b4857600080fd5b806395d89b411161019157806395d89b411461093957806395ea57171461094e5780639c7525e61461096e5780639cc7f7081461098e578063a05b775f146109ae578063a217fddf146109ce578063a22cb465146109e3578063a578c09314610a03578063a8fa8e0d14610a3357600080fd5b806370f08160146108355780637dbded281461085557806381e9ff191461087557806382d66d5f14610897578063840f7113146108b75780638423df79146108d75780638cb0a511146108eb5780638eb7a776146108f957806390eddd521461091957600080fd5b80633659cfe6116102df57806352d1902d1161027757806352d1902d14610705578063572b6c051461071a5780635c41d2fe146107535780635e79b726146107735780636352211e146107935780636623fc46146107b35780636dba2729146107d35780636f7caf41146107f357806370a082311461081557600080fd5b80633659cfe6146105fd57806336e450411461061d5780633e7e86691461063d57806342842e0e1461065f57806342966c68146106725780634d93172d146106925780634f1ef286146106b25780634f6ccce7146106c557806351da912d146106e557600080fd5b806320c5429b1161035257806320c5429b146104f757806323b872dd14610517578063263f3e7e1461052a5780632d33d27a1461054a5780632f745c591461056a578063310ed7f01461058a57806331416a291461059d57806334e37b8a146105bd5780633568dd29146105dd57600080fd5b806301ffc9a7146103bb57806306fdde03146103f0578063081812fc14610412578063095ea7b31461043f57806309c3dd87146104545780630f485c02146104745780631442f5211461049557806315700052146104c257806318160ddd146104e2575b600080fd5b3480156103c757600080fd5b506103db6103d6366004614a64565b610cf4565b60405190151581526020015b60405180910390f35b3480156103fc57600080fd5b50610405610d55565b6040516103e79190614ad9565b34801561041e57600080fd5b5061043261042d366004614aec565b610de7565b6040516103e79190614b05565b61045261044d366004614b30565b610e39565b005b34801561046057600080fd5b5061040561046f366004614aec565b610e52565b610487610482366004614b5a565b610f53565b6040519081526020016103e7565b3480156104a157600080fd5b506104b56104b0366004614b30565b610f92565b6040516103e79190614b8f565b3480156104ce57600080fd5b506104526104dd366004614bd3565b611049565b3480156104ee57600080fd5b50609d54610487565b34801561050357600080fd5b50610452610512366004614aec565b6110a9565b610452610525366004614bee565b6110fd565b34801561053657600080fd5b50610487610545366004614aec565b611143565b34801561055657600080fd5b5060cc54610432906001600160a01b031681565b34801561057657600080fd5b50610487610585366004614b30565b61118b565b610452610598366004614c1a565b61122c565b3480156105a957600080fd5b506104526105b8366004614c87565b611249565b3480156105c957600080fd5b506104526105d8366004614bd3565b61146e565b3480156105e957600080fd5b506104526105f8366004614b30565b611482565b34801561060957600080fd5b50610452610618366004614bd3565b61149f565b34801561062957600080fd5b50610452610638366004614d74565b611565565b34801561064957600080fd5b50609a5460405160ff90911681526020016103e7565b61045261066d366004614bee565b6115bb565b34801561067e57600080fd5b5061045261068d366004614aec565b6115d6565b34801561069e57600080fd5b506104526106ad366004614bd3565b6115eb565b6104526106c0366004614e6c565b611618565b3480156106d157600080fd5b506104876106e0366004614aec565b6116ce565b3480156106f157600080fd5b50610452610700366004614eb9565b61175f565b34801561071157600080fd5b50610487611789565b34801561072657600080fd5b506103db610735366004614bd3565b6001600160a01b031660009081526097602052604090205460ff1690565b34801561075f57600080fd5b5061045261076e366004614bd3565b611837565b34801561077f57600080fd5b5061045261078e366004614ef3565b611867565b34801561079f57600080fd5b506104326107ae366004614aec565b61187d565b3480156107bf57600080fd5b506104526107ce366004614aec565b6118ed565b3480156107df57600080fd5b506103db6107ee366004614b30565b611902565b3480156107ff57600080fd5b5061048760008051602061571583398151915281565b34801561082157600080fd5b50610487610830366004614bd3565b61191d565b34801561084157600080fd5b50610452610850366004614b30565b6119a5565b34801561086157600080fd5b50610452610870366004614f2e565b6119be565b34801561088157600080fd5b5061048760008051602061569583398151915281565b3480156108a357600080fd5b506104526108b2366004614b30565b611bad565b3480156108c357600080fd5b5060a054610432906001600160a01b031681565b3480156108e357600080fd5b5060016103db565b61045261044d366004614b5a565b34801561090557600080fd5b50610452610914366004614d74565b611bc2565b34801561092557600080fd5b50610452610934366004614b30565b611be2565b34801561094557600080fd5b50610405611bfb565b34801561095a57600080fd5b50610405610969366004614aec565b611c0a565b34801561097a57600080fd5b50610452610989366004614f9d565b611cac565b34801561099a57600080fd5b506104876109a9366004614aec565b611d5b565b3480156109ba57600080fd5b506104876109c9366004614aec565b611da3565b3480156109da57600080fd5b50610487600081565b3480156109ef57600080fd5b506104526109fe366004614fe8565b611dc1565b348015610a0f57600080fd5b506103db610a1e366004614aec565b60ce6020526000908152604090205460ff1681565b348015610a3f57600080fd5b50610452610a4e366004614bee565b611dd3565b348015610a5f57600080fd5b50610487610a6e366004614aec565b611f2c565b348015610a7f57600080fd5b50610452610a8e366004614d74565b611f40565b610452610aa136600461501f565b611f60565b348015610ab257600080fd5b506103db610ac1366004614d74565b611f93565b348015610ad257600080fd5b506103db610ae1366004614b30565b611fc4565b348015610af257600080fd5b50610452610b01366004614bd3565b611fdf565b348015610b1257600080fd5b50610405610b21366004614aec565b61203c565b348015610b3257600080fd5b506104876000805160206156b583398151915281565b348015610b5457600080fd5b50610452610b63366004614aec565b6120db565b348015610b7457600080fd5b50610487610b83366004614eb9565b6120f0565b348015610b9457600080fd5b506103db610ba3366004614bd3565b6001600160a01b0316600090815260cb602052604090205460ff1690565b348015610bcd57600080fd5b50610452610bdc366004615086565b61210f565b348015610bed57600080fd5b50610487610bfc3660046150cc565b612158565b348015610c0d57600080fd5b50610c21610c1c366004614aec565b61218c565b6040516103e79594939291906150f8565b348015610c3e57600080fd5b50610452610c4d366004614bd3565b6121ec565b348015610c5e57600080fd5b506104056121fd565b348015610c7357600080fd5b506103db610c82366004615139565b6001600160a01b039182166000908152609f602090815260408083209390941682526002909201909152205460ff1690565b348015610cc057600080fd5b506103db610ccf366004614b30565b612306565b348015610ce057600080fd5b506103db610cef366004614aec565b612377565b60006001600160e01b03198216630354d60560e61b1480610d2557506001600160e01b031982166380ac58cd60e01b145b80610d4057506001600160e01b031982166370b0048160e11b145b80610d4f5750610d4f82612384565b92915050565b606060988054610d6490615163565b80601f0160208091040260200160405190810160405280929190818152602001828054610d9090615163565b8015610ddd5780601f10610db257610100808354040283529160200191610ddd565b820191906000526020600020905b815481529060010190602001808311610dc057829003601f168201915b5050505050905090565b6000610df2826123b9565b6000828152609e6020526040902054609d80549091908110610e1657610e16615198565b60009182526020909120600460069092020101546001600160a01b031692915050565b60405163c03a3ff560e01b815260040160405180910390fd5b60606000610e6b60408051602081019091526000815290565b60a0549091506001600160a01b0316610ecb576000815111610e9c5760405180602001604052806000815250610f4c565b80610ea6846123de565b604051602001610eb79291906151ae565b604051602081830303815290604052610f4c565b60a054604051633601bfc560e11b8152600481018590526001600160a01b0390911690636c037f8a906024015b60006040518083038186803b158015610f1057600080fd5b505afa158015610f24573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f4c91908101906151ee565b9392505050565b6000610f67610f6061247a565b8584612489565b610f7084612504565b9050610f878382610f8087611143565b600061250e565b610f4c848284612635565b6060600080610fa18585612914565b915091506000816001600160401b03811115610fbf57610fbf614da9565b604051908082528060200260200182016040528015610fe8578160200160208202803683370190505b50905060005b8281101561103f5783818151811061100857611008615198565b602002602001015182828151811061102257611022615198565b60209081029190910101528061103781615271565b915050610fee565b5095945050505050565b6110516129e1565b6040516001600160a01b038216907f286f82d2b1e37b5e9f33e455d014b4a5f6c29388e6e41e1281d4c83e04f4265590600090a26001600160a01b0316600090815260cb60205260409020805460ff19166001179055565b6110ba6110b582611143565b6129f3565b600081815260cf6020526040808220805460ff191660021790555182917fdb43aa42235c8d63908794a952603e8d43a549383d13123c3d893a3fc2e6249591a250565b61110e61110861247a565b50600090565b6111335760405162461bcd60e51b815260040161112a906152a2565b60405180910390fd5b61113e838383612a0b565b505050565b600061114e826123b9565b6000828152609e6020526040902054609d8054909190811061117257611172615198565b9060005260206000209060060201600101549050919050565b60006111968361191d565b82106111ef5760405162461bcd60e51b815260206004820152602260248201527f455243333532353a206f776e657220696e646578206f7574206f6620626f756e604482015261647360f01b606482015260840161112a565b6001600160a01b0383166000908152609f6020526040902080548390811061121957611219615198565b9060005260206000200154905092915050565b61123e61123761247a565b8483612489565b61113e838383612635565b600054610100900460ff16158080156112695750600054600160ff909116105b8061128a575061127830612b5a565b15801561128a575060005460ff166001145b6112a65760405162461bcd60e51b815260040161112a906152f4565b6000805460ff1916600117905580156112c9576000805461ff0019166101001790555b6001600160a01b0385166112f057604051630ca2c90160e21b815260040160405180910390fd5b6001600160a01b03841661131757604051630ca2c90160e21b815260040160405180910390fd5b60005b8281101561138557600084848381811061133657611336615198565b905060200201602081019061134b9190614bd3565b6001600160a01b0316141561137357604051630ca2c90160e21b815260040160405180910390fd5b8061137d81615271565b91505061131a565b506113f989898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b815292508b91508a908190840183828082843760009201829052509250612b69915050565b6114038383612b9b565b61140c84612c5d565b6001600160a01b038516600090815260cb60205260409020805460ff191660011790558015611463576000805461ff0019169055604051600181526000805160206157358339815191529060200160405180910390a15b505050505050505050565b6114766129e1565b61147f81612c5d565b50565b61149b6000805160206156b58339815191528284611bc2565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156114e85760405162461bcd60e51b815260040161112a90615342565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661151a612ca7565b6001600160a01b0316146115405760405162461bcd60e51b815260040161112a9061538e565b61154981612cc3565b6040805160008082526020820190925261147f91839190612ccb565b61156d61247a565b6001600160a01b0316816001600160a01b0316146115b0576040516307ca099360e31b8152600481018490526001600160a01b038216602482015260440161112a565b61113e838383612e45565b61113e83838360405180602001604052806000815250611f60565b6115e26110b582611143565b61147f81612ee1565b6115f36129e1565b61147f816001600160a01b03166000908152609760205260409020805460ff19169055565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156116615760405162461bcd60e51b815260040161112a90615342565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611693612ca7565b6001600160a01b0316146116b95760405162461bcd60e51b815260040161112a9061538e565b6116c282612cc3565b61149b82826001612ccb565b60006116d9609d5490565b82106117335760405162461bcd60e51b815260206004820152602360248201527f455243333532353a20676c6f62616c20696e646578206f7574206f6620626f756044820152626e647360e81b606482015260840161112a565b609d828154811061174657611746615198565b9060005260206000209060060201600001549050919050565b61177f6000805160206156b583398151915261177a84611143565b612fde565b61149b8282612ff0565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118245760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b606482015260840161112a565b506000805160206156f583398151915290565b61183f6129e1565b61147f816001600160a01b03166000908152609760205260409020805460ff19166001179055565b6118736110b584611143565b61113e838361303f565b6000611888826123b9565b6000828152609e6020526040902054609d805490919081106118ac576118ac615198565b60009182526020909120600360069092020101546001600160a01b03169050806118e85760405162461bcd60e51b815260040161112a906153da565b919050565b6118f96110b582611143565b61147f8161309b565b6000610f4c6000805160206156b58339815191528385611f93565b60006001600160a01b0382166119895760405162461bcd60e51b815260206004820152602b60248201527f455243333532353a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b606482015260840161112a565b506001600160a01b03166000908152609f602052604090205490565b61149b6000805160206156b58339815191528284611f40565b600085815260d16020526040902080546119d790615163565b1590506119fa57604051636f55f62b60e01b81526004810186905260240161112a565b600085815260d160205260409020611a139085856148ce565b508115611b3857600085815260ce60205260409020805460ff19168315151790556001600160a01b038116611a5b57604051630ca2c90160e21b815260040160405180910390fd5b611a6d816001600160a01b0316612b5a565b611a8c578060405163d4daafa160e01b815260040161112a9190614b05565b611aa56000805160206156958339815191528683613142565b611abe6000805160206157158339815191528683613142565b611ae5600080516020615715833981519152866000805160206156958339815191526131d3565b611b0c6000805160206156b5833981519152866000805160206156958339815191526131d3565b611b33600080516020615695833981519152866000805160206156958339815191526131d3565b611ba6565b611b5860008051602061571583398151915286611b5361247a565b613142565b611b7f600080516020615715833981519152866000805160206157158339815191526131d3565b611ba66000805160206156b5833981519152866000805160206157158339815191526131d3565b5050505050565b61149b60008051602061571583398151915282845b611bcc83836120f0565b82611bd78282612fde565b611ba6858585612e45565b61149b6000805160206157158339815191528284611f40565b606060998054610d6490615163565b600081815260d160205260409020805460609190611c2790615163565b80601f0160208091040260200160405190810160405280929190818152602001828054611c5390615163565b8015611ca05780601f10611c7557610100808354040283529160200191611ca0565b820191906000526020600020905b815481529060010190602001808311611c8357829003601f168201915b50505050509050919050565b600083815260d1602052604090208054611cc590615163565b15159050611ce957604051630817886d60e41b81526004810184905260240161112a565b611d0460008051602061571583398151915284610ac161247a565b611d3c57611d1061247a565b8360008051602061571583398151915260405163c8c801a760e01b815260040161112a9392919061540d565b600083815260d160205260409020611d559083836148ce565b50505050565b6000611d66826123b9565b6000828152609e6020526040902054609d80549091908110611d8a57611d8a615198565b9060005260206000209060060201600201549050919050565b6000611dae8261323e565b50600090815260d0602052604090205490565b61149b611dcc61247a565b8383613267565b600081815260ce602052604090205460ff16611e055760405163db53ce7160e01b81526004810182905260240161112a565b611e1e600080516020615695833981519152828561333b565b6001600160a01b038216611e4557604051630ca2c90160e21b815260040160405180910390fd5b611e5e6000805160206156958339815191528284611f40565b611e776000805160206157158339815191528284611f40565b611e906000805160206156b58339815191528284611f40565b611ea96000805160206156b58339815191528285611bc2565b611ec26000805160206157158339815191528285611bc2565b611edb6000805160206156958339815191528285611bc2565b604080516001600160a01b038086168252841660208201529081018290527f744258a28673e8738e2812c0ab8e8dbd70352f8871b1febac0dd753d96d79f58906060015b60405180910390a1505050565b600081815260cd6020526040812054610d4f565b611f4a83836120f0565b82611f558282612fde565b611ba6858585613142565b611f6b61110861247a565b611f875760405162461bcd60e51b815260040161112a906152a2565b611d5584848484613369565b600091825260ca602090815260408084209484529381528383206001600160a01b0392909216835252205460ff1690565b6000610f4c6000805160206157158339815191528385611f93565b611fe76129e1565b6040516001600160a01b038216907ffb445f6ec07647d2bb7af72821e6b8b7303ec375e934d4a338d38ed5846c2d5690600090a26001600160a01b0316600090815260cb60205260409020805460ff19169055565b6060612047826123b9565b600061205e60408051602081019091526000815290565b60a0549091506001600160a01b03166120aa57600081511161208f5760405180602001604052806000815250610f4c565b80612099846123de565b604051602001610eb792919061542e565b60a0546040516344a5a61760e11b8152600481018590526001600160a01b039091169063894b4c2e90602401610ef8565b6120e76110b582611143565b61147f816133dc565b600090815260ca60209081526040808320938352929052206001015490565b612118846129f3565b60006121268686600161342a565b9050831561214057600081815260d0602052604090208490555b8215612150576121508184612ff0565b505050505050565b6000612163836123b9565b506000918252609c602090815260408084206001600160a01b0393909316845291905290205490565b600080606060008061219d8661187d565b600087815260cf602052604090205490955060ff1660028111156121c3576121c361528c565b600096875260d0602090815260408089205460cd90925290972054959790969395939450915050565b6121f46129e1565b61147f81613442565b6060600061221660408051602081019091526000815290565b60a0549091506001600160a01b03166122765760008151116122475760405180602001604052806000815250612300565b806122513061348c565b60405160200161226292919061545d565b604051602081830303815290604052612300565b60a060009054906101000a90046001600160a01b03166001600160a01b031663725fa09c6040518163ffffffff1660e01b815260040160006040518083038186803b1580156122c457600080fd5b505afa1580156122d8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261230091908101906151ee565b91505090565b60008060006123158585612914565b9150915060005b8181101561236b5761234883828151811061233957612339615198565b602002602001015160006134a2565b156123595760019350505050610d4f565b8061236381615271565b91505061231c565b50600095945050505050565b6000610d4f8260006134a2565b60006001600160e01b031982166333cb74f560e11b1480610d4f57506301ffc9a760e01b6001600160e01b0319831614610d4f565b6123c281613547565b61147f5760405162461bcd60e51b815260040161112a906153da565b606060006123eb83613593565b60010190506000816001600160401b0381111561240a5761240a614da9565b6040519080825280601f01601f191660200182016040528015612434576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461246d57612472565b61243e565b509392505050565b600061248461366b565b905090565b60006124958385612158565b90506000198114611d5557818110156124f05760405162461bcd60e51b815260206004820152601f60248201527f455243333532353a20696e73756666696369656e7420616c6c6f77616e636500604482015260640161112a565b611d5583856124ff85856154a1565b613695565b6000610d4f6137c4565b6001600160a01b03841661256e5760405162461bcd60e51b815260206004820152602160248201527f455243333532353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b606482015260840161112a565b826125c55760405162461bcd60e51b815260206004820152602160248201527f455243333532353a2063616e6e6f74206d696e74207a65726f20746f6b656e496044820152601960fa1b606482015260840161112a565b6125ce83613547565b1561261b5760405162461bcd60e51b815260206004820152601d60248201527f455243333532353a20746f6b656e20616c7265616479206d696e746564000000604482015260640161112a565b6126268484846137db565b612630838261388f565b611d55565b61263e83613547565b61269a5760405162461bcd60e51b815260206004820152602760248201527f455243333532353a207472616e736665722066726f6d20696e76616c696420746044820152661bdad95b88125160ca1b606482015260840161112a565b6126a382613547565b6126fd5760405162461bcd60e51b815260206004820152602560248201527f455243333532353a207472616e7366657220746f20696e76616c696420746f6b604482015264195b88125160da1b606482015260840161112a565b6000838152609e6020526040812054609d8054909190811061272157612721615198565b906000526020600020906006020190506000609d609e6000868152602001908152602001600020548154811061275957612759615198565b9060005260206000209060060201905082826002015410156127d05760405162461bcd60e51b815260206004820152602a60248201527f455243333532353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161112a565b806001015482600101541461283e5760405162461bcd60e51b815260206004820152602e60248201527f455243333532353a207472616e7366657220746f20746f6b656e20776974682060448201526d191a5999995c995b9d081cdb1bdd60921b606482015260840161112a565b8282600201600082825461285291906154a1565b925050819055508281600201600082825461286d91906154b8565b9091555050604051838152849086906000805160206156d58339815191529060200160405180910390a36128b285858560405180602001604052806000815250613902565b611ba65760405162461bcd60e51b815260206004820152602d60248201527f455243333532353a207472616e736665722072656a656374656420627920455260448201526c21999a991aa932b1b2b4bb32b960991b606482015260840161112a565b60606000806129228561191d565b90506000816001600160401b0381111561293e5761293e614da9565b604051908082528060200260200182016040528015612967578160200160208202803683370190505b5090506000805b838110156129d2576000612982898361118b565b90508761298e82611143565b14156129bf578084846129a081615271565b9550815181106129b2576129b2615198565b6020026020010181815250505b50806129ca81615271565b91505061296e565b509093509150505b9250929050565b6129f16129ec61247a565b613a63565b565b61147f6000805160206156b583398151915282612fde565b826001600160a01b0316612a1e8261187d565b6001600160a01b031614612a805760405162461bcd60e51b8152602060048201526024808201527f455243333532353a207472616e736665722066726f6d20696e76616c6964206f6044820152633bb732b960e11b606482015260840161112a565b6001600160a01b038216612ae45760405162461bcd60e51b815260206004820152602560248201527f455243333532353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161112a565b6000612aef82611143565b90506000612afc83611d5b565b9050612b09600084613a9e565b612b1283613b35565b612b1c8584613be0565b612b268484613d01565b82846001600160a01b0316866001600160a01b031660008051602061577c83398151915260405160405180910390a4611ba6565b6001600160a01b03163b151590565b600054610100900460ff16612b905760405162461bcd60e51b815260040161112a906154d0565b61113e838383613d8a565b600054610100900460ff1615808015612bbb5750600054600160ff909116105b80612bdc5750612bca30612b5a565b158015612bdc575060005460ff166001145b612bf85760405162461bcd60e51b815260040161112a906152f4565b6000805460ff191660011790558015612c1b576000805461ff0019166101001790555b612c23613df1565b612c2d8383613e18565b801561113e576000805461ff00191690556040516001815260008051602061573583398151915290602001611f1f565b60cc80546001600160a01b0319166001600160a01b0383169081179091556040517f5e4a30f4224898dbac86adca855a5edd3b8341a3aeb2b6ff0f0b5a82c013b65a90600090a250565b6000805160206156f5833981519152546001600160a01b031690565b61147f6129e1565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612cfe5761113e83613f3b565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d3757600080fd5b505afa925050508015612d67575060408051601f3d908101601f19168201909252612d649181019061551b565b60015b612dca5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161112a565b6000805160206156f58339815191528114612e395760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161112a565b5061113e838383613fd5565b612e50838383611f93565b1561113e57600082815260ca6020908152604080832086845282528083206001600160a01b03851684529091529020805460ff19169055612e8f61247a565b6001600160a01b0316816001600160a01b0316847f6f9148fcdc32766ca802c14716295d56eab7ed848d0dba113966f40087c8839085604051612ed491815260200190565b60405180910390a4505050565b612eea816123b9565b6000818152609e6020526040812054609d80549091908110612f0e57612f0e615198565b60009182526020909120600691909102016003810154600182015460028301549293506001600160a01b0390911691612f4685613b35565b612f508386613be0565b612f5985613ffa565b6000856000805160206156d583398151915283604051612f7b91815260200190565b60405180910390a3600082867fe4f48c240d3b994948aa54f3e2f5fca59263dfe1d52b6e4cf39a5d249b5ccb6560405160405180910390a460405185906000906001600160a01b0386169060008051602061577c833981519152908390a4611ba6565b61149b8282612feb61247a565b61333b565b600082815260cd602090815260409182902083905581518481529081018390527f5e07998cef9cea674942c66f0ea7b0bce89ab9473ce240cc93d616c3491f8aeb910160405180910390a15050565b61304a826001614208565b600082815260d06020526040908190208290555182907f1ebc57da8b3ebab98506502fbb73232ea29fbe86e4963a5a8c004810ad11190d9061308f9084815260200190565b60405180910390a25050565b6130a48161323e565b6001600082815260cf602052604090205460ff1660028111156130c9576130c961528c565b1461310257600081815260cf6020526040908190205490516308c9ef2d60e11b815261112a91839160ff90911690600190600401615556565b600081815260cf6020526040808220805460ff191690555182917fe2babfd5e77285a3c3dbc4b25592cbe4a7a26e97a7ac63067a22ebdaa9b82add91a250565b61314d838383611f93565b61113e57600082815260ca6020908152604080832086845282528083206001600160a01b03851684529091529020805460ff1916600117905561318e61247a565b6001600160a01b0316816001600160a01b0316847f4dc88bd74ca601684356789d5b3dbc9cd44275b2544e8d35041203703b76823285604051612ed491815260200190565b60006131df84846120f0565b600084815260ca6020908152604080832088845282529182902060010185905590518581529192508391839187917f15f4a36186b2284157fe71215a07487f6c8bdc1203b3307c3e1fd9693011d3d3910160405180910390a450505050565b61324781613547565b61147f576040516321fbdd2b60e11b81526004810182905260240161112a565b816001600160a01b0316836001600160a01b031614156132c95760405162461bcd60e51b815260206004820152601a60248201527f455243333532353a20617070726f766520746f2063616c6c6572000000000000604482015260640161112a565b6001600160a01b038381166000818152609f602090815260408083209487168084526002909501825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3191015b60405180910390a3505050565b613346838383611f93565b61113e5780828460405163c8c801a760e01b815260040161112a9392919061540d565b613374848484612a0b565b6133808484848461423a565b611d555760405162461bcd60e51b815260206004820152602760248201527f455243333532353a207472616e7366657220746f206e6f6e204552433732315260448201526632b1b2b4bb32b960c91b606482015260840161112a565b6133e7816001614208565b600081815260cf6020526040808220805460ff191660011790555182917f779fbee689bbd6f006ecb329206d35c7db7380f9837a8826fb8dc5cfcd3d33dd91a250565b60006134346137c4565b9050610f4c8482858561250e565b60a080546001600160a01b0319166001600160a01b0383169081179091556040517f5252f52e45fc8ee6a7b43cef3645d23e9a470a34182b8b3a12627556635bfc9c90600090a250565b6060610d4f6001600160a01b038316601461439d565b600082815260cf602052604081205460ff16818160028111156134c7576134c761528c565b146134d6576000915050610d4f565b60006134e18561187d565b600086815260d06020526040902054909150158015906134ff575083155b15613533576001600160a01b0381161580159061352a5750600085815260d060205260409020544211155b92505050610d4f565b6001600160a01b031615159150610d4f9050565b609d5460009015801590610d4f57506000828152609e6020526040902054609d8054849290811061357a5761357a615198565b9060005260206000209060060201600001541492915050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106135d25772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106135fe576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061361c57662386f26fc10000830492506010015b6305f5e1008310613634576305f5e100830492506008015b612710831061364857612710830492506004015b6064831061365a576064830492506002015b600a8310610d4f5760010192915050565b3360009081526097602052604081205460ff1615613690575060131936013560601c90565b503390565b6001600160a01b0382166136fe5760405162461bcd60e51b815260206004820152602a60248201527f455243333532353a20617070726f76652076616c756520746f20746865207a65604482015269726f206164647265737360b01b606482015260840161112a565b6137088284614538565b61376e576000838152609e6020526040902054609d8054909190811061373057613730615198565b60009182526020808320600692909202909101600501805460018101825590835291200180546001600160a01b0319166001600160a01b0384161790555b6000838152609c602090815260408083206001600160a01b038616808552908352928190208490555183815285917f621b050de0ad08b51d19b48b3e6df75348c4de6bdd93e81b252ca62e28265b1b910161332e565b60006137d4609b80546001019055565b50609b5490565b6040805160c081018252838152602080820184905260008284018190526001600160a01b038716606084015260808301819052835181815291820190935260a082015290506138298161460c565b6138338484613d01565b60405183906001600160a01b0386169060009060008051602061577c833981519152908290a4816000847fe4f48c240d3b994948aa54f3e2f5fca59263dfe1d52b6e4cf39a5d249b5ccb6560405160405180910390a450505050565b6000828152609e6020526040902054609d805483929081106138b3576138b3615198565b906000526020600020906006020160020160008282546138d391906154b8565b909155505060405181815282906000906000805160206156d58339815191529060200160405180910390a35050565b60008061390e8561187d565b9050613922816001600160a01b0316612b5a565b80156139a657506040516301ffc9a760e01b8152629ce20b60e01b60048201526001600160a01b038216906301ffc9a79060240160206040518083038186803b15801561396e57600080fd5b505afa158015613982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139a69190615577565b15613a55576000816001600160a01b0316629ce20b6139c361247a565b898989896040518663ffffffff1660e01b81526004016139e7959493929190615594565b602060405180830381600087803b158015613a0157600080fd5b505af1158015613a15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a3991906155d2565b6001600160e01b031916629ce20b60e01b149250613a5b915050565b60019150505b949350505050565b6001600160a01b038116600090815260cb602052604090205460ff1661147f5780604051632957ccdd60e21b815260040161112a9190614b05565b6000818152609e6020526040902054609d80548492908110613ac257613ac2615198565b6000918252602090912060069091020160040180546001600160a01b0319166001600160a01b0392831617905581908316613afc8261187d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152609e6020526040812054609d80549091908110613b5957613b59615198565b600091825260208220600560069092020190810154909250905b81811015613bd1576000836005018281548110613b9257613b92615198565b6000918252602080832090910154878352609c825260408084206001600160a01b03909216845291528120555080613bc981615271565b915050613b73565b5061113e600583016000614952565b6000818152609e6020526040812054609d80549091908110613c0457613c04615198565b6000918252602080832060069290920290910160030180546001600160a01b0319166001600160a01b039485161790559184168152609f909152604081208054909190613c53906001906154a1565b90506000826000018281548110613c6c57613c6c615198565b90600052602060002001549050600083600101600086815260200190815260200160002054905081846000018281548110613ca957613ca9615198565b60009182526020808320909101929092558381526001860190915260408082208390558682528120558354849080613ce357613ce36155ef565b60019003818190600052602060002001600090559055505050505050565b6000818152609e6020526040902054609d80548492908110613d2557613d25615198565b6000918252602080832060069290920290910160030180546001600160a01b0319166001600160a01b03948516179055939091168152609f80845260408083208054858552600182810188529285208190559286529082018155825292902090910155565b600054610100900460ff16613db15760405162461bcd60e51b815260040161112a906154d0565b8251613dc4906098906020860190614970565b508151613dd8906099906020850190614970565b50609a805460ff191660ff929092169190911790555050565b600054610100900460ff166129f15760405162461bcd60e51b815260040161112a906154d0565b600054610100900460ff1615808015613e385750600054600160ff909116105b80613e595750613e4730612b5a565b158015613e59575060005460ff166001145b613e755760405162461bcd60e51b815260040161112a906152f4565b6000805460ff191660011790558015613e98576000805461ff0019166101001790555b60005b82811015613f0a57600160976000868685818110613ebb57613ebb615198565b9050602002016020810190613ed09190614bd3565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580613f0281615271565b915050613e9b565b50801561113e576000805461ff00191690556040516001815260008051602061573583398151915290602001611f1f565b613f4481612b5a565b613fa65760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161112a565b6000805160206156f583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b613fde8361475e565b600082511180613feb5750805b1561113e57611d55838361479e565b609d5460009061400c906001906154a1565b6000838152609e6020526040812054609d805493945090928490811061403457614034615198565b60009182526020918290206040805160c08101825260069093029091018054835260018101548385015260028101548383015260038101546001600160a01b03908116606085015260048201541660808401526005810180548351818702810187019094528084529394919360a0860193928301828280156140df57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116140c1575b505050505081525050905080609d83815481106140fe576140fe615198565b600091825260209182902083516006909202019081558282015160018201556040830151600282015560608301516003820180546001600160a01b039283166001600160a01b031991821617909155608085015160048401805491909316911617905560a08301518051919261417c926005850192909101906149e4565b505081516000908152609e602052604080822085905586825281205550609d8054806141aa576141aa6155ef565b60008281526020812060066000199093019283020181815560018101829055600281018290556003810180546001600160a01b03199081169091556004820180549091169055906141fe6005830182614952565b5050905550505050565b61421282826134a2565b61149b576040516316af84a960e21b815260048101839052811515602482015260440161112a565b600061424e846001600160a01b0316612b5a565b1561439557836001600160a01b031663150b7a0261426a61247a565b8786866040518563ffffffff1660e01b815260040161428c9493929190615605565b602060405180830381600087803b1580156142a657600080fd5b505af19250505080156142d6575060408051601f3d908101601f191682019092526142d3918101906155d2565b60015b61437b573d808015614304576040519150601f19603f3d011682016040523d82523d6000602084013e614309565b606091505b5080516143735760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606482015260840161112a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613a5b565b506001613a5b565b606060006143ac836002615642565b6143b79060026154b8565b6001600160401b038111156143ce576143ce614da9565b6040519080825280601f01601f1916602001820160405280156143f8576020820181803683370190505b509050600360fc1b8160008151811061441357614413615198565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061444257614442615198565b60200101906001600160f81b031916908160001a9053506000614466846002615642565b6144719060016154b8565b90505b60018111156144e9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106144a5576144a5615198565b1a60f81b8282815181106144bb576144bb615198565b60200101906001600160f81b031916908160001a90535060049490941c936144e281615661565b9050614474565b508315610f4c5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161112a565b6000818152609e6020526040812054609d8054839290811061455c5761455c615198565b6000918252602082206005600690920201015491505b81811015614601576000848152609e6020526040902054609d80546001600160a01b038816929081106145a7576145a7615198565b906000526020600020906006020160050182815481106145c9576145c9615198565b6000918252602090912001546001600160a01b031614156145ef57600192505050610d4f565b806145f981615271565b915050614572565b506000949350505050565b609d805482516000908152609e6020908152604080832084905560018401855593909152835160069092027fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7b8101928355818501517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7c820155928401517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7d84015560608401517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7e840180546001600160a01b039283166001600160a01b03199182161790915560808601517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7f8601805491909316911617905560a084015180518594611d55937fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf809091019201906149e4565b61476781613f3b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606147a983612b5a565b6148045760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161112a565b600080846001600160a01b03168460405161481f9190615678565b600060405180830381855af49150503d806000811461485a576040519150601f19603f3d011682016040523d82523d6000602084013e61485f565b606091505b5091509150614887828260405180606001604052806027815260200161575560279139614890565b95945050505050565b6060831561489f575081610f4c565b610f4c83838151156148b45781518083602001fd5b8060405162461bcd60e51b815260040161112a9190614ad9565b8280546148da90615163565b90600052602060002090601f0160209004810192826148fc5760008555614942565b82601f106149155782800160ff19823516178555614942565b82800160010185558215614942579182015b82811115614942578235825591602001919060010190614927565b5061494e929150614a39565b5090565b508054600082559060005260206000209081019061147f9190614a39565b82805461497c90615163565b90600052602060002090601f01602090048101928261499e5760008555614942565b82601f106149b757805160ff1916838001178555614942565b82800160010185558215614942579182015b828111156149425782518255916020019190600101906149c9565b828054828255906000526020600020908101928215614942579160200282015b8281111561494257825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614a04565b5b8082111561494e5760008155600101614a3a565b6001600160e01b03198116811461147f57600080fd5b600060208284031215614a7657600080fd5b8135610f4c81614a4e565b60005b83811015614a9c578181015183820152602001614a84565b83811115611d555750506000910152565b60008151808452614ac5816020860160208601614a81565b601f01601f19169290920160200192915050565b602081526000610f4c6020830184614aad565b600060208284031215614afe57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b80356001600160a01b03811681146118e857600080fd5b60008060408385031215614b4357600080fd5b614b4c83614b19565b946020939093013593505050565b600080600060608486031215614b6f57600080fd5b83359250614b7f60208501614b19565b9150604084013590509250925092565b6020808252825182820181905260009190848201906040850190845b81811015614bc757835183529284019291840191600101614bab565b50909695505050505050565b600060208284031215614be557600080fd5b610f4c82614b19565b600080600060608486031215614c0357600080fd5b614c0c84614b19565b9250614b7f60208501614b19565b600080600060608486031215614c2f57600080fd5b505081359360208301359350604090920135919050565b60008083601f840112614c5857600080fd5b5081356001600160401b03811115614c6f57600080fd5b6020830191508360208285010111156129da57600080fd5b60008060008060008060008060a0898b031215614ca357600080fd5b88356001600160401b0380821115614cba57600080fd5b614cc68c838d01614c46565b909a50985060208b0135915080821115614cdf57600080fd5b614ceb8c838d01614c46565b9098509650869150614cff60408c01614b19565b9550614d0d60608c01614b19565b945060808b0135915080821115614d2357600080fd5b818b0191508b601f830112614d3757600080fd5b813581811115614d4657600080fd5b8c60208260051b8501011115614d5b57600080fd5b6020830194508093505050509295985092959890939650565b600080600060608486031215614d8957600080fd5b8335925060208401359150614da060408501614b19565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614de757614de7614da9565b604052919050565b60006001600160401b03821115614e0857614e08614da9565b50601f01601f191660200190565b600082601f830112614e2757600080fd5b8135614e3a614e3582614def565b614dbf565b818152846020838601011115614e4f57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215614e7f57600080fd5b614e8883614b19565b915060208301356001600160401b03811115614ea357600080fd5b614eaf85828601614e16565b9150509250929050565b60008060408385031215614ecc57600080fd5b50508035926020909101359150565b600060808284031215614eed57600080fd5b50919050565b600080600060c08486031215614f0857600080fd5b8335925060208401359150614da08560408601614edb565b801515811461147f57600080fd5b600080600080600060808688031215614f4657600080fd5b8535945060208601356001600160401b03811115614f6357600080fd5b614f6f88828901614c46565b9095509350506040860135614f8381614f20565b9150614f9160608701614b19565b90509295509295909350565b600080600060408486031215614fb257600080fd5b8335925060208401356001600160401b03811115614fcf57600080fd5b614fdb86828701614c46565b9497909650939450505050565b60008060408385031215614ffb57600080fd5b61500483614b19565b9150602083013561501481614f20565b809150509250929050565b6000806000806080858703121561503557600080fd5b61503e85614b19565b935061504c60208601614b19565b92506040850135915060608501356001600160401b0381111561506e57600080fd5b61507a87828801614e16565b91505092959194509250565b6000806000806000610100868803121561509f57600080fd5b6150a886614b19565b9450602086013593506040860135925060608601359150614f918760808801614edb565b600080604083850312156150df57600080fd5b823591506150ef60208401614b19565b90509250929050565b6001600160a01b038616815260ff8516602082015260a06040820181905260009061512590830186614aad565b606083019490945250608001529392505050565b6000806040838503121561514c57600080fd5b61515583614b19565b91506150ef60208401614b19565b600181811c9082168061517757607f821691505b60208210811415614eed57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600083516151c0818460208801614a81565b64736c6f742f60d81b90830190815283516151e2816005840160208801614a81565b01600501949350505050565b60006020828403121561520057600080fd5b81516001600160401b0381111561521657600080fd5b8201601f8101841361522757600080fd5b8051615235614e3582614def565b81815285602083850101111561524a57600080fd5b614887826020830160208601614a81565b634e487b7160e01b600052601160045260246000fd5b60006000198214156152855761528561525b565b5060010190565b634e487b7160e01b600052602160045260246000fd5b60208082526032908201527f455243333532353a207472616e736665722063616c6c6572206973206e6f74206040820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b602080825260199082015278115490cccd4c8d4e881a5b9d985b1a59081d1bdad95b881251603a1b604082015260600190565b6001600160a01b039390931683526020830191909152604082015260600190565b60008351615440818460208801614a81565b835190830190615454818360208801614a81565b01949350505050565b6000835161546f818460208801614a81565b68636f6e74726163742f60b81b9083019081528351615495816009840160208801614a81565b01600901949350505050565b6000828210156154b3576154b361525b565b500390565b600082198211156154cb576154cb61525b565b500190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006020828403121561552d57600080fd5b5051919050565b6003811061555257634e487b7160e01b600052602160045260246000fd5b9052565b8381526060810161556a6020830185615534565b613a5b6040830184615534565b60006020828403121561558957600080fd5b8151610f4c81614f20565b60018060a01b038616815284602082015283604082015282606082015260a0608082015260006155c760a0830184614aad565b979650505050505050565b6000602082840312156155e457600080fd5b8151610f4c81614a4e565b634e487b7160e01b600052603160045260246000fd5b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061563890830184614aad565b9695505050505050565b600081600019048311821515161561565c5761565c61525b565b500290565b6000816156705761567061525b565b506000190190565b6000825161568a818460208701614a81565b919091019291505056fefca69b310bd19d275687ebe00b254b0772cf7a367c3f81a9a5a433f831fdc1dc3c63e605be3290ab6b04cfc46c6e1516e626d43236b034f09d7ede1d017beb0c0b2aac84f3ec956911fd78eae5311062972ff949f38412e8da39069d9f068cc6360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc449b0a7e0acc0a95c71947cb19fdd122b42abca9bdfbd6707ca4f1e3fdaef05e7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220ead6216325538c621fa2da89aa6b41f76bb46c073e45678d8b50cdd05f141d4b64736f6c63430008090033", + "devdoc": { + "details": "Gateway Token contract is responsible for managing Identity.com KYC gateway tokens those tokens represent completed KYC with attached identity. Gateway tokens using ERC721 standard with custom extensions. Contract handles multiple levels of access such as Network Authority (may represent a specific regulator body) Gatekeepers (Identity.com network parties who can mint/burn/freeze gateway tokens) and overall system Admin who can add new Gatekeepers and Network Authorities", + "errors": { + "Common__NotContract(address)": [ + { + "params": { + "account": "address of the account." + } + } + ], + "Common__NotSuperAdmin(address)": [ + { + "params": { + "account": "address of the account." + } + } + ], + "Common__Unauthorized(address,uint256,bytes32)": [ + { + "params": { + "domain": "the domain to which the role applies.", + "role": "role that is required.", + "sender": "address of the sender." + } + } + ], + "GatewayToken__InsufficientFunds(uint256,uint256)": [ + { + "params": { + "available": "balance available.", + "required": "requested amount to transfer." + } + } + ], + "GatewayToken__NetworkAlreadyExists(uint256)": [ + { + "params": { + "network": "gatekeeper network id." + } + } + ], + "GatewayToken__NetworkDoesNotExist(uint256)": [ + { + "params": { + "network": "gatekeeper network id." + } + } + ], + "GatewayToken__NotDAOGoverned(uint256)": [ + { + "params": { + "network": "gatekeeper network id." + } + } + ], + "GatewayToken__TokenDoesNotExist(uint256)": [ + { + "params": { + "tokenId": "token id." + } + } + ], + "GatewayToken__TokenDoesNotExistOrIsInactive(uint256,bool)": [ + { + "params": { + "allowExpired": "whether to allow expired tokens.", + "tokenId": "token id." + } + } + ], + "GatewayToken__TokenInvalidStateForOperation(uint256,uint8,uint8)": [ + { + "params": { + "expectedState": "expected token state.", + "state": "current token state.", + "tokenId": "token id." + } + } + ] + }, + "kind": "dev", + "methods": { + "addGatekeeper(address,uint256)": { + "details": "Triggers to add new gatekeeper into the system.", + "params": { + "gatekeeper": "Gatekeeper address" + } + }, + "addNetworkAuthority(address,uint256)": { + "details": "Triggers to add new network authority into the system.", + "params": { + "authority": "Network Authority address" + } + }, + "approve(uint256,address,uint256)": { + "details": "Transfers are disabled for Gateway Tokens - override ERC3525 approve functions to revert Note - transferFrom and safeTransferFrom are disabled indirectly with the _isApprovedOrOwner function" + }, + "burn(uint256)": { + "details": "Triggers to burn gateway token", + "params": { + "tokenId": "Gateway token id" + } + }, + "constructor": { + "custom:oz-upgrades-unsafe-allow": "constructor" + }, + "contractURI()": { + "details": "This function SHOULD return the URI for this contract in JSON format, starting with header `data:application/json;`. See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for contract URI.", + "returns": { + "_0": "The JSON formatted URI of the current ERC3525 contract" + } + }, + "freeze(uint256)": { + "details": "Triggers to freeze gateway token", + "params": { + "tokenId": "Gateway token id" + } + }, + "getExpiration(uint256)": { + "details": "Triggers to get specified `tokenId` expiration timestamp", + "params": { + "tokenId": "Gateway token id" + } + }, + "getRoleAdmin(bytes32,uint256)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "getToken(uint256)": { + "details": "Triggers to get all information gateway token related to specified `tokenId`", + "params": { + "tokenId": "Gateway token id" + } + }, + "getTokenBitmask(uint256)": { + "details": "Triggers to get gateway token bitmask" + }, + "grantRole(bytes32,uint256,address)": { + "details": "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. May emit a {RoleGranted} event." + }, + "hasRole(bytes32,uint256,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "isGatekeeper(address,uint256)": { + "details": "Triggers to verify if address has a GATEKEEPER role.", + "params": { + "gatekeeper": "Gatekeeper address" + } + }, + "isNetworkAuthority(address,uint256)": { + "details": "Triggers to verify if authority has a NETWORK_AUTHORITY_ROLE role.", + "params": { + "authority": "Network Authority address" + } + }, + "mint(address,uint256,uint256,uint256,(uint256,uint8,address,address))": { + "details": "Triggers to mint gateway token", + "params": { + "mask": "The bitmask for the token", + "network": "Gateway token type", + "to": "Gateway token owner" + } + }, + "name()": { + "details": "Returns the token collection name." + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier." + }, + "removeGatekeeper(address,uint256)": { + "details": "Triggers to remove existing gatekeeper from gateway token.", + "params": { + "gatekeeper": "Gatekeeper address" + } + }, + "removeNetworkAuthority(address,uint256)": { + "details": "Triggers to remove existing network authority from gateway token.", + "params": { + "authority": "Network Authority address" + } + }, + "renounceRole(bytes32,uint256,address)": { + "details": "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 revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event." + }, + "revoke(uint256)": { + "details": "Triggers to revoke gateway token", + "params": { + "tokenId": "Gateway token id" + } + }, + "revokeRole(bytes32,uint256,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." + }, + "setBitmask(uint256,uint256)": { + "details": "Triggers to set full bitmask for gateway token with `tokenId`" + }, + "setExpiration(uint256,uint256,(uint256,uint8,address,address))": { + "details": "Triggers to set expiration for tokenId", + "params": { + "tokenId": "Gateway token id" + } + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + }, + "symbol()": { + "details": "Returns the token collection symbol." + }, + "tokenURI(uint256)": { + "details": "Returns the Uniform Resource Identifier (URI) for `tokenId` token." + }, + "totalSupply()": { + "returns": { + "_0": "A count of valid NFTs tracked by this contract, where each one of them has an assigned and queryable owner not equal to the zero address" + } + }, + "transferDAOManager(address,address,uint256)": { + "details": "Transfers Gateway Token DAO Manager access from `previousManager` to `newManager` Only a current DAO Manager can do this. They can do this for any other DAO Manager. This is useful for two reasons: 1. Key rotation of the current (msg signer) DAO manager 2. Replacing a lost or compromised key of an existing DAO manager", + "params": { + "newManager": "Address to transfer DAO Manager role for." + } + }, + "transfersRestricted()": { + "details": "Returns true if gateway token owner transfers restricted, and false otherwise." + }, + "unfreeze(uint256)": { + "details": "Triggers to unfreeze gateway token", + "params": { + "tokenId": "Gateway token id" + } + }, + "updateFlagsStorage(address)": { + "details": "Triggers to update FlagsStorage contract address", + "params": { + "flagsStorage": "FlagsStorage contract address" + } + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + }, + "valueDecimals()": { + "details": "Returns the number of decimals the token uses for value." + }, + "verifyToken(address,uint256)": { + "details": "Triggered by external contract to verify the validity of the default token for `owner`. Checks owner has any token on gateway token contract, `tokenId` still active, and not expired." + }, + "verifyToken(uint256)": { + "details": "Triggered by external contract to verify the validity of the default token for `owner`. Checks owner has any token on gateway token contract, `tokenId` still active, and not expired." + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "Common__MissingAccount()": [ + { + "notice": "The passed-in account is the zero-address" + } + ], + "Common__NotContract(address)": [ + { + "notice": "The passed-in account is not a contract, where an account is expected" + } + ], + "Common__NotSuperAdmin(address)": [ + { + "notice": "The passed-in account is not a super-admin" + } + ], + "Common__Unauthorized(address,uint256,bytes32)": [ + { + "notice": "The request was made from an unauthorized address." + } + ], + "GatewayToken__InsufficientFunds(uint256,uint256)": [ + { + "notice": "Insufficient funds for withdrawal. Needed `required` but only `available` available." + } + ], + "GatewayToken__NetworkAlreadyExists(uint256)": [ + { + "notice": "The gatekeeper network being created already exists." + } + ], + "GatewayToken__NetworkDoesNotExist(uint256)": [ + { + "notice": "The gatekeeper network does not exist." + } + ], + "GatewayToken__NotDAOGoverned(uint256)": [ + { + "notice": "The gatekeeper network is not dao-governed." + } + ], + "GatewayToken__TokenDoesNotExist(uint256)": [ + { + "notice": "The requested token does not exist." + } + ], + "GatewayToken__TokenDoesNotExistOrIsInactive(uint256,bool)": [ + { + "notice": "The requested token is not active or does not exist" + } + ], + "GatewayToken__TokenInvalidStateForOperation(uint256,uint8,uint8)": [ + { + "notice": "The requested token state is invalid for the request" + } + ], + "GatewayToken__TransferDisabled()": [ + { + "notice": "Token transfers are disabled" + } + ], + "ParameterizedAccessControl__RenounceRoleNotForSelf(bytes32,address)": [ + { + "notice": "A sender can only renounce roles for themselves" + } + ] + }, + "kind": "user", + "methods": { + "addNetworkAuthority(address,uint256)": { + "notice": "Can be triggered by DAO Manager or any Network Authority" + }, + "contractURI()": { + "notice": "Returns the Uniform Resource Identifier (URI) for the current ERC3525 contract." + }, + "removeNetworkAuthority(address,uint256)": { + "notice": "Can be triggered by DAO Manager or any Network Authority" + }, + "totalSupply()": { + "notice": "Count NFTs tracked by this contract" + }, + "transferDAOManager(address,address,uint256)": { + "notice": "GatewayToken contract has to be DAO Governed" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 534, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 537, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 516, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 831, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 1157, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 9804, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_trustedForwarders", + "offset": 0, + "slot": "151", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 5001, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_name", + "offset": 0, + "slot": "152", + "type": "t_string_storage" + }, + { + "astId": 5003, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_symbol", + "offset": 0, + "slot": "153", + "type": "t_string_storage" + }, + { + "astId": 5005, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_decimals", + "offset": 0, + "slot": "154", + "type": "t_uint8" + }, + { + "astId": 5008, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_tokenIdGenerator", + "offset": 0, + "slot": "155", + "type": "t_struct(Counter)1164_storage" + }, + { + "astId": 5014, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_approvedValues", + "offset": 0, + "slot": "156", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5018, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_allTokens", + "offset": 0, + "slot": "157", + "type": "t_array(t_struct(TokenData)4987_storage)dyn_storage" + }, + { + "astId": 5022, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_allTokensIndex", + "offset": 0, + "slot": "158", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 5027, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_addressData", + "offset": 0, + "slot": "159", + "type": "t_mapping(t_address,t_struct(AddressData)4999_storage)" + }, + { + "astId": 5030, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "metadataDescriptor", + "offset": 0, + "slot": "160", + "type": "t_contract(IERC3525MetadataDescriptorUpgradeable)7682" + }, + { + "astId": 7105, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "__gap", + "offset": 0, + "slot": "161", + "type": "t_array(t_uint256)41_storage" + }, + { + "astId": 9971, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_roleDomain", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_uint256,t_struct(RoleDomain)9966_storage)" + }, + { + "astId": 9975, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_superAdmins", + "offset": 0, + "slot": "203", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 10384, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "flagsStorage", + "offset": 0, + "slot": "204", + "type": "t_contract(IFlagsStorage)10609" + }, + { + "astId": 10388, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_bitmasks", + "offset": 0, + "slot": "205", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 8506, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "isNetworkDAOGoverned", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_uint256,t_bool)" + }, + { + "astId": 8526, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_tokenStates", + "offset": 0, + "slot": "207", + "type": "t_mapping(t_uint256,t_enum(TokenState)10653)" + }, + { + "astId": 8530, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_expirations", + "offset": 0, + "slot": "208", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 8534, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_networks", + "offset": 0, + "slot": "209", + "type": "t_mapping(t_uint256,t_string_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(TokenData)4987_storage)dyn_storage": { + "base": "t_struct(TokenData)4987_storage", + "encoding": "dynamic_array", + "label": "struct ERC3525Upgradeable.TokenData[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)41_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[41]", + "numberOfBytes": "1312" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IERC3525MetadataDescriptorUpgradeable)7682": { + "encoding": "inplace", + "label": "contract IERC3525MetadataDescriptorUpgradeable", + "numberOfBytes": "20" + }, + "t_contract(IFlagsStorage)10609": { + "encoding": "inplace", + "label": "contract IFlagsStorage", + "numberOfBytes": "20" + }, + "t_enum(TokenState)10653": { + "encoding": "inplace", + "label": "enum IGatewayToken.TokenState", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_struct(AddressData)4999_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct ERC3525Upgradeable.AddressData)", + "numberOfBytes": "32", + "value": "t_struct(AddressData)4999_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes32,t_struct(RoleData)9960_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct ParameterizedAccessControl.RoleData)", + "numberOfBytes": "32", + "value": "t_struct(RoleData)9960_storage" + }, + "t_mapping(t_uint256,t_bool)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint256,t_enum(TokenState)10653)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => enum IGatewayToken.TokenState)", + "numberOfBytes": "32", + "value": "t_enum(TokenState)10653" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_uint256,t_string_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_uint256,t_struct(RoleDomain)9966_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct ParameterizedAccessControl.RoleDomain)", + "numberOfBytes": "32", + "value": "t_struct(RoleDomain)9966_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(AddressData)4999_storage": { + "encoding": "inplace", + "label": "struct ERC3525Upgradeable.AddressData", + "members": [ + { + "astId": 4990, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "ownedTokens", + "offset": 0, + "slot": "0", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 4994, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "ownedTokensIndex", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 4998, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "approvals", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_bool)" + } + ], + "numberOfBytes": "96" + }, + "t_struct(Counter)1164_storage": { + "encoding": "inplace", + "label": "struct CountersUpgradeable.Counter", + "members": [ + { + "astId": 1163, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "_value", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_struct(RoleData)9960_storage": { + "encoding": "inplace", + "label": "struct ParameterizedAccessControl.RoleData", + "members": [ + { + "astId": 9957, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "members", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 9959, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "adminRole", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RoleDomain)9966_storage": { + "encoding": "inplace", + "label": "struct ParameterizedAccessControl.RoleDomain", + "members": [ + { + "astId": 9965, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "roles", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_struct(RoleData)9960_storage)" + } + ], + "numberOfBytes": "32" + }, + "t_struct(TokenData)4987_storage": { + "encoding": "inplace", + "label": "struct ERC3525Upgradeable.TokenData", + "members": [ + { + "astId": 4975, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "id", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 4977, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "slot", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 4979, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "balance", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 4981, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "owner", + "offset": 0, + "slot": "3", + "type": "t_address" + }, + { + "astId": 4983, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "approved", + "offset": 0, + "slot": "4", + "type": "t_address" + }, + { + "astId": 4986, + "contract": "contracts/GatewayToken.sol:GatewayToken", + "label": "valueApprovals", + "offset": 0, + "slot": "5", + "type": "t_array(t_address)dyn_storage" + } + ], + "numberOfBytes": "192" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/ethereum/smart-contract/deployments/polygonAmoy/GatewayTokenProxy.json b/ethereum/smart-contract/deployments/polygonAmoy/GatewayTokenProxy.json new file mode 100644 index 000000000..b09ce9dcf --- /dev/null +++ b/ethereum/smart-contract/deployments/polygonAmoy/GatewayTokenProxy.json @@ -0,0 +1,81 @@ +{ + "address": "0xF65b6396dF6B7e2D8a6270E3AB6c7BB08BAEF22E", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "args": [ + "0x65Bb8eb7c66c107e379C1C5781268393303E4b50", + "0x31416a2900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000074489ac99ae3ce1428ce8c8dbe374cffc009081e000000000000000000000000e25c6c4fcaec2010bae4b05d863be2a5a5db940f00000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000010476174657761792050726f746f636f6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000450415353000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "numDeployments": 1, + "bytecode": "0x60806040526040516107813803806107818339810160408190526100229161032b565b61004d60017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd6103f9565b60008051602061073a833981519152146100695761006961041e565b6100758282600061007c565b5050610483565b610085836100e6565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806100c65750805b156100e1576100df83836101a660201b6100291760201c565b505b505050565b6100f9816101d260201b6100551760201c565b6101605760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b8061018560008051602061073a83398151915260001b6101d860201b61005b1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b60606101cb838360405180606001604052806027815260200161075a602791396101db565b9392505050565b3b151590565b90565b6060833b61023a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610157565b600080856001600160a01b0316856040516102559190610434565b600060405180830381855af49150503d8060008114610290576040519150601f19603f3d011682016040523d82523d6000602084013e610295565b606091505b5090925090506102a68282866102b0565b9695505050505050565b606083156102bf5750816101cb565b8251156102cf5782518084602001fd5b8160405162461bcd60e51b81526004016101579190610450565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561031a578181015183820152602001610302565b838111156100df5750506000910152565b6000806040838503121561033e57600080fd5b82516001600160a01b038116811461035557600080fd5b60208401519092506001600160401b038082111561037257600080fd5b818501915085601f83011261038657600080fd5b815181811115610398576103986102e9565b604051601f8201601f19908116603f011681019083821181831017156103c0576103c06102e9565b816040528281528860208487010111156103d957600080fd5b6103ea8360208301602088016102ff565b80955050505050509250929050565b60008282101561041957634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b600082516104468184602087016102ff565b9190910192915050565b602081526000825180602084015261046f8160408501602087016102ff565b601f01601f19169190910160400192915050565b6102a8806104926000396000f3fe60806040523661001357610011610017565b005b6100115b61002761002261005e565b610096565b565b606061004e838360405180606001604052806027815260200161024c602791396100ba565b9392505050565b3b151590565b90565b60006100917f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100b5573d6000f35b3d6000fd5b6060833b61011e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b03168560405161013991906101fc565b600060405180830381855af49150503d8060008114610174576040519150601f19603f3d011682016040523d82523d6000602084013e610179565b606091505b5091509150610189828286610193565b9695505050505050565b606083156101a257508161004e565b8251156101b25782518084602001fd5b8160405162461bcd60e51b81526004016101159190610218565b60005b838110156101e75781810151838201526020016101cf565b838111156101f6576000848401525b50505050565b6000825161020e8184602087016101cc565b9190910192915050565b60208152600082518060208401526102378160408501602087016101cc565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122041f64d2ff908c9983923017ed36c949dd92697a1f359295e2ea2f809da86127664736f6c63430008090033360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040523661001357610011610017565b005b6100115b61002761002261005e565b610096565b565b606061004e838360405180606001604052806027815260200161024c602791396100ba565b9392505050565b3b151590565b90565b60006100917f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100b5573d6000f35b3d6000fd5b6060833b61011e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b03168560405161013991906101fc565b600060405180830381855af49150503d8060008114610174576040519150601f19603f3d011682016040523d82523d6000602084013e610179565b606091505b5091509150610189828286610193565b9695505050505050565b606083156101a257508161004e565b8251156101b25782518084602001fd5b8160405162461bcd60e51b81526004016101159190610218565b60005b838110156101e75781810151838201526020016101cf565b838111156101f6576000848401525b50505050565b6000825161020e8184602087016101cc565b9190910192915050565b60208152600082518060208401526102378160408501602087016101cc565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122041f64d2ff908c9983923017ed36c949dd92697a1f359295e2ea2f809da86127664736f6c63430008090033" +} \ No newline at end of file diff --git a/ethereum/smart-contract/deployments/polygonAmoy/solcInputs/4a6763d5d7b481587f46311ce6697e8c.json b/ethereum/smart-contract/deployments/polygonAmoy/solcInputs/4a6763d5d7b481587f46311ce6697e8c.json new file mode 100644 index 000000000..4cc5aabef --- /dev/null +++ b/ethereum/smart-contract/deployments/polygonAmoy/solcInputs/4a6763d5d7b481587f46311ce6697e8c.json @@ -0,0 +1,224 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.3) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.9._\n */\ninterface IERC1967Upgradeable {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.3) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/IERC1967Upgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@solvprotocol/erc-3525/ERC3525Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC3525Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./IERC3525ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721EnumerableUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"./extensions/IERC3525MetadataUpgradeable.sol\";\nimport \"./periphery/interface/IERC3525MetadataDescriptorUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\ncontract ERC3525Upgradeable is Initializable, ContextUpgradeable, IERC3525MetadataUpgradeable, IERC721EnumerableUpgradeable {\n using StringsUpgradeable for address;\n using StringsUpgradeable for uint256;\n using AddressUpgradeable for address;\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n event SetMetadataDescriptor(address indexed metadataDescriptor);\n\n struct TokenData {\n uint256 id;\n uint256 slot;\n uint256 balance;\n address owner;\n address approved;\n address[] valueApprovals;\n }\n\n struct AddressData {\n uint256[] ownedTokens;\n mapping(uint256 => uint256) ownedTokensIndex;\n mapping(address => bool) approvals;\n }\n\n string private _name;\n string private _symbol;\n uint8 private _decimals;\n CountersUpgradeable.Counter private _tokenIdGenerator;\n\n // id => (approval => allowance)\n // @dev _approvedValues cannot be defined within TokenData, cause struct containing mappings cannot be constructed.\n mapping(uint256 => mapping(address => uint256)) private _approvedValues;\n\n TokenData[] private _allTokens;\n\n // key: id\n mapping(uint256 => uint256) private _allTokensIndex;\n\n mapping(address => AddressData) private _addressData;\n\n IERC3525MetadataDescriptorUpgradeable public metadataDescriptor;\n\n function __ERC3525_init(string memory name_, string memory symbol_, uint8 decimals_) internal onlyInitializing {\n __ERC3525_init_unchained(name_, symbol_, decimals_);\n }\n\n function __ERC3525_init_unchained(string memory name_, string memory symbol_, uint8 decimals_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n _decimals = decimals_;\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return\n interfaceId == type(IERC165Upgradeable).interfaceId ||\n interfaceId == type(IERC3525Upgradeable).interfaceId ||\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC3525MetadataUpgradeable).interfaceId ||\n interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || \n interfaceId == type(IERC721MetadataUpgradeable).interfaceId;\n }\n\n /**\n * @dev Returns the token collection name.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals the token uses for value.\n */\n function valueDecimals() public view virtual override returns (uint8) {\n return _decimals;\n }\n\n function balanceOf(uint256 tokenId_) public view virtual override returns (uint256) {\n _requireMinted(tokenId_);\n return _allTokens[_allTokensIndex[tokenId_]].balance;\n }\n\n function ownerOf(uint256 tokenId_) public view virtual override returns (address owner_) {\n _requireMinted(tokenId_);\n owner_ = _allTokens[_allTokensIndex[tokenId_]].owner;\n require(owner_ != address(0), \"ERC3525: invalid token ID\");\n }\n\n function slotOf(uint256 tokenId_) public view virtual override returns (uint256) {\n _requireMinted(tokenId_);\n return _allTokens[_allTokensIndex[tokenId_]].slot;\n }\n\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n function contractURI() public view virtual override returns (string memory) {\n string memory baseURI = _baseURI();\n return \n address(metadataDescriptor) != address(0) ? \n metadataDescriptor.constructContractURI() :\n bytes(baseURI).length > 0 ? \n string(abi.encodePacked(baseURI, \"contract/\", StringsUpgradeable.toHexString(address(this)))) : \n \"\";\n }\n\n function slotURI(uint256 slot_) public view virtual override returns (string memory) {\n string memory baseURI = _baseURI();\n return \n address(metadataDescriptor) != address(0) ? \n metadataDescriptor.constructSlotURI(slot_) : \n bytes(baseURI).length > 0 ? \n string(abi.encodePacked(baseURI, \"slot/\", slot_.toString())) : \n \"\";\n }\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId_) public view virtual override returns (string memory) {\n _requireMinted(tokenId_);\n string memory baseURI = _baseURI();\n return \n address(metadataDescriptor) != address(0) ? \n metadataDescriptor.constructTokenURI(tokenId_) : \n bytes(baseURI).length > 0 ? \n string(abi.encodePacked(baseURI, tokenId_.toString())) : \n \"\";\n }\n\n function approve(uint256 tokenId_, address to_, uint256 value_) public payable virtual override {\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\n require(to_ != owner, \"ERC3525: approval to current owner\");\n\n require(_isApprovedOrOwner(_msgSender(), tokenId_), \"ERC3525: approve caller is not owner nor approved\");\n\n _approveValue(tokenId_, to_, value_);\n }\n\n function allowance(uint256 tokenId_, address operator_) public view virtual override returns (uint256) {\n _requireMinted(tokenId_);\n return _approvedValues[tokenId_][operator_];\n }\n\n function transferFrom(\n uint256 fromTokenId_,\n address to_,\n uint256 value_\n ) public payable virtual override returns (uint256 newTokenId) {\n _spendAllowance(_msgSender(), fromTokenId_, value_);\n\n newTokenId = _createDerivedTokenId(fromTokenId_);\n _mint(to_, newTokenId, ERC3525Upgradeable.slotOf(fromTokenId_), 0);\n _transferValue(fromTokenId_, newTokenId, value_);\n }\n\n function transferFrom(\n uint256 fromTokenId_,\n uint256 toTokenId_,\n uint256 value_\n ) public payable virtual override {\n _spendAllowance(_msgSender(), fromTokenId_, value_);\n _transferValue(fromTokenId_, toTokenId_, value_);\n }\n\n function balanceOf(address owner_) public view virtual override returns (uint256 balance) {\n require(owner_ != address(0), \"ERC3525: balance query for the zero address\");\n return _addressData[owner_].ownedTokens.length;\n }\n\n function transferFrom(\n address from_,\n address to_,\n uint256 tokenId_\n ) public payable virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId_), \"ERC3525: transfer caller is not owner nor approved\");\n _transferTokenId(from_, to_, tokenId_);\n }\n\n function safeTransferFrom(\n address from_,\n address to_,\n uint256 tokenId_,\n bytes memory data_\n ) public payable virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId_), \"ERC3525: transfer caller is not owner nor approved\");\n _safeTransferTokenId(from_, to_, tokenId_, data_);\n }\n\n function safeTransferFrom(\n address from_,\n address to_,\n uint256 tokenId_\n ) public payable virtual override {\n safeTransferFrom(from_, to_, tokenId_, \"\");\n }\n\n function approve(address to_, uint256 tokenId_) public payable virtual override {\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\n require(to_ != owner, \"ERC3525: approval to current owner\");\n\n require(\n _msgSender() == owner || ERC3525Upgradeable.isApprovedForAll(owner, _msgSender()),\n \"ERC3525: approve caller is not owner nor approved for all\"\n );\n\n _approve(to_, tokenId_);\n }\n\n function getApproved(uint256 tokenId_) public view virtual override returns (address) {\n _requireMinted(tokenId_);\n return _allTokens[_allTokensIndex[tokenId_]].approved;\n }\n\n function setApprovalForAll(address operator_, bool approved_) public virtual override {\n _setApprovalForAll(_msgSender(), operator_, approved_);\n }\n\n function isApprovedForAll(address owner_, address operator_) public view virtual override returns (bool) {\n return _addressData[owner_].approvals[operator_];\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n function tokenByIndex(uint256 index_) public view virtual override returns (uint256) {\n require(index_ < ERC3525Upgradeable.totalSupply(), \"ERC3525: global index out of bounds\");\n return _allTokens[index_].id;\n }\n\n function tokenOfOwnerByIndex(address owner_, uint256 index_) public view virtual override returns (uint256) {\n require(index_ < ERC3525Upgradeable.balanceOf(owner_), \"ERC3525: owner index out of bounds\");\n return _addressData[owner_].ownedTokens[index_];\n }\n\n function _setApprovalForAll(\n address owner_,\n address operator_,\n bool approved_\n ) internal virtual {\n require(owner_ != operator_, \"ERC3525: approve to caller\");\n\n _addressData[owner_].approvals[operator_] = approved_;\n\n emit ApprovalForAll(owner_, operator_, approved_);\n }\n\n function _isApprovedOrOwner(address operator_, uint256 tokenId_) internal view virtual returns (bool) {\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\n return (\n operator_ == owner ||\n ERC3525Upgradeable.isApprovedForAll(owner, operator_) ||\n ERC3525Upgradeable.getApproved(tokenId_) == operator_\n );\n }\n\n function _spendAllowance(address operator_, uint256 tokenId_, uint256 value_) internal virtual {\n uint256 currentAllowance = ERC3525Upgradeable.allowance(tokenId_, operator_);\n if (!_isApprovedOrOwner(operator_, tokenId_) && currentAllowance != type(uint256).max) {\n require(currentAllowance >= value_, \"ERC3525: insufficient allowance\");\n _approveValue(tokenId_, operator_, currentAllowance - value_);\n }\n }\n\n function _exists(uint256 tokenId_) internal view virtual returns (bool) {\n return _allTokens.length != 0 && _allTokens[_allTokensIndex[tokenId_]].id == tokenId_;\n }\n\n function _requireMinted(uint256 tokenId_) internal view virtual {\n require(_exists(tokenId_), \"ERC3525: invalid token ID\");\n }\n\n function _mint(address to_, uint256 slot_, uint256 value_) internal virtual returns (uint256 tokenId) {\n tokenId = _createOriginalTokenId();\n _mint(to_, tokenId, slot_, value_); \n }\n\n function _mint(address to_, uint256 tokenId_, uint256 slot_, uint256 value_) internal virtual {\n require(to_ != address(0), \"ERC3525: mint to the zero address\");\n require(tokenId_ != 0, \"ERC3525: cannot mint zero tokenId\");\n require(!_exists(tokenId_), \"ERC3525: token already minted\");\n\n _beforeValueTransfer(address(0), to_, 0, tokenId_, slot_, value_);\n __mintToken(to_, tokenId_, slot_);\n __mintValue(tokenId_, value_);\n _afterValueTransfer(address(0), to_, 0, tokenId_, slot_, value_);\n }\n\n function _mintValue(uint256 tokenId_, uint256 value_) internal virtual {\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\n uint256 slot = ERC3525Upgradeable.slotOf(tokenId_);\n _beforeValueTransfer(address(0), owner, 0, tokenId_, slot, value_);\n __mintValue(tokenId_, value_);\n _afterValueTransfer(address(0), owner, 0, tokenId_, slot, value_);\n }\n\n function __mintValue(uint256 tokenId_, uint256 value_) private {\n _allTokens[_allTokensIndex[tokenId_]].balance += value_;\n emit TransferValue(0, tokenId_, value_);\n }\n\n function __mintToken(address to_, uint256 tokenId_, uint256 slot_) private {\n TokenData memory tokenData = TokenData({\n id: tokenId_,\n slot: slot_,\n balance: 0,\n owner: to_,\n approved: address(0),\n valueApprovals: new address[](0)\n });\n\n _addTokenToAllTokensEnumeration(tokenData);\n _addTokenToOwnerEnumeration(to_, tokenId_);\n\n emit Transfer(address(0), to_, tokenId_);\n emit SlotChanged(tokenId_, 0, slot_);\n }\n\n function _burn(uint256 tokenId_) internal virtual {\n _requireMinted(tokenId_);\n\n TokenData storage tokenData = _allTokens[_allTokensIndex[tokenId_]];\n address owner = tokenData.owner;\n uint256 slot = tokenData.slot;\n uint256 value = tokenData.balance;\n\n _beforeValueTransfer(owner, address(0), tokenId_, 0, slot, value);\n\n _clearApprovedValues(tokenId_);\n _removeTokenFromOwnerEnumeration(owner, tokenId_);\n _removeTokenFromAllTokensEnumeration(tokenId_);\n\n emit TransferValue(tokenId_, 0, value);\n emit SlotChanged(tokenId_, slot, 0);\n emit Transfer(owner, address(0), tokenId_);\n\n _afterValueTransfer(owner, address(0), tokenId_, 0, slot, value);\n }\n\n function _burnValue(uint256 tokenId_, uint256 burnValue_) internal virtual {\n _requireMinted(tokenId_);\n\n TokenData storage tokenData = _allTokens[_allTokensIndex[tokenId_]];\n address owner = tokenData.owner;\n uint256 slot = tokenData.slot;\n uint256 value = tokenData.balance;\n\n require(value >= burnValue_, \"ERC3525: burn value exceeds balance\");\n\n _beforeValueTransfer(owner, address(0), tokenId_, 0, slot, burnValue_);\n \n tokenData.balance -= burnValue_;\n emit TransferValue(tokenId_, 0, burnValue_);\n \n _afterValueTransfer(owner, address(0), tokenId_, 0, slot, burnValue_);\n }\n\n function _addTokenToOwnerEnumeration(address to_, uint256 tokenId_) private {\n _allTokens[_allTokensIndex[tokenId_]].owner = to_;\n\n _addressData[to_].ownedTokensIndex[tokenId_] = _addressData[to_].ownedTokens.length;\n _addressData[to_].ownedTokens.push(tokenId_);\n }\n\n function _removeTokenFromOwnerEnumeration(address from_, uint256 tokenId_) private {\n _allTokens[_allTokensIndex[tokenId_]].owner = address(0);\n\n AddressData storage ownerData = _addressData[from_];\n uint256 lastTokenIndex = ownerData.ownedTokens.length - 1;\n uint256 lastTokenId = ownerData.ownedTokens[lastTokenIndex];\n uint256 tokenIndex = ownerData.ownedTokensIndex[tokenId_];\n\n ownerData.ownedTokens[tokenIndex] = lastTokenId;\n ownerData.ownedTokensIndex[lastTokenId] = tokenIndex;\n\n delete ownerData.ownedTokensIndex[tokenId_];\n ownerData.ownedTokens.pop();\n }\n\n function _addTokenToAllTokensEnumeration(TokenData memory tokenData_) private {\n _allTokensIndex[tokenData_.id] = _allTokens.length;\n _allTokens.push(tokenData_);\n }\n\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId_) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId_];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n TokenData memory lastTokenData = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenData; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenData.id] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId_];\n _allTokens.pop();\n }\n\n function _approve(address to_, uint256 tokenId_) internal virtual {\n _allTokens[_allTokensIndex[tokenId_]].approved = to_;\n emit Approval(ERC3525Upgradeable.ownerOf(tokenId_), to_, tokenId_);\n }\n\n function _approveValue(\n uint256 tokenId_,\n address to_,\n uint256 value_\n ) internal virtual {\n require(to_ != address(0), \"ERC3525: approve value to the zero address\");\n if (!_existApproveValue(to_, tokenId_)) {\n _allTokens[_allTokensIndex[tokenId_]].valueApprovals.push(to_);\n }\n _approvedValues[tokenId_][to_] = value_;\n\n emit ApprovalValue(tokenId_, to_, value_);\n }\n\n function _clearApprovedValues(uint256 tokenId_) internal virtual {\n TokenData storage tokenData = _allTokens[_allTokensIndex[tokenId_]];\n uint256 length = tokenData.valueApprovals.length;\n for (uint256 i = 0; i < length; i++) {\n address approval = tokenData.valueApprovals[i];\n delete _approvedValues[tokenId_][approval];\n }\n delete tokenData.valueApprovals;\n }\n\n function _existApproveValue(address to_, uint256 tokenId_) internal view virtual returns (bool) {\n uint256 length = _allTokens[_allTokensIndex[tokenId_]].valueApprovals.length;\n for (uint256 i = 0; i < length; i++) {\n if (_allTokens[_allTokensIndex[tokenId_]].valueApprovals[i] == to_) {\n return true;\n }\n }\n return false;\n }\n\n function _transferValue(\n uint256 fromTokenId_,\n uint256 toTokenId_,\n uint256 value_\n ) internal virtual {\n require(_exists(fromTokenId_), \"ERC3525: transfer from invalid token ID\");\n require(_exists(toTokenId_), \"ERC3525: transfer to invalid token ID\");\n\n TokenData storage fromTokenData = _allTokens[_allTokensIndex[fromTokenId_]];\n TokenData storage toTokenData = _allTokens[_allTokensIndex[toTokenId_]];\n\n require(fromTokenData.balance >= value_, \"ERC3525: insufficient balance for transfer\");\n require(fromTokenData.slot == toTokenData.slot, \"ERC3525: transfer to token with different slot\");\n\n _beforeValueTransfer(\n fromTokenData.owner,\n toTokenData.owner,\n fromTokenId_,\n toTokenId_,\n fromTokenData.slot,\n value_\n );\n\n fromTokenData.balance -= value_;\n toTokenData.balance += value_;\n\n emit TransferValue(fromTokenId_, toTokenId_, value_);\n\n _afterValueTransfer(\n fromTokenData.owner,\n toTokenData.owner,\n fromTokenId_,\n toTokenId_,\n fromTokenData.slot,\n value_\n );\n\n require(\n _checkOnERC3525Received(fromTokenId_, toTokenId_, value_, \"\"),\n \"ERC3525: transfer rejected by ERC3525Receiver\"\n );\n }\n\n function _transferTokenId(\n address from_,\n address to_,\n uint256 tokenId_\n ) internal virtual {\n require(ERC3525Upgradeable.ownerOf(tokenId_) == from_, \"ERC3525: transfer from invalid owner\");\n require(to_ != address(0), \"ERC3525: transfer to the zero address\");\n\n uint256 slot = ERC3525Upgradeable.slotOf(tokenId_);\n uint256 value = ERC3525Upgradeable.balanceOf(tokenId_);\n\n _beforeValueTransfer(from_, to_, tokenId_, tokenId_, slot, value);\n\n _approve(address(0), tokenId_);\n _clearApprovedValues(tokenId_);\n\n _removeTokenFromOwnerEnumeration(from_, tokenId_);\n _addTokenToOwnerEnumeration(to_, tokenId_);\n\n emit Transfer(from_, to_, tokenId_);\n\n _afterValueTransfer(from_, to_, tokenId_, tokenId_, slot, value);\n }\n\n function _safeTransferTokenId(\n address from_,\n address to_,\n uint256 tokenId_,\n bytes memory data_\n ) internal virtual {\n _transferTokenId(from_, to_, tokenId_);\n require(\n _checkOnERC721Received(from_, to_, tokenId_, data_),\n \"ERC3525: transfer to non ERC721Receiver\"\n );\n }\n\n function _checkOnERC3525Received( \n uint256 fromTokenId_, \n uint256 toTokenId_, \n uint256 value_, \n bytes memory data_\n ) private returns (bool) {\n address to = ERC3525Upgradeable.ownerOf(toTokenId_);\n if (to.isContract() && IERC165Upgradeable(to).supportsInterface(type(IERC3525ReceiverUpgradeable).interfaceId)) {\n bytes4 retval = IERC3525ReceiverUpgradeable(to).onERC3525Received(_msgSender(), fromTokenId_, toTokenId_, value_, data_);\n return retval == IERC3525ReceiverUpgradeable.onERC3525Received.selector;\n } else {\n return true;\n }\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from_ address representing the previous owner of the given token ID\n * @param to_ target address that will receive the tokens\n * @param tokenId_ uint256 ID of the token to be transferred\n * @param data_ bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from_,\n address to_,\n uint256 tokenId_,\n bytes memory data_\n ) private returns (bool) {\n if (to_.isContract()) {\n try \n IERC721ReceiverUpgradeable(to_).onERC721Received(_msgSender(), from_, tokenId_, data_) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /* solhint-disable */\n function _beforeValueTransfer(\n address from_,\n address to_,\n uint256 fromTokenId_,\n uint256 toTokenId_,\n uint256 slot_,\n uint256 value_\n ) internal virtual {}\n\n function _afterValueTransfer(\n address from_,\n address to_,\n uint256 fromTokenId_,\n uint256 toTokenId_,\n uint256 slot_,\n uint256 value_\n ) internal virtual {}\n /* solhint-enable */\n\n function _setMetadataDescriptor(address metadataDescriptor_) internal virtual {\n metadataDescriptor = IERC3525MetadataDescriptorUpgradeable(metadataDescriptor_);\n emit SetMetadataDescriptor(metadataDescriptor_);\n }\n\n function _createOriginalTokenId() internal virtual returns (uint256) {\n _tokenIdGenerator.increment();\n return _tokenIdGenerator.current();\n }\n\n function _createDerivedTokenId(uint256 fromTokenId_) internal virtual returns (uint256) {\n fromTokenId_;\n return _createOriginalTokenId();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[41] private __gap;\n}\n" + }, + "@solvprotocol/erc-3525/extensions/IERC3525MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\nimport \"../IERC3525Upgradeable.sol\";\nimport \"./IERC721MetadataUpgradeable.sol\";\n\n/**\n * @title ERC-3525 Semi-Fungible Token Standard, optional extension for metadata\n * @dev Interfaces for any contract that wants to support query of the Uniform Resource Identifier\n * (URI) for the ERC3525 contract as well as a specified slot.\n * Because of the higher reliability of data stored in smart contracts compared to data stored in\n * centralized systems, it is recommended that metadata, including `contractURI`, `slotURI` and\n * `tokenURI`, be directly returned in JSON format, instead of being returned with a url pointing\n * to any resource stored in a centralized system.\n * See https://eips.ethereum.org/EIPS/eip-3525\n * Note: the ERC-165 identifier for this interface is 0xe1600902.\n */\ninterface IERC3525MetadataUpgradeable is IERC3525Upgradeable, IERC721MetadataUpgradeable {\n /**\n * @notice Returns the Uniform Resource Identifier (URI) for the current ERC3525 contract.\n * @dev This function SHOULD return the URI for this contract in JSON format, starting with\n * header `data:application/json;`.\n * See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for contract URI.\n * @return The JSON formatted URI of the current ERC3525 contract\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the Uniform Resource Identifier (URI) for the specified slot.\n * @dev This function SHOULD return the URI for `_slot` in JSON format, starting with header\n * `data:application/json;`.\n * See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for slot URI.\n * @return The JSON formatted URI of `_slot`\n */\n function slotURI(uint256 _slot) external view returns (string memory);\n}\n" + }, + "@solvprotocol/erc-3525/extensions/IERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n * Note: the ERC-165 identifier for this interface is 0x780e9d63.\n */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /** \n * @notice Count NFTs tracked by this contract\n * @return A count of valid NFTs tracked by this contract, where each one of\n * them has an assigned and queryable owner not equal to the zero address\n */\n function totalSupply() external view returns (uint256);\n\n /** \n * @notice Enumerate valid NFTs\n * @dev Throws if `_index` >= `totalSupply()`.\n * @param _index A counter less than `totalSupply()`\n * @return The token identifier for the `_index`th NFT,\n * (sort order not specified)\n */\n function tokenByIndex(uint256 _index) external view returns (uint256);\n\n /** \n * @notice Enumerate NFTs assigned to an owner\n * @dev Throws if `_index` >= `balanceOf(_owner)` or if\n * `_owner` is the zero address, representing invalid NFTs.\n * @param _owner An address where we are interested in NFTs owned by them\n * @param _index A counter less than `balanceOf(_owner)`\n * @return The token identifier for the `_index`th NFT assigned to `_owner`,\n * (sort order not specified)\n */\n function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);\n}\n" + }, + "@solvprotocol/erc-3525/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n * Note: the ERC-165 identifier for this interface is 0x5b5e139f.\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @notice A descriptive name for a collection of NFTs in this contract\n */\n function name() external view returns (string memory);\n\n /**\n * @notice An abbreviated name for NFTs in this contract\n */\n function symbol() external view returns (string memory);\n\n /**\n * @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n * @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC\n * 3986. The URI may point to a JSON file that conforms to the \"ERC721\n * Metadata JSON Schema\".\n */\n function tokenURI(uint256 _tokenId) external view returns (string memory);\n}\n" + }, + "@solvprotocol/erc-3525/IERC3525.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./IERC721.sol\";\n\n/**\n * @title ERC-3525 Semi-Fungible Token Standard\n * @dev See https://eips.ethereum.org/EIPS/eip-3525\n * Note: the ERC-165 identifier for this interface is 0xd5358140.\n */\ninterface IERC3525 is IERC165, IERC721 {\n /**\n * @dev MUST emit when value of a token is transferred to another token with the same slot,\n * including zero value transfers (_value == 0) as well as transfers when tokens are created\n * (`_fromTokenId` == 0) or destroyed (`_toTokenId` == 0).\n * @param _fromTokenId The token id to transfer value from\n * @param _toTokenId The token id to transfer value to\n * @param _value The transferred value\n */\n event TransferValue(uint256 indexed _fromTokenId, uint256 indexed _toTokenId, uint256 _value);\n\n /**\n * @dev MUST emits when the approval value of a token is set or changed.\n * @param _tokenId The token to approve\n * @param _operator The operator to approve for\n * @param _value The maximum value that `_operator` is allowed to manage\n */\n event ApprovalValue(uint256 indexed _tokenId, address indexed _operator, uint256 _value);\n\n /**\n * @dev MUST emit when the slot of a token is set or changed.\n * @param _tokenId The token of which slot is set or changed\n * @param _oldSlot The previous slot of the token\n * @param _newSlot The updated slot of the token\n */ \n event SlotChanged(uint256 indexed _tokenId, uint256 indexed _oldSlot, uint256 indexed _newSlot);\n\n /**\n * @notice Get the number of decimals the token uses for value - e.g. 6, means the user\n * representation of the value of a token can be calculated by dividing it by 1,000,000.\n * Considering the compatibility with third-party wallets, this function is defined as\n * `valueDecimals()` instead of `decimals()` to avoid conflict with ERC20 tokens.\n * @return The number of decimals for value\n */\n function valueDecimals() external view returns (uint8);\n\n /**\n * @notice Get the value of a token.\n * @param _tokenId The token for which to query the balance\n * @return The value of `_tokenId`\n */\n function balanceOf(uint256 _tokenId) external view returns (uint256);\n\n /**\n * @notice Get the slot of a token.\n * @param _tokenId The identifier for a token\n * @return The slot of the token\n */\n function slotOf(uint256 _tokenId) external view returns (uint256);\n\n /**\n * @notice Allow an operator to manage the value of a token, up to the `_value` amount.\n * @dev MUST revert unless caller is the current owner, an authorized operator, or the approved\n * address for `_tokenId`.\n * MUST emit ApprovalValue event.\n * @param _tokenId The token to approve\n * @param _operator The operator to be approved\n * @param _value The maximum value of `_toTokenId` that `_operator` is allowed to manage\n */\n function approve(\n uint256 _tokenId,\n address _operator,\n uint256 _value\n ) external payable;\n\n /**\n * @notice Get the maximum value of a token that an operator is allowed to manage.\n * @param _tokenId The token for which to query the allowance\n * @param _operator The address of an operator\n * @return The current approval value of `_tokenId` that `_operator` is allowed to manage\n */\n function allowance(uint256 _tokenId, address _operator) external view returns (uint256);\n\n /**\n * @notice Transfer value from a specified token to another specified token with the same slot.\n * @dev Caller MUST be the current owner, an authorized operator or an operator who has been\n * approved the whole `_fromTokenId` or part of it.\n * MUST revert if `_fromTokenId` or `_toTokenId` is zero token id or does not exist.\n * MUST revert if slots of `_fromTokenId` and `_toTokenId` do not match.\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\n * operator.\n * MUST emit `TransferValue` event.\n * @param _fromTokenId The token to transfer value from\n * @param _toTokenId The token to transfer value to\n * @param _value The transferred value\n */\n function transferFrom(\n uint256 _fromTokenId,\n uint256 _toTokenId,\n uint256 _value\n ) external payable;\n\n /**\n * @notice Transfer value from a specified token to an address. The caller should confirm that\n * `_to` is capable of receiving ERC3525 tokens.\n * @dev This function MUST create a new ERC3525 token with the same slot for `_to` to receive\n * the transferred value.\n * MUST revert if `_fromTokenId` is zero token id or does not exist.\n * MUST revert if `_to` is zero address.\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\n * operator.\n * MUST emit `Transfer` and `TransferValue` events.\n * @param _fromTokenId The token to transfer value from\n * @param _to The address to transfer value to\n * @param _value The transferred value\n * @return ID of the new token created for `_to` which receives the transferred value\n */\n function transferFrom(\n uint256 _fromTokenId,\n address _to,\n uint256 _value\n ) external payable returns (uint256);\n}\n" + }, + "@solvprotocol/erc-3525/IERC3525ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\n/**\n * @title EIP-3525 token receiver interface\n * @dev Interface for a smart contract that wants to be informed by EIP-3525 contracts when \n * receiving values from ANY addresses or EIP-3525 tokens.\n * Note: the EIP-165 identifier for this interface is 0x009ce20b.\n */\ninterface IERC3525ReceiverUpgradeable {\n /**\n * @notice Handle the receipt of an EIP-3525 token value.\n * @dev An EIP-3525 smart contract MUST check whether this function is implemented by the \n * recipient contract, if the recipient contract implements this function, the EIP-3525 \n * contract MUST call this function after a value transfer (i.e. `transferFrom(uint256,\n * uint256,uint256,bytes)`).\n * MUST return 0x009ce20b (i.e. `bytes4(keccak256('onERC3525Received(address,uint256,uint256,\n * uint256,bytes)'))`) if the transfer is accepted.\n * MUST revert or return any value other than 0x009ce20b if the transfer is rejected.\n * @param _operator The address which triggered the transfer\n * @param _fromTokenId The token id to transfer value from\n * @param _toTokenId The token id to transfer value to\n * @param _value The transferred value\n * @param _data Additional data with no specified format\n * @return `bytes4(keccak256('onERC3525Received(address,uint256,uint256,uint256,bytes)'))` \n * unless the transfer is rejected.\n */\n function onERC3525Received(address _operator, uint256 _fromTokenId, uint256 _toTokenId, uint256 _value, bytes calldata _data) external returns (bytes4);\n\n}" + }, + "@solvprotocol/erc-3525/IERC3525Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\nimport \"./IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-3525 Semi-Fungible Token Standard\n * @dev See https://eips.ethereum.org/EIPS/eip-3525\n * Note: the ERC-165 identifier for this interface is 0xd5358140.\n */\ninterface IERC3525Upgradeable is IERC165Upgradeable, IERC721Upgradeable {\n /**\n * @dev MUST emit when value of a token is transferred to another token with the same slot,\n * including zero value transfers (_value == 0) as well as transfers when tokens are created\n * (`_fromTokenId` == 0) or destroyed (`_toTokenId` == 0).\n * @param _fromTokenId The token id to transfer value from\n * @param _toTokenId The token id to transfer value to\n * @param _value The transferred value\n */\n event TransferValue(uint256 indexed _fromTokenId, uint256 indexed _toTokenId, uint256 _value);\n\n /**\n * @dev MUST emits when the approval value of a token is set or changed.\n * @param _tokenId The token to approve\n * @param _operator The operator to approve for\n * @param _value The maximum value that `_operator` is allowed to manage\n */\n event ApprovalValue(uint256 indexed _tokenId, address indexed _operator, uint256 _value);\n\n /**\n * @dev MUST emit when the slot of a token is set or changed.\n * @param _tokenId The token of which slot is set or changed\n * @param _oldSlot The previous slot of the token\n * @param _newSlot The updated slot of the token\n */ \n event SlotChanged(uint256 indexed _tokenId, uint256 indexed _oldSlot, uint256 indexed _newSlot);\n\n /**\n * @notice Get the number of decimals the token uses for value - e.g. 6, means the user\n * representation of the value of a token can be calculated by dividing it by 1,000,000.\n * Considering the compatibility with third-party wallets, this function is defined as\n * `valueDecimals()` instead of `decimals()` to avoid conflict with ERC20 tokens.\n * @return The number of decimals for value\n */\n function valueDecimals() external view returns (uint8);\n\n /**\n * @notice Get the value of a token.\n * @param _tokenId The token for which to query the balance\n * @return The value of `_tokenId`\n */\n function balanceOf(uint256 _tokenId) external view returns (uint256);\n\n /**\n * @notice Get the slot of a token.\n * @param _tokenId The identifier for a token\n * @return The slot of the token\n */\n function slotOf(uint256 _tokenId) external view returns (uint256);\n\n /**\n * @notice Allow an operator to manage the value of a token, up to the `_value` amount.\n * @dev MUST revert unless caller is the current owner, an authorized operator, or the approved\n * address for `_tokenId`.\n * MUST emit ApprovalValue event.\n * @param _tokenId The token to approve\n * @param _operator The operator to be approved\n * @param _value The maximum value of `_toTokenId` that `_operator` is allowed to manage\n */\n function approve(\n uint256 _tokenId,\n address _operator,\n uint256 _value\n ) external payable;\n\n /**\n * @notice Get the maximum value of a token that an operator is allowed to manage.\n * @param _tokenId The token for which to query the allowance\n * @param _operator The address of an operator\n * @return The current approval value of `_tokenId` that `_operator` is allowed to manage\n */\n function allowance(uint256 _tokenId, address _operator) external view returns (uint256);\n\n /**\n * @notice Transfer value from a specified token to another specified token with the same slot.\n * @dev Caller MUST be the current owner, an authorized operator or an operator who has been\n * approved the whole `_fromTokenId` or part of it.\n * MUST revert if `_fromTokenId` or `_toTokenId` is zero token id or does not exist.\n * MUST revert if slots of `_fromTokenId` and `_toTokenId` do not match.\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\n * operator.\n * MUST emit `TransferValue` event.\n * @param _fromTokenId The token to transfer value from\n * @param _toTokenId The token to transfer value to\n * @param _value The transferred value\n */\n function transferFrom(\n uint256 _fromTokenId,\n uint256 _toTokenId,\n uint256 _value\n ) external payable;\n\n /**\n * @notice Transfer value from a specified token to an address. The caller should confirm that\n * `_to` is capable of receiving ERC3525 tokens.\n * @dev This function MUST create a new ERC3525 token with the same slot for `_to` to receive\n * the transferred value.\n * MUST revert if `_fromTokenId` is zero token id or does not exist.\n * MUST revert if `_to` is zero address.\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\n * operator.\n * MUST emit `Transfer` and `TransferValue` events.\n * @param _fromTokenId The token to transfer value from\n * @param _to The address to transfer value to\n * @param _value The transferred value\n * @return ID of the new token created for `_to` which receives the transferred value\n */\n function transferFrom(\n uint256 _fromTokenId,\n address _to,\n uint256 _value\n ) external payable returns (uint256);\n}\n" + }, + "@solvprotocol/erc-3525/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/** \n * @title ERC-721 Non-Fungible Token Standard\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n * Note: the ERC-165 identifier for this interface is 0x80ac58cd.\n */\ninterface IERC721 is IERC165 {\n /** \n * @dev This emits when ownership of any NFT changes by any mechanism.\n * This event emits when NFTs are created (`from` == 0) and destroyed\n * (`to` == 0). Exception: during contract creation, any number of NFTs\n * may be created and assigned without emitting Transfer. At the time of\n * any transfer, the approved address for that NFT (if any) is reset to none.\n */\n event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);\n\n /**\n * @dev This emits when the approved address for an NFT is changed or\n * reaffirmed. The zero address indicates there is no approved address.\n * When a Transfer event emits, this also indicates that the approved\n * address for that NFT (if any) is reset to none.\n */\n event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);\n\n /**\n * @dev This emits when an operator is enabled or disabled for an owner.\n * The operator can manage all NFTs of the owner.\n */\n event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);\n\n /**\n * @notice Count all NFTs assigned to an owner\n * @dev NFTs assigned to the zero address are considered invalid, and this\n * function throws for queries about the zero address.\n * @param _owner An address for whom to query the balance\n * @return The number of NFTs owned by `_owner`, possibly zero\n */\n function balanceOf(address _owner) external view returns (uint256);\n\n /**\n * @notice Find the owner of an NFT\n * @dev NFTs assigned to zero address are considered invalid, and queries\n * about them do throw.\n * @param _tokenId The identifier for an NFT\n * @return The address of the owner of the NFT\n */\n function ownerOf(uint256 _tokenId) external view returns (address);\n\n /**\n * @notice Transfers the ownership of an NFT from one address to another address\n * @dev Throws unless `msg.sender` is the current owner, an authorized\n * operator, or the approved address for this NFT. Throws if `_from` is\n * not the current owner. Throws if `_to` is the zero address. Throws if\n * `_tokenId` is not a valid NFT. When transfer is complete, this function\n * checks if `_to` is a smart contract (code size > 0). If so, it calls\n * `onERC721Received` on `_to` and throws if the return value is not\n * `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes calldata data) external payable;\n\n /**\n * @notice Transfers the ownership of an NFT from one address to another address\n * @dev This works identically to the other function with an extra data parameter,\n * except this function just sets data to \"\".\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n */\n function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;\n\n /**\n * @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n * TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n * THEY MAY BE PERMANENTLY LOST\n * @dev Throws unless `msg.sender` is the current owner, an authorized\n * operator, or the approved address for this NFT. Throws if `_from` is\n * not the current owner. Throws if `_to` is the zero address. Throws if\n * `_tokenId` is not a valid NFT.\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n */\n function transferFrom(address _from, address _to, uint256 _tokenId) external payable;\n\n /**\n * @notice Change or reaffirm the approved address for an NFT\n * @dev The zero address indicates there is no approved address.\n * Throws unless `msg.sender` is the current NFT owner, or an authorized\n * operator of the current owner.\n * @param _approved The new approved NFT controller\n * @param _tokenId The NFT to approve\n */\n function approve(address _approved, uint256 _tokenId) external payable;\n\n /**\n * @notice Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s assets\n * @dev Emits the ApprovalForAll event. The contract MUST allow\n * multiple operators per owner.\n * @param _operator Address to add to the set of authorized operators\n * @param _approved True if the operator is approved, false to revoke approval\n */\n function setApprovalForAll(address _operator, bool _approved) external;\n\n /**\n * @notice Get the approved address for a single NFT\n * @dev Throws if `_tokenId` is not a valid NFT.\n * @param _tokenId The NFT to find the approved address for\n * @return The approved address for this NFT, or the zero address if there is none\n */\n function getApproved(uint256 _tokenId) external view returns (address);\n\n /**\n * @notice Query if an address is an authorized operator for another address\n * @param _owner The address that owns the NFTs\n * @param _operator The address that acts on behalf of the owner\n * @return True if `_operator` is an approved operator for `_owner`, false otherwise\n */\n function isApprovedForAll(address _owner, address _operator) external view returns (bool);\n}\n" + }, + "@solvprotocol/erc-3525/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers from ERC721 asset contracts.\n * Note: the ERC-165 identifier for this interface is 0x150b7a02.\n */\ninterface IERC721ReceiverUpgradeable {\n /** \n * @notice Handle the receipt of an NFT\n * @dev The ERC721 smart contract calls this function on the recipient\n * after a `transfer`. This function MAY throw to revert and reject the\n * transfer. Return of other than the magic value MUST result in the\n * transaction being reverted.\n * Note: the contract address is always the message sender.\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address which previously owned the token\n * @param _tokenId The NFT identifier which is being transferred\n * @param _data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n * unless throwing\n */\n function onERC721Received(\n address _operator, \n address _from, \n uint256 _tokenId, \n bytes calldata _data\n ) external returns(bytes4);\n}\n" + }, + "@solvprotocol/erc-3525/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\n/** \n * @title ERC-721 Non-Fungible Token Standard\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n * Note: the ERC-165 identifier for this interface is 0x80ac58cd.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /** \n * @dev This emits when ownership of any NFT changes by any mechanism.\n * This event emits when NFTs are created (`from` == 0) and destroyed\n * (`to` == 0). Exception: during contract creation, any number of NFTs\n * may be created and assigned without emitting Transfer. At the time of\n * any transfer, the approved address for that NFT (if any) is reset to none.\n */\n event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);\n\n /**\n * @dev This emits when the approved address for an NFT is changed or\n * reaffirmed. The zero address indicates there is no approved address.\n * When a Transfer event emits, this also indicates that the approved\n * address for that NFT (if any) is reset to none.\n */\n event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);\n\n /**\n * @dev This emits when an operator is enabled or disabled for an owner.\n * The operator can manage all NFTs of the owner.\n */\n event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);\n\n /**\n * @notice Count all NFTs assigned to an owner\n * @dev NFTs assigned to the zero address are considered invalid, and this\n * function throws for queries about the zero address.\n * @param _owner An address for whom to query the balance\n * @return The number of NFTs owned by `_owner`, possibly zero\n */\n function balanceOf(address _owner) external view returns (uint256);\n\n /**\n * @notice Find the owner of an NFT\n * @dev NFTs assigned to zero address are considered invalid, and queries\n * about them do throw.\n * @param _tokenId The identifier for an NFT\n * @return The address of the owner of the NFT\n */\n function ownerOf(uint256 _tokenId) external view returns (address);\n\n /**\n * @notice Transfers the ownership of an NFT from one address to another address\n * @dev Throws unless `msg.sender` is the current owner, an authorized\n * operator, or the approved address for this NFT. Throws if `_from` is\n * not the current owner. Throws if `_to` is the zero address. Throws if\n * `_tokenId` is not a valid NFT. When transfer is complete, this function\n * checks if `_to` is a smart contract (code size > 0). If so, it calls\n * `onERC721Received` on `_to` and throws if the return value is not\n * `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes calldata data) external payable;\n\n /**\n * @notice Transfers the ownership of an NFT from one address to another address\n * @dev This works identically to the other function with an extra data parameter,\n * except this function just sets data to \"\".\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n */\n function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;\n\n /**\n * @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n * TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n * THEY MAY BE PERMANENTLY LOST\n * @dev Throws unless `msg.sender` is the current owner, an authorized\n * operator, or the approved address for this NFT. Throws if `_from` is\n * not the current owner. Throws if `_to` is the zero address. Throws if\n * `_tokenId` is not a valid NFT.\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n */\n function transferFrom(address _from, address _to, uint256 _tokenId) external payable;\n\n /**\n * @notice Change or reaffirm the approved address for an NFT\n * @dev The zero address indicates there is no approved address.\n * Throws unless `msg.sender` is the current NFT owner, or an authorized\n * operator of the current owner.\n * @param _approved The new approved NFT controller\n * @param _tokenId The NFT to approve\n */\n function approve(address _approved, uint256 _tokenId) external payable;\n\n /**\n * @notice Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s assets\n * @dev Emits the ApprovalForAll event. The contract MUST allow\n * multiple operators per owner.\n * @param _operator Address to add to the set of authorized operators\n * @param _approved True if the operator is approved, false to revoke approval\n */\n function setApprovalForAll(address _operator, bool _approved) external;\n\n /**\n * @notice Get the approved address for a single NFT\n * @dev Throws if `_tokenId` is not a valid NFT.\n * @param _tokenId The NFT to find the approved address for\n * @return The approved address for this NFT, or the zero address if there is none\n */\n function getApproved(uint256 _tokenId) external view returns (address);\n\n /**\n * @notice Query if an address is an authorized operator for another address\n * @param _owner The address that owns the NFTs\n * @param _operator The address that acts on behalf of the owner\n * @return True if `_operator` is an approved operator for `_owner`, false otherwise\n */\n function isApprovedForAll(address _owner, address _operator) external view returns (bool);\n}\n" + }, + "@solvprotocol/erc-3525/periphery/interface/IERC3525MetadataDescriptorUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC3525MetadataDescriptorUpgradeable {\n\n function constructContractURI() external view returns (string memory);\n\n function constructSlotURI(uint256 slot) external view returns (string memory);\n \n function constructTokenURI(uint256 tokenId) external view returns (string memory);\n\n}" + }, + "contracts/ChargeHandler.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19; // Fixed version for concrete contracts\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {AccessControlUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {Charge, ChargeType} from \"./library/Charge.sol\";\nimport {InternalTokenApproval} from \"./library/InternalTokenApproval.sol\";\nimport {IChargeHandler} from \"./interfaces/IChargeHandler.sol\";\nimport {Common__MissingAccount} from \"./library/CommonErrors.sol\";\n\n/**\n * @dev The ChargeHandler contract is an internal library used by the Gatekeeper\n * to handle charges made to the gatekeeper on gateway token issuance or refresh.\n *\n * The charge functionality operates in conjunction with the forwarder to allow a transaction to be\n * a) signed by a gatekeeper, but\n * b) sent from a gateway token recipient\n * This is necessary for the ETH charge type, as the charge payer must sign the transaction. For ERC20\n * transactions, it is sufficient for the charge payer to sign an approval transaction beforehand.\n *\n * Note: The sender address of the charge can differ between the ETH and ERC20 charge types.\n * ETH: The funds are sent via the \"value\" property of an eth transaction, and are forwarded on to the\n * recipient address.\n * ERC20: The sender address is specified as `tokenSender` in the Charge object. This will typically be,\n * the gateway token recipient, but it can be any address. Setting this value explicitly is necessary, as\n * it cannot be reliably derived from within the GatewayToken contract. Options would be:\n * _msgSender() (ERC2771) - This is the inner transaction sender - the gatekeeper\n * msg.sender - This is the forwarder contract\n * tx.origin - This is the EOA (Externally Owned Account) that signed the outer transaction. While this is\n * typically the gateway token recipient, using tx.origin precludes the use of smart contract wallets, as well as\n * being discouraged for other security reasons.\n */\ncontract ChargeHandler is\n Initializable,\n UUPSUpgradeable,\n AccessControlUpgradeable,\n IChargeHandler,\n InternalTokenApproval\n{\n using SafeERC20 for IERC20;\n bytes32 public constant CHARGE_CALLER_ROLE = keccak256(\"CHARGE_CALLER_ROLE\");\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n // empty constructor in line with the UUPS upgradeable proxy pattern\n // solhint-disable-next-line no-empty-blocks\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address owner) external initializer {\n if (owner == address(0)) revert Common__MissingAccount();\n\n __AccessControl_init();\n __UUPSUpgradeable_init();\n\n _setupRole(DEFAULT_ADMIN_ROLE, owner);\n }\n\n function setRole(bytes32 role, address recipient) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _setupRole(role, recipient);\n }\n\n /**\n * @dev Send a fee either in ETH (wei) or ERC20 to the gatekeeper.\n * Note, ERC20 requires that the sender has approved the amount.\n * This function uses the CEI (checks-effects-interactions) pattern to avoid reentrancy\n * when sending ETH to the recipient (if the recipient is a smart contract)\n * @param charge The charge details\n **/\n function handleCharge(Charge calldata charge, uint network) external payable onlyRole(CHARGE_CALLER_ROLE) {\n if (charge.chargeType == ChargeType.ETH) {\n _handleEthCharge(charge);\n } else if (charge.chargeType == ChargeType.ERC20) {\n _handleERC20Charge(charge, network);\n }\n }\n\n function setApproval(address gatewayTokenAddress, address tokenAddress, uint256 tokens, uint256 network) external {\n _setApproval(gatewayTokenAddress, tokenAddress, tokens, network);\n emit ApprovalSet(gatewayTokenAddress, tokenAddress, tokens, network);\n }\n\n function _handleEthCharge(Charge calldata charge) internal {\n // CHECKS\n // send wei if the charge type is ETH\n if (msg.value != charge.value) {\n revert Charge__IncorrectValue(msg.value, charge.value);\n }\n\n // EFFECTS\n emit ChargePaid(charge);\n\n // INTERACTIONS\n (bool success, ) = payable(charge.recipient).call{value: charge.value}(\"\");\n if (!success) {\n revert Charge__TransferFailed(charge.value);\n }\n }\n\n function _handleERC20Charge(Charge calldata charge, uint network) internal {\n if (msg.value > 0) {\n // if the charge type is ERC20, the eth value should be zero\n revert Charge__IncorrectValue(msg.value, 0);\n }\n // send tokens if the charge type is ERC20\n IERC20 token = IERC20(charge.token);\n\n // CHECKS\n // check that the sender has approved the token transfer from this particular gatekeeper network\n // note - for security's sake, the user has to approve the tokens to a particular\n // gatekeeper network, to avoid front-running attacks. For more details, see\n // InternalTokenApproval.sol\n // Note - safeTransferFrom() additionally checks the global allowance for this contract.\n (bool approvalValid, uint256 remainingAllowance) = _consumeApproval(\n charge.tokenSender,\n _msgSender(),\n charge.token,\n charge.value,\n network\n );\n if (!approvalValid) {\n revert Charge__IncorrectAllowance(remainingAllowance, charge.value);\n }\n\n // EFFECTS\n emit ChargePaid(charge);\n\n // INTERACTIONS\n token.safeTransferFrom(charge.tokenSender, charge.recipient, charge.value);\n }\n\n // includes the onlySuperAdmin modifier to ensure that only the super admin can call this function\n // otherwise, no other logic.\n // solhint-disable-next-line no-empty-blocks\n function _authorizeUpgrade(address) internal override onlyRole(DEFAULT_ADMIN_ROLE) {}\n}\n" + }, + "contracts/FlagsStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19; // Fixed version for concrete contracts\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {EnumerableSet} from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {IFlagsStorage} from \"./interfaces/IFlagsStorage.sol\";\nimport {BitMask} from \"./library/BitMask.sol\";\nimport {Common__NotSuperAdmin, Common__MissingAccount} from \"./library/CommonErrors.sol\";\n\n/**\n * @dev FlagsStorage is the main contract to store KYC-related flags for Gateway Token System.\n * KYC flags are identifiable by short identifiers in bytes32 strings. After adding flags\n * those bit indexes could be used by GatewayToken implementations to associate flags per token.\n */\ncontract FlagsStorage is Initializable, IFlagsStorage, UUPSUpgradeable {\n using EnumerableSet for EnumerableSet.Bytes32Set;\n using Address for address;\n using BitMask for uint256;\n\n EnumerableSet.Bytes32Set private _supportedFlags;\n\n address public superAdmin;\n\n uint256 public supportedFlagsMask;\n\n mapping(bytes32 => uint8) public flagIndexes;\n\n /// The flag being added already exists\n /// @param flag The flag being added\n error FlagsStorage__FlagAlreadyExists(bytes32 flag);\n\n /// The flag being removed does not exist\n /// @param flag The flag being removed\n error FlagsStorage__FlagNotSupported(bytes32 flag);\n\n /// Multiple flags updated but the number of flags passed in does not match the number of indexes\n /// @param expected The number of flags passed in\n /// @param actual The number of indexes passed in\n error FlagsStorage__IncorrectVariableLength(uint256 expected, uint256 actual);\n\n /// The flag index is already used\n /// @param index The flag index\n error FlagsStorage__IndexAlreadyUsed(uint8 index);\n\n // @dev Modifier to prevent calls from anyone except Identity.com Admin\n modifier onlySuperAdmin() {\n _onlySuperAdmin();\n _;\n }\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n // empty constructor in line with the UUPS upgradeable proxy pattern\n // solhint-disable-next-line no-empty-blocks\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address _superAdmin) external initializer {\n if (_superAdmin == address(0)) revert Common__MissingAccount();\n superAdmin = _superAdmin;\n }\n\n /**\n * @dev Triggers to transfer ownership of this contract to\n * new super admin, reverts on zero address and wallet addresses\n * @param newSuperAdmin New super admin contract address\n * @notice Only executed by existing super admin\n */\n function updateSuperAdmin(address newSuperAdmin) external onlySuperAdmin {\n if (newSuperAdmin == address(0)) revert Common__MissingAccount();\n\n emit SuperAdminUpdated(superAdmin, newSuperAdmin);\n superAdmin = newSuperAdmin;\n }\n\n /**\n * @dev Triggers to add new flag into gateway token system\n * @param flag Flag short identifier\n * @param index Flag index (limited to 255)\n * @notice Only executed by existing DAO Manager\n */\n function addFlag(bytes32 flag, uint8 index) external onlySuperAdmin {\n _addFlag(flag, index);\n }\n\n /**\n * @dev Triggers to add multiple flags into gateway token system\n * @param flags Array of flag short identifiers\n * @param indexes Array of flag indexes (limited to 255)\n * @notice Only executed by existing DAO Manager\n */\n function addFlags(bytes32[] calldata flags, uint8[] calldata indexes) external onlySuperAdmin {\n if (flags.length != indexes.length) revert FlagsStorage__IncorrectVariableLength(flags.length, indexes.length);\n\n uint256 length = flags.length;\n for (uint8 i = 0; i < length; i++) {\n _addFlag(flags[i], indexes[i]);\n }\n }\n\n /**\n * @dev Triggers to remove existing flag from gateway token system\n * @param flag Flag short identifier\n * @notice Only executed by existing DAO Manager\n */\n function removeFlag(bytes32 flag) external onlySuperAdmin {\n if (!_supportedFlags.contains(flag)) revert FlagsStorage__FlagNotSupported(flag);\n\n _removeFlag(flag);\n }\n\n /**\n * @dev Triggers to remove multiple existing flags from gateway token system\n * @param flags Array of flag short identifiers\n * @notice Only executed by existing DAO Manager\n */\n function removeFlags(bytes32[] calldata flags) external onlySuperAdmin {\n uint256 length = flags.length;\n for (uint8 i = 0; i < length; i++) {\n // additional check to reduce incorrect FlagRemoved events\n if (!_supportedFlags.contains(flags[i])) revert FlagsStorage__FlagNotSupported(flags[i]);\n\n _removeFlag(flags[i]);\n }\n }\n\n /**\n * @dev Triggers to check if a particular flag is supported\n * @param flag Flag short identifier\n * @return Boolean for flag support\n */\n function isFlagSupported(bytes32 flag) external view returns (bool) {\n return _supportedFlags.contains(flag);\n }\n\n /**\n * @dev Internal function to add new flag\n */\n function _addFlag(bytes32 flag, uint8 index) internal {\n if (supportedFlagsMask.checkBit(index)) revert FlagsStorage__IndexAlreadyUsed(index);\n if (_supportedFlags.contains(flag)) revert FlagsStorage__FlagAlreadyExists(flag);\n\n flagIndexes[flag] = index;\n _supportedFlags.add(flag);\n supportedFlagsMask = supportedFlagsMask.setBit(index);\n\n emit FlagAdded(flag, index);\n }\n\n /**\n * @dev Internal function to remove existing flag\n */\n function _removeFlag(bytes32 flag) internal {\n _supportedFlags.remove(flag);\n uint8 _index = flagIndexes[flag];\n\n supportedFlagsMask = supportedFlagsMask.clearBit(_index);\n delete flagIndexes[flag];\n\n emit FlagRemoved(flag);\n }\n\n // includes the onlySuperAdmin modifier to ensure that only the super admin can call this function\n // otherwise, no other logic.\n // solhint-disable-next-line no-empty-blocks\n function _authorizeUpgrade(address) internal override onlySuperAdmin {}\n\n // separate into a private function to reduce code size\n function _onlySuperAdmin() private view {\n if (msg.sender != superAdmin) revert Common__NotSuperAdmin(msg.sender);\n }\n}\n" + }, + "contracts/FlexibleNonceForwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19; // Fixed version for concrete contracts\n\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {EIP712} from \"@openzeppelin/contracts/utils/cryptography/EIP712.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {IForwarder} from \"./interfaces/IForwarder.sol\";\n\ncontract FlexibleNonceForwarder is IForwarder, EIP712, ReentrancyGuard {\n using ECDSA for bytes32;\n using Address for address payable;\n\n struct SigsForNonce {\n mapping(bytes => bool) sigs;\n }\n\n struct FlexibleNonce {\n uint256 currentNonce;\n uint256 block; // when this nonce was first used - used to age transactions\n mapping(uint256 => SigsForNonce) sigsForNonce;\n }\n\n bytes32 private constant _TYPEHASH =\n keccak256(\"ForwardRequest(address from,address to,uint256 value,uint256 gas,uint256 nonce,bytes data)\");\n\n mapping(address => FlexibleNonce) private _nonces;\n\n uint256 private immutable _blockAgeTolerance;\n\n event ForwardResult(bool);\n\n /// The tx to be forwarded is not signed by the request sender.\n error FlexibleNonceForwarder__InvalidSigner(address signer, address expectedSigner);\n\n /// The tx to be forwarded has already been seen.\n error FlexibleNonceForwarder__TxAlreadySeen();\n\n /// The tx to be forwarded is too old.\n error FlexibleNonceForwarder__TxTooOld(uint256 blockNumber, uint256 blockAgeTolerance);\n\n constructor(uint256 blockAgeTolerance) EIP712(\"FlexibleNonceForwarder\", \"0.0.1\") {\n _blockAgeTolerance = blockAgeTolerance;\n }\n\n function execute(\n ForwardRequest calldata req,\n bytes calldata signature\n ) external payable nonReentrant returns (bool, bytes memory) {\n _verifyFlexibleNonce(req, signature);\n _refundExcessValue(req);\n\n (bool success, bytes memory returndata) = req.to.call{gas: req.gas, value: req.value}(\n abi.encodePacked(req.data, req.from)\n );\n\n // Forward the revert message from the call if the call failed.\n if (success == false) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n revert(add(returndata, 32), mload(returndata))\n }\n }\n\n // Validate that the relayer has sent enough gas for the call.\n // See https://ronan.eth.limo/blog/ethereum-gas-dangers/\n if (gasleft() <= req.gas / 64) {\n // We explicitly trigger invalid opcode to consume all gas and bubble-up the effects, since\n // neither revert or assert consume all gas since Solidity 0.8.0\n // https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require\n // solhint-disable-next-line no-inline-assembly\n assembly {\n invalid()\n }\n }\n emit ForwardResult(success);\n\n return (success, returndata);\n }\n\n function getNonce(address from) external view returns (uint256) {\n return _nonces[from].currentNonce;\n }\n\n function _verifyFlexibleNonce(ForwardRequest calldata req, bytes calldata signature) internal {\n address signer = _hashTypedDataV4(\n keccak256(abi.encode(_TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data)))\n ).recover(signature);\n\n if (signer != req.from) {\n revert FlexibleNonceForwarder__InvalidSigner(signer, req.from);\n }\n\n if (_nonces[req.from].currentNonce == req.nonce) {\n // request nonce is expected next nonce - increment the nonce, and we are done\n _nonces[req.from].currentNonce = req.nonce + 1;\n _nonces[req.from].block = block.number;\n } else {\n // request nonce is not expected next nonce - check if we have seen this signature before\n if (_nonces[req.from].sigsForNonce[req.nonce].sigs[signature]) {\n revert FlexibleNonceForwarder__TxAlreadySeen();\n }\n\n // check if the nonce is too old\n if (_nonces[req.from].block + _blockAgeTolerance < block.number) {\n revert FlexibleNonceForwarder__TxTooOld(_nonces[req.from].block, _blockAgeTolerance);\n }\n }\n\n // store the signature for this nonce to ensure no replay attacks\n _nonces[req.from].sigsForNonce[req.nonce].sigs[signature] = true;\n }\n\n function _refundExcessValue(ForwardRequest calldata req) internal {\n // Refund the excess value sent to the forwarder if the value inside the request is less than the value sent.\n if (msg.value > req.value) {\n payable(msg.sender).sendValue(msg.value - req.value);\n }\n }\n}\n" + }, + "contracts/Gated.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport {IGatewayTokenVerifier} from \"./interfaces/IGatewayTokenVerifier.sol\";\n\nabstract contract Gated {\n address private immutable _gatewayTokenContract;\n uint256 private immutable _gatekeeperNetwork;\n\n /// The gateway token is not valid.\n error IsGated__InvalidGatewayToken(address gatewayToken);\n /// The gateway token contract address is zero.\n error IsGated__ZeroContractAddress();\n\n /**\n * @dev Modifier to make a function callable only when the caller has a valid gateway token.\n *\n * Requirements:\n *\n * - The caller must have a valid, non-expired gateway token on the _gatekeeperNetwork network.\n */\n modifier gated() {\n IGatewayTokenVerifier verifier = IGatewayTokenVerifier(_gatewayTokenContract);\n if (!verifier.verifyToken(msg.sender, _gatekeeperNetwork)) {\n revert IsGated__InvalidGatewayToken(_gatewayTokenContract);\n }\n _;\n }\n\n /**\n * @dev Initializes the contract with a gateway token contract address and a gatekeeper network.\n *\n * Contract functions with the `gated` modifier will only be callable when the caller has a valid,\n * non-expired gateway token on the `gatekeeperNetwork` network using this `gatewayTokenContract`.\n *\n * See {ERC2771Context-constructor}.\n */\n constructor(address gatewayTokenContract, uint256 gatekeeperNetwork) {\n // check for zero address\n if (gatewayTokenContract == address(0)) {\n revert IsGated__ZeroContractAddress();\n }\n _gatewayTokenContract = gatewayTokenContract;\n _gatekeeperNetwork = gatekeeperNetwork;\n }\n}\n" + }, + "contracts/GatedERC2771.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport {IGatewayTokenVerifier} from \"./interfaces/IGatewayTokenVerifier.sol\";\nimport {MultiERC2771Context} from \"./MultiERC2771Context.sol\";\n\nabstract contract GatedERC2771 is MultiERC2771Context {\n address private immutable _gatewayTokenContract;\n uint256 private immutable _gatekeeperNetwork;\n\n /// The gateway token is not valid.\n error IsGated__InvalidGatewayToken(address gatewayToken);\n /// The gateway token contract address is zero.\n error IsGated__ZeroContractAddress();\n\n /**\n * @dev Modifier to make a function callable only when the caller has a valid gateway token.\n *\n * Requirements:\n *\n * - The caller must have a valid, non-expired gateway token on the _gatekeeperNetwork network.\n */\n modifier gated() {\n IGatewayTokenVerifier verifier = IGatewayTokenVerifier(_gatewayTokenContract);\n if (!verifier.verifyToken(_msgSender(), _gatekeeperNetwork)) {\n revert IsGated__InvalidGatewayToken(_gatewayTokenContract);\n }\n _;\n }\n\n /**\n * @dev Initializes the contract with a gateway token contract address and a gatekeeper network.\n *\n * Contract functions with the `gated` modifier will only be callable when the caller has a valid,\n * non-expired gateway token on the `gatekeeperNetwork` network using this `gatewayTokenContract`.\n *\n * See {ERC2771Context-constructor}.\n */\n constructor(address gatewayTokenContract, uint256 gatekeeperNetwork) MultiERC2771Context(new address[](0)) {\n // check for zero address\n if (gatewayTokenContract == address(0)) {\n revert IsGated__ZeroContractAddress();\n }\n\n _gatewayTokenContract = gatewayTokenContract;\n _gatekeeperNetwork = gatekeeperNetwork;\n }\n}\n" + }, + "contracts/GatedERC2771Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport {IGatewayTokenVerifier} from \"./interfaces/IGatewayTokenVerifier.sol\";\nimport {MultiERC2771ContextUpgradeable} from \"./MultiERC2771ContextUpgradeable.sol\";\n\nabstract contract GatedERC2771Upgradeable is MultiERC2771ContextUpgradeable {\n address private _gatewayTokenContract;\n uint256 private _gatekeeperNetwork;\n\n /// The gateway token is not valid.\n error IsGated__InvalidGatewayToken(address gatewayToken);\n /// The gateway token contract address is zero.\n error IsGated__ZeroContractAddress();\n\n /**\n * @dev Modifier to make a function callable only when the caller has a valid gateway token.\n *\n * Requirements:\n *\n * - The caller must have a valid, non-expired gateway token on the _gatekeeperNetwork network.\n */\n modifier gated() {\n IGatewayTokenVerifier verifier = IGatewayTokenVerifier(_gatewayTokenContract);\n if (!verifier.verifyToken(_msgSender(), _gatekeeperNetwork)) {\n revert IsGated__InvalidGatewayToken(_gatewayTokenContract);\n }\n _;\n }\n\n /**\n * @dev Initializes the contract with a gateway token contract address and a gatekeeper network.\n *\n * Contract functions with the `gated` modifier will only be callable when the caller has a valid,\n * non-expired gateway token on the `gatekeeperNetwork` network using this `gatewayTokenContract`.\n *\n * See {ERC2771Context-constructor}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __GatedERC2771Upgradeable_init(\n address gatewayTokenContract,\n uint256 gatekeeperNetwork,\n address[] calldata trustedForwarders\n ) internal onlyInitializing {\n // check for zero address\n if (gatewayTokenContract == address(0)) {\n revert IsGated__ZeroContractAddress();\n }\n _gatewayTokenContract = gatewayTokenContract;\n _gatekeeperNetwork = gatekeeperNetwork;\n __MultiERC2771ContextUpgradeable_init(trustedForwarders);\n }\n}\n" + }, + "contracts/GatewayToken.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19; // Fixed version for concrete contracts\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IERC3525MetadataUpgradeable} from \"@solvprotocol/erc-3525/extensions/IERC3525MetadataUpgradeable.sol\";\nimport {ERC3525Upgradeable} from \"@solvprotocol/erc-3525/ERC3525Upgradeable.sol\";\nimport {IERC721} from \"@solvprotocol/erc-3525/IERC721.sol\";\nimport {IERC3525} from \"@solvprotocol/erc-3525/IERC3525.sol\";\nimport {TokenBitMask} from \"./TokenBitMask.sol\";\nimport {IGatewayToken} from \"./interfaces/IGatewayToken.sol\";\nimport {IERC721Freezable} from \"./interfaces/IERC721Freezable.sol\";\nimport {IERC721Expirable} from \"./interfaces/IERC721Expirable.sol\";\nimport {IERC721Revokable} from \"./interfaces/IERC721Revokable.sol\";\nimport {MultiERC2771ContextUpgradeable} from \"./MultiERC2771ContextUpgradeable.sol\";\nimport {Charge} from \"./library/Charge.sol\";\nimport {ParameterizedAccessControl} from \"./ParameterizedAccessControl.sol\";\nimport {Common__MissingAccount, Common__NotContract, Common__Unauthorized} from \"./library/CommonErrors.sol\";\nimport {BitMask} from \"./library/BitMask.sol\";\nimport {InternalTokenApproval} from \"./library/InternalTokenApproval.sol\";\nimport {IChargeHandler} from \"./interfaces/IChargeHandler.sol\";\n\n/**\n * @dev Gateway Token contract is responsible for managing Identity.com KYC gateway tokens\n * those tokens represent completed KYC with attached identity.\n * Gateway tokens using ERC721 standard with custom extensions.\n *\n * Contract handles multiple levels of access such as Network Authority\n * (may represent a specific regulator body)\n * Gatekeepers (Identity.com network parties who can mint/burn/freeze gateway tokens)\n * and overall system Admin who can add\n * new Gatekeepers and Network Authorities\n */\ncontract GatewayToken is\n UUPSUpgradeable,\n MultiERC2771ContextUpgradeable,\n ERC3525Upgradeable,\n ParameterizedAccessControl,\n IERC721Freezable,\n IERC721Expirable,\n IERC721Revokable,\n IGatewayToken,\n TokenBitMask\n{\n using Address for address;\n using Strings for uint;\n using BitMask for uint256;\n\n enum NetworkFeature {\n // if set, gateway tokens are considered invalid if the gatekeeper that minted them is removed from the network\n // defaults to false, and can be set by the network authority.\n REMOVE_GATEKEEPER_INVALIDATES_TOKENS\n }\n\n // Off-chain DAO governance access control\n mapping(uint => bool) public isNetworkDAOGoverned;\n\n // Access control roles\n bytes32 public constant DAO_MANAGER_ROLE = keccak256(\"DAO_MANAGER_ROLE\");\n bytes32 public constant GATEKEEPER_ROLE = keccak256(\"GATEKEEPER_ROLE\");\n bytes32 public constant NETWORK_AUTHORITY_ROLE = keccak256(\"NETWORK_AUTHORITY_ROLE\");\n\n // Mapping from token id to state\n mapping(uint => TokenState) internal _tokenStates;\n\n // Optional Mapping from token ID to expiration date\n mapping(uint => uint) internal _expirations;\n\n mapping(uint => string) internal _networks;\n\n // Specifies the gatekeeper that minted a given token\n mapping(uint => address) internal _issuingGatekeepers;\n\n // Mapping for gatekeeper network features\n mapping(uint => uint256) internal _networkFeatures;\n\n IChargeHandler internal _chargeHandler;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n // constructor is \"empty\" as we are using the proxy pattern,\n // where setup code is in the initialize function\n // called by the proxy contract\n constructor() {\n _disableInitializers();\n }\n\n function initialize(\n string calldata name,\n string calldata symbol,\n address superAdmin,\n address flagsStorage,\n address chargeHandler,\n address[] calldata trustedForwarders\n ) external initializer {\n // Check for zero addresses\n if (superAdmin == address(0)) {\n revert Common__MissingAccount();\n }\n\n if (flagsStorage == address(0)) {\n revert Common__MissingAccount();\n }\n\n if (chargeHandler == address(0)) {\n revert Common__MissingAccount();\n }\n\n // Check for zero addresses in the trusted forwarders array\n for (uint256 i = 0; i < trustedForwarders.length; i++) {\n if (trustedForwarders[i] == address(0)) {\n revert Common__MissingAccount();\n }\n }\n\n __ERC3525_init(name, symbol, 0);\n __MultiERC2771ContextUpgradeable_init(trustedForwarders);\n\n _setFlagsStorage(flagsStorage);\n _setChargeHandler(chargeHandler);\n _superAdmins[superAdmin] = true;\n\n emit GatewayTokenInitialized(name, symbol, superAdmin, flagsStorage, chargeHandler, trustedForwarders);\n }\n\n function setMetadataDescriptor(address _metadataDescriptor) external onlySuperAdmin {\n _setMetadataDescriptor(_metadataDescriptor);\n }\n\n function addForwarder(address forwarder) external onlySuperAdmin {\n _addForwarder(forwarder);\n emit ForwarderAdded(forwarder);\n }\n\n function removeForwarder(address forwarder) external onlySuperAdmin {\n _removeForwarder(forwarder);\n emit ForwarderRemoved(forwarder);\n }\n\n /**\n * @dev Triggers to update FlagsStorage contract address\n * @param flagsStorage FlagsStorage contract address\n */\n function updateFlagsStorage(address flagsStorage) external onlySuperAdmin {\n // check for zero address\n if (flagsStorage == address(0)) {\n revert Common__MissingAccount();\n }\n _setFlagsStorage(flagsStorage);\n }\n\n /**\n * @dev Update the ChargeHandler contract address\n * @param chargeHandler ChargeHandler contract address\n */\n function updateChargeHandler(address chargeHandler) external onlySuperAdmin {\n _setChargeHandler(chargeHandler);\n }\n\n /**\n * @dev Triggers to burn gateway token\n * @param tokenId Gateway token id\n */\n function burn(uint tokenId) external virtual {\n _checkGatekeeper(slotOf(tokenId));\n _burn(tokenId);\n }\n\n /**\n * @dev Triggers to mint gateway token\n * @param to Gateway token owner\n * @param network Gateway token type\n * @param mask The bitmask for the token\n */\n function mint(\n address to,\n uint network,\n uint expiration,\n uint mask,\n Charge calldata charge\n ) external payable virtual {\n // CHECKS\n _checkGatekeeper(network);\n\n // EFFECTS\n uint tokenId = ERC3525Upgradeable._mint(to, network, 1);\n\n if (expiration > 0) {\n _expirations[tokenId] = expiration;\n }\n\n if (mask > 0) {\n _setBitMask(tokenId, mask);\n }\n\n _issuingGatekeepers[tokenId] = _msgSender();\n\n // INTERACTIONS\n _handleCharge(charge, network);\n }\n\n function revoke(uint tokenId) external virtual override {\n _checkGatekeeper(slotOf(tokenId));\n\n _tokenStates[tokenId] = TokenState.REVOKED;\n\n emit Revoke(tokenId);\n }\n\n /**\n * @dev Triggers to freeze gateway token\n * @param tokenId Gateway token id\n */\n function freeze(uint tokenId) external virtual {\n _checkGatekeeper(slotOf(tokenId));\n\n _freeze(tokenId);\n }\n\n /**\n * @dev Triggers to unfreeze gateway token\n * @param tokenId Gateway token id\n */\n function unfreeze(uint tokenId) external virtual {\n _checkGatekeeper(slotOf(tokenId));\n\n _unfreeze(tokenId);\n }\n\n /**\n * @dev Triggers to set expiration for tokenId\n * @param tokenId Gateway token id\n * @param timestamp Expiration timestamp\n * @param charge Charge for the operation\n */\n function setExpiration(uint tokenId, uint timestamp, Charge calldata charge) external payable virtual {\n // CHECKS\n uint network = slotOf(tokenId);\n _checkGatekeeper(slotOf(tokenId));\n // EFFECTS\n _setExpiration(tokenId, timestamp);\n // INTERACTIONS\n _handleCharge(charge, network);\n }\n\n /**\n * @dev Transfers Gateway Token DAO Manager access from `previousManager` to `newManager`\n * Only a current DAO Manager can do this. They can do this for any other DAO Manager.\n * This is useful for two reasons:\n * 1. Key rotation of the current (msg signer) DAO manager\n * 2. Replacing a lost or compromised key of an existing DAO manager\n * @param newManager Address to transfer DAO Manager role for.\n * @notice GatewayToken contract has to be DAO Governed\n */\n function transferDAOManager(address previousManager, address newManager, uint network) external {\n if (!isNetworkDAOGoverned[network]) revert GatewayToken__NotDAOGoverned(network);\n\n // check the previous manager is a current dao manager\n _checkRole(DAO_MANAGER_ROLE, network, previousManager);\n\n if (newManager == address(0)) revert Common__MissingAccount();\n\n if (!newManager.isContract()) {\n revert Common__NotContract(newManager);\n }\n\n // grant the new manager the relevant roles\n grantRole(DAO_MANAGER_ROLE, network, newManager);\n grantRole(NETWORK_AUTHORITY_ROLE, network, newManager);\n grantRole(GATEKEEPER_ROLE, network, newManager);\n\n // revoke the relevant roles from the previous manager\n revokeRole(GATEKEEPER_ROLE, network, previousManager);\n revokeRole(NETWORK_AUTHORITY_ROLE, network, previousManager);\n revokeRole(DAO_MANAGER_ROLE, network, previousManager);\n\n emit DAOManagerTransferred(previousManager, newManager, network);\n }\n\n function createNetwork(uint network, string calldata name, bool daoGoverned, address daoManager) external virtual {\n // do not allow empty names\n if (bytes(name).length == 0) {\n revert GatewayToken__EmptyNetworkName();\n }\n\n if (bytes(_networks[network]).length != 0) {\n revert GatewayToken__NetworkAlreadyExists(network);\n }\n\n _networks[network] = name;\n\n if (daoGoverned) {\n isNetworkDAOGoverned[network] = daoGoverned;\n\n if (daoManager == address(0)) {\n revert Common__MissingAccount();\n }\n if (!daoManager.isContract()) {\n revert Common__NotContract(daoManager);\n }\n\n // use the internal function to avoid the check for the network authority role\n // since this network does not exist yet, it has no existing network authority\n _grantRole(DAO_MANAGER_ROLE, network, daoManager);\n _grantRole(NETWORK_AUTHORITY_ROLE, network, daoManager);\n\n // DAO managers can assign and revoke network authorities and gatekeepers\n _setRoleAdmin(NETWORK_AUTHORITY_ROLE, network, DAO_MANAGER_ROLE);\n _setRoleAdmin(GATEKEEPER_ROLE, network, DAO_MANAGER_ROLE);\n // DAO Managers can administrate themselves\n _setRoleAdmin(DAO_MANAGER_ROLE, network, DAO_MANAGER_ROLE);\n } else {\n // use the internal function to avoid the check for the network authority role\n // since this network does not exist yet, it has no existing network authority\n _grantRole(NETWORK_AUTHORITY_ROLE, network, _msgSender());\n\n _setRoleAdmin(NETWORK_AUTHORITY_ROLE, network, NETWORK_AUTHORITY_ROLE);\n _setRoleAdmin(GATEKEEPER_ROLE, network, NETWORK_AUTHORITY_ROLE);\n }\n }\n\n function renameNetwork(uint network, string calldata name) external virtual {\n // do not allow empty names\n if (bytes(name).length == 0) {\n revert GatewayToken__EmptyNetworkName();\n }\n\n if (bytes(_networks[network]).length == 0) {\n revert GatewayToken__NetworkDoesNotExist(network);\n }\n if (!hasRole(NETWORK_AUTHORITY_ROLE, network, _msgSender())) {\n revert Common__Unauthorized(_msgSender(), network, NETWORK_AUTHORITY_ROLE);\n }\n\n _networks[network] = name;\n }\n\n /**\n * @dev Triggers to add new gatekeeper into the system.\n * @param gatekeeper Gatekeeper address\n */\n function addGatekeeper(address gatekeeper, uint network) external virtual {\n grantRole(GATEKEEPER_ROLE, network, gatekeeper);\n }\n\n /**\n * @dev Triggers to remove existing gatekeeper from gateway token.\n * @param gatekeeper Gatekeeper address\n */\n function removeGatekeeper(address gatekeeper, uint network) external virtual {\n revokeRole(GATEKEEPER_ROLE, network, gatekeeper);\n }\n\n /**\n * @dev Triggers to add new network authority into the system.\n * @param authority Network Authority address\n *\n * @notice Can be triggered by DAO Manager or any Network Authority\n */\n function addNetworkAuthority(address authority, uint network) external virtual {\n grantRole(NETWORK_AUTHORITY_ROLE, network, authority);\n }\n\n /**\n * @dev Triggers to remove existing network authority from gateway token.\n * @param authority Network Authority address\n *\n * @notice Can be triggered by DAO Manager or any Network Authority\n */\n function removeNetworkAuthority(address authority, uint network) external virtual {\n revokeRole(NETWORK_AUTHORITY_ROLE, network, authority);\n }\n\n /**\n * @dev Triggers to set full bitmask for gateway token with `tokenId`\n */\n function setBitmask(uint tokenId, uint mask) external virtual {\n _checkSenderRole(GATEKEEPER_ROLE, slotOf(tokenId));\n _setBitMask(tokenId, mask);\n }\n\n function setNetworkFeatures(uint network, uint256 mask) external virtual {\n _checkSenderRole(NETWORK_AUTHORITY_ROLE, network);\n _networkFeatures[network] = mask;\n }\n\n function getNetwork(uint network) external view virtual returns (string memory) {\n return _networks[network];\n }\n\n function getIssuingGatekeeper(uint tokenId) external view virtual returns (address) {\n return _issuingGatekeepers[tokenId];\n }\n\n function getTokenIdsByOwnerAndNetwork(\n address owner,\n uint network,\n bool onlyActive\n ) external view virtual returns (uint[] memory) {\n (uint[] memory tokenIds, uint count) = _getTokenIdsByOwnerAndNetwork(owner, network, onlyActive);\n uint[] memory tokenIdsResized = new uint[](count);\n\n for (uint i = 0; i < count; i++) {\n tokenIdsResized[i] = tokenIds[i];\n }\n\n return tokenIdsResized;\n }\n\n /**\n * @dev Triggered by external contract to verify the validity of the default token for `owner`.\n *\n * Checks owner has any token on gateway token contract, `tokenId` still active, and not expired.\n */\n function verifyToken(address owner, uint network) external view virtual returns (bool) {\n (, uint count) = _getTokenIdsByOwnerAndNetwork(owner, network, true);\n\n return count > 0;\n }\n\n /**\n * @dev Triggered by external contract to verify the validity of the default token for `owner`.\n *\n * Checks owner has any token on gateway token contract, `tokenId` still active, and not expired.\n */\n function verifyToken(uint tokenId) external view virtual returns (bool) {\n return _existsAndActive(tokenId, false);\n }\n\n /**\n * @dev Triggers to get all information gateway token related to specified `tokenId`\n * @param tokenId Gateway token id\n */\n function getToken(\n uint tokenId\n )\n external\n view\n virtual\n returns (address owner, uint8 state, string memory identity, uint expiration, uint bitmask)\n {\n owner = ownerOf(tokenId);\n state = uint8(_tokenStates[tokenId]);\n expiration = _expirations[tokenId];\n bitmask = _getBitMask(tokenId);\n\n return (owner, state, identity, expiration, bitmask);\n }\n\n /**\n * @dev Triggers to get specified `tokenId` expiration timestamp\n * @param tokenId Gateway token id\n */\n function getExpiration(uint tokenId) external view virtual returns (uint) {\n _checkTokenExists(tokenId);\n\n return _expirations[tokenId];\n }\n\n /**\n * @dev Triggers to verify if address has a GATEKEEPER role.\n * @param gatekeeper Gatekeeper address\n */\n function isGatekeeper(address gatekeeper, uint network) external view virtual returns (bool) {\n return hasRole(GATEKEEPER_ROLE, network, gatekeeper);\n }\n\n /**\n * @dev Triggers to verify if authority has a NETWORK_AUTHORITY_ROLE role.\n * @param authority Network Authority address\n */\n function isNetworkAuthority(address authority, uint network) external view virtual returns (bool) {\n return hasRole(NETWORK_AUTHORITY_ROLE, network, authority);\n }\n\n /**\n * @dev Triggers to get gateway token bitmask\n */\n function getTokenBitmask(uint tokenId) external view virtual returns (uint) {\n return _getBitMask(tokenId);\n }\n\n /**\n * @dev Returns true if gateway token owner transfers restricted, and false otherwise.\n */\n function transfersRestricted() external pure virtual returns (bool) {\n return true;\n }\n\n /**\n * @dev Transfers are disabled for Gateway Tokens - override ERC3525 approve functions to revert\n * Note - transferFrom and safeTransferFrom are disabled indirectly with the _isApprovedOrOwner function\n */\n function approve(uint256, address, uint256) public payable virtual override {\n revert GatewayToken__TransferDisabled();\n }\n\n function approve(address, uint256) public payable virtual override {\n revert GatewayToken__TransferDisabled();\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC3525Upgradeable, ParameterizedAccessControl) returns (bool) {\n return\n interfaceId == type(IERC3525).interfaceId ||\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC3525MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function networkHasFeature(uint network, NetworkFeature feature) public view virtual returns (bool) {\n return _networkFeatures[network].checkBit(uint8(feature));\n }\n\n /**\n * @dev Freezes `tokenId` and it's usage by gateway token owner.\n *\n * Emits a {Freeze} event.\n */\n function _freeze(uint tokenId) internal virtual {\n _checkActiveToken(tokenId, true);\n\n _tokenStates[tokenId] = TokenState.FROZEN;\n\n emit Freeze(tokenId);\n }\n\n /**\n * @dev Unfreezes `tokenId` and it's usage by gateway token owner.\n *\n * Emits a {Unfreeze} event.\n */\n function _unfreeze(uint tokenId) internal virtual {\n _checkTokenExists(tokenId);\n if (_tokenStates[tokenId] != TokenState.FROZEN) {\n revert GatewayToken__TokenInvalidStateForOperation(tokenId, _tokenStates[tokenId], TokenState.FROZEN);\n }\n\n _tokenStates[tokenId] = TokenState.ACTIVE;\n\n emit Unfreeze(tokenId);\n }\n\n /**\n * @dev Sets expiration time for `tokenId`.\n */\n function _setExpiration(uint tokenId, uint timestamp) internal virtual {\n _checkActiveToken(tokenId, true);\n\n _expirations[tokenId] = timestamp;\n emit Expiration(tokenId, timestamp);\n }\n\n // includes the onlySuperAdmin modifier to ensure that only the super admin can call this function\n // otherwise, no other logic.\n // solhint-disable-next-line no-empty-blocks\n function _authorizeUpgrade(address) internal override onlySuperAdmin {}\n\n /**\n * @dev Internal function to set ChargeHandler contract address\n * @param chargeHandler ChargeHandler contract address\n */\n function _setChargeHandler(address chargeHandler) internal {\n _chargeHandler = IChargeHandler(chargeHandler);\n\n emit ChargeHandlerUpdated(chargeHandler);\n }\n\n function _handleCharge(Charge calldata charge, uint network) internal {\n // solhint-disable-next-line no-empty-blocks\n try _chargeHandler.handleCharge{value: msg.value}(charge, network) {\n // done\n } catch (bytes memory reason) {\n // Rethrow the custom error from the charge handler\n // Using inline assembly here avoids the need to parse the revert reason\n // solhint-disable-next-line no-inline-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n\n function _msgSender()\n internal\n view\n virtual\n override(MultiERC2771ContextUpgradeable, ContextUpgradeable)\n returns (address sender)\n {\n return MultiERC2771ContextUpgradeable._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(MultiERC2771ContextUpgradeable, ContextUpgradeable)\n returns (bytes calldata)\n {\n return MultiERC2771ContextUpgradeable._msgData();\n }\n\n function _getTokenIdsByOwnerAndNetwork(\n address owner,\n uint network,\n bool onlyActive\n ) internal view returns (uint[] memory, uint) {\n uint length = balanceOf(owner);\n uint[] memory tokenIds = new uint[](length);\n uint count = 0;\n\n for (uint i = 0; i < length; i++) {\n uint tokenId = tokenOfOwnerByIndex(owner, i);\n if (slotOf(tokenId) == network && (!onlyActive || _existsAndActive(tokenId, false))) {\n tokenIds[count++] = tokenId;\n }\n }\n\n return (tokenIds, count);\n }\n\n /**\n * @dev Returns whether `tokenId` exists and not frozen.\n */\n function _existsAndActive(uint tokenId, bool allowExpired) internal view virtual returns (bool) {\n // check state before anything else. This reduces the overhead,\n // and avoids a revert, if the token does not exist.\n TokenState state = _tokenStates[tokenId];\n if (state != TokenState.ACTIVE) return false;\n\n // if the network has the REMOVE_GATEKEEPER_INVALIDATES_TOKENS feature,\n // check that the gatekeeper is still in the gatekeeper network.\n // tokens issued without gatekeepers are exempt.\n uint network = slotOf(tokenId);\n if (networkHasFeature(network, NetworkFeature.REMOVE_GATEKEEPER_INVALIDATES_TOKENS)) {\n address gatekeeper = _issuingGatekeepers[tokenId];\n if (gatekeeper != address(0) && !hasRole(GATEKEEPER_ROLE, network, gatekeeper)) {\n return false;\n }\n }\n\n address owner = ownerOf(tokenId);\n if (_expirations[tokenId] != 0 && !allowExpired) {\n return owner != address(0) && block.timestamp <= _expirations[tokenId];\n } else {\n return owner != address(0);\n }\n }\n\n function _isApprovedOrOwner(address, uint) internal view virtual override returns (bool) {\n return false; // transfers are restricted, so this can never pass\n }\n\n /// @dev Checks if the sender has the specified role on the specified network and revert otherwise\n function _checkSenderRole(bytes32 role, uint network) internal view {\n _checkRole(role, network, _msgSender());\n }\n\n function _checkGatekeeper(uint network) internal view {\n _checkSenderRole(GATEKEEPER_ROLE, network);\n }\n\n /// @dev Checks if the token exists and is active. Optionally ignore expiry.\n /// Use this when you need to check if a token exists, and is not frozen or revoked\n /// But you don't care about its expiry, e.g. you are extending the expiry.\n function _checkActiveToken(uint tokenId, bool allowExpired) internal view {\n if (!_existsAndActive(tokenId, allowExpired)) {\n revert GatewayToken__TokenDoesNotExistOrIsInactive(tokenId, allowExpired);\n }\n }\n\n /// @dev Checks if the token exists - ignore if it is active or not.\n function _checkTokenExists(uint tokenId) internal view {\n if (!_exists(tokenId)) {\n revert GatewayToken__TokenDoesNotExist(tokenId);\n }\n }\n}\n" + }, + "contracts/interfaces/IChargeHandler.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport {Charge} from \"../library/Charge.sol\";\n\ninterface IChargeHandler {\n /**\n * @dev Emitted when tokens are approved to be drawn by this contract in the context of\n * a gateway token contract and a specific gatekeeper network.\n */\n event ApprovalSet(address gatewayTokenAddress, address tokenAddress, uint256 tokens, uint256 network);\n\n event ChargePaid(Charge);\n\n error Charge__IncorrectAllowance(uint256 allowance, uint256 expectedAllowance);\n\n error Charge__IncorrectValue(uint256 value, uint256 expectedValue);\n\n error Charge__TransferFailed(uint256 value);\n\n function handleCharge(Charge calldata charge, uint network) external payable;\n\n function setApproval(address gatewayTokenAddress, address tokenAddress, uint256 tokens, uint256 network) external;\n}\n" + }, + "contracts/interfaces/IERC721Expirable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport {Charge} from \"../library/Charge.sol\";\n\ninterface IERC721Expirable {\n /**\n * @dev Emitted when expiration set to `tokenId`\n */\n event Expiration(uint256 indexed tokenId, uint256 timestamp);\n\n /**\n * @dev Set the gateway token expiry\n * @param tokenId Gateway token id\n * @param tokenId Expiration timestamp\n * @param charge The charge details for token issuance (ignored here - handled if at all by the forwarding contract)\n */\n function setExpiration(uint256 tokenId, uint256 timestamp, Charge calldata charge) external payable;\n\n /**\n * @dev Get the gateway token expiry\n * @param tokenId Gateway token id\n */\n function getExpiration(uint256 tokenId) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IERC721Freezable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\ninterface IERC721Freezable {\n /**\n * @dev Emitted when a token is frozen by gatekeeper\n */\n event Freeze(uint256 indexed tokenId);\n\n /**\n * @dev Emitted when a token is unfrozen by gatekeeper\n */\n event Unfreeze(uint256 indexed tokenId);\n\n /**\n * @dev Triggers to freeze gateway token\n * @param tokenId Gateway token id\n */\n function freeze(uint256 tokenId) external;\n\n /**\n * @dev Triggers to unfreeze gateway token\n * @param tokenId Gateway token id\n */\n function unfreeze(uint256 tokenId) external;\n}\n" + }, + "contracts/interfaces/IERC721Revokable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\ninterface IERC721Revokable {\n /**\n * @dev Emitted when GatewayToken is revoked.\n */\n event Revoke(uint256 indexed tokenId);\n\n /**\n * @dev Triggers to revoke gateway token\n * @param tokenId Gateway token id\n */\n function revoke(uint256 tokenId) external;\n}\n" + }, + "contracts/interfaces/IFlagsStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\npragma experimental ABIEncoderV2;\n\ninterface IFlagsStorage {\n /**\n * @dev Emitted when DAO Controller is updated from `prevDAOController` to `daoController`.\n */\n event SuperAdminUpdated(address indexed prevSuperAdmin, address indexed superAdmin);\n\n /**\n * @dev Emitted when new flag is added with `flag` short code and `index`.\n */\n event FlagAdded(bytes32 indexed flag, uint8 index);\n\n /**\n * @dev Emitted when existing flag is removed from FlagsStorage by `flag` short code.\n */\n event FlagRemoved(bytes32 indexed flag);\n\n /**\n * @dev Triggers to add new flag into gateway token system\n * @param _flag Flag short identifier\n * @param _index Flag index (limited to 255)\n * @notice Only executed by existing DAO Manager\n */\n function addFlag(bytes32 _flag, uint8 _index) external;\n\n /**\n * @dev Triggers to add multiple flags into gateway token system\n * @param _flags Array of flag short identifiers\n * @param _indexes Array of flag indexes (limited to 255)\n * @notice Only executed by existing DAO Manager\n */\n function addFlags(bytes32[] memory _flags, uint8[] memory _indexes) external;\n\n /**\n * @dev Triggers to remove existing flag from gateway token system\n * @param _flag Flag short identifier\n * @notice Only executed by existing DAO Manager\n */\n function removeFlag(bytes32 _flag) external;\n\n /**\n * @dev Triggers to remove multiple existing flags from gateway token system\n * @param _flags Array of flag short identifiers\n * @notice Only executed by existing DAO Manager\n */\n function removeFlags(bytes32[] memory _flags) external;\n\n /**\n * @dev Triggers to transfer ownership of this contract to new DAO Controller,\n * reverts on zero address and wallet addresses\n * @param _newSuperAdmin New DAO Controller contract address\n * @notice Only executed by existing DAO Manager\n */\n function updateSuperAdmin(address _newSuperAdmin) external;\n\n /**\n * @dev Triggers to get DAO Controller address\n */\n function superAdmin() external view returns (address);\n\n /**\n * @dev Triggers to get flag index from flags mapping\n */\n function flagIndexes(bytes32) external view returns (uint8);\n\n /**\n * @dev Triggers to check if a particular flag is supported\n * @param _flag Flag short identifier\n * @return Boolean for flag support\n */\n function isFlagSupported(bytes32 _flag) external view returns (bool);\n\n /**\n * @dev Triggers to get bitmask of all supported flags\n */\n function supportedFlagsMask() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IForwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\npragma experimental ABIEncoderV2;\n\ninterface IForwarder {\n struct ForwardRequest {\n address from;\n address to;\n uint256 value;\n uint256 gas;\n uint256 nonce;\n bytes data;\n }\n\n function execute(\n ForwardRequest calldata req,\n bytes calldata signature\n ) external payable returns (bool, bytes memory);\n\n function getNonce(address from) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IGatewayToken.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport {Charge} from \"../library/Charge.sol\";\n\ninterface IGatewayToken {\n enum TokenState {\n ACTIVE,\n FROZEN,\n REVOKED\n }\n\n /**\n * @dev Emitted when GatewayToken contract is initialized.\n */\n event GatewayTokenInitialized(\n string name,\n string symbol,\n address superAdmin,\n address flagsStorage,\n address chargeHandler,\n address[] trustedForwarders\n );\n\n /**\n * @dev Emitted when a gatekeeper network is created.\n */\n event GatekeeperNetworkCreated(uint256 network, string name, bool daoGoverned, address daoManager);\n\n /**\n * @dev Emitted when GatewayToken DAO Manager transferred to `newDAOManager` address.\n */\n event DAOManagerTransferred(address previousDAOManager, address newDAOManager, uint256 network);\n\n /**\n * @dev Emitted when Identity.com Admin updated the ChargeHandler\n * contract address\n */\n event ChargeHandlerUpdated(address indexed chargeHandler);\n\n /**\n * @dev Emitted when Identity.com Admin added a trusted forwarder\n * contract address\n */\n event ForwarderAdded(address indexed forwarder);\n\n /**\n * @dev Emitted when Identity.com Admin removed a trusted forwarder\n * contract address\n */\n event ForwarderRemoved(address indexed forwarder);\n\n /// Insufficient funds for withdrawal. Needed `required` but only\n /// `available` available.\n /// @param available balance available.\n /// @param required requested amount to transfer.\n error GatewayToken__InsufficientFunds(uint256 available, uint256 required);\n\n /// The gatekeeper network being created already exists.\n /// @param network gatekeeper network id.\n error GatewayToken__NetworkAlreadyExists(uint network);\n\n /// The gatekeeper network does not exist.\n /// @param network gatekeeper network id.\n error GatewayToken__NetworkDoesNotExist(uint network);\n\n /// The gatekeeper network name is empty.\n error GatewayToken__EmptyNetworkName();\n\n /// The gatekeeper network is not dao-governed.\n /// @param network gatekeeper network id.\n error GatewayToken__NotDAOGoverned(uint network);\n\n /// The requested token does not exist.\n /// @param tokenId token id.\n error GatewayToken__TokenDoesNotExist(uint256 tokenId);\n\n /// The requested token is not active or does not exist\n /// @param tokenId token id.\n /// @param allowExpired whether to allow expired tokens.\n error GatewayToken__TokenDoesNotExistOrIsInactive(uint256 tokenId, bool allowExpired);\n\n /// The requested token state is invalid for the request\n /// @param tokenId token id.\n /// @param state current token state.\n /// @param expectedState expected token state.\n error GatewayToken__TokenInvalidStateForOperation(uint256 tokenId, TokenState state, TokenState expectedState);\n\n /// Token transfers are disabled\n error GatewayToken__TransferDisabled();\n\n /**\n * @dev Triggers to verify if address has a GATEKEEPER role.\n * @param gatekeeper Gatekeeper address\n * @param network GatekeeperNetwork id\n */\n function isGatekeeper(address gatekeeper, uint256 network) external returns (bool);\n\n function createNetwork(uint256 network, string memory name, bool daoGoverned, address daoManager) external;\n\n function renameNetwork(uint256 network, string memory name) external;\n\n /**\n * @dev Triggers to add new network authority into the system.\n * @param authority Network Authority address\n * @param network GatekeeperNetwork id\n *\n * @notice Only triggered by Identity.com Admin\n */\n function addNetworkAuthority(address authority, uint256 network) external;\n\n /**\n * @dev Triggers to remove existing network authority from gateway token.\n * @param authority Network Authority address\n * @param network GatekeeperNetwork id\n *\n * @notice Only triggered by Identity.com Admin\n */\n function removeNetworkAuthority(address authority, uint256 network) external;\n\n /**\n * @dev Triggers to verify if authority has a NETWORK_AUTHORITY_ROLE role.\n * @param authority Network Authority address\n * @param network GatekeeperNetwork id\n */\n function isNetworkAuthority(address authority, uint256 network) external returns (bool);\n\n /**\n * @dev Transfers Gateway Token DAO Manager access from daoManager to `newManager`\n * @param newManager Address to transfer DAO Manager role for.\n */\n function transferDAOManager(address previousManager, address newManager, uint256 network) external;\n\n function mint(\n address to,\n uint256 network,\n uint256 expiration,\n uint256 mask,\n Charge calldata charge\n ) external payable;\n\n /**\n * @dev Triggers to get all information relating to gateway `tokenId`\n * @param tokenId Gateway token id\n */\n function getToken(\n uint256 tokenId\n ) external view returns (address owner, uint8 state, string memory identity, uint256 expiration, uint256 bitmask);\n\n function getNetwork(uint256 network) external view returns (string memory);\n}\n" + }, + "contracts/interfaces/IGatewayTokenVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\npragma experimental ABIEncoderV2;\n\ninterface IGatewayTokenVerifier {\n /**\n * @dev Triggered by external contract to verify if `slot` and token `owner` are correct.\n *\n * Checks if token exists in gateway token contract, `slot` still active, and not expired.\n * Performs additional checks to verify that `owner` is not blacklisted globally.\n */\n function verifyToken(address owner, uint256 network) external view returns (bool);\n\n function verifyToken(uint256 tokenId) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IParameterizedAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity >=0.8.19;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IParameterizedAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(\n bytes32 indexed role,\n uint256 domain,\n bytes32 indexed previousAdminRole,\n bytes32 indexed newAdminRole\n );\n\n event SuperAdminAdded(address indexed account);\n\n event SuperAdminRemoved(address indexed account);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, uint256 domain, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, uint256 domain, address indexed account, address indexed sender);\n\n /// A sender can only renounce roles for themselves\n error ParameterizedAccessControl__RenounceRoleNotForSelf(bytes32 role, address account);\n\n /// A super-admin cannot remove themselves. This is to prevent an accidental lock-out\n error ParameterizedAccessControl__NoSelfAdminRemoval();\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, uint256 domain, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, uint256 domain, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, uint256 domain, address account) external;\n\n function setSuperAdmin(address account) external;\n\n function revokeSuperAdmin(address account) external;\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, uint256 domain, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role, uint256 domain) external view returns (bytes32);\n\n function isSuperAdmin(address account) external view returns (bool);\n}\n" + }, + "contracts/library/BitMask.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nlibrary BitMask {\n uint internal constant _ONE = uint256(1);\n\n /**\n * @dev Internal function to set 1 bit in specific `index`\n * @return Updated bitmask with modified bit at `index`\n */\n function setBit(uint256 self, uint8 index) internal pure returns (uint256) {\n return self | (_ONE << index);\n }\n\n /**\n * @dev Internal function to clear bit to 0 in specific `index`\n * @return Updated bitmask with modified bit at `index`\n */\n function clearBit(uint256 self, uint8 index) internal pure returns (uint256) {\n return self & ~(_ONE << index);\n }\n\n /**\n * @dev Internal function to check bit at specific `index`\n * @return Returns TRUE if bit is '1', FALSE otherwise\n */\n function checkBit(uint256 self, uint8 index) internal pure returns (bool) {\n return (self & (uint256(1) << index)) > 0;\n }\n}\n" + }, + "contracts/library/Charge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nenum ChargeType {\n NONE, // No charge\n ETH, // Charge amount is in Eth (Wei)\n ERC20 // Charge amount is in an ERC20 token (token field) in minor denomination\n}\n\n/**\n * @dev The Charge struct represents details of a charge made to the gatekeeper on\n * gateway token issuance or refresh.\n */\nstruct Charge {\n // the amount in either wei (if chargeType = ETH) or ERC20 minor denomination (if chargeType = ERC20)\n uint256 value;\n // whether to charge in wei or ERC20\n ChargeType chargeType;\n // if chargeType = ERC20, the token to charge in\n address token;\n // the sender of the funds if chargeType = ERC20. This is necessary as the transaction is forwarded,\n // and the originator of the transaction is not clear inside the GatewayToken contract.\n // More details in ChargeHandler.sol\n address tokenSender;\n // the recipient of the funds. Typically a wallet owned by the gatekeeper.\n address recipient;\n}\n" + }, + "contracts/library/CommonErrors.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.19;\n\n/// The passed-in account is the zero-address\nerror Common__MissingAccount();\n\n/// The passed-in account is not a contract, where an account is expected\n/// @param account address of the account.\nerror Common__NotContract(address account);\n\n/// The passed-in account is not a super-admin\n/// @param account address of the account.\nerror Common__NotSuperAdmin(address account);\n\n/// The request was made from an unauthorized address.\n/// @param sender address of the sender.\n/// @param domain the domain to which the role applies.\n/// @param role role that is required.\nerror Common__Unauthorized(address sender, uint domain, bytes32 role);\n" + }, + "contracts/library/InternalTokenApproval.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n/**\n * @title InternalTokenApproval\n * @dev This contract manages token approvals for preventing front-running attacks.\n * Users are required to specifically approve\n * ERC20 spending for a designated gatekeeper network. This is in addition to the general\n * approval given to the GatewayToken contract. The aim is to ensure that malicious actors\n * cannot exploit the process by setting up rogue gatekeeper networks, and then front-running\n * legitimate issuance transactions and siphoning ERC20 tokens from\n * unsuspecting recipients.\n */\ncontract InternalTokenApproval {\n // Mapping of user addresses to their respective internal approval configurations.\n // prettier-ignore\n mapping(\n address userAddress => mapping(\n address gatewayTokenAddress => mapping(\n address erc20TokenAddress => mapping(\n uint256 network => uint256 tokens\n )))) internal _approvals;\n\n /**\n * @dev Set a token approval.\n * @param tokenAddress The address of the token to approve.\n * @param tokens The number of tokens to approve.\n * @param network The specific network for which the tokens are approved.\n */\n function _setApproval(address gatewayTokenAddress, address tokenAddress, uint256 tokens, uint256 network) internal {\n _approvals[msg.sender][gatewayTokenAddress][tokenAddress][network] = tokens;\n }\n\n /**\n * @dev Consume a certain amount of the token approval.\n * @param user The user for which the approval details are to be consumed.\n * @param gatewayTokenAddress The address of the gateway token contract that the tokens are approved to be drwan by.\n * @param tokenAddress The address of the token being spent.\n * @param tokens The number of tokens to consume.\n * @param network The specific network from which the tokens are consumed.\n * @return A boolean indicating if the operation was successful.\n */\n function _consumeApproval(\n address user,\n address gatewayTokenAddress,\n address tokenAddress,\n uint256 tokens,\n uint256 network\n ) internal returns (bool, uint256) {\n if (_approvals[user][gatewayTokenAddress][tokenAddress][network] < tokens) {\n return (false, _approvals[user][gatewayTokenAddress][tokenAddress][network]);\n }\n\n _approvals[user][gatewayTokenAddress][tokenAddress][network] -= tokens;\n return (true, _approvals[user][gatewayTokenAddress][tokenAddress][network]);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n // solhint-disable-next-line\n uint256[49] private __gap;\n}\n" + }, + "contracts/MultiERC2771Context.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport {Context} from \"@openzeppelin/contracts/utils/Context.sol\";\n\n/**\n * @dev Context variant with ERC2771 support for multiple trusted forwarders.\n */\nabstract contract MultiERC2771Context is Context {\n mapping(address => bool) private _trustedForwarders;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(address[] memory trustedForwarders) {\n for (uint i = 0; i < trustedForwarders.length; i++) {\n _trustedForwarders[trustedForwarders[i]] = true;\n }\n }\n\n function isTrustedForwarder(address forwarder) public view virtual returns (bool) {\n return _trustedForwarders[forwarder];\n }\n\n // The overridden function should declare the appropriate access control//\n // keep init functions at the top by the constructor\n function _addForwarder(address forwarder) internal virtual {\n _trustedForwarders[forwarder] = true;\n }\n\n // The overridden function should declare the appropriate access control\n function _removeForwarder(address forwarder) internal virtual {\n _trustedForwarders[forwarder] = false;\n }\n\n function _msgSender() internal view virtual override returns (address sender) {\n if (isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return super._msgSender();\n }\n }\n\n function _msgData() internal view virtual override returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n return msg.data[:msg.data.length - 20];\n } else {\n return super._msgData();\n }\n }\n}\n" + }, + "contracts/MultiERC2771ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/**\n * @dev Context variant with ERC2771 support for multiple trusted forwarders.\n */\nabstract contract MultiERC2771ContextUpgradeable is ContextUpgradeable {\n mapping(address => bool) private _trustedForwarders;\n\n function isTrustedForwarder(address forwarder) public view virtual returns (bool) {\n return _trustedForwarders[forwarder];\n }\n\n // because MultiERC2771ContextUpgradeable is abstract we don't implement a\n // constructor. It's the responsibility of the derived contract to\n // disable the Initializers with \"_disableInitializers()\"\n\n // solhint-disable-next-line func-name-mixedcase\n function __MultiERC2771ContextUpgradeable_init(address[] calldata trustedForwarders) internal onlyInitializing {\n __Context_init_unchained();\n __MultiERC2771ContextUpgradeable_init_unchained(trustedForwarders);\n }\n\n // solhint-disable-next-line func-name-mixedcase\n function __MultiERC2771ContextUpgradeable_init_unchained(\n address[] calldata trustedForwarders\n ) internal onlyInitializing {\n for (uint i = 0; i < trustedForwarders.length; i++) {\n _trustedForwarders[trustedForwarders[i]] = true;\n }\n }\n\n // The overridden function should declare the appropriate access control//\n // keep init functions at the top by the constructor\n function _addForwarder(address forwarder) internal virtual {\n _trustedForwarders[forwarder] = true;\n }\n\n // The overridden function should declare the appropriate access control\n function _removeForwarder(address forwarder) internal virtual {\n _trustedForwarders[forwarder] = false;\n }\n\n function _msgSender() internal view virtual override returns (address sender) {\n if (isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return super._msgSender();\n }\n }\n\n function _msgData() internal view virtual override returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender) && msg.data.length >= 20) {\n return msg.data[:msg.data.length - 20];\n } else {\n return super._msgData();\n }\n }\n}\n" + }, + "contracts/ParameterizedAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)\n\npragma solidity >=0.8.19;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IParameterizedAccessControl} from \"./interfaces/IParameterizedAccessControl.sol\";\nimport {Common__Unauthorized, Common__NotSuperAdmin} from \"./library/CommonErrors.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract ParameterizedAccessControl is ContextUpgradeable, IParameterizedAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n struct RoleDomain {\n mapping(bytes32 => RoleData) roles;\n }\n\n mapping(uint256 => RoleDomain) private _roleDomain;\n mapping(address => bool) internal _superAdmins;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role.\n */\n modifier onlyRole(bytes32 role, uint256 domain) {\n _checkRole(role, domain);\n _;\n }\n\n /**\n * @dev Modifier that checks that an account is a super admin. Reverts if not.\n */\n modifier onlySuperAdmin() {\n _onlySuperAdmin();\n _;\n }\n\n function setSuperAdmin(address account) external onlySuperAdmin {\n emit SuperAdminAdded(account);\n _superAdmins[account] = true;\n }\n\n function revokeSuperAdmin(address account) external onlySuperAdmin {\n if (account == _msgSender()) revert ParameterizedAccessControl__NoSelfAdminRemoval();\n emit SuperAdminRemoved(account);\n _superAdmins[account] = false;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(\n bytes32 role,\n uint256 domain,\n address account\n ) public virtual override onlyRole(getRoleAdmin(role, domain), domain) {\n _grantRole(role, domain, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(\n bytes32 role,\n uint256 domain,\n address account\n ) public virtual override onlyRole(getRoleAdmin(role, domain), domain) {\n _revokeRole(role, domain, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, uint256 domain, address account) public virtual override {\n if (account != _msgSender()) revert ParameterizedAccessControl__RenounceRoleNotForSelf(role, account);\n\n _revokeRole(role, domain, account);\n }\n\n function isSuperAdmin(address account) public view returns (bool) {\n return _superAdmins[account];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IParameterizedAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, uint256 domain, address account) public view virtual override returns (bool) {\n return _roleDomain[domain].roles[role].members[account];\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role, uint256 domain) public view virtual override returns (bytes32) {\n return _roleDomain[domain].roles[role].adminRole;\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Internal function without access restriction.\n *\n * [WARNING]\n * ====\n * This function should only be called from when setting\n * up the initial roles for the system or domain.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {ParameterizedAccessControl}.\n * ====\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, uint256 domain, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role, domain);\n _roleDomain[domain].roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, domain, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * [WARNING]\n * ====\n * This function should only be called from when setting\n * up the initial roles for the system or domain.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {ParameterizedAccessControl}.\n * ====\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, uint256 domain, address account) internal virtual {\n if (!hasRole(role, domain, account)) {\n _roleDomain[domain].roles[role].members[account] = true;\n emit RoleGranted(role, domain, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, uint256 domain, address account) internal virtual {\n if (hasRole(role, domain, account)) {\n _roleDomain[domain].roles[role].members[account] = false;\n emit RoleRevoked(role, domain, account, _msgSender());\n }\n }\n\n /**\n * @dev Revert if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role, uint256 domain) internal view virtual {\n _checkRole(role, domain, _msgSender());\n }\n\n /**\n * @dev Revert if `account` is missing `role`.\n *\n */\n function _checkRole(bytes32 role, uint256 domain, address account) internal view virtual {\n if (!hasRole(role, domain, account)) {\n revert Common__Unauthorized(account, domain, role);\n }\n }\n\n /**\n * @dev Revert if `account` is not a super admin\n */\n function _checkAdmin(address account) internal view virtual {\n if (!isSuperAdmin(account)) revert Common__NotSuperAdmin(account);\n }\n\n // separate into a private function to reduce code size\n function _onlySuperAdmin() private view {\n _checkAdmin(_msgSender());\n }\n}\n" + }, + "contracts/TokenBitMask.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19; // Fixed version for concrete contracts\n\nimport {BitMask} from \"./library/BitMask.sol\";\nimport {IFlagsStorage} from \"./interfaces/IFlagsStorage.sol\";\n\n/**\n * @dev TokenBitMask contract is an internal smart contract for Gateway Token\n * implementation that stores KYC flags, defined in a FlagsStorage contract,\n * for each gateway token in a bitmask.\n */\ncontract TokenBitMask {\n using BitMask for uint256;\n\n // Gateway Token system FlagsStorage contract address\n IFlagsStorage public flagsStorage;\n\n // Mapping for gateway token id to bitmask\n mapping(uint256 => uint256) private _bitmasks;\n\n /**\n * @dev Emitted when token BitMask associated with `tokenId` updated to `bitmask`.\n */\n event BitMaskUpdated(uint256 tokenId, uint256 bitmask);\n\n /**\n * @dev Emitted when Identity.com Admin updated FlagsStorage\n * contract address from `previousFlagsStorage` to `flagsStorage`.\n */\n event FlagsStorageUpdated(address indexed flagsStorage);\n\n /**\n * @dev Internal function to set FlagsStorage contract address\n * @param _flagsStorage FlagsStorage contract address\n */\n function _setFlagsStorage(address _flagsStorage) internal {\n flagsStorage = IFlagsStorage(_flagsStorage);\n\n emit FlagsStorageUpdated(_flagsStorage);\n }\n\n /**\n * @dev Internal function to set full bitmask for gateway token\n * @notice This function rewrites previous bitmask, use _addBitmask if you need to add flags to existing bitmask\n */\n function _setBitMask(uint256 tokenId, uint256 mask) internal {\n _bitmasks[tokenId] = mask;\n\n emit BitMaskUpdated(tokenId, mask);\n }\n\n /**\n * @dev Internal function to get gateway token bitmask\n */\n function _getBitMask(uint256 tokenId) internal view returns (uint256) {\n return _bitmasks[tokenId];\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 100 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/ethereum/smart-contract/deployments/polygonAmoy/solcInputs/87b3170c5841073ac3f676d17cabccfa.json b/ethereum/smart-contract/deployments/polygonAmoy/solcInputs/87b3170c5841073ac3f676d17cabccfa.json new file mode 100644 index 000000000..2c699af4a --- /dev/null +++ b/ethereum/smart-contract/deployments/polygonAmoy/solcInputs/87b3170c5841073ac3f676d17cabccfa.json @@ -0,0 +1,188 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.3) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.9._\n */\ninterface IERC1967Upgradeable {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.3) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/IERC1967Upgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@solvprotocol/erc-3525/ERC3525Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC3525Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./IERC3525ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721EnumerableUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"./extensions/IERC3525MetadataUpgradeable.sol\";\nimport \"./periphery/interface/IERC3525MetadataDescriptorUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\ncontract ERC3525Upgradeable is Initializable, ContextUpgradeable, IERC3525MetadataUpgradeable, IERC721EnumerableUpgradeable {\n using StringsUpgradeable for address;\n using StringsUpgradeable for uint256;\n using AddressUpgradeable for address;\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n event SetMetadataDescriptor(address indexed metadataDescriptor);\n\n struct TokenData {\n uint256 id;\n uint256 slot;\n uint256 balance;\n address owner;\n address approved;\n address[] valueApprovals;\n }\n\n struct AddressData {\n uint256[] ownedTokens;\n mapping(uint256 => uint256) ownedTokensIndex;\n mapping(address => bool) approvals;\n }\n\n string private _name;\n string private _symbol;\n uint8 private _decimals;\n CountersUpgradeable.Counter private _tokenIdGenerator;\n\n // id => (approval => allowance)\n // @dev _approvedValues cannot be defined within TokenData, cause struct containing mappings cannot be constructed.\n mapping(uint256 => mapping(address => uint256)) private _approvedValues;\n\n TokenData[] private _allTokens;\n\n // key: id\n mapping(uint256 => uint256) private _allTokensIndex;\n\n mapping(address => AddressData) private _addressData;\n\n IERC3525MetadataDescriptorUpgradeable public metadataDescriptor;\n\n function __ERC3525_init(string memory name_, string memory symbol_, uint8 decimals_) internal onlyInitializing {\n __ERC3525_init_unchained(name_, symbol_, decimals_);\n }\n\n function __ERC3525_init_unchained(string memory name_, string memory symbol_, uint8 decimals_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n _decimals = decimals_;\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return\n interfaceId == type(IERC165Upgradeable).interfaceId ||\n interfaceId == type(IERC3525Upgradeable).interfaceId ||\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC3525MetadataUpgradeable).interfaceId ||\n interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || \n interfaceId == type(IERC721MetadataUpgradeable).interfaceId;\n }\n\n /**\n * @dev Returns the token collection name.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals the token uses for value.\n */\n function valueDecimals() public view virtual override returns (uint8) {\n return _decimals;\n }\n\n function balanceOf(uint256 tokenId_) public view virtual override returns (uint256) {\n _requireMinted(tokenId_);\n return _allTokens[_allTokensIndex[tokenId_]].balance;\n }\n\n function ownerOf(uint256 tokenId_) public view virtual override returns (address owner_) {\n _requireMinted(tokenId_);\n owner_ = _allTokens[_allTokensIndex[tokenId_]].owner;\n require(owner_ != address(0), \"ERC3525: invalid token ID\");\n }\n\n function slotOf(uint256 tokenId_) public view virtual override returns (uint256) {\n _requireMinted(tokenId_);\n return _allTokens[_allTokensIndex[tokenId_]].slot;\n }\n\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n function contractURI() public view virtual override returns (string memory) {\n string memory baseURI = _baseURI();\n return \n address(metadataDescriptor) != address(0) ? \n metadataDescriptor.constructContractURI() :\n bytes(baseURI).length > 0 ? \n string(abi.encodePacked(baseURI, \"contract/\", StringsUpgradeable.toHexString(address(this)))) : \n \"\";\n }\n\n function slotURI(uint256 slot_) public view virtual override returns (string memory) {\n string memory baseURI = _baseURI();\n return \n address(metadataDescriptor) != address(0) ? \n metadataDescriptor.constructSlotURI(slot_) : \n bytes(baseURI).length > 0 ? \n string(abi.encodePacked(baseURI, \"slot/\", slot_.toString())) : \n \"\";\n }\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId_) public view virtual override returns (string memory) {\n _requireMinted(tokenId_);\n string memory baseURI = _baseURI();\n return \n address(metadataDescriptor) != address(0) ? \n metadataDescriptor.constructTokenURI(tokenId_) : \n bytes(baseURI).length > 0 ? \n string(abi.encodePacked(baseURI, tokenId_.toString())) : \n \"\";\n }\n\n function approve(uint256 tokenId_, address to_, uint256 value_) public payable virtual override {\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\n require(to_ != owner, \"ERC3525: approval to current owner\");\n\n require(_isApprovedOrOwner(_msgSender(), tokenId_), \"ERC3525: approve caller is not owner nor approved\");\n\n _approveValue(tokenId_, to_, value_);\n }\n\n function allowance(uint256 tokenId_, address operator_) public view virtual override returns (uint256) {\n _requireMinted(tokenId_);\n return _approvedValues[tokenId_][operator_];\n }\n\n function transferFrom(\n uint256 fromTokenId_,\n address to_,\n uint256 value_\n ) public payable virtual override returns (uint256 newTokenId) {\n _spendAllowance(_msgSender(), fromTokenId_, value_);\n\n newTokenId = _createDerivedTokenId(fromTokenId_);\n _mint(to_, newTokenId, ERC3525Upgradeable.slotOf(fromTokenId_), 0);\n _transferValue(fromTokenId_, newTokenId, value_);\n }\n\n function transferFrom(\n uint256 fromTokenId_,\n uint256 toTokenId_,\n uint256 value_\n ) public payable virtual override {\n _spendAllowance(_msgSender(), fromTokenId_, value_);\n _transferValue(fromTokenId_, toTokenId_, value_);\n }\n\n function balanceOf(address owner_) public view virtual override returns (uint256 balance) {\n require(owner_ != address(0), \"ERC3525: balance query for the zero address\");\n return _addressData[owner_].ownedTokens.length;\n }\n\n function transferFrom(\n address from_,\n address to_,\n uint256 tokenId_\n ) public payable virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId_), \"ERC3525: transfer caller is not owner nor approved\");\n _transferTokenId(from_, to_, tokenId_);\n }\n\n function safeTransferFrom(\n address from_,\n address to_,\n uint256 tokenId_,\n bytes memory data_\n ) public payable virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId_), \"ERC3525: transfer caller is not owner nor approved\");\n _safeTransferTokenId(from_, to_, tokenId_, data_);\n }\n\n function safeTransferFrom(\n address from_,\n address to_,\n uint256 tokenId_\n ) public payable virtual override {\n safeTransferFrom(from_, to_, tokenId_, \"\");\n }\n\n function approve(address to_, uint256 tokenId_) public payable virtual override {\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\n require(to_ != owner, \"ERC3525: approval to current owner\");\n\n require(\n _msgSender() == owner || ERC3525Upgradeable.isApprovedForAll(owner, _msgSender()),\n \"ERC3525: approve caller is not owner nor approved for all\"\n );\n\n _approve(to_, tokenId_);\n }\n\n function getApproved(uint256 tokenId_) public view virtual override returns (address) {\n _requireMinted(tokenId_);\n return _allTokens[_allTokensIndex[tokenId_]].approved;\n }\n\n function setApprovalForAll(address operator_, bool approved_) public virtual override {\n _setApprovalForAll(_msgSender(), operator_, approved_);\n }\n\n function isApprovedForAll(address owner_, address operator_) public view virtual override returns (bool) {\n return _addressData[owner_].approvals[operator_];\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n function tokenByIndex(uint256 index_) public view virtual override returns (uint256) {\n require(index_ < ERC3525Upgradeable.totalSupply(), \"ERC3525: global index out of bounds\");\n return _allTokens[index_].id;\n }\n\n function tokenOfOwnerByIndex(address owner_, uint256 index_) public view virtual override returns (uint256) {\n require(index_ < ERC3525Upgradeable.balanceOf(owner_), \"ERC3525: owner index out of bounds\");\n return _addressData[owner_].ownedTokens[index_];\n }\n\n function _setApprovalForAll(\n address owner_,\n address operator_,\n bool approved_\n ) internal virtual {\n require(owner_ != operator_, \"ERC3525: approve to caller\");\n\n _addressData[owner_].approvals[operator_] = approved_;\n\n emit ApprovalForAll(owner_, operator_, approved_);\n }\n\n function _isApprovedOrOwner(address operator_, uint256 tokenId_) internal view virtual returns (bool) {\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\n return (\n operator_ == owner ||\n ERC3525Upgradeable.isApprovedForAll(owner, operator_) ||\n ERC3525Upgradeable.getApproved(tokenId_) == operator_\n );\n }\n\n function _spendAllowance(address operator_, uint256 tokenId_, uint256 value_) internal virtual {\n uint256 currentAllowance = ERC3525Upgradeable.allowance(tokenId_, operator_);\n if (!_isApprovedOrOwner(operator_, tokenId_) && currentAllowance != type(uint256).max) {\n require(currentAllowance >= value_, \"ERC3525: insufficient allowance\");\n _approveValue(tokenId_, operator_, currentAllowance - value_);\n }\n }\n\n function _exists(uint256 tokenId_) internal view virtual returns (bool) {\n return _allTokens.length != 0 && _allTokens[_allTokensIndex[tokenId_]].id == tokenId_;\n }\n\n function _requireMinted(uint256 tokenId_) internal view virtual {\n require(_exists(tokenId_), \"ERC3525: invalid token ID\");\n }\n\n function _mint(address to_, uint256 slot_, uint256 value_) internal virtual returns (uint256 tokenId) {\n tokenId = _createOriginalTokenId();\n _mint(to_, tokenId, slot_, value_); \n }\n\n function _mint(address to_, uint256 tokenId_, uint256 slot_, uint256 value_) internal virtual {\n require(to_ != address(0), \"ERC3525: mint to the zero address\");\n require(tokenId_ != 0, \"ERC3525: cannot mint zero tokenId\");\n require(!_exists(tokenId_), \"ERC3525: token already minted\");\n\n _beforeValueTransfer(address(0), to_, 0, tokenId_, slot_, value_);\n __mintToken(to_, tokenId_, slot_);\n __mintValue(tokenId_, value_);\n _afterValueTransfer(address(0), to_, 0, tokenId_, slot_, value_);\n }\n\n function _mintValue(uint256 tokenId_, uint256 value_) internal virtual {\n address owner = ERC3525Upgradeable.ownerOf(tokenId_);\n uint256 slot = ERC3525Upgradeable.slotOf(tokenId_);\n _beforeValueTransfer(address(0), owner, 0, tokenId_, slot, value_);\n __mintValue(tokenId_, value_);\n _afterValueTransfer(address(0), owner, 0, tokenId_, slot, value_);\n }\n\n function __mintValue(uint256 tokenId_, uint256 value_) private {\n _allTokens[_allTokensIndex[tokenId_]].balance += value_;\n emit TransferValue(0, tokenId_, value_);\n }\n\n function __mintToken(address to_, uint256 tokenId_, uint256 slot_) private {\n TokenData memory tokenData = TokenData({\n id: tokenId_,\n slot: slot_,\n balance: 0,\n owner: to_,\n approved: address(0),\n valueApprovals: new address[](0)\n });\n\n _addTokenToAllTokensEnumeration(tokenData);\n _addTokenToOwnerEnumeration(to_, tokenId_);\n\n emit Transfer(address(0), to_, tokenId_);\n emit SlotChanged(tokenId_, 0, slot_);\n }\n\n function _burn(uint256 tokenId_) internal virtual {\n _requireMinted(tokenId_);\n\n TokenData storage tokenData = _allTokens[_allTokensIndex[tokenId_]];\n address owner = tokenData.owner;\n uint256 slot = tokenData.slot;\n uint256 value = tokenData.balance;\n\n _beforeValueTransfer(owner, address(0), tokenId_, 0, slot, value);\n\n _clearApprovedValues(tokenId_);\n _removeTokenFromOwnerEnumeration(owner, tokenId_);\n _removeTokenFromAllTokensEnumeration(tokenId_);\n\n emit TransferValue(tokenId_, 0, value);\n emit SlotChanged(tokenId_, slot, 0);\n emit Transfer(owner, address(0), tokenId_);\n\n _afterValueTransfer(owner, address(0), tokenId_, 0, slot, value);\n }\n\n function _burnValue(uint256 tokenId_, uint256 burnValue_) internal virtual {\n _requireMinted(tokenId_);\n\n TokenData storage tokenData = _allTokens[_allTokensIndex[tokenId_]];\n address owner = tokenData.owner;\n uint256 slot = tokenData.slot;\n uint256 value = tokenData.balance;\n\n require(value >= burnValue_, \"ERC3525: burn value exceeds balance\");\n\n _beforeValueTransfer(owner, address(0), tokenId_, 0, slot, burnValue_);\n \n tokenData.balance -= burnValue_;\n emit TransferValue(tokenId_, 0, burnValue_);\n \n _afterValueTransfer(owner, address(0), tokenId_, 0, slot, burnValue_);\n }\n\n function _addTokenToOwnerEnumeration(address to_, uint256 tokenId_) private {\n _allTokens[_allTokensIndex[tokenId_]].owner = to_;\n\n _addressData[to_].ownedTokensIndex[tokenId_] = _addressData[to_].ownedTokens.length;\n _addressData[to_].ownedTokens.push(tokenId_);\n }\n\n function _removeTokenFromOwnerEnumeration(address from_, uint256 tokenId_) private {\n _allTokens[_allTokensIndex[tokenId_]].owner = address(0);\n\n AddressData storage ownerData = _addressData[from_];\n uint256 lastTokenIndex = ownerData.ownedTokens.length - 1;\n uint256 lastTokenId = ownerData.ownedTokens[lastTokenIndex];\n uint256 tokenIndex = ownerData.ownedTokensIndex[tokenId_];\n\n ownerData.ownedTokens[tokenIndex] = lastTokenId;\n ownerData.ownedTokensIndex[lastTokenId] = tokenIndex;\n\n delete ownerData.ownedTokensIndex[tokenId_];\n ownerData.ownedTokens.pop();\n }\n\n function _addTokenToAllTokensEnumeration(TokenData memory tokenData_) private {\n _allTokensIndex[tokenData_.id] = _allTokens.length;\n _allTokens.push(tokenData_);\n }\n\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId_) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId_];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n TokenData memory lastTokenData = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenData; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenData.id] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId_];\n _allTokens.pop();\n }\n\n function _approve(address to_, uint256 tokenId_) internal virtual {\n _allTokens[_allTokensIndex[tokenId_]].approved = to_;\n emit Approval(ERC3525Upgradeable.ownerOf(tokenId_), to_, tokenId_);\n }\n\n function _approveValue(\n uint256 tokenId_,\n address to_,\n uint256 value_\n ) internal virtual {\n require(to_ != address(0), \"ERC3525: approve value to the zero address\");\n if (!_existApproveValue(to_, tokenId_)) {\n _allTokens[_allTokensIndex[tokenId_]].valueApprovals.push(to_);\n }\n _approvedValues[tokenId_][to_] = value_;\n\n emit ApprovalValue(tokenId_, to_, value_);\n }\n\n function _clearApprovedValues(uint256 tokenId_) internal virtual {\n TokenData storage tokenData = _allTokens[_allTokensIndex[tokenId_]];\n uint256 length = tokenData.valueApprovals.length;\n for (uint256 i = 0; i < length; i++) {\n address approval = tokenData.valueApprovals[i];\n delete _approvedValues[tokenId_][approval];\n }\n delete tokenData.valueApprovals;\n }\n\n function _existApproveValue(address to_, uint256 tokenId_) internal view virtual returns (bool) {\n uint256 length = _allTokens[_allTokensIndex[tokenId_]].valueApprovals.length;\n for (uint256 i = 0; i < length; i++) {\n if (_allTokens[_allTokensIndex[tokenId_]].valueApprovals[i] == to_) {\n return true;\n }\n }\n return false;\n }\n\n function _transferValue(\n uint256 fromTokenId_,\n uint256 toTokenId_,\n uint256 value_\n ) internal virtual {\n require(_exists(fromTokenId_), \"ERC3525: transfer from invalid token ID\");\n require(_exists(toTokenId_), \"ERC3525: transfer to invalid token ID\");\n\n TokenData storage fromTokenData = _allTokens[_allTokensIndex[fromTokenId_]];\n TokenData storage toTokenData = _allTokens[_allTokensIndex[toTokenId_]];\n\n require(fromTokenData.balance >= value_, \"ERC3525: insufficient balance for transfer\");\n require(fromTokenData.slot == toTokenData.slot, \"ERC3525: transfer to token with different slot\");\n\n _beforeValueTransfer(\n fromTokenData.owner,\n toTokenData.owner,\n fromTokenId_,\n toTokenId_,\n fromTokenData.slot,\n value_\n );\n\n fromTokenData.balance -= value_;\n toTokenData.balance += value_;\n\n emit TransferValue(fromTokenId_, toTokenId_, value_);\n\n _afterValueTransfer(\n fromTokenData.owner,\n toTokenData.owner,\n fromTokenId_,\n toTokenId_,\n fromTokenData.slot,\n value_\n );\n\n require(\n _checkOnERC3525Received(fromTokenId_, toTokenId_, value_, \"\"),\n \"ERC3525: transfer rejected by ERC3525Receiver\"\n );\n }\n\n function _transferTokenId(\n address from_,\n address to_,\n uint256 tokenId_\n ) internal virtual {\n require(ERC3525Upgradeable.ownerOf(tokenId_) == from_, \"ERC3525: transfer from invalid owner\");\n require(to_ != address(0), \"ERC3525: transfer to the zero address\");\n\n uint256 slot = ERC3525Upgradeable.slotOf(tokenId_);\n uint256 value = ERC3525Upgradeable.balanceOf(tokenId_);\n\n _beforeValueTransfer(from_, to_, tokenId_, tokenId_, slot, value);\n\n _approve(address(0), tokenId_);\n _clearApprovedValues(tokenId_);\n\n _removeTokenFromOwnerEnumeration(from_, tokenId_);\n _addTokenToOwnerEnumeration(to_, tokenId_);\n\n emit Transfer(from_, to_, tokenId_);\n\n _afterValueTransfer(from_, to_, tokenId_, tokenId_, slot, value);\n }\n\n function _safeTransferTokenId(\n address from_,\n address to_,\n uint256 tokenId_,\n bytes memory data_\n ) internal virtual {\n _transferTokenId(from_, to_, tokenId_);\n require(\n _checkOnERC721Received(from_, to_, tokenId_, data_),\n \"ERC3525: transfer to non ERC721Receiver\"\n );\n }\n\n function _checkOnERC3525Received( \n uint256 fromTokenId_, \n uint256 toTokenId_, \n uint256 value_, \n bytes memory data_\n ) private returns (bool) {\n address to = ERC3525Upgradeable.ownerOf(toTokenId_);\n if (to.isContract() && IERC165Upgradeable(to).supportsInterface(type(IERC3525ReceiverUpgradeable).interfaceId)) {\n bytes4 retval = IERC3525ReceiverUpgradeable(to).onERC3525Received(_msgSender(), fromTokenId_, toTokenId_, value_, data_);\n return retval == IERC3525ReceiverUpgradeable.onERC3525Received.selector;\n } else {\n return true;\n }\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from_ address representing the previous owner of the given token ID\n * @param to_ target address that will receive the tokens\n * @param tokenId_ uint256 ID of the token to be transferred\n * @param data_ bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from_,\n address to_,\n uint256 tokenId_,\n bytes memory data_\n ) private returns (bool) {\n if (to_.isContract()) {\n try \n IERC721ReceiverUpgradeable(to_).onERC721Received(_msgSender(), from_, tokenId_, data_) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /* solhint-disable */\n function _beforeValueTransfer(\n address from_,\n address to_,\n uint256 fromTokenId_,\n uint256 toTokenId_,\n uint256 slot_,\n uint256 value_\n ) internal virtual {}\n\n function _afterValueTransfer(\n address from_,\n address to_,\n uint256 fromTokenId_,\n uint256 toTokenId_,\n uint256 slot_,\n uint256 value_\n ) internal virtual {}\n /* solhint-enable */\n\n function _setMetadataDescriptor(address metadataDescriptor_) internal virtual {\n metadataDescriptor = IERC3525MetadataDescriptorUpgradeable(metadataDescriptor_);\n emit SetMetadataDescriptor(metadataDescriptor_);\n }\n\n function _createOriginalTokenId() internal virtual returns (uint256) {\n _tokenIdGenerator.increment();\n return _tokenIdGenerator.current();\n }\n\n function _createDerivedTokenId(uint256 fromTokenId_) internal virtual returns (uint256) {\n fromTokenId_;\n return _createOriginalTokenId();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[41] private __gap;\n}\n" + }, + "@solvprotocol/erc-3525/extensions/IERC3525MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\nimport \"../IERC3525Upgradeable.sol\";\nimport \"./IERC721MetadataUpgradeable.sol\";\n\n/**\n * @title ERC-3525 Semi-Fungible Token Standard, optional extension for metadata\n * @dev Interfaces for any contract that wants to support query of the Uniform Resource Identifier\n * (URI) for the ERC3525 contract as well as a specified slot.\n * Because of the higher reliability of data stored in smart contracts compared to data stored in\n * centralized systems, it is recommended that metadata, including `contractURI`, `slotURI` and\n * `tokenURI`, be directly returned in JSON format, instead of being returned with a url pointing\n * to any resource stored in a centralized system.\n * See https://eips.ethereum.org/EIPS/eip-3525\n * Note: the ERC-165 identifier for this interface is 0xe1600902.\n */\ninterface IERC3525MetadataUpgradeable is IERC3525Upgradeable, IERC721MetadataUpgradeable {\n /**\n * @notice Returns the Uniform Resource Identifier (URI) for the current ERC3525 contract.\n * @dev This function SHOULD return the URI for this contract in JSON format, starting with\n * header `data:application/json;`.\n * See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for contract URI.\n * @return The JSON formatted URI of the current ERC3525 contract\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the Uniform Resource Identifier (URI) for the specified slot.\n * @dev This function SHOULD return the URI for `_slot` in JSON format, starting with header\n * `data:application/json;`.\n * See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for slot URI.\n * @return The JSON formatted URI of `_slot`\n */\n function slotURI(uint256 _slot) external view returns (string memory);\n}\n" + }, + "@solvprotocol/erc-3525/extensions/IERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n * Note: the ERC-165 identifier for this interface is 0x780e9d63.\n */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /** \n * @notice Count NFTs tracked by this contract\n * @return A count of valid NFTs tracked by this contract, where each one of\n * them has an assigned and queryable owner not equal to the zero address\n */\n function totalSupply() external view returns (uint256);\n\n /** \n * @notice Enumerate valid NFTs\n * @dev Throws if `_index` >= `totalSupply()`.\n * @param _index A counter less than `totalSupply()`\n * @return The token identifier for the `_index`th NFT,\n * (sort order not specified)\n */\n function tokenByIndex(uint256 _index) external view returns (uint256);\n\n /** \n * @notice Enumerate NFTs assigned to an owner\n * @dev Throws if `_index` >= `balanceOf(_owner)` or if\n * `_owner` is the zero address, representing invalid NFTs.\n * @param _owner An address where we are interested in NFTs owned by them\n * @param _index A counter less than `balanceOf(_owner)`\n * @return The token identifier for the `_index`th NFT assigned to `_owner`,\n * (sort order not specified)\n */\n function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);\n}\n" + }, + "@solvprotocol/erc-3525/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n * Note: the ERC-165 identifier for this interface is 0x5b5e139f.\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @notice A descriptive name for a collection of NFTs in this contract\n */\n function name() external view returns (string memory);\n\n /**\n * @notice An abbreviated name for NFTs in this contract\n */\n function symbol() external view returns (string memory);\n\n /**\n * @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n * @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC\n * 3986. The URI may point to a JSON file that conforms to the \"ERC721\n * Metadata JSON Schema\".\n */\n function tokenURI(uint256 _tokenId) external view returns (string memory);\n}\n" + }, + "@solvprotocol/erc-3525/IERC3525.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./IERC721.sol\";\n\n/**\n * @title ERC-3525 Semi-Fungible Token Standard\n * @dev See https://eips.ethereum.org/EIPS/eip-3525\n * Note: the ERC-165 identifier for this interface is 0xd5358140.\n */\ninterface IERC3525 is IERC165, IERC721 {\n /**\n * @dev MUST emit when value of a token is transferred to another token with the same slot,\n * including zero value transfers (_value == 0) as well as transfers when tokens are created\n * (`_fromTokenId` == 0) or destroyed (`_toTokenId` == 0).\n * @param _fromTokenId The token id to transfer value from\n * @param _toTokenId The token id to transfer value to\n * @param _value The transferred value\n */\n event TransferValue(uint256 indexed _fromTokenId, uint256 indexed _toTokenId, uint256 _value);\n\n /**\n * @dev MUST emits when the approval value of a token is set or changed.\n * @param _tokenId The token to approve\n * @param _operator The operator to approve for\n * @param _value The maximum value that `_operator` is allowed to manage\n */\n event ApprovalValue(uint256 indexed _tokenId, address indexed _operator, uint256 _value);\n\n /**\n * @dev MUST emit when the slot of a token is set or changed.\n * @param _tokenId The token of which slot is set or changed\n * @param _oldSlot The previous slot of the token\n * @param _newSlot The updated slot of the token\n */ \n event SlotChanged(uint256 indexed _tokenId, uint256 indexed _oldSlot, uint256 indexed _newSlot);\n\n /**\n * @notice Get the number of decimals the token uses for value - e.g. 6, means the user\n * representation of the value of a token can be calculated by dividing it by 1,000,000.\n * Considering the compatibility with third-party wallets, this function is defined as\n * `valueDecimals()` instead of `decimals()` to avoid conflict with ERC20 tokens.\n * @return The number of decimals for value\n */\n function valueDecimals() external view returns (uint8);\n\n /**\n * @notice Get the value of a token.\n * @param _tokenId The token for which to query the balance\n * @return The value of `_tokenId`\n */\n function balanceOf(uint256 _tokenId) external view returns (uint256);\n\n /**\n * @notice Get the slot of a token.\n * @param _tokenId The identifier for a token\n * @return The slot of the token\n */\n function slotOf(uint256 _tokenId) external view returns (uint256);\n\n /**\n * @notice Allow an operator to manage the value of a token, up to the `_value` amount.\n * @dev MUST revert unless caller is the current owner, an authorized operator, or the approved\n * address for `_tokenId`.\n * MUST emit ApprovalValue event.\n * @param _tokenId The token to approve\n * @param _operator The operator to be approved\n * @param _value The maximum value of `_toTokenId` that `_operator` is allowed to manage\n */\n function approve(\n uint256 _tokenId,\n address _operator,\n uint256 _value\n ) external payable;\n\n /**\n * @notice Get the maximum value of a token that an operator is allowed to manage.\n * @param _tokenId The token for which to query the allowance\n * @param _operator The address of an operator\n * @return The current approval value of `_tokenId` that `_operator` is allowed to manage\n */\n function allowance(uint256 _tokenId, address _operator) external view returns (uint256);\n\n /**\n * @notice Transfer value from a specified token to another specified token with the same slot.\n * @dev Caller MUST be the current owner, an authorized operator or an operator who has been\n * approved the whole `_fromTokenId` or part of it.\n * MUST revert if `_fromTokenId` or `_toTokenId` is zero token id or does not exist.\n * MUST revert if slots of `_fromTokenId` and `_toTokenId` do not match.\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\n * operator.\n * MUST emit `TransferValue` event.\n * @param _fromTokenId The token to transfer value from\n * @param _toTokenId The token to transfer value to\n * @param _value The transferred value\n */\n function transferFrom(\n uint256 _fromTokenId,\n uint256 _toTokenId,\n uint256 _value\n ) external payable;\n\n /**\n * @notice Transfer value from a specified token to an address. The caller should confirm that\n * `_to` is capable of receiving ERC3525 tokens.\n * @dev This function MUST create a new ERC3525 token with the same slot for `_to` to receive\n * the transferred value.\n * MUST revert if `_fromTokenId` is zero token id or does not exist.\n * MUST revert if `_to` is zero address.\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\n * operator.\n * MUST emit `Transfer` and `TransferValue` events.\n * @param _fromTokenId The token to transfer value from\n * @param _to The address to transfer value to\n * @param _value The transferred value\n * @return ID of the new token created for `_to` which receives the transferred value\n */\n function transferFrom(\n uint256 _fromTokenId,\n address _to,\n uint256 _value\n ) external payable returns (uint256);\n}\n" + }, + "@solvprotocol/erc-3525/IERC3525ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\n/**\n * @title EIP-3525 token receiver interface\n * @dev Interface for a smart contract that wants to be informed by EIP-3525 contracts when \n * receiving values from ANY addresses or EIP-3525 tokens.\n * Note: the EIP-165 identifier for this interface is 0x009ce20b.\n */\ninterface IERC3525ReceiverUpgradeable {\n /**\n * @notice Handle the receipt of an EIP-3525 token value.\n * @dev An EIP-3525 smart contract MUST check whether this function is implemented by the \n * recipient contract, if the recipient contract implements this function, the EIP-3525 \n * contract MUST call this function after a value transfer (i.e. `transferFrom(uint256,\n * uint256,uint256,bytes)`).\n * MUST return 0x009ce20b (i.e. `bytes4(keccak256('onERC3525Received(address,uint256,uint256,\n * uint256,bytes)'))`) if the transfer is accepted.\n * MUST revert or return any value other than 0x009ce20b if the transfer is rejected.\n * @param _operator The address which triggered the transfer\n * @param _fromTokenId The token id to transfer value from\n * @param _toTokenId The token id to transfer value to\n * @param _value The transferred value\n * @param _data Additional data with no specified format\n * @return `bytes4(keccak256('onERC3525Received(address,uint256,uint256,uint256,bytes)'))` \n * unless the transfer is rejected.\n */\n function onERC3525Received(address _operator, uint256 _fromTokenId, uint256 _toTokenId, uint256 _value, bytes calldata _data) external returns (bytes4);\n\n}" + }, + "@solvprotocol/erc-3525/IERC3525Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\nimport \"./IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-3525 Semi-Fungible Token Standard\n * @dev See https://eips.ethereum.org/EIPS/eip-3525\n * Note: the ERC-165 identifier for this interface is 0xd5358140.\n */\ninterface IERC3525Upgradeable is IERC165Upgradeable, IERC721Upgradeable {\n /**\n * @dev MUST emit when value of a token is transferred to another token with the same slot,\n * including zero value transfers (_value == 0) as well as transfers when tokens are created\n * (`_fromTokenId` == 0) or destroyed (`_toTokenId` == 0).\n * @param _fromTokenId The token id to transfer value from\n * @param _toTokenId The token id to transfer value to\n * @param _value The transferred value\n */\n event TransferValue(uint256 indexed _fromTokenId, uint256 indexed _toTokenId, uint256 _value);\n\n /**\n * @dev MUST emits when the approval value of a token is set or changed.\n * @param _tokenId The token to approve\n * @param _operator The operator to approve for\n * @param _value The maximum value that `_operator` is allowed to manage\n */\n event ApprovalValue(uint256 indexed _tokenId, address indexed _operator, uint256 _value);\n\n /**\n * @dev MUST emit when the slot of a token is set or changed.\n * @param _tokenId The token of which slot is set or changed\n * @param _oldSlot The previous slot of the token\n * @param _newSlot The updated slot of the token\n */ \n event SlotChanged(uint256 indexed _tokenId, uint256 indexed _oldSlot, uint256 indexed _newSlot);\n\n /**\n * @notice Get the number of decimals the token uses for value - e.g. 6, means the user\n * representation of the value of a token can be calculated by dividing it by 1,000,000.\n * Considering the compatibility with third-party wallets, this function is defined as\n * `valueDecimals()` instead of `decimals()` to avoid conflict with ERC20 tokens.\n * @return The number of decimals for value\n */\n function valueDecimals() external view returns (uint8);\n\n /**\n * @notice Get the value of a token.\n * @param _tokenId The token for which to query the balance\n * @return The value of `_tokenId`\n */\n function balanceOf(uint256 _tokenId) external view returns (uint256);\n\n /**\n * @notice Get the slot of a token.\n * @param _tokenId The identifier for a token\n * @return The slot of the token\n */\n function slotOf(uint256 _tokenId) external view returns (uint256);\n\n /**\n * @notice Allow an operator to manage the value of a token, up to the `_value` amount.\n * @dev MUST revert unless caller is the current owner, an authorized operator, or the approved\n * address for `_tokenId`.\n * MUST emit ApprovalValue event.\n * @param _tokenId The token to approve\n * @param _operator The operator to be approved\n * @param _value The maximum value of `_toTokenId` that `_operator` is allowed to manage\n */\n function approve(\n uint256 _tokenId,\n address _operator,\n uint256 _value\n ) external payable;\n\n /**\n * @notice Get the maximum value of a token that an operator is allowed to manage.\n * @param _tokenId The token for which to query the allowance\n * @param _operator The address of an operator\n * @return The current approval value of `_tokenId` that `_operator` is allowed to manage\n */\n function allowance(uint256 _tokenId, address _operator) external view returns (uint256);\n\n /**\n * @notice Transfer value from a specified token to another specified token with the same slot.\n * @dev Caller MUST be the current owner, an authorized operator or an operator who has been\n * approved the whole `_fromTokenId` or part of it.\n * MUST revert if `_fromTokenId` or `_toTokenId` is zero token id or does not exist.\n * MUST revert if slots of `_fromTokenId` and `_toTokenId` do not match.\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\n * operator.\n * MUST emit `TransferValue` event.\n * @param _fromTokenId The token to transfer value from\n * @param _toTokenId The token to transfer value to\n * @param _value The transferred value\n */\n function transferFrom(\n uint256 _fromTokenId,\n uint256 _toTokenId,\n uint256 _value\n ) external payable;\n\n /**\n * @notice Transfer value from a specified token to an address. The caller should confirm that\n * `_to` is capable of receiving ERC3525 tokens.\n * @dev This function MUST create a new ERC3525 token with the same slot for `_to` to receive\n * the transferred value.\n * MUST revert if `_fromTokenId` is zero token id or does not exist.\n * MUST revert if `_to` is zero address.\n * MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the\n * operator.\n * MUST emit `Transfer` and `TransferValue` events.\n * @param _fromTokenId The token to transfer value from\n * @param _to The address to transfer value to\n * @param _value The transferred value\n * @return ID of the new token created for `_to` which receives the transferred value\n */\n function transferFrom(\n uint256 _fromTokenId,\n address _to,\n uint256 _value\n ) external payable returns (uint256);\n}\n" + }, + "@solvprotocol/erc-3525/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/** \n * @title ERC-721 Non-Fungible Token Standard\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n * Note: the ERC-165 identifier for this interface is 0x80ac58cd.\n */\ninterface IERC721 is IERC165 {\n /** \n * @dev This emits when ownership of any NFT changes by any mechanism.\n * This event emits when NFTs are created (`from` == 0) and destroyed\n * (`to` == 0). Exception: during contract creation, any number of NFTs\n * may be created and assigned without emitting Transfer. At the time of\n * any transfer, the approved address for that NFT (if any) is reset to none.\n */\n event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);\n\n /**\n * @dev This emits when the approved address for an NFT is changed or\n * reaffirmed. The zero address indicates there is no approved address.\n * When a Transfer event emits, this also indicates that the approved\n * address for that NFT (if any) is reset to none.\n */\n event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);\n\n /**\n * @dev This emits when an operator is enabled or disabled for an owner.\n * The operator can manage all NFTs of the owner.\n */\n event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);\n\n /**\n * @notice Count all NFTs assigned to an owner\n * @dev NFTs assigned to the zero address are considered invalid, and this\n * function throws for queries about the zero address.\n * @param _owner An address for whom to query the balance\n * @return The number of NFTs owned by `_owner`, possibly zero\n */\n function balanceOf(address _owner) external view returns (uint256);\n\n /**\n * @notice Find the owner of an NFT\n * @dev NFTs assigned to zero address are considered invalid, and queries\n * about them do throw.\n * @param _tokenId The identifier for an NFT\n * @return The address of the owner of the NFT\n */\n function ownerOf(uint256 _tokenId) external view returns (address);\n\n /**\n * @notice Transfers the ownership of an NFT from one address to another address\n * @dev Throws unless `msg.sender` is the current owner, an authorized\n * operator, or the approved address for this NFT. Throws if `_from` is\n * not the current owner. Throws if `_to` is the zero address. Throws if\n * `_tokenId` is not a valid NFT. When transfer is complete, this function\n * checks if `_to` is a smart contract (code size > 0). If so, it calls\n * `onERC721Received` on `_to` and throws if the return value is not\n * `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes calldata data) external payable;\n\n /**\n * @notice Transfers the ownership of an NFT from one address to another address\n * @dev This works identically to the other function with an extra data parameter,\n * except this function just sets data to \"\".\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n */\n function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;\n\n /**\n * @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n * TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n * THEY MAY BE PERMANENTLY LOST\n * @dev Throws unless `msg.sender` is the current owner, an authorized\n * operator, or the approved address for this NFT. Throws if `_from` is\n * not the current owner. Throws if `_to` is the zero address. Throws if\n * `_tokenId` is not a valid NFT.\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n */\n function transferFrom(address _from, address _to, uint256 _tokenId) external payable;\n\n /**\n * @notice Change or reaffirm the approved address for an NFT\n * @dev The zero address indicates there is no approved address.\n * Throws unless `msg.sender` is the current NFT owner, or an authorized\n * operator of the current owner.\n * @param _approved The new approved NFT controller\n * @param _tokenId The NFT to approve\n */\n function approve(address _approved, uint256 _tokenId) external payable;\n\n /**\n * @notice Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s assets\n * @dev Emits the ApprovalForAll event. The contract MUST allow\n * multiple operators per owner.\n * @param _operator Address to add to the set of authorized operators\n * @param _approved True if the operator is approved, false to revoke approval\n */\n function setApprovalForAll(address _operator, bool _approved) external;\n\n /**\n * @notice Get the approved address for a single NFT\n * @dev Throws if `_tokenId` is not a valid NFT.\n * @param _tokenId The NFT to find the approved address for\n * @return The approved address for this NFT, or the zero address if there is none\n */\n function getApproved(uint256 _tokenId) external view returns (address);\n\n /**\n * @notice Query if an address is an authorized operator for another address\n * @param _owner The address that owns the NFTs\n * @param _operator The address that acts on behalf of the owner\n * @return True if `_operator` is an approved operator for `_owner`, false otherwise\n */\n function isApprovedForAll(address _owner, address _operator) external view returns (bool);\n}\n" + }, + "@solvprotocol/erc-3525/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers from ERC721 asset contracts.\n * Note: the ERC-165 identifier for this interface is 0x150b7a02.\n */\ninterface IERC721ReceiverUpgradeable {\n /** \n * @notice Handle the receipt of an NFT\n * @dev The ERC721 smart contract calls this function on the recipient\n * after a `transfer`. This function MAY throw to revert and reject the\n * transfer. Return of other than the magic value MUST result in the\n * transaction being reverted.\n * Note: the contract address is always the message sender.\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address which previously owned the token\n * @param _tokenId The NFT identifier which is being transferred\n * @param _data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n * unless throwing\n */\n function onERC721Received(\n address _operator, \n address _from, \n uint256 _tokenId, \n bytes calldata _data\n ) external returns(bytes4);\n}\n" + }, + "@solvprotocol/erc-3525/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.1;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\n/** \n * @title ERC-721 Non-Fungible Token Standard\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n * Note: the ERC-165 identifier for this interface is 0x80ac58cd.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /** \n * @dev This emits when ownership of any NFT changes by any mechanism.\n * This event emits when NFTs are created (`from` == 0) and destroyed\n * (`to` == 0). Exception: during contract creation, any number of NFTs\n * may be created and assigned without emitting Transfer. At the time of\n * any transfer, the approved address for that NFT (if any) is reset to none.\n */\n event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);\n\n /**\n * @dev This emits when the approved address for an NFT is changed or\n * reaffirmed. The zero address indicates there is no approved address.\n * When a Transfer event emits, this also indicates that the approved\n * address for that NFT (if any) is reset to none.\n */\n event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);\n\n /**\n * @dev This emits when an operator is enabled or disabled for an owner.\n * The operator can manage all NFTs of the owner.\n */\n event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);\n\n /**\n * @notice Count all NFTs assigned to an owner\n * @dev NFTs assigned to the zero address are considered invalid, and this\n * function throws for queries about the zero address.\n * @param _owner An address for whom to query the balance\n * @return The number of NFTs owned by `_owner`, possibly zero\n */\n function balanceOf(address _owner) external view returns (uint256);\n\n /**\n * @notice Find the owner of an NFT\n * @dev NFTs assigned to zero address are considered invalid, and queries\n * about them do throw.\n * @param _tokenId The identifier for an NFT\n * @return The address of the owner of the NFT\n */\n function ownerOf(uint256 _tokenId) external view returns (address);\n\n /**\n * @notice Transfers the ownership of an NFT from one address to another address\n * @dev Throws unless `msg.sender` is the current owner, an authorized\n * operator, or the approved address for this NFT. Throws if `_from` is\n * not the current owner. Throws if `_to` is the zero address. Throws if\n * `_tokenId` is not a valid NFT. When transfer is complete, this function\n * checks if `_to` is a smart contract (code size > 0). If so, it calls\n * `onERC721Received` on `_to` and throws if the return value is not\n * `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes calldata data) external payable;\n\n /**\n * @notice Transfers the ownership of an NFT from one address to another address\n * @dev This works identically to the other function with an extra data parameter,\n * except this function just sets data to \"\".\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n */\n function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;\n\n /**\n * @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n * TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n * THEY MAY BE PERMANENTLY LOST\n * @dev Throws unless `msg.sender` is the current owner, an authorized\n * operator, or the approved address for this NFT. Throws if `_from` is\n * not the current owner. Throws if `_to` is the zero address. Throws if\n * `_tokenId` is not a valid NFT.\n * @param _from The current owner of the NFT\n * @param _to The new owner\n * @param _tokenId The NFT to transfer\n */\n function transferFrom(address _from, address _to, uint256 _tokenId) external payable;\n\n /**\n * @notice Change or reaffirm the approved address for an NFT\n * @dev The zero address indicates there is no approved address.\n * Throws unless `msg.sender` is the current NFT owner, or an authorized\n * operator of the current owner.\n * @param _approved The new approved NFT controller\n * @param _tokenId The NFT to approve\n */\n function approve(address _approved, uint256 _tokenId) external payable;\n\n /**\n * @notice Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s assets\n * @dev Emits the ApprovalForAll event. The contract MUST allow\n * multiple operators per owner.\n * @param _operator Address to add to the set of authorized operators\n * @param _approved True if the operator is approved, false to revoke approval\n */\n function setApprovalForAll(address _operator, bool _approved) external;\n\n /**\n * @notice Get the approved address for a single NFT\n * @dev Throws if `_tokenId` is not a valid NFT.\n * @param _tokenId The NFT to find the approved address for\n * @return The approved address for this NFT, or the zero address if there is none\n */\n function getApproved(uint256 _tokenId) external view returns (address);\n\n /**\n * @notice Query if an address is an authorized operator for another address\n * @param _owner The address that owns the NFTs\n * @param _operator The address that acts on behalf of the owner\n * @return True if `_operator` is an approved operator for `_owner`, false otherwise\n */\n function isApprovedForAll(address _owner, address _operator) external view returns (bool);\n}\n" + }, + "@solvprotocol/erc-3525/periphery/interface/IERC3525MetadataDescriptorUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC3525MetadataDescriptorUpgradeable {\n\n function constructContractURI() external view returns (string memory);\n\n function constructSlotURI(uint256 slot) external view returns (string memory);\n \n function constructTokenURI(uint256 tokenId) external view returns (string memory);\n\n}" + }, + "contracts/FlagsStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {EnumerableSet} from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {IFlagsStorage} from \"./interfaces/IFlagsStorage.sol\";\nimport {BitMask} from \"./library/BitMask.sol\";\nimport {Common__NotSuperAdmin, Common__MissingAccount} from \"./library/CommonErrors.sol\";\n\n/**\n * @dev FlagsStorage is the main contract to store KYC-related flags for Gateway Token System.\n * KYC flags are identifiable by short identifiers in bytes32 strings. After adding flags\n * those bit indexes could be used by GatewayToken implementations to associate flags per token.\n */\ncontract FlagsStorage is Initializable, IFlagsStorage, UUPSUpgradeable {\n using EnumerableSet for EnumerableSet.Bytes32Set;\n using Address for address;\n using BitMask for uint256;\n\n EnumerableSet.Bytes32Set private _supportedFlags;\n\n address public superAdmin;\n\n uint256 public supportedFlagsMask;\n\n mapping(bytes32 => uint8) public flagIndexes;\n\n /// The flag being added already exists\n /// @param flag The flag being added\n error FlagsStorage__FlagAlreadyExists(bytes32 flag);\n\n /// The flag being removed does not exist\n /// @param flag The flag being removed\n error FlagsStorage__FlagNotSupported(bytes32 flag);\n\n /// Multiple flags updated but the number of flags passed in does not match the number of indexes\n /// @param expected The number of flags passed in\n /// @param actual The number of indexes passed in\n error FlagsStorage__IncorrectVariableLength(uint256 expected, uint256 actual);\n\n /// The flag index is already used\n /// @param index The flag index\n error FlagsStorage__IndexAlreadyUsed(uint8 index);\n\n // @dev Modifier to prevent calls from anyone except Identity.com Admin\n modifier onlySuperAdmin() {\n _onlySuperAdmin();\n _;\n }\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n // empty constructor in line with the UUPS upgradeable proxy pattern\n // solhint-disable-next-line no-empty-blocks\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address _superAdmin) external initializer {\n if (_superAdmin == address(0)) revert Common__MissingAccount();\n superAdmin = _superAdmin;\n }\n\n /**\n * @dev Triggers to transfer ownership of this contract to\n * new super admin, reverts on zero address and wallet addresses\n * @param newSuperAdmin New super admin contract address\n * @notice Only executed by existing super admin\n */\n function updateSuperAdmin(address newSuperAdmin) external onlySuperAdmin {\n if (newSuperAdmin == address(0)) revert Common__MissingAccount();\n\n emit SuperAdminUpdated(superAdmin, newSuperAdmin);\n superAdmin = newSuperAdmin;\n }\n\n /**\n * @dev Triggers to add new flag into gateway token system\n * @param flag Flag short identifier\n * @param index Flag index (limited to 255)\n * @notice Only executed by existing DAO Manager\n */\n function addFlag(bytes32 flag, uint8 index) external onlySuperAdmin {\n _addFlag(flag, index);\n }\n\n /**\n * @dev Triggers to add multiple flags into gateway token system\n * @param flags Array of flag short identifiers\n * @param indexes Array of flag indexes (limited to 255)\n * @notice Only executed by existing DAO Manager\n */\n function addFlags(bytes32[] calldata flags, uint8[] calldata indexes) external onlySuperAdmin {\n if (flags.length != indexes.length) revert FlagsStorage__IncorrectVariableLength(flags.length, indexes.length);\n\n uint256 length = flags.length;\n for (uint8 i = 0; i < length; i++) {\n _addFlag(flags[i], indexes[i]);\n }\n }\n\n /**\n * @dev Triggers to remove existing flag from gateway token system\n * @param flag Flag short identifier\n * @notice Only executed by existing DAO Manager\n */\n function removeFlag(bytes32 flag) external onlySuperAdmin {\n if (!_supportedFlags.contains(flag)) revert FlagsStorage__FlagNotSupported(flag);\n\n _removeFlag(flag);\n }\n\n /**\n * @dev Triggers to remove multiple existing flags from gateway token system\n * @param flags Array of flag short identifiers\n * @notice Only executed by existing DAO Manager\n */\n function removeFlags(bytes32[] calldata flags) external onlySuperAdmin {\n uint256 length = flags.length;\n for (uint8 i = 0; i < length; i++) {\n // additional check to reduce incorrect FlagRemoved events\n if (!_supportedFlags.contains(flags[i])) revert FlagsStorage__FlagNotSupported(flags[i]);\n\n _removeFlag(flags[i]);\n }\n }\n\n /**\n * @dev Triggers to check if a particular flag is supported\n * @param flag Flag short identifier\n * @return Boolean for flag support\n */\n function isFlagSupported(bytes32 flag) external view returns (bool) {\n return _supportedFlags.contains(flag);\n }\n\n /**\n * @dev Internal function to add new flag\n */\n function _addFlag(bytes32 flag, uint8 index) internal {\n if (supportedFlagsMask.checkBit(index)) revert FlagsStorage__IndexAlreadyUsed(index);\n if (_supportedFlags.contains(flag)) revert FlagsStorage__FlagAlreadyExists(flag);\n\n flagIndexes[flag] = index;\n _supportedFlags.add(flag);\n supportedFlagsMask = supportedFlagsMask.setBit(index);\n\n emit FlagAdded(flag, index);\n }\n\n /**\n * @dev Internal function to remove existing flag\n */\n function _removeFlag(bytes32 flag) internal {\n _supportedFlags.remove(flag);\n uint8 _index = flagIndexes[flag];\n\n supportedFlagsMask = supportedFlagsMask.clearBit(_index);\n delete flagIndexes[flag];\n\n emit FlagRemoved(flag);\n }\n\n // includes the onlySuperAdmin modifier to ensure that only the super admin can call this function\n // otherwise, no other logic.\n // solhint-disable-next-line no-empty-blocks\n function _authorizeUpgrade(address) internal override onlySuperAdmin {}\n\n // separate into a private function to reduce code size\n function _onlySuperAdmin() private view {\n if (msg.sender != superAdmin) revert Common__NotSuperAdmin(msg.sender);\n }\n}\n" + }, + "contracts/FlexibleNonceForwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {EIP712} from \"@openzeppelin/contracts/utils/cryptography/EIP712.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {IForwarder} from \"./interfaces/IForwarder.sol\";\n\ncontract FlexibleNonceForwarder is IForwarder, EIP712, ReentrancyGuard {\n using ECDSA for bytes32;\n using Address for address payable;\n\n struct SigsForNonce {\n mapping(bytes => bool) sigs;\n }\n\n struct FlexibleNonce {\n uint256 currentNonce;\n uint256 block; // when this nonce was first used - used to age transactions\n mapping(uint256 => SigsForNonce) sigsForNonce;\n }\n\n bytes32 private constant _TYPEHASH =\n keccak256(\"ForwardRequest(address from,address to,uint256 value,uint256 gas,uint256 nonce,bytes data)\");\n\n mapping(address => FlexibleNonce) private _nonces;\n\n uint256 private immutable _blockAgeTolerance;\n\n event ForwardResult(bool);\n\n /// The tx to be forwarded is not signed by the request sender.\n error FlexibleNonceForwarder__InvalidSigner(address signer, address expectedSigner);\n\n /// The tx to be forwarded has already been seen.\n error FlexibleNonceForwarder__TxAlreadySeen();\n\n /// The tx to be forwarded is too old.\n error FlexibleNonceForwarder__TxTooOld(uint256 blockNumber, uint256 blockAgeTolerance);\n\n constructor(uint256 blockAgeTolerance) EIP712(\"FlexibleNonceForwarder\", \"0.0.1\") {\n _blockAgeTolerance = blockAgeTolerance;\n }\n\n function execute(\n ForwardRequest calldata req,\n bytes calldata signature\n ) external payable nonReentrant returns (bool, bytes memory) {\n _verifyFlexibleNonce(req, signature);\n _refundExcessValue(req);\n\n (bool success, bytes memory returndata) = req.to.call{gas: req.gas, value: req.value}(\n abi.encodePacked(req.data, req.from)\n );\n\n // Validate that the relayer has sent enough gas for the call.\n // See https://ronan.eth.limo/blog/ethereum-gas-dangers/\n if (gasleft() <= req.gas / 63) {\n // We explicitly trigger invalid opcode to consume all gas and bubble-up the effects, since\n // neither revert or assert consume all gas since Solidity 0.8.0\n // https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require\n // solhint-disable-next-line no-inline-assembly\n assembly {\n invalid()\n }\n }\n\n emit ForwardResult(success);\n\n return (success, returndata);\n }\n\n function getNonce(address from) external view returns (uint256) {\n return _nonces[from].currentNonce;\n }\n\n function _verifyFlexibleNonce(ForwardRequest calldata req, bytes calldata signature) internal {\n address signer = _hashTypedDataV4(\n keccak256(abi.encode(_TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data)))\n ).recover(signature);\n\n if (signer != req.from) {\n revert FlexibleNonceForwarder__InvalidSigner(signer, req.from);\n }\n\n if (_nonces[req.from].currentNonce == req.nonce) {\n // request nonce is expected next nonce - increment the nonce, and we are done\n _nonces[req.from].currentNonce = req.nonce + 1;\n _nonces[req.from].block = block.number;\n } else {\n // request nonce is not expected next nonce - check if we have seen this signature before\n if (_nonces[req.from].sigsForNonce[req.nonce].sigs[signature]) {\n revert FlexibleNonceForwarder__TxAlreadySeen();\n }\n\n // check if the nonce is too old\n if (_nonces[req.from].block + _blockAgeTolerance < block.number) {\n revert FlexibleNonceForwarder__TxTooOld(_nonces[req.from].block, _blockAgeTolerance);\n }\n }\n\n // store the signature for this nonce to ensure no replay attacks\n _nonces[req.from].sigsForNonce[req.nonce].sigs[signature] = true;\n }\n\n function _refundExcessValue(ForwardRequest calldata req) internal {\n // Refund the excess value sent to the forwarder if the value inside the request is less than the value sent.\n if (msg.value > req.value) {\n payable(msg.sender).sendValue(msg.value - req.value);\n }\n }\n}\n" + }, + "contracts/Gated.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport {IGatewayTokenVerifier} from \"./interfaces/IGatewayTokenVerifier.sol\";\n\ncontract Gated {\n /// The gateway token is not valid.\n error IsGated__InvalidGatewayToken(address gatewayToken);\n\n modifier gated(address gatewayToken, uint256 gatekeeperNetwork) {\n IGatewayTokenVerifier verifier = IGatewayTokenVerifier(gatewayToken);\n if (!verifier.verifyToken(msg.sender, gatekeeperNetwork)) {\n revert IsGated__InvalidGatewayToken(gatewayToken);\n }\n _;\n }\n}\n" + }, + "contracts/GatewayToken.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IERC3525MetadataUpgradeable} from \"@solvprotocol/erc-3525/extensions/IERC3525MetadataUpgradeable.sol\";\nimport {ERC3525Upgradeable} from \"@solvprotocol/erc-3525/ERC3525Upgradeable.sol\";\nimport {IERC721} from \"@solvprotocol/erc-3525/IERC721.sol\";\nimport {IERC3525} from \"@solvprotocol/erc-3525/IERC3525.sol\";\nimport {TokenBitMask} from \"./TokenBitMask.sol\";\nimport {IGatewayToken} from \"./interfaces/IGatewayToken.sol\";\nimport {IERC721Freezable} from \"./interfaces/IERC721Freezable.sol\";\nimport {IERC721Expirable} from \"./interfaces/IERC721Expirable.sol\";\nimport {IERC721Revokable} from \"./interfaces/IERC721Revokable.sol\";\nimport {MultiERC2771Context} from \"./MultiERC2771Context.sol\";\nimport {Charge} from \"./library/Charge.sol\";\nimport {ParameterizedAccessControl} from \"./ParameterizedAccessControl.sol\";\nimport {Common__MissingAccount, Common__NotContract, Common__Unauthorized} from \"./library/CommonErrors.sol\";\n\n/**\n * @dev Gateway Token contract is responsible for managing Identity.com KYC gateway tokens\n * those tokens represent completed KYC with attached identity.\n * Gateway tokens using ERC721 standard with custom extensions.\n *\n * Contract handles multiple levels of access such as Network Authority\n * (may represent a specific regulator body)\n * Gatekeepers (Identity.com network parties who can mint/burn/freeze gateway tokens)\n * and overall system Admin who can add\n * new Gatekeepers and Network Authorities\n */\ncontract GatewayToken is\n UUPSUpgradeable,\n MultiERC2771Context,\n ERC3525Upgradeable,\n ParameterizedAccessControl,\n IERC721Freezable,\n IERC721Expirable,\n IERC721Revokable,\n IGatewayToken,\n TokenBitMask\n{\n using Address for address;\n using Strings for uint;\n\n // Off-chain DAO governance access control\n mapping(uint => bool) public isNetworkDAOGoverned;\n\n // Access control roles\n bytes32 public constant DAO_MANAGER_ROLE = keccak256(\"DAO_MANAGER_ROLE\");\n bytes32 public constant GATEKEEPER_ROLE = keccak256(\"GATEKEEPER_ROLE\");\n bytes32 public constant NETWORK_AUTHORITY_ROLE = keccak256(\"NETWORK_AUTHORITY_ROLE\");\n\n // Optional mapping for gateway token bitmaps\n mapping(uint => TokenState) internal _tokenStates;\n\n // Optional Mapping from token ID to expiration date\n mapping(uint => uint) internal _expirations;\n\n mapping(uint => string) internal _networks;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n // constructor is \"empty\" as we are using the proxy pattern,\n // where setup code is in the initialize function\n // called by the proxy contract\n constructor() {\n _disableInitializers();\n }\n\n function initialize(\n string calldata _name,\n string calldata _symbol,\n address _superAdmin,\n address _flagsStorage,\n address[] calldata _trustedForwarders\n ) external initializer {\n // Check for zero addresses\n if (_superAdmin == address(0)) {\n revert Common__MissingAccount();\n }\n\n if (_flagsStorage == address(0)) {\n revert Common__MissingAccount();\n }\n\n // Check for zero addresses in the trusted forwarders array\n for (uint256 i = 0; i < _trustedForwarders.length; i++) {\n if (_trustedForwarders[i] == address(0)) {\n revert Common__MissingAccount();\n }\n }\n\n __ERC3525_init(_name, _symbol, 0);\n __MultiERC2771Context_init(_trustedForwarders);\n\n _setFlagsStorage(_flagsStorage);\n _superAdmins[_superAdmin] = true;\n }\n\n function setMetadataDescriptor(address _metadataDescriptor) external onlySuperAdmin {\n _setMetadataDescriptor(_metadataDescriptor);\n }\n\n function addForwarder(address forwarder) external onlySuperAdmin {\n _addForwarder(forwarder);\n }\n\n function removeForwarder(address forwarder) external onlySuperAdmin {\n _removeForwarder(forwarder);\n }\n\n /**\n * @dev Triggers to update FlagsStorage contract address\n * @param flagsStorage FlagsStorage contract address\n */\n function updateFlagsStorage(address flagsStorage) external onlySuperAdmin {\n _setFlagsStorage(flagsStorage);\n }\n\n /**\n * @dev Triggers to burn gateway token\n * @param tokenId Gateway token id\n */\n function burn(uint tokenId) external virtual {\n _checkGatekeeper(slotOf(tokenId));\n _burn(tokenId);\n }\n\n /**\n * @dev Triggers to mint gateway token\n * @param to Gateway token owner\n * @param network Gateway token type\n * @param mask The bitmask for the token\n */\n function mint(address to, uint network, uint expiration, uint mask, Charge calldata) external virtual {\n _checkGatekeeper(network);\n\n uint tokenId = ERC3525Upgradeable._mint(to, network, 1);\n\n if (expiration > 0) {\n _expirations[tokenId] = expiration;\n }\n\n if (mask > 0) {\n _setBitMask(tokenId, mask);\n }\n }\n\n function revoke(uint tokenId) external virtual override {\n _checkGatekeeper(slotOf(tokenId));\n\n _tokenStates[tokenId] = TokenState.REVOKED;\n\n emit Revoke(tokenId);\n }\n\n /**\n * @dev Triggers to freeze gateway token\n * @param tokenId Gateway token id\n */\n function freeze(uint tokenId) external virtual {\n _checkGatekeeper(slotOf(tokenId));\n\n _freeze(tokenId);\n }\n\n /**\n * @dev Triggers to unfreeze gateway token\n * @param tokenId Gateway token id\n */\n function unfreeze(uint tokenId) external virtual {\n _checkGatekeeper(slotOf(tokenId));\n\n _unfreeze(tokenId);\n }\n\n /**\n * @dev Triggers to set expiration for tokenId\n * @param tokenId Gateway token id\n */\n function setExpiration(uint tokenId, uint timestamp, Charge calldata) external virtual {\n _checkGatekeeper(slotOf(tokenId));\n\n _setExpiration(tokenId, timestamp);\n }\n\n /**\n * @dev Transfers Gateway Token DAO Manager access from `previousManager` to `newManager`\n * Only a current DAO Manager can do this. They can do this for any other DAO Manager.\n * This is useful for two reasons:\n * 1. Key rotation of the current (msg signer) DAO manager\n * 2. Replacing a lost or compromised key of an existing DAO manager\n * @param newManager Address to transfer DAO Manager role for.\n * @notice GatewayToken contract has to be DAO Governed\n */\n function transferDAOManager(address previousManager, address newManager, uint network) external {\n if (!isNetworkDAOGoverned[network]) revert GatewayToken__NotDAOGoverned(network);\n\n // check the previous manager is a current dao manager\n _checkRole(DAO_MANAGER_ROLE, network, previousManager);\n\n if (newManager == address(0)) revert Common__MissingAccount();\n\n // grant the new manager the relevant roles\n grantRole(DAO_MANAGER_ROLE, network, newManager);\n grantRole(NETWORK_AUTHORITY_ROLE, network, newManager);\n grantRole(GATEKEEPER_ROLE, network, newManager);\n\n // revoke the relevant roles from the previous manager\n revokeRole(GATEKEEPER_ROLE, network, previousManager);\n revokeRole(NETWORK_AUTHORITY_ROLE, network, previousManager);\n revokeRole(DAO_MANAGER_ROLE, network, previousManager);\n\n emit DAOManagerTransferred(previousManager, newManager, network);\n }\n\n function createNetwork(uint network, string calldata name, bool daoGoverned, address daoManager) external virtual {\n if (bytes(_networks[network]).length != 0) {\n revert GatewayToken__NetworkAlreadyExists(network);\n }\n\n _networks[network] = name;\n\n if (daoGoverned) {\n isNetworkDAOGoverned[network] = daoGoverned;\n\n if (daoManager == address(0)) {\n revert Common__MissingAccount();\n }\n if (!daoManager.isContract()) {\n revert Common__NotContract(daoManager);\n }\n\n // use the internal function to avoid the check for the network authority role\n // since this network does not exist yet, it has no existing network authority\n _grantRole(DAO_MANAGER_ROLE, network, daoManager);\n _grantRole(NETWORK_AUTHORITY_ROLE, network, daoManager);\n\n // DAO managers can assign and revoke network authorities and gatekeepers\n _setRoleAdmin(NETWORK_AUTHORITY_ROLE, network, DAO_MANAGER_ROLE);\n _setRoleAdmin(GATEKEEPER_ROLE, network, DAO_MANAGER_ROLE);\n // DAO Managers can administrate themselves\n _setRoleAdmin(DAO_MANAGER_ROLE, network, DAO_MANAGER_ROLE);\n } else {\n // use the internal function to avoid the check for the network authority role\n // since this network does not exist yet, it has no existing network authority\n _grantRole(NETWORK_AUTHORITY_ROLE, network, _msgSender());\n\n _setRoleAdmin(NETWORK_AUTHORITY_ROLE, network, NETWORK_AUTHORITY_ROLE);\n _setRoleAdmin(GATEKEEPER_ROLE, network, NETWORK_AUTHORITY_ROLE);\n }\n }\n\n function renameNetwork(uint network, string calldata name) external virtual {\n if (bytes(_networks[network]).length == 0) {\n revert GatewayToken__NetworkDoesNotExist(network);\n }\n if (!hasRole(NETWORK_AUTHORITY_ROLE, network, _msgSender())) {\n revert Common__Unauthorized(_msgSender(), network, NETWORK_AUTHORITY_ROLE);\n }\n\n _networks[network] = name;\n }\n\n /**\n * @dev Triggers to add new gatekeeper into the system.\n * @param gatekeeper Gatekeeper address\n */\n function addGatekeeper(address gatekeeper, uint network) external virtual {\n grantRole(GATEKEEPER_ROLE, network, gatekeeper);\n }\n\n /**\n * @dev Triggers to remove existing gatekeeper from gateway token.\n * @param gatekeeper Gatekeeper address\n */\n function removeGatekeeper(address gatekeeper, uint network) external virtual {\n revokeRole(GATEKEEPER_ROLE, network, gatekeeper);\n }\n\n /**\n * @dev Triggers to add new network authority into the system.\n * @param authority Network Authority address\n *\n * @notice Can be triggered by DAO Manager or any Network Authority\n */\n function addNetworkAuthority(address authority, uint network) external virtual {\n grantRole(NETWORK_AUTHORITY_ROLE, network, authority);\n }\n\n /**\n * @dev Triggers to remove existing network authority from gateway token.\n * @param authority Network Authority address\n *\n * @notice Can be triggered by DAO Manager or any Network Authority\n */\n function removeNetworkAuthority(address authority, uint network) external virtual {\n revokeRole(NETWORK_AUTHORITY_ROLE, network, authority);\n }\n\n /**\n * @dev Triggers to set full bitmask for gateway token with `tokenId`\n */\n function setBitmask(uint tokenId, uint mask) external virtual {\n _checkSenderRole(GATEKEEPER_ROLE, slotOf(tokenId));\n _setBitMask(tokenId, mask);\n }\n\n function getNetwork(uint network) external view virtual returns (string memory) {\n return _networks[network];\n }\n\n function getTokenIdsByOwnerAndNetwork(address owner, uint network) external view virtual returns (uint[] memory) {\n (uint[] memory tokenIds, uint count) = _getTokenIdsByOwnerAndNetwork(owner, network);\n uint[] memory tokenIdsResized = new uint[](count);\n for (uint i = 0; i < count; i++) {\n tokenIdsResized[i] = tokenIds[i];\n }\n return tokenIdsResized;\n }\n\n /**\n * @dev Triggered by external contract to verify the validity of the default token for `owner`.\n *\n * Checks owner has any token on gateway token contract, `tokenId` still active, and not expired.\n */\n function verifyToken(address owner, uint network) external view virtual returns (bool) {\n (uint[] memory tokenIds, uint count) = _getTokenIdsByOwnerAndNetwork(owner, network);\n\n for (uint i = 0; i < count; i++) {\n if (_existsAndActive(tokenIds[i], false)) return true;\n }\n\n return false;\n }\n\n /**\n * @dev Triggered by external contract to verify the validity of the default token for `owner`.\n *\n * Checks owner has any token on gateway token contract, `tokenId` still active, and not expired.\n */\n function verifyToken(uint tokenId) external view virtual returns (bool) {\n return _existsAndActive(tokenId, false);\n }\n\n /**\n * @dev Triggers to get all information gateway token related to specified `tokenId`\n * @param tokenId Gateway token id\n */\n function getToken(\n uint tokenId\n )\n external\n view\n virtual\n returns (address owner, uint8 state, string memory identity, uint expiration, uint bitmask)\n {\n owner = ownerOf(tokenId);\n state = uint8(_tokenStates[tokenId]);\n expiration = _expirations[tokenId];\n bitmask = _getBitMask(tokenId);\n\n return (owner, state, identity, expiration, bitmask);\n }\n\n /**\n * @dev Triggers to get specified `tokenId` expiration timestamp\n * @param tokenId Gateway token id\n */\n function getExpiration(uint tokenId) external view virtual returns (uint) {\n _checkTokenExists(tokenId);\n\n return _expirations[tokenId];\n }\n\n /**\n * @dev Triggers to verify if address has a GATEKEEPER role.\n * @param gatekeeper Gatekeeper address\n */\n function isGatekeeper(address gatekeeper, uint network) external view virtual returns (bool) {\n return hasRole(GATEKEEPER_ROLE, network, gatekeeper);\n }\n\n /**\n * @dev Triggers to verify if authority has a NETWORK_AUTHORITY_ROLE role.\n * @param authority Network Authority address\n */\n function isNetworkAuthority(address authority, uint network) external view virtual returns (bool) {\n return hasRole(NETWORK_AUTHORITY_ROLE, network, authority);\n }\n\n /**\n * @dev Triggers to get gateway token bitmask\n */\n function getTokenBitmask(uint tokenId) external view virtual returns (uint) {\n return _getBitMask(tokenId);\n }\n\n /**\n * @dev Returns true if gateway token owner transfers restricted, and false otherwise.\n */\n function transfersRestricted() external pure virtual returns (bool) {\n return true;\n }\n\n /**\n * @dev Transfers are disabled for Gateway Tokens - override ERC3525 approve functions to revert\n * Note - transferFrom and safeTransferFrom are disabled indirectly with the _isApprovedOrOwner function\n */\n function approve(uint256, address, uint256) public payable virtual override {\n revert GatewayToken__TransferDisabled();\n }\n\n function approve(address, uint256) public payable virtual override {\n revert GatewayToken__TransferDisabled();\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC3525Upgradeable, ParameterizedAccessControl) returns (bool) {\n return\n interfaceId == type(IERC3525).interfaceId ||\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC3525MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Freezes `tokenId` and it's usage by gateway token owner.\n *\n * Emits a {Freeze} event.\n */\n function _freeze(uint tokenId) internal virtual {\n _checkActiveToken(tokenId, true);\n\n _tokenStates[tokenId] = TokenState.FROZEN;\n\n emit Freeze(tokenId);\n }\n\n /**\n * @dev Unfreezes `tokenId` and it's usage by gateway token owner.\n *\n * Emits a {Unfreeze} event.\n */\n function _unfreeze(uint tokenId) internal virtual {\n _checkTokenExists(tokenId);\n if (_tokenStates[tokenId] != TokenState.FROZEN) {\n revert GatewayToken__TokenInvalidStateForOperation(tokenId, _tokenStates[tokenId], TokenState.FROZEN);\n }\n\n _tokenStates[tokenId] = TokenState.ACTIVE;\n\n emit Unfreeze(tokenId);\n }\n\n /**\n * @dev Sets expiration time for `tokenId`.\n */\n function _setExpiration(uint tokenId, uint timestamp) internal virtual {\n _checkActiveToken(tokenId, true);\n\n _expirations[tokenId] = timestamp;\n emit Expiration(tokenId, timestamp);\n }\n\n // includes the onlySuperAdmin modifier to ensure that only the super admin can call this function\n // otherwise, no other logic.\n // solhint-disable-next-line no-empty-blocks\n function _authorizeUpgrade(address) internal override onlySuperAdmin {}\n\n function _msgSender()\n internal\n view\n virtual\n override(MultiERC2771Context, ContextUpgradeable)\n returns (address sender)\n {\n return MultiERC2771Context._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(MultiERC2771Context, ContextUpgradeable)\n returns (bytes calldata)\n {\n return MultiERC2771Context._msgData();\n }\n\n function _getTokenIdsByOwnerAndNetwork(address owner, uint network) internal view returns (uint[] memory, uint) {\n uint length = balanceOf(owner);\n uint[] memory tokenIds = new uint[](length);\n uint count = 0;\n\n for (uint i = 0; i < length; i++) {\n uint tokenId = tokenOfOwnerByIndex(owner, i);\n if (slotOf(tokenId) == network) {\n tokenIds[count++] = tokenId;\n }\n }\n\n return (tokenIds, count);\n }\n\n /**\n * @dev Returns whether `tokenId` exists and not frozen.\n */\n function _existsAndActive(uint tokenId, bool allowExpired) internal view virtual returns (bool) {\n // check state before anything else. This reduces the overhead,\n // and avoids a revert, if the token does not exist.\n TokenState state = _tokenStates[tokenId];\n if (state != TokenState.ACTIVE) return false;\n\n address owner = ownerOf(tokenId);\n if (_expirations[tokenId] != 0 && !allowExpired) {\n return owner != address(0) && block.timestamp <= _expirations[tokenId];\n } else {\n return owner != address(0);\n }\n }\n\n function _isApprovedOrOwner(address, uint) internal view virtual override returns (bool) {\n return false; // transfers are restricted, so this can never pass\n }\n\n /// @dev Checks if the sender has the specified role on the specified network and revert otherwise\n function _checkSenderRole(bytes32 role, uint network) internal view {\n _checkRole(role, network, _msgSender());\n }\n\n function _checkGatekeeper(uint network) internal view {\n _checkSenderRole(GATEKEEPER_ROLE, network);\n }\n\n /// @dev Checks if the token exists and is active. Optionally ignore expiry.\n /// Use this when you need to check if a token exists, and is not frozen or revoked\n /// But you don't care about its expiry, e.g. you are extending the expiry.\n function _checkActiveToken(uint tokenId, bool allowExpired) internal view {\n if (!_existsAndActive(tokenId, allowExpired)) {\n revert GatewayToken__TokenDoesNotExistOrIsInactive(tokenId, allowExpired);\n }\n }\n\n /// @dev Checks if the token exists - ignore if it is active or not.\n function _checkTokenExists(uint tokenId) internal view {\n if (!_exists(tokenId)) {\n revert GatewayToken__TokenDoesNotExist(tokenId);\n }\n }\n}\n" + }, + "contracts/interfaces/IERC721Expirable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\nimport {Charge} from \"../library/Charge.sol\";\n\ninterface IERC721Expirable {\n /**\n * @dev Emitted when expiration set to `tokenId`\n */\n event Expiration(uint256 indexed tokenId, uint256 timestamp);\n\n /**\n * @dev Set the gateway token expiry\n * @param tokenId Gateway token id\n * @param tokenId Expiration timestamp\n * @param charge The charge details for token issuance (ignored here - handled if at all by the forwarding contract)\n */\n function setExpiration(uint256 tokenId, uint256 timestamp, Charge calldata charge) external;\n\n /**\n * @dev Get the gateway token expiry\n * @param tokenId Gateway token id\n */\n function getExpiration(uint256 tokenId) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IERC721Freezable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\ninterface IERC721Freezable {\n /**\n * @dev Emitted when a token is frozen by gatekeeper\n */\n event Freeze(uint256 indexed tokenId);\n\n /**\n * @dev Emitted when a token is unfrozen by gatekeeper\n */\n event Unfreeze(uint256 indexed tokenId);\n\n /**\n * @dev Triggers to freeze gateway token\n * @param tokenId Gateway token id\n */\n function freeze(uint256 tokenId) external;\n\n /**\n * @dev Triggers to unfreeze gateway token\n * @param tokenId Gateway token id\n */\n function unfreeze(uint256 tokenId) external;\n}\n" + }, + "contracts/interfaces/IERC721Revokable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\ninterface IERC721Revokable {\n /**\n * @dev Emitted when GatewayToken is revoked.\n */\n event Revoke(uint256 indexed tokenId);\n\n /**\n * @dev Triggers to revoke gateway token\n * @param tokenId Gateway token id\n */\n function revoke(uint256 tokenId) external;\n}\n" + }, + "contracts/interfaces/IFlagsStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\npragma experimental ABIEncoderV2;\n\ninterface IFlagsStorage {\n /**\n * @dev Emitted when DAO Controller is updated from `prevDAOController` to `daoController`.\n */\n event SuperAdminUpdated(address indexed prevSuperAdmin, address indexed superAdmin);\n\n /**\n * @dev Emitted when new flag is added with `flag` short code and `index`.\n */\n event FlagAdded(bytes32 indexed flag, uint8 index);\n\n /**\n * @dev Emitted when existing flag is removed from FlagsStorage by `flag` short code.\n */\n event FlagRemoved(bytes32 indexed flag);\n\n /**\n * @dev Triggers to add new flag into gateway token system\n * @param _flag Flag short identifier\n * @param _index Flag index (limited to 255)\n * @notice Only executed by existing DAO Manager\n */\n function addFlag(bytes32 _flag, uint8 _index) external;\n\n /**\n * @dev Triggers to add multiple flags into gateway token system\n * @param _flags Array of flag short identifiers\n * @param _indexes Array of flag indexes (limited to 255)\n * @notice Only executed by existing DAO Manager\n */\n function addFlags(bytes32[] memory _flags, uint8[] memory _indexes) external;\n\n /**\n * @dev Triggers to remove existing flag from gateway token system\n * @param _flag Flag short identifier\n * @notice Only executed by existing DAO Manager\n */\n function removeFlag(bytes32 _flag) external;\n\n /**\n * @dev Triggers to remove multiple existing flags from gateway token system\n * @param _flags Array of flag short identifiers\n * @notice Only executed by existing DAO Manager\n */\n function removeFlags(bytes32[] memory _flags) external;\n\n /**\n * @dev Triggers to transfer ownership of this contract to new DAO Controller,\n * reverts on zero address and wallet addresses\n * @param _newSuperAdmin New DAO Controller contract address\n * @notice Only executed by existing DAO Manager\n */\n function updateSuperAdmin(address _newSuperAdmin) external;\n\n /**\n * @dev Triggers to get DAO Controller address\n */\n function superAdmin() external view returns (address);\n\n /**\n * @dev Triggers to get flag index from flags mapping\n */\n function flagIndexes(bytes32) external view returns (uint8);\n\n /**\n * @dev Triggers to check if a particular flag is supported\n * @param _flag Flag short identifier\n * @return Boolean for flag support\n */\n function isFlagSupported(bytes32 _flag) external view returns (bool);\n\n /**\n * @dev Triggers to get bitmask of all supported flags\n */\n function supportedFlagsMask() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IForwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\npragma experimental ABIEncoderV2;\n\ninterface IForwarder {\n struct ForwardRequest {\n address from;\n address to;\n uint256 value;\n uint256 gas;\n uint256 nonce;\n bytes data;\n }\n\n function execute(\n ForwardRequest calldata req,\n bytes calldata signature\n ) external payable returns (bool, bytes memory);\n\n function getNonce(address from) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IGatewayToken.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\nimport {Charge} from \"../library/Charge.sol\";\n\ninterface IGatewayToken {\n enum TokenState {\n ACTIVE,\n FROZEN,\n REVOKED\n }\n\n /**\n * @dev Emitted when GatewayToken DAO Manager transferred to `newDAOManager` address.\n */\n event DAOManagerTransferred(address previousDAOManager, address newDAOManager, uint256 network);\n\n /// Insufficient funds for withdrawal. Needed `required` but only\n /// `available` available.\n /// @param available balance available.\n /// @param required requested amount to transfer.\n error GatewayToken__InsufficientFunds(uint256 available, uint256 required);\n\n /// The gatekeeper network being created already exists.\n /// @param network gatekeeper network id.\n error GatewayToken__NetworkAlreadyExists(uint network);\n\n /// The gatekeeper network does not exist.\n /// @param network gatekeeper network id.\n error GatewayToken__NetworkDoesNotExist(uint network);\n\n /// The gatekeeper network is not dao-governed.\n /// @param network gatekeeper network id.\n error GatewayToken__NotDAOGoverned(uint network);\n\n /// The requested token does not exist.\n /// @param tokenId token id.\n error GatewayToken__TokenDoesNotExist(uint256 tokenId);\n\n /// The requested token is not active or does not exist\n /// @param tokenId token id.\n /// @param allowExpired whether to allow expired tokens.\n error GatewayToken__TokenDoesNotExistOrIsInactive(uint256 tokenId, bool allowExpired);\n\n /// The requested token state is invalid for the request\n /// @param tokenId token id.\n /// @param state current token state.\n /// @param expectedState expected token state.\n error GatewayToken__TokenInvalidStateForOperation(uint256 tokenId, TokenState state, TokenState expectedState);\n\n /// Token transfers are disabled\n error GatewayToken__TransferDisabled();\n\n /**\n * @dev Triggers to verify if address has a GATEKEEPER role.\n * @param gatekeeper Gatekeeper address\n * @param network GatekeeperNetwork id\n */\n function isGatekeeper(address gatekeeper, uint256 network) external returns (bool);\n\n function createNetwork(uint256 network, string memory name, bool daoGoverned, address daoManager) external;\n\n function renameNetwork(uint256 network, string memory name) external;\n\n /**\n * @dev Triggers to add new network authority into the system.\n * @param authority Network Authority address\n * @param network GatekeeperNetwork id\n *\n * @notice Only triggered by Identity.com Admin\n */\n function addNetworkAuthority(address authority, uint256 network) external;\n\n /**\n * @dev Triggers to remove existing network authority from gateway token.\n * @param authority Network Authority address\n * @param network GatekeeperNetwork id\n *\n * @notice Only triggered by Identity.com Admin\n */\n function removeNetworkAuthority(address authority, uint256 network) external;\n\n /**\n * @dev Triggers to verify if authority has a NETWORK_AUTHORITY_ROLE role.\n * @param authority Network Authority address\n * @param network GatekeeperNetwork id\n */\n function isNetworkAuthority(address authority, uint256 network) external returns (bool);\n\n /**\n * @dev Transfers Gateway Token DAO Manager access from daoManager to `newManager`\n * @param newManager Address to transfer DAO Manager role for.\n */\n function transferDAOManager(address previousManager, address newManager, uint256 network) external;\n\n function mint(address to, uint256 network, uint256 expiration, uint256 mask, Charge calldata charge) external;\n\n /**\n * @dev Triggers to get all information relating to gateway `tokenId`\n * @param tokenId Gateway token id\n */\n function getToken(\n uint256 tokenId\n ) external view returns (address owner, uint8 state, string memory identity, uint256 expiration, uint256 bitmask);\n\n function getNetwork(uint256 network) external view returns (string memory);\n}\n" + }, + "contracts/interfaces/IGatewayTokenVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\npragma experimental ABIEncoderV2;\n\ninterface IGatewayTokenVerifier {\n /**\n * @dev Triggered by external contract to verify if `slot` and token `owner` are correct.\n *\n * Checks if token exists in gateway token contract, `slot` still active, and not expired.\n * Performs additional checks to verify that `owner` is not blacklisted globally.\n */\n function verifyToken(address owner, uint256 network) external view returns (bool);\n\n function verifyToken(uint256 tokenId) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IParameterizedAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity 0.8.9;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IParameterizedAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(\n bytes32 indexed role,\n uint256 domain,\n bytes32 indexed previousAdminRole,\n bytes32 indexed newAdminRole\n );\n\n event SuperAdminAdded(address indexed account);\n\n event SuperAdminRemoved(address indexed account);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, uint256 domain, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, uint256 domain, address indexed account, address indexed sender);\n\n /// A sender can only renounce roles for themselves\n error ParameterizedAccessControl__RenounceRoleNotForSelf(bytes32 role, address account);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, uint256 domain, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, uint256 domain, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, uint256 domain, address account) external;\n\n function setSuperAdmin(address account) external;\n\n function revokeSuperAdmin(address account) external;\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, uint256 domain, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role, uint256 domain) external view returns (bytes32);\n\n function isSuperAdmin(address account) external view returns (bool);\n}\n" + }, + "contracts/library/BitMask.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\nlibrary BitMask {\n uint internal constant _ONE = uint256(1);\n\n /**\n * @dev Internal function to set 1 bit in specific `index`\n * @return Updated bitmask with modified bit at `index`\n */\n function setBit(uint256 self, uint8 index) internal pure returns (uint256) {\n return self | (_ONE << index);\n }\n\n /**\n * @dev Internal function to clear bit to 0 in specific `index`\n * @return Updated bitmask with modified bit at `index`\n */\n function clearBit(uint256 self, uint8 index) internal pure returns (uint256) {\n return self & ~(_ONE << index);\n }\n\n /**\n * @dev Internal function to check bit at specific `index`\n * @return Returns TRUE if bit is '1', FALSE otherwise\n */\n function checkBit(uint256 self, uint8 index) internal pure returns (bool) {\n return (self & (uint256(1) << index)) > 0;\n }\n}\n" + }, + "contracts/library/Charge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\nenum ChargeType {\n NONE, // No charge\n ETH, // Charge amount is in Eth (Wei)\n ERC20 // Charge amount is in an ERC20 token (token field) in minor denomination\n}\n\n/**\n * @dev The Charge struct represents details of a charge made to the gatekeeper on\n * gateway token issuance or refresh.\n */\nstruct Charge {\n uint256 value;\n ChargeType chargeType;\n address token;\n address recipient;\n}\n" + }, + "contracts/library/CommonErrors.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.9;\n\n/// The passed-in account is the zero-address\nerror Common__MissingAccount();\n\n/// The passed-in account is not a contract, where an account is expected\n/// @param account address of the account.\nerror Common__NotContract(address account);\n\n/// The passed-in account is not a super-admin\n/// @param account address of the account.\nerror Common__NotSuperAdmin(address account);\n\n/// The request was made from an unauthorized address.\n/// @param sender address of the sender.\n/// @param domain the domain to which the role applies.\n/// @param role role that is required.\nerror Common__Unauthorized(address sender, uint domain, bytes32 role);\n" + }, + "contracts/MultiERC2771Context.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/**\n * @dev Context variant with ERC2771 support for multiple trusted forwarders.\n */\nabstract contract MultiERC2771Context is ContextUpgradeable {\n mapping(address => bool) private _trustedForwarders;\n\n function isTrustedForwarder(address forwarder) public view virtual returns (bool) {\n return _trustedForwarders[forwarder];\n }\n\n // because MultiERC2771Context is abstract we don't implement a\n // constructor. It's the responsibility of the derived contract to\n // disable the Initializers with \"_disableInitializers()\"\n\n // solhint-disable-next-line func-name-mixedcase\n function __MultiERC2771Context_init(address[] calldata trustedForwarders) internal initializer {\n __Context_init_unchained();\n __MultiERC2771Context_init_unchained(trustedForwarders);\n }\n\n // solhint-disable-next-line func-name-mixedcase\n function __MultiERC2771Context_init_unchained(address[] calldata trustedForwarders) internal initializer {\n for (uint i = 0; i < trustedForwarders.length; i++) {\n _trustedForwarders[trustedForwarders[i]] = true;\n }\n }\n\n // The overridden function should declare the appropriate access control//\n // keep init functions at the top by the constructor\n function _addForwarder(address forwarder) internal virtual {\n _trustedForwarders[forwarder] = true;\n }\n\n // The overridden function should declare the appropriate access control\n function _removeForwarder(address forwarder) internal virtual {\n _trustedForwarders[forwarder] = false;\n }\n\n function _msgSender() internal view virtual override returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return super._msgSender();\n }\n }\n\n function _msgData() internal view virtual override returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return super._msgData();\n }\n }\n}\n" + }, + "contracts/ParameterizedAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)\n\npragma solidity 0.8.9;\n\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IParameterizedAccessControl} from \"./interfaces/IParameterizedAccessControl.sol\";\nimport {Common__Unauthorized, Common__NotSuperAdmin} from \"./library/CommonErrors.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract ParameterizedAccessControl is ContextUpgradeable, IParameterizedAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n struct RoleDomain {\n mapping(bytes32 => RoleData) roles;\n }\n\n mapping(uint256 => RoleDomain) private _roleDomain;\n mapping(address => bool) internal _superAdmins;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role.\n */\n modifier onlyRole(bytes32 role, uint256 domain) {\n _checkRole(role, domain);\n _;\n }\n\n /**\n * @dev Modifier that checks that an account is a super admin. Reverts if not.\n */\n modifier onlySuperAdmin() {\n _onlySuperAdmin();\n _;\n }\n\n function setSuperAdmin(address account) external onlySuperAdmin {\n emit SuperAdminAdded(account);\n _superAdmins[account] = true;\n }\n\n function revokeSuperAdmin(address account) external onlySuperAdmin {\n emit SuperAdminRemoved(account);\n _superAdmins[account] = false;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(\n bytes32 role,\n uint256 domain,\n address account\n ) public virtual override onlyRole(getRoleAdmin(role, domain), domain) {\n _grantRole(role, domain, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(\n bytes32 role,\n uint256 domain,\n address account\n ) public virtual override onlyRole(getRoleAdmin(role, domain), domain) {\n _revokeRole(role, domain, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, uint256 domain, address account) public virtual override {\n if (account != _msgSender()) revert ParameterizedAccessControl__RenounceRoleNotForSelf(role, account);\n\n _revokeRole(role, domain, account);\n }\n\n function isSuperAdmin(address account) public view returns (bool) {\n return _superAdmins[account];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IParameterizedAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, uint256 domain, address account) public view virtual override returns (bool) {\n return _roleDomain[domain].roles[role].members[account];\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role, uint256 domain) public view virtual override returns (bytes32) {\n return _roleDomain[domain].roles[role].adminRole;\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Internal function without access restriction.\n *\n * [WARNING]\n * ====\n * This function should only be called from when setting\n * up the initial roles for the system or domain.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {ParameterizedAccessControl}.\n * ====\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, uint256 domain, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role, domain);\n _roleDomain[domain].roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, domain, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * [WARNING]\n * ====\n * This function should only be called from when setting\n * up the initial roles for the system or domain.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {ParameterizedAccessControl}.\n * ====\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, uint256 domain, address account) internal virtual {\n if (!hasRole(role, domain, account)) {\n _roleDomain[domain].roles[role].members[account] = true;\n emit RoleGranted(role, domain, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, uint256 domain, address account) internal virtual {\n if (hasRole(role, domain, account)) {\n _roleDomain[domain].roles[role].members[account] = false;\n emit RoleRevoked(role, domain, account, _msgSender());\n }\n }\n\n /**\n * @dev Revert if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role, uint256 domain) internal view virtual {\n _checkRole(role, domain, _msgSender());\n }\n\n /**\n * @dev Revert if `account` is missing `role`.\n *\n */\n function _checkRole(bytes32 role, uint256 domain, address account) internal view virtual {\n if (!hasRole(role, domain, account)) {\n revert Common__Unauthorized(account, domain, role);\n }\n }\n\n /**\n * @dev Revert if `account` is not a super admin\n */\n function _checkAdmin(address account) internal view virtual {\n if (!isSuperAdmin(account)) revert Common__NotSuperAdmin(account);\n }\n\n // separate into a private function to reduce code size\n function _onlySuperAdmin() private view {\n _checkAdmin(_msgSender());\n }\n}\n" + }, + "contracts/TokenBitMask.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\nimport {BitMask} from \"./library/BitMask.sol\";\nimport {IFlagsStorage} from \"./interfaces/IFlagsStorage.sol\";\n\n/**\n * @dev TokenBitMask contract is an internal smart contract for Gateway Token\n * implementation that stores KYC flags per identity token in a bitmask\n */\ncontract TokenBitMask {\n using BitMask for uint256;\n\n // Gateway Token system FlagsStorage contract address\n IFlagsStorage public flagsStorage;\n\n // Mapping for gateway token id to bitmask\n mapping(uint256 => uint256) private _bitmasks;\n\n /**\n * @dev Emitted when token BitMask associated with `tokenId` updated to `bitmask`.\n */\n event BitMaskUpdated(uint256 tokenId, uint256 bitmask);\n\n /**\n * @dev Emitted when Identity.com Admin updated FlagsStorage\n * contract address from `previousFlagsStorage` to `flagsStorage`.\n */\n event FlagsStorageUpdated(address indexed flagsStorage);\n\n /**\n * @dev Internal funciton to set FlagsStorage contract address\n * @param _flagsStorage FlagsStorage contract address\n */\n function _setFlagsStorage(address _flagsStorage) internal {\n flagsStorage = IFlagsStorage(_flagsStorage);\n\n emit FlagsStorageUpdated(_flagsStorage);\n }\n\n /**\n * @dev Internal function to set full bitmask for gateway token\n * @notice This function rewrites previous bitmask, use _addBitmask if you need to add flags to existing bitmask\n */\n function _setBitMask(uint256 tokenId, uint256 mask) internal {\n _bitmasks[tokenId] = mask;\n\n emit BitMaskUpdated(tokenId, mask);\n }\n\n /**\n * @dev Internal function to get gateway token bitmask\n */\n function _getBitMask(uint256 tokenId) internal view returns (uint256) {\n return _bitmasks[tokenId];\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 100 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/ethereum/smart-contract/package.json b/ethereum/smart-contract/package.json index 64474b8e7..711e135b3 100644 --- a/ethereum/smart-contract/package.json +++ b/ethereum/smart-contract/package.json @@ -6,6 +6,7 @@ "test": "test" }, "scripts": { + "task": "hardhat", "analyze": "slither . --config-file slither.config.json", "coverage": "NODE_ENV=test hardhat coverage && istanbul check-coverage --statements 97 --branches 90 --functions 95 --lines 93", "test": "NODE_ENV=test hardhat test", diff --git a/ethereum/smart-contract/tasks/getFees.ts b/ethereum/smart-contract/tasks/getFees.ts new file mode 100644 index 000000000..9288c1b93 --- /dev/null +++ b/ethereum/smart-contract/tasks/getFees.ts @@ -0,0 +1,18 @@ +import { HardhatRuntimeEnvironment } from 'hardhat/types'; +import {BigNumber} from "ethers"; + + + +export const getFees = async (args: any, hre: HardhatRuntimeEnvironment) => { + const { ethers, getNamedAccounts, deployments } = hre; + + const [deployer] = await ethers.getSigners(); + + const toGwei = (wei: BigNumber) => ethers.utils.formatUnits(wei, "gwei") + + const fees = await deployer.getFeeData(); + + if (fees.maxFeePerGas) console.log(`maxFeePerGas ${toGwei(fees.maxFeePerGas).toString()} gwei (${fees.maxFeePerGas.toString()} wei)`); + if (fees.maxPriorityFeePerGas) console.log(`maxPriorityFeePerGas ${toGwei(fees.maxPriorityFeePerGas).toString()} gwei (${fees.maxPriorityFeePerGas.toString()} wei)`); + if (fees.gasPrice) console.log(`maxFeePerGas ${toGwei(fees.gasPrice).toString()} gwei (${fees.gasPrice.toString()} wei)`); +};