diff --git a/constants/tokenConfig.js b/constants/tokenConfig.js index 3538100c..c60b076e 100755 --- a/constants/tokenConfig.js +++ b/constants/tokenConfig.js @@ -44,7 +44,7 @@ module.exports = { symbol: "DOMI", withFee: true, }, - FpOFT: { + ForgottenPlaylandOFT: { name: "Forgotten Playland", symbol: "FP", withFee: true, @@ -120,7 +120,7 @@ module.exports = { withFee: true, minGas: 10000000, }, - FpProxyOFT: { + ForgottenPlaylandProxyOFT: { address: "0xEeee2A2E650697d2A8e8BC990C2f3d04203bE06f", withFee: true, minGas: 10000000, diff --git a/contracts/contracts-upgradable/examples/FP.sol b/contracts/contracts-upgradable/examples/FP.sol index ca57eae7..c336dc22 100644 --- a/contracts/contracts-upgradable/examples/FP.sol +++ b/contracts/contracts-upgradable/examples/FP.sol @@ -2,9 +2,9 @@ pragma solidity ^0.8.18; -import "../token/oft/v2/fee/OFTWithFeeUpgradeable.sol"; +import "../token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol"; import "../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol"; -contract FpOFT is OFTWithFeeUpgradeable {} +contract ForgottenPlaylandOFT is OFTWithFeePermitUpgradeable {} -contract FpProxyOFT is ProxyOFTWithFeeUpgradeable {} +contract ForgottenPlaylandProxyOFT is ProxyOFTWithFeeUpgradeable {} diff --git a/contracts/contracts-upgradable/token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol b/contracts/contracts-upgradable/token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol index f4d33fca..9eabb697 100644 --- a/contracts/contracts-upgradable/token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol +++ b/contracts/contracts-upgradable/token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol @@ -15,11 +15,16 @@ contract OFTWithFeePermitUpgradeable is Initializable, BaseOFTWithFeeUpgradeable _disableInitializers(); } - function initialize(string memory _name, string memory _symbol, uint8 _sharedDecimals, address _lzEndpoint) public virtual initializer { - __OFTWithFeeUpgradeable_init(_name, _symbol, _sharedDecimals, _lzEndpoint); + function initialize( + string memory _name, + string memory _symbol, + uint8 _sharedDecimals, + address _lzEndpoint + ) public virtual initializer { + __OFTWithFeePermitUpgradeable_init(_name, _symbol, _sharedDecimals, _lzEndpoint); } - function __OFTWithFeeUpgradeable_init( + function __OFTWithFeePermitUpgradeable_init( string memory _name, string memory _symbol, uint8 _sharedDecimals, @@ -32,13 +37,13 @@ contract OFTWithFeePermitUpgradeable is Initializable, BaseOFTWithFeeUpgradeable __ERC20_init_unchained(_name, _symbol); __ERC20Permit_init_unchained(_name); - __OFTWithFeeUpgradeable_init_unchained(_sharedDecimals); + __OFTWithFeePermitUpgradeable_init_unchained(_sharedDecimals); } - function __OFTWithFeeUpgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing { + function __OFTWithFeePermitUpgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing { uint8 decimals = decimals(); require(_sharedDecimals <= decimals, "OFTWithFee: sharedDecimals must be <= decimals"); - ld2sdRate = 10 ** (decimals - _sharedDecimals); + ld2sdRate = 10**(decimals - _sharedDecimals); } /************************************************************************ @@ -55,19 +60,32 @@ contract OFTWithFeePermitUpgradeable is Initializable, BaseOFTWithFeeUpgradeable /************************************************************************ * internal functions ************************************************************************/ - function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) { + function _debitFrom( + address _from, + uint16, + bytes32, + uint _amount + ) internal virtual override returns (uint) { address spender = _msgSender(); if (_from != spender) _spendAllowance(_from, spender, _amount); _burn(_from, _amount); return _amount; } - function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) { + function _creditTo( + uint16, + address _toAddress, + uint _amount + ) internal virtual override returns (uint) { _mint(_toAddress, _amount); return _amount; } - function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) { + function _transferFrom( + address _from, + address _to, + uint _amount + ) internal virtual override returns (uint) { address spender = _msgSender(); // if transfer from this contract, no need to check allowance if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount); diff --git a/deploy/FpOFT.js b/deploy/ForgottenPlaylandOFT.js similarity index 97% rename from deploy/FpOFT.js rename to deploy/ForgottenPlaylandOFT.js index c7a9ae72..1586c943 100644 --- a/deploy/FpOFT.js +++ b/deploy/ForgottenPlaylandOFT.js @@ -1,7 +1,7 @@ const LZ_ENDPOINTS = require("../constants/layerzeroEndpoints.json") const TOKEN_CONFIG = require("../constants/tokenConfig") -const CONTRACT_NAME = "FpOFT" +const CONTRACT_NAME = "ForgottenPlaylandOFT" module.exports = async function ({ deployments, getNamedAccounts }) { const { deploy } = deployments diff --git a/deploy/FpProxyOFT.js b/deploy/ForgottenPlaylandProxyOFT.js similarity index 96% rename from deploy/FpProxyOFT.js rename to deploy/ForgottenPlaylandProxyOFT.js index 964b9708..59ced9cc 100644 --- a/deploy/FpProxyOFT.js +++ b/deploy/ForgottenPlaylandProxyOFT.js @@ -1,7 +1,7 @@ const LZ_ENDPOINTS = require("../constants/layerzeroEndpoints.json") const TOKEN_CONFIG = require("../constants/tokenConfig") -const CONTRACT_NAME = "FpProxyOFT" +const CONTRACT_NAME = "ForgottenPlaylandProxyOFT" module.exports = async function ({ deployments, getNamedAccounts }) { const { deploy } = deployments diff --git a/deployments/beam/ForgottenPlaylandOFT.json b/deployments/beam/ForgottenPlaylandOFT.json new file mode 100644 index 00000000..c03790a8 --- /dev/null +++ b/deployments/beam/ForgottenPlaylandOFT.json @@ -0,0 +1,2005 @@ +{ + "address": "0xAff7314Bc869ff4AB265ec7Efa8E442F1D978d7a", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_hash", + "type": "bytes32" + } + ], + "name": "CallOFTReceivedSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } + ], + "name": "MessageFailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "NonContractAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": true, + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "ReceiveFromChain", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_payloadHash", + "type": "bytes32" + } + ], + "name": "RetryMessageSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": true, + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "SendToChain", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "feeBp", + "type": "uint16" + } + ], + "name": "SetDefaultFeeBp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "dstchainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "feeBp", + "type": "uint16" + } + ], + "name": "SetFeeBp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "feeOwner", + "type": "address" + } + ], + "name": "SetFeeOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "_type", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_minDstGas", + "type": "uint256" + } + ], + "name": "SetMinDstGas", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "precrime", + "type": "address" + } + ], + "name": "SetPrecrime", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_path", + "type": "bytes" + } + ], + "name": "SetTrustedRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_remoteAddress", + "type": "bytes" + } + ], + "name": "SetTrustedRemoteAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "_useCustomAdapterParams", + "type": "bool" + } + ], + "name": "SetUseCustomAdapterParams", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "BP_DENOMINATOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_PAYLOAD_SIZE_LIMIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NO_EXTRA_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PT_SEND", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PT_SEND_AND_CALL", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "_from", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_gasForCall", + "type": "uint256" + } + ], + "name": "callOnOFTReceived", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "chainIdToFeeBps", + "outputs": [ + { + "internalType": "uint16", + "name": "feeBP", + "type": "uint16" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "circulatingSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "creditedPackets", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "defaultFeeBp", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_dstGasForCall", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "_useZro", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "_adapterParams", + "type": "bytes" + } + ], + "name": "estimateSendAndCallFee", + "outputs": [ + { + "internalType": "uint256", + "name": "nativeFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "zroFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_useZro", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "_adapterParams", + "type": "bytes" + } + ], + "name": "estimateSendFee", + "outputs": [ + { + "internalType": "uint256", + "name": "nativeFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "zroFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "failedMessages", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + } + ], + "name": "forceResumeReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_chainId", + "type": "uint16" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_configType", + "type": "uint256" + } + ], + "name": "getConfig", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + } + ], + "name": "getTrustedRemoteAddress", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "_sharedDecimals", + "type": "uint8" + }, + { + "internalType": "address", + "name": "_lzEndpoint", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + } + ], + "name": "isTrustedRemote", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lzEndpoint", + "outputs": [ + { + "internalType": "contract ILayerZeroEndpointUpgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "lzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "minDstGasLookup", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "nonblockingLzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "payloadSizeLimitLookup", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "precrime", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "quoteOFTFee", + "outputs": [ + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "retryMessage", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_dstGasForCall", + "type": "uint64" + }, + { + "components": [ + { + "internalType": "address payable", + "name": "refundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "zroPaymentAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "adapterParams", + "type": "bytes" + } + ], + "internalType": "struct ICommonOFTUpgradeable.LzCallParams", + "name": "_callParams", + "type": "tuple" + } + ], + "name": "sendAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address payable", + "name": "refundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "zroPaymentAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "adapterParams", + "type": "bytes" + } + ], + "internalType": "struct ICommonOFTUpgradeable.LzCallParams", + "name": "_callParams", + "type": "tuple" + } + ], + "name": "sendFrom", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_chainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_configType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_config", + "type": "bytes" + } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_feeBp", + "type": "uint16" + } + ], + "name": "setDefaultFeeBp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bool", + "name": "_enabled", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "_feeBp", + "type": "uint16" + } + ], + "name": "setFeeBp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeOwner", + "type": "address" + } + ], + "name": "setFeeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_packetType", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_minGas", + "type": "uint256" + } + ], + "name": "setMinDstGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_size", + "type": "uint256" + } + ], + "name": "setPayloadSizeLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_precrime", + "type": "address" + } + ], + "name": "setPrecrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + } + ], + "name": "setReceiveVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + } + ], + "name": "setSendVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_path", + "type": "bytes" + } + ], + "name": "setTrustedRemote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_remoteAddress", + "type": "bytes" + } + ], + "name": "setTrustedRemoteAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_useCustomAdapterParams", + "type": "bool" + } + ], + "name": "setUseCustomAdapterParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sharedDecimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "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": [], + "name": "token", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "trustedRemoteLookup", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "useCustomAdapterParams", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xfd7af94c3d841909bd3eeb7e1c72050d4cb1713ae3f9e2a5bda5f824f23429b2", + "receipt": { + "to": null, + "from": "0xbFb53a2c470cdb4FF32eE4F18A93B98F9f55D0E1", + "contractAddress": "0xAff7314Bc869ff4AB265ec7Efa8E442F1D978d7a", + "transactionIndex": 1, + "gasUsed": "613214", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000040000000000000000000000000000020000000000000000000800000000000000000000000000000000400800000000000000002000000000000000000000000080000000000000020000000000000000000000000000080400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xfb1539ce8d3367b49cfdbcc43625870f7cfb9fdfbad5da922534b2d9a829838b", + "transactionHash": "0xfd7af94c3d841909bd3eeb7e1c72050d4cb1713ae3f9e2a5bda5f824f23429b2", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 1804412, + "transactionHash": "0xfd7af94c3d841909bd3eeb7e1c72050d4cb1713ae3f9e2a5bda5f824f23429b2", + "address": "0xAff7314Bc869ff4AB265ec7Efa8E442F1D978d7a", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000bfb53a2c470cdb4ff32ee4f18a93b98f9f55d0e1" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0xfb1539ce8d3367b49cfdbcc43625870f7cfb9fdfbad5da922534b2d9a829838b" + }, + { + "transactionIndex": 1, + "blockNumber": 1804412, + "transactionHash": "0xfd7af94c3d841909bd3eeb7e1c72050d4cb1713ae3f9e2a5bda5f824f23429b2", + "address": "0xAff7314Bc869ff4AB265ec7Efa8E442F1D978d7a", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 2, + "blockHash": "0xfb1539ce8d3367b49cfdbcc43625870f7cfb9fdfbad5da922534b2d9a829838b" + } + ], + "blockNumber": 1804412, + "cumulativeGasUsed": "691354", + "status": 1, + "byzantium": true + }, + "args": [ + "0x156F777eA035c3A96B049BF270DFE39f3813778b", + "0x2A66d51407b84b82b5AFF3DeC4D49f72CBCD322a", + "0xde7ea79d000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000006000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd70000000000000000000000000000000000000000000000000000000000000012466f72676f7474656e20506c61796c616e64000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024650000000000000000000000000000000000000000000000000000000000000" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"Storage slot with the admin of the contract. This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is validated in the constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":\"OptimizedTransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\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 Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\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 function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\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 // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\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 functionCall(target, data, \\\"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(address target, bytes memory data, string memory errorMessage) 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(address target, bytes memory data, uint256 value) 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(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\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\\n // solhint-disable-next-line no-inline-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}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"},\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.7.0;\\n\\nimport \\\"../openzeppelin/proxy/UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract OptimizedTransparentUpgradeableProxy is UpgradeableProxy {\\n address internal immutable _ADMIN;\\n\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(\\n address initialLogic,\\n address initialAdmin,\\n bytes memory _data\\n ) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 slot = _ADMIN_SLOT;\\n\\n _ADMIN = initialAdmin;\\n\\n // still store it to work with EIP-1967\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, initialAdmin)\\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 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, ) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n return _ADMIN;\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x076456d71495e22183c672db71d719bd2dc7cb3b35e5bba21ce37eea1ec30347\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040526040516108fc3803806108fc8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101e9565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b506001600160601b0319606082901b166080527fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035550610297565b6101fc8161025b60201b6103581760201c565b6102375760405162461bcd60e51b81526004018080602001828103825260368152602001806108c66036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028f57508115155b949350505050565b60805160601c6106126102b46000398061047352506106126000f3fe6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c63430007060033", + "execute": { + "methodName": "initialize", + "args": [ + "Forgotten Playland", + "FP", + 6, + "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7" + ] + }, + "implementation": "0x156F777eA035c3A96B049BF270DFE39f3813778b", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "Storage slot with the admin of the contract. This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is validated in the constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/beam/ForgottenPlaylandOFT_Implementation.json b/deployments/beam/ForgottenPlaylandOFT_Implementation.json new file mode 100644 index 00000000..dd9d6428 --- /dev/null +++ b/deployments/beam/ForgottenPlaylandOFT_Implementation.json @@ -0,0 +1,2463 @@ +{ + "address": "0x156F777eA035c3A96B049BF270DFE39f3813778b", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_hash", + "type": "bytes32" + } + ], + "name": "CallOFTReceivedSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } + ], + "name": "MessageFailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "NonContractAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": true, + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "ReceiveFromChain", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_payloadHash", + "type": "bytes32" + } + ], + "name": "RetryMessageSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": true, + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "SendToChain", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "feeBp", + "type": "uint16" + } + ], + "name": "SetDefaultFeeBp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "dstchainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "feeBp", + "type": "uint16" + } + ], + "name": "SetFeeBp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "feeOwner", + "type": "address" + } + ], + "name": "SetFeeOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "_type", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_minDstGas", + "type": "uint256" + } + ], + "name": "SetMinDstGas", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "precrime", + "type": "address" + } + ], + "name": "SetPrecrime", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_path", + "type": "bytes" + } + ], + "name": "SetTrustedRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_remoteAddress", + "type": "bytes" + } + ], + "name": "SetTrustedRemoteAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "_useCustomAdapterParams", + "type": "bool" + } + ], + "name": "SetUseCustomAdapterParams", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "BP_DENOMINATOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_PAYLOAD_SIZE_LIMIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NO_EXTRA_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PT_SEND", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PT_SEND_AND_CALL", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "_from", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_gasForCall", + "type": "uint256" + } + ], + "name": "callOnOFTReceived", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "chainIdToFeeBps", + "outputs": [ + { + "internalType": "uint16", + "name": "feeBP", + "type": "uint16" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "circulatingSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "creditedPackets", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "defaultFeeBp", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_dstGasForCall", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "_useZro", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "_adapterParams", + "type": "bytes" + } + ], + "name": "estimateSendAndCallFee", + "outputs": [ + { + "internalType": "uint256", + "name": "nativeFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "zroFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_useZro", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "_adapterParams", + "type": "bytes" + } + ], + "name": "estimateSendFee", + "outputs": [ + { + "internalType": "uint256", + "name": "nativeFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "zroFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "failedMessages", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + } + ], + "name": "forceResumeReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_chainId", + "type": "uint16" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_configType", + "type": "uint256" + } + ], + "name": "getConfig", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + } + ], + "name": "getTrustedRemoteAddress", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "_sharedDecimals", + "type": "uint8" + }, + { + "internalType": "address", + "name": "_lzEndpoint", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + } + ], + "name": "isTrustedRemote", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lzEndpoint", + "outputs": [ + { + "internalType": "contract ILayerZeroEndpointUpgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "lzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "minDstGasLookup", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "nonblockingLzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "payloadSizeLimitLookup", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "precrime", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "quoteOFTFee", + "outputs": [ + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "retryMessage", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_dstGasForCall", + "type": "uint64" + }, + { + "components": [ + { + "internalType": "address payable", + "name": "refundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "zroPaymentAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "adapterParams", + "type": "bytes" + } + ], + "internalType": "struct ICommonOFTUpgradeable.LzCallParams", + "name": "_callParams", + "type": "tuple" + } + ], + "name": "sendAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address payable", + "name": "refundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "zroPaymentAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "adapterParams", + "type": "bytes" + } + ], + "internalType": "struct ICommonOFTUpgradeable.LzCallParams", + "name": "_callParams", + "type": "tuple" + } + ], + "name": "sendFrom", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_chainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_configType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_config", + "type": "bytes" + } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_feeBp", + "type": "uint16" + } + ], + "name": "setDefaultFeeBp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bool", + "name": "_enabled", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "_feeBp", + "type": "uint16" + } + ], + "name": "setFeeBp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeOwner", + "type": "address" + } + ], + "name": "setFeeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_packetType", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_minGas", + "type": "uint256" + } + ], + "name": "setMinDstGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_size", + "type": "uint256" + } + ], + "name": "setPayloadSizeLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_precrime", + "type": "address" + } + ], + "name": "setPrecrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + } + ], + "name": "setReceiveVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + } + ], + "name": "setSendVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_path", + "type": "bytes" + } + ], + "name": "setTrustedRemote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_remoteAddress", + "type": "bytes" + } + ], + "name": "setTrustedRemoteAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_useCustomAdapterParams", + "type": "bool" + } + ], + "name": "setUseCustomAdapterParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sharedDecimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "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": [], + "name": "token", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "trustedRemoteLookup", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "useCustomAdapterParams", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x90733b6816c3ab8edd11c718e738e5984eda27d5002be6a02c17d7dbb19f897a", + "receipt": { + "to": null, + "from": "0xbFb53a2c470cdb4FF32eE4F18A93B98F9f55D0E1", + "contractAddress": "0x156F777eA035c3A96B049BF270DFE39f3813778b", + "transactionIndex": 0, + "gasUsed": "4780155", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000001000000000040000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x1ae5c77b55c1233f22fe29926ad928d02ef9f944b9de2ec857e86d1324d28847", + "transactionHash": "0x90733b6816c3ab8edd11c718e738e5984eda27d5002be6a02c17d7dbb19f897a", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 1804410, + "transactionHash": "0x90733b6816c3ab8edd11c718e738e5984eda27d5002be6a02c17d7dbb19f897a", + "address": "0x156F777eA035c3A96B049BF270DFE39f3813778b", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 0, + "blockHash": "0x1ae5c77b55c1233f22fe29926ad928d02ef9f944b9de2ec857e86d1324d28847" + } + ], + "blockNumber": 1804410, + "cumulativeGasUsed": "4780155", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "8313c17822638cfb28f4331864b9ea01", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_hash\",\"type\":\"bytes32\"}],\"name\":\"CallOFTReceivedSuccess\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_reason\",\"type\":\"bytes\"}],\"name\":\"MessageFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"NonContractAddress\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"ReceiveFromChain\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_payloadHash\",\"type\":\"bytes32\"}],\"name\":\"RetryMessageSuccess\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_toAddress\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"SendToChain\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"feeBp\",\"type\":\"uint16\"}],\"name\":\"SetDefaultFeeBp\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"dstchainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"feeBp\",\"type\":\"uint16\"}],\"name\":\"SetFeeBp\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeOwner\",\"type\":\"address\"}],\"name\":\"SetFeeOwner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_type\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minDstGas\",\"type\":\"uint256\"}],\"name\":\"SetMinDstGas\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"precrime\",\"type\":\"address\"}],\"name\":\"SetPrecrime\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_remoteChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_path\",\"type\":\"bytes\"}],\"name\":\"SetTrustedRemote\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_remoteChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_remoteAddress\",\"type\":\"bytes\"}],\"name\":\"SetTrustedRemoteAddress\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_useCustomAdapterParams\",\"type\":\"bool\"}],\"name\":\"SetUseCustomAdapterParams\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BP_DENOMINATOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_PAYLOAD_SIZE_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NO_EXTRA_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PT_SEND\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PT_SEND_AND_CALL\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"_from\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_gasForCall\",\"type\":\"uint256\"}],\"name\":\"callOnOFTReceived\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"chainIdToFeeBps\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"feeBP\",\"type\":\"uint16\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"circulatingSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"name\":\"creditedPackets\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultFeeBp\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes32\",\"name\":\"_toAddress\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_dstGasForCall\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"_useZro\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"_adapterParams\",\"type\":\"bytes\"}],\"name\":\"estimateSendAndCallFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"nativeFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"zroFee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes32\",\"name\":\"_toAddress\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"_useZro\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"_adapterParams\",\"type\":\"bytes\"}],\"name\":\"estimateSendFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"nativeFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"zroFee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"name\":\"failedMessages\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"}],\"name\":\"forceResumeReceive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_version\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"_chainId\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_configType\",\"type\":\"uint256\"}],\"name\":\"getConfig\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_remoteChainId\",\"type\":\"uint16\"}],\"name\":\"getTrustedRemoteAddress\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"_sharedDecimals\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"_lzEndpoint\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"}],\"name\":\"isTrustedRemote\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lzEndpoint\",\"outputs\":[{\"internalType\":\"contract ILayerZeroEndpointUpgradeable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"}],\"name\":\"lzReceive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"minDstGasLookup\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"}],\"name\":\"nonblockingLzReceive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"payloadSizeLimitLookup\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precrime\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"quoteOFTFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"}],\"name\":\"retryMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes32\",\"name\":\"_toAddress\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_dstGasForCall\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"address payable\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"zroPaymentAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"adapterParams\",\"type\":\"bytes\"}],\"internalType\":\"struct ICommonOFTUpgradeable.LzCallParams\",\"name\":\"_callParams\",\"type\":\"tuple\"}],\"name\":\"sendAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes32\",\"name\":\"_toAddress\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address payable\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"zroPaymentAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"adapterParams\",\"type\":\"bytes\"}],\"internalType\":\"struct ICommonOFTUpgradeable.LzCallParams\",\"name\":\"_callParams\",\"type\":\"tuple\"}],\"name\":\"sendFrom\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_version\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"_chainId\",\"type\":\"uint16\"},{\"internalType\":\"uint256\",\"name\":\"_configType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_config\",\"type\":\"bytes\"}],\"name\":\"setConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_feeBp\",\"type\":\"uint16\"}],\"name\":\"setDefaultFeeBp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"bool\",\"name\":\"_enabled\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"_feeBp\",\"type\":\"uint16\"}],\"name\":\"setFeeBp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_feeOwner\",\"type\":\"address\"}],\"name\":\"setFeeOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"_packetType\",\"type\":\"uint16\"},{\"internalType\":\"uint256\",\"name\":\"_minGas\",\"type\":\"uint256\"}],\"name\":\"setMinDstGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"uint256\",\"name\":\"_size\",\"type\":\"uint256\"}],\"name\":\"setPayloadSizeLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_precrime\",\"type\":\"address\"}],\"name\":\"setPrecrime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_version\",\"type\":\"uint16\"}],\"name\":\"setReceiveVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_version\",\"type\":\"uint16\"}],\"name\":\"setSendVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_path\",\"type\":\"bytes\"}],\"name\":\"setTrustedRemote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_remoteChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_remoteAddress\",\"type\":\"bytes\"}],\"name\":\"setTrustedRemoteAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_useCustomAdapterParams\",\"type\":\"bool\"}],\"name\":\"setUseCustomAdapterParams\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sharedDecimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"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\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"trustedRemoteLookup\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"useCustomAdapterParams\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"ReceiveFromChain(uint16,address,uint256)\":{\"details\":\"Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain. `_nonce` is the inbound nonce.\"},\"SendToChain(uint16,address,bytes32,uint256)\":{\"details\":\"Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`) `_nonce` is the outbound nonce\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"DOMAIN_SEPARATOR()\":{\"details\":\"See {IERC20Permit-DOMAIN_SEPARATOR}.\"},\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"circulatingSupply()\":{\"details\":\"returns the circulating amount of tokens on current chain\"},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"decreaseAllowance(address,uint256)\":{\"details\":\"Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.\"},\"eip712Domain()\":{\"details\":\"See {EIP-5267}. _Available since v4.9._\"},\"estimateSendFee(uint16,bytes32,uint256,bool,bytes)\":{\"details\":\"estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`) _dstChainId - L0 defined chain id to send tokens too _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain _amount - amount of the tokens to transfer _useZro - indicates to use zro to pay L0 fees _adapterParam - flexible bytes array to indicate messaging adapter services in L0\"},\"increaseAllowance(address,uint256)\":{\"details\":\"Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"nonces(address)\":{\"details\":\"See {IERC20Permit-nonces}.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)\":{\"details\":\"See {IERC20Permit-permit}.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"sendFrom(address,uint16,bytes32,uint256,uint256,(address,address,bytes))\":{\"details\":\"send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from` `_from` the owner of token `_dstChainId` the destination chain identifier `_toAddress` can be any size depending on the `dstChainId`. `_amount` the quantity of tokens in wei `_minAmount` the minimum amount of tokens to receive on dstChain `_refundAddress` the address LayerZero refunds if too much message fee is sent `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) `_adapterParams` is a flexible bytes array to indicate messaging adapter services\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"token()\":{\"details\":\"returns the address of the ERC20 token\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for ``from``'s tokens of at least `amount`.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts-upgradable/examples/FP.sol\":\"ForgottenPlaylandOFT\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC5267Upgradeable {\\n /**\\n * @dev MAY be emitted to signal that the domain could have changed.\\n */\\n event EIP712DomainChanged();\\n\\n /**\\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\\n * signature.\\n */\\n function eip712Domain()\\n external\\n view\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n );\\n}\\n\",\"keccak256\":\"0xe562dab443278837fa50faddb76743399e942181881db8dccaea3bd1712994db\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20Upgradeable.sol\\\";\\nimport \\\"./extensions/IERC20MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * The default value of {decimals} is 18. To change this, you should override\\n * this function so it returns a different value.\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC20_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the default value returned by this function, unless\\n * it's overridden.\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, allowance(owner, spender) + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = allowance(owner, spender);\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `from` to `to`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(address from, address to, uint256 amount) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\\n // decrementing then incrementing.\\n _balances[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n unchecked {\\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\\n _balances[account] += amount;\\n }\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n // Overflow not possible: amount <= accountBalance <= totalSupply.\\n _totalSupply -= amount;\\n }\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(address owner, address spender, uint256 amount) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 amount) 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[45] private __gap;\\n}\\n\",\"keccak256\":\"0xd14a627157b9a411d2410713e5dd3a377e9064bd5c194a90748bbf27ea625784\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 IERC20Upgradeable {\\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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x0e1f0f5f62f67a881cd1a9597acbc0a5e4071f3c2c10449a183b922ae7272e3f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20PermitUpgradeable.sol\\\";\\nimport \\\"../ERC20Upgradeable.sol\\\";\\nimport \\\"../../../utils/cryptography/ECDSAUpgradeable.sol\\\";\\nimport \\\"../../../utils/cryptography/EIP712Upgradeable.sol\\\";\\nimport \\\"../../../utils/CountersUpgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation 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 *\\n * _Available since v3.4._\\n *\\n * @custom:storage-size 51\\n */\\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\\n using CountersUpgradeable for CountersUpgradeable.Counter;\\n\\n mapping(address => CountersUpgradeable.Counter) private _nonces;\\n\\n // solhint-disable-next-line var-name-mixedcase\\n bytes32 private constant _PERMIT_TYPEHASH =\\n keccak256(\\\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\\\");\\n /**\\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\\n * However, to ensure consistency with the upgradeable transpiler, we will continue\\n * to reserve a slot.\\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\\n\\n /**\\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\\\"1\\\"`.\\n *\\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\\n */\\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\\n __EIP712_init_unchained(name, \\\"1\\\");\\n }\\n\\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\\n\\n /**\\n * @dev See {IERC20Permit-permit}.\\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 ) public virtual override {\\n require(block.timestamp <= deadline, \\\"ERC20Permit: expired deadline\\\");\\n\\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\\n\\n bytes32 hash = _hashTypedDataV4(structHash);\\n\\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\\n require(signer == owner, \\\"ERC20Permit: invalid signature\\\");\\n\\n _approve(owner, spender, value);\\n }\\n\\n /**\\n * @dev See {IERC20Permit-nonces}.\\n */\\n function nonces(address owner) public view virtual override returns (uint256) {\\n return _nonces[owner].current();\\n }\\n\\n /**\\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\\n return _domainSeparatorV4();\\n }\\n\\n /**\\n * @dev \\\"Consume a nonce\\\": return the current value and increment.\\n *\\n * _Available since v4.1._\\n */\\n function _useNonce(address owner) internal virtual returns (uint256 current) {\\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\\n current = nonce.current();\\n nonce.increment();\\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\":\"0x3988ac03e4819acd4b5adf41de7d43c1471748ddc2d73d2c7aca1e3827402e5d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x605434219ebbe4653f703640f06969faa5a1d78f0bfef878e5ddbb1ca369ceeb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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 IERC20PermitUpgradeable {\\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\":\"0xd60f939a3ca0199014d079b4dd66aa757954334947d81eb5c1d35d7a83061ab3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20Upgradeable.sol\\\";\\nimport \\\"../extensions/IERC20PermitUpgradeable.sol\\\";\\nimport \\\"../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {\\n using AddressUpgradeable for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) 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(IERC20Upgradeable token, address spender, uint256 value) 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 /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20PermitUpgradeable 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(IERC20Upgradeable 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 require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation 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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\\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 cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0x23b997be73d3dd46885262704f0f8cfc7273fdadfe303d37969a9561373972b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) 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\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.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 `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../StringsUpgradeable.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 ECDSAUpgradeable {\\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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\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\\\", StringsUpgradeable.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 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0xa014f65d84b02827055d99993ccdbfb4b56b2c9e91eb278d82a93330659d06e4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"./ECDSAUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC5267Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\\n *\\n * _Available since v3.4._\\n *\\n * @custom:storage-size 52\\n */\\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\\n bytes32 private constant _TYPE_HASH =\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\");\\n\\n /// @custom:oz-renamed-from _HASHED_NAME\\n bytes32 private _hashedName;\\n /// @custom:oz-renamed-from _HASHED_VERSION\\n bytes32 private _hashedVersion;\\n\\n string private _name;\\n string private _version;\\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 function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\\n __EIP712_init_unchained(name, version);\\n }\\n\\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\\n _name = name;\\n _version = version;\\n\\n // Reset prior values in storage if upgrading\\n _hashedName = 0;\\n _hashedVersion = 0;\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n return _buildDomainSeparator();\\n }\\n\\n function _buildDomainSeparator() private view returns (bytes32) {\\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), 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 ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n\\n /**\\n * @dev See {EIP-5267}.\\n *\\n * _Available since v4.9._\\n */\\n function eip712Domain()\\n public\\n view\\n virtual\\n override\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n )\\n {\\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\\n // and the EIP712 domain is not reliable, as it will be missing name and version.\\n require(_hashedName == 0 && _hashedVersion == 0, \\\"EIP712: Uninitialized\\\");\\n\\n return (\\n hex\\\"0f\\\", // 01111\\n _EIP712Name(),\\n _EIP712Version(),\\n block.chainid,\\n address(this),\\n bytes32(0),\\n new uint256[](0)\\n );\\n }\\n\\n /**\\n * @dev The name parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Name() internal virtual view returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev The version parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Version() internal virtual view returns (string memory) {\\n return _version;\\n }\\n\\n /**\\n * @dev The hash of the name parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\\n */\\n function _EIP712NameHash() internal view returns (bytes32) {\\n string memory name = _EIP712Name();\\n if (bytes(name).length > 0) {\\n return keccak256(bytes(name));\\n } else {\\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\\n bytes32 hashedName = _hashedName;\\n if (hashedName != 0) {\\n return hashedName;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\n }\\n }\\n\\n /**\\n * @dev The hash of the version parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\\n */\\n function _EIP712VersionHash() internal view returns (bytes32) {\\n string memory version = _EIP712Version();\\n if (bytes(version).length > 0) {\\n return keccak256(bytes(version));\\n } else {\\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\\n bytes32 hashedVersion = _hashedVersion;\\n if (hashedVersion != 0) {\\n return hashedVersion;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\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[48] private __gap;\\n}\\n\",\"keccak256\":\"0xeb8d6be406a373771724922eb41b5d593bc8e2dc705daa22cd1145cfc8f5a3a0\",\"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.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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 256, 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 << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/examples/FP.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.18;\\n\\nimport \\\"../token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol\\\";\\nimport \\\"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\\\";\\n\\ncontract ForgottenPlaylandOFT is OFTWithFeePermitUpgradeable {}\\n\\ncontract ForgottenPlaylandProxyOFT is ProxyOFTWithFeeUpgradeable {}\\n\",\"keccak256\":\"0xff3b15c60765d3c002a4d7a4729766449b34694d1ab46b97d8ed67f4fb4b130b\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/lzApp/LzAppUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"./interfaces/ILayerZeroReceiverUpgradeable.sol\\\";\\nimport \\\"./interfaces/ILayerZeroUserApplicationConfigUpgradeable.sol\\\";\\nimport \\\"./interfaces/ILayerZeroEndpointUpgradeable.sol\\\";\\nimport \\\"../../libraries/BytesLib.sol\\\";\\n\\n/*\\n * a generic LzReceiver implementation\\n */\\nabstract contract LzAppUpgradeable is\\n Initializable,\\n OwnableUpgradeable,\\n ILayerZeroReceiverUpgradeable,\\n ILayerZeroUserApplicationConfigUpgradeable\\n{\\n using BytesLib for bytes;\\n\\n // ua can not send payload larger than this by default, but it can be changed by the ua owner\\n uint public constant DEFAULT_PAYLOAD_SIZE_LIMIT = 10000;\\n\\n ILayerZeroEndpointUpgradeable public lzEndpoint;\\n mapping(uint16 => bytes) public trustedRemoteLookup;\\n mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup;\\n mapping(uint16 => uint) public payloadSizeLimitLookup;\\n address public precrime;\\n\\n event SetPrecrime(address precrime);\\n event SetTrustedRemote(uint16 _remoteChainId, bytes _path);\\n event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress);\\n event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas);\\n\\n function __LzAppUpgradeable_init(address _endpoint) internal onlyInitializing {\\n __Ownable_init_unchained();\\n __LzAppUpgradeable_init_unchained(_endpoint);\\n }\\n\\n function __LzAppUpgradeable_init_unchained(address _endpoint) internal onlyInitializing {\\n lzEndpoint = ILayerZeroEndpointUpgradeable(_endpoint);\\n }\\n\\n function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override {\\n // lzReceive must be called by the endpoint for security\\n require(_msgSender() == address(lzEndpoint), \\\"LzApp: invalid endpoint caller\\\");\\n\\n bytes memory trustedRemote = trustedRemoteLookup[_srcChainId];\\n // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.\\n require(\\n _srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote),\\n \\\"LzApp: invalid source sending contract\\\"\\n );\\n\\n _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\\n }\\n\\n // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging\\n function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\\n\\n function _lzSend(\\n uint16 _dstChainId,\\n bytes memory _payload,\\n address payable _refundAddress,\\n address _zroPaymentAddress,\\n bytes memory _adapterParams,\\n uint _nativeFee\\n ) internal virtual {\\n bytes memory trustedRemote = trustedRemoteLookup[_dstChainId];\\n require(trustedRemote.length != 0, \\\"LzApp: destination chain is not a trusted source\\\");\\n _checkPayloadSize(_dstChainId, _payload.length);\\n lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams);\\n }\\n\\n function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual {\\n uint providedGasLimit = _getGasLimit(_adapterParams);\\n uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas;\\n require(minGasLimit > 0, \\\"LzApp: minGasLimit not set\\\");\\n require(providedGasLimit >= minGasLimit, \\\"LzApp: gas limit is too low\\\");\\n }\\n\\n function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) {\\n require(_adapterParams.length >= 34, \\\"LzApp: invalid adapterParams\\\");\\n assembly {\\n gasLimit := mload(add(_adapterParams, 34))\\n }\\n }\\n\\n function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual {\\n uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId];\\n if (payloadSizeLimit == 0) {\\n // use default if not set\\n payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT;\\n }\\n require(_payloadSize <= payloadSizeLimit, \\\"LzApp: payload size is too large\\\");\\n }\\n\\n //---------------------------UserApplication config----------------------------------------\\n function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) {\\n return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);\\n }\\n\\n // generic config for LayerZero user Application\\n function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner {\\n lzEndpoint.setConfig(_version, _chainId, _configType, _config);\\n }\\n\\n function setSendVersion(uint16 _version) external override onlyOwner {\\n lzEndpoint.setSendVersion(_version);\\n }\\n\\n function setReceiveVersion(uint16 _version) external override onlyOwner {\\n lzEndpoint.setReceiveVersion(_version);\\n }\\n\\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner {\\n lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress);\\n }\\n\\n // _path = abi.encodePacked(remoteAddress, localAddress)\\n // this function set the trusted path for the cross-chain communication\\n function setTrustedRemote(uint16 _srcChainId, bytes calldata _path) external onlyOwner {\\n trustedRemoteLookup[_srcChainId] = _path;\\n emit SetTrustedRemote(_srcChainId, _path);\\n }\\n\\n function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner {\\n trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this));\\n emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress);\\n }\\n\\n function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) {\\n bytes memory path = trustedRemoteLookup[_remoteChainId];\\n require(path.length != 0, \\\"LzApp: no trusted path record\\\");\\n return path.slice(0, path.length - 20); // the last 20 bytes should be address(this)\\n }\\n\\n function setPrecrime(address _precrime) external onlyOwner {\\n precrime = _precrime;\\n emit SetPrecrime(_precrime);\\n }\\n\\n function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner {\\n require(_minGas > 0, \\\"LzApp: invalid minGas\\\");\\n minDstGasLookup[_dstChainId][_packetType] = _minGas;\\n emit SetMinDstGas(_dstChainId, _packetType, _minGas);\\n }\\n\\n // if the size is 0, it means default size limit\\n function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner {\\n payloadSizeLimitLookup[_dstChainId] = _size;\\n }\\n\\n //--------------------------- VIEW FUNCTION ----------------------------------------\\n function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) {\\n bytes memory trustedSource = trustedRemoteLookup[_srcChainId];\\n return keccak256(trustedSource) == keccak256(_srcAddress);\\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 uint[45] private __gap;\\n}\\n\",\"keccak256\":\"0x7c17b736a978ee67fdaaf41963d93f78ddc8f6671597bac75d7a88c4bc3e0529\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/lzApp/NonblockingLzAppUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"./LzAppUpgradeable.sol\\\";\\nimport \\\"../../libraries/ExcessivelySafeCall.sol\\\";\\n\\n/*\\n * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel\\n * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking\\n * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress)\\n */\\nabstract contract NonblockingLzAppUpgradeable is Initializable, LzAppUpgradeable {\\n using ExcessivelySafeCall for address;\\n\\n function __NonblockingLzAppUpgradeable_init(address _endpoint) internal onlyInitializing {\\n __Ownable_init_unchained();\\n __LzAppUpgradeable_init_unchained(_endpoint);\\n }\\n\\n function __NonblockingLzAppUpgradeable_init_unchained(address _endpoint) internal onlyInitializing {}\\n\\n mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages;\\n\\n event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason);\\n event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash);\\n\\n // overriding the virtual function in LzReceiver\\n function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {\\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\\n gasleft(),\\n 150,\\n abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)\\n );\\n // try-catch all errors/exceptions\\n if (!success) {\\n _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason);\\n }\\n }\\n\\n function _storeFailedMessage(\\n uint16 _srcChainId,\\n bytes memory _srcAddress,\\n uint64 _nonce,\\n bytes memory _payload,\\n bytes memory _reason\\n ) internal virtual {\\n failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload);\\n emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason);\\n }\\n\\n function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual {\\n // only internal transaction\\n require(_msgSender() == address(this), \\\"NonblockingLzApp: caller must be LzApp\\\");\\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\\n }\\n\\n //@notice override this function\\n function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\\n\\n function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual {\\n // assert there is message to retry\\n bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce];\\n require(payloadHash != bytes32(0), \\\"NonblockingLzApp: no stored message\\\");\\n require(keccak256(_payload) == payloadHash, \\\"NonblockingLzApp: invalid payload\\\");\\n // clear the stored message\\n failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0);\\n // execute the message. revert if it fails again\\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\\n emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash);\\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 uint[49] private __gap;\\n}\\n\",\"keccak256\":\"0xe5e6cad4f4150cffaf48c7588b934e8b43762505d9d4e600f2fcdbc271fb7b20\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroEndpointUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"./ILayerZeroUserApplicationConfigUpgradeable.sol\\\";\\n\\ninterface ILayerZeroEndpointUpgradeable is ILayerZeroUserApplicationConfigUpgradeable {\\n // @notice send a LayerZero message to the specified address at a LayerZero endpoint.\\n // @param _dstChainId - the destination chain identifier\\n // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains\\n // @param _payload - a custom bytes payload to send to the destination contract\\n // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address\\n // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction\\n // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination\\n function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;\\n\\n // @notice used by the messaging library to publish verified payload\\n // @param _srcChainId - the source chain identifier\\n // @param _srcAddress - the source contract (as bytes) at the source chain\\n // @param _dstAddress - the address on destination chain\\n // @param _nonce - the unbound message ordering nonce\\n // @param _gasLimit - the gas limit for external contract execution\\n // @param _payload - verified payload to send to the destination contract\\n function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external;\\n\\n // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain\\n // @param _srcChainId - the source chain identifier\\n // @param _srcAddress - the source chain contract address\\n function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);\\n\\n // @notice get the outboundNonce from this source chain which, consequently, is always an EVM\\n // @param _srcAddress - the source chain contract address\\n function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);\\n\\n // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery\\n // @param _dstChainId - the destination chain identifier\\n // @param _userApplication - the user app address on this EVM chain\\n // @param _payload - the custom message to send over LayerZero\\n // @param _payInZRO - if false, user app pays the protocol fee in native token\\n // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain\\n function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee);\\n\\n // @notice get this Endpoint's immutable source identifier\\n function getChainId() external view returns (uint16);\\n\\n // @notice the interface to retry failed message on this Endpoint destination\\n // @param _srcChainId - the source chain identifier\\n // @param _srcAddress - the source chain contract address\\n // @param _payload - the payload to be retried\\n function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external;\\n\\n // @notice query if any STORED payload (message blocking) at the endpoint.\\n // @param _srcChainId - the source chain identifier\\n // @param _srcAddress - the source chain contract address\\n function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);\\n\\n // @notice query if the _libraryAddress is valid for sending msgs.\\n // @param _userApplication - the user app address on this EVM chain\\n function getSendLibraryAddress(address _userApplication) external view returns (address);\\n\\n // @notice query if the _libraryAddress is valid for receiving msgs.\\n // @param _userApplication - the user app address on this EVM chain\\n function getReceiveLibraryAddress(address _userApplication) external view returns (address);\\n\\n // @notice query if the non-reentrancy guard for send() is on\\n // @return true if the guard is on. false otherwise\\n function isSendingPayload() external view returns (bool);\\n\\n // @notice query if the non-reentrancy guard for receive() is on\\n // @return true if the guard is on. false otherwise\\n function isReceivingPayload() external view returns (bool);\\n\\n // @notice get the configuration of the LayerZero messaging library of the specified version\\n // @param _version - messaging library version\\n // @param _chainId - the chainId for the pending config change\\n // @param _userApplication - the contract address of the user application\\n // @param _configType - type of configuration. every messaging library has its own convention.\\n function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory);\\n\\n // @notice get the send() LayerZero messaging library version\\n // @param _userApplication - the contract address of the user application\\n function getSendVersion(address _userApplication) external view returns (uint16);\\n\\n // @notice get the lzReceive() LayerZero messaging library version\\n // @param _userApplication - the contract address of the user application\\n function getReceiveVersion(address _userApplication) external view returns (uint16);\\n}\\n\",\"keccak256\":\"0x748e7abf8908f264c6fff8ea7730b1766ab5a262be7962404f7d263066b41487\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.2;\\n\\ninterface ILayerZeroReceiverUpgradeable {\\n // @notice LayerZero endpoint will invoke this function to deliver the message on the destination\\n // @param _srcChainId - the source endpoint identifier\\n // @param _srcAddress - the source sending contract address from the source chain\\n // @param _nonce - the ordered message nonce\\n // @param _payload - the signed payload is the UA bytes has encoded to be sent\\n function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;\\n}\\n\",\"keccak256\":\"0x6ce5593a1247719f7209cad8068573c249674b41b859c6379ace1baaea0ed2a3\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroUserApplicationConfigUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.2;\\n\\ninterface ILayerZeroUserApplicationConfigUpgradeable {\\n // @notice set the configuration of the LayerZero messaging library of the specified version\\n // @param _version - messaging library version\\n // @param _chainId - the chainId for the pending config change\\n // @param _configType - type of configuration. every messaging library has its own convention.\\n // @param _config - configuration in the bytes. can encode arbitrary content.\\n function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;\\n\\n // @notice set the send() LayerZero messaging library version to _version\\n // @param _version - new messaging library version\\n function setSendVersion(uint16 _version) external;\\n\\n // @notice set the lzReceive() LayerZero messaging library version to _version\\n // @param _version - new messaging library version\\n function setReceiveVersion(uint16 _version) external;\\n\\n // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload\\n // @param _srcChainId - the chainId of the source chain\\n // @param _srcAddress - the contract address of the source contract at the source chain\\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;\\n}\\n\",\"keccak256\":\"0xa808baa32db12c453b982320e0c9a8c07aec8c0f3bb36ac2ed26f3ad47476879\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/OFTCoreV2Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../../lzApp/NonblockingLzAppUpgradeable.sol\\\";\\nimport \\\"../../../../libraries/ExcessivelySafeCall.sol\\\";\\nimport \\\"./interfaces/ICommonOFTUpgradeable.sol\\\";\\nimport \\\"./interfaces/IOFTReceiverV2Upgradeable.sol\\\";\\n\\nabstract contract OFTCoreV2Upgradeable is NonblockingLzAppUpgradeable {\\n using BytesLib for bytes;\\n using ExcessivelySafeCall for address;\\n\\n uint public constant NO_EXTRA_GAS = 0;\\n\\n // packet type\\n uint8 public constant PT_SEND = 0;\\n uint8 public constant PT_SEND_AND_CALL = 1;\\n\\n uint8 public sharedDecimals;\\n\\n bool public useCustomAdapterParams;\\n mapping(uint16 => mapping(bytes => mapping(uint64 => bool))) public creditedPackets;\\n\\n /**\\n * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\\n * `_nonce` is the outbound nonce\\n */\\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes32 indexed _toAddress, uint _amount);\\n\\n /**\\n * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain.\\n * `_nonce` is the inbound nonce.\\n */\\n event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount);\\n\\n event SetUseCustomAdapterParams(bool _useCustomAdapterParams);\\n\\n event CallOFTReceivedSuccess(uint16 indexed _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _hash);\\n\\n event NonContractAddress(address _address);\\n\\n // _sharedDecimals should be the minimum decimals on all chains\\n function __OFTCoreV2Upgradeable_init(uint8 _sharedDecimals, address _lzEndpoint) internal onlyInitializing {\\n __Ownable_init_unchained();\\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\\n }\\n\\n function __OFTCoreV2Upgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\\n sharedDecimals = _sharedDecimals;\\n }\\n\\n /************************************************************************\\n * public functions\\n ************************************************************************/\\n function callOnOFTReceived(\\n uint16 _srcChainId,\\n bytes calldata _srcAddress,\\n uint64 _nonce,\\n bytes32 _from,\\n address _to,\\n uint _amount,\\n bytes calldata _payload,\\n uint _gasForCall\\n ) public virtual {\\n require(_msgSender() == address(this), \\\"OFTCore: caller must be OFTCore\\\");\\n\\n // send\\n _amount = _transferFrom(address(this), _to, _amount);\\n emit ReceiveFromChain(_srcChainId, _to, _amount);\\n\\n // call\\n IOFTReceiverV2Upgradeable(_to).onOFTReceived{gas: _gasForCall}(_srcChainId, _srcAddress, _nonce, _from, _amount, _payload);\\n }\\n\\n function setUseCustomAdapterParams(bool _useCustomAdapterParams) public virtual onlyOwner {\\n useCustomAdapterParams = _useCustomAdapterParams;\\n emit SetUseCustomAdapterParams(_useCustomAdapterParams);\\n }\\n\\n /************************************************************************\\n * internal functions\\n ************************************************************************/\\n function _estimateSendFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bool _useZro,\\n bytes memory _adapterParams\\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\\n // mock the payload for sendFrom()\\n bytes memory payload = _encodeSendPayload(_toAddress, _ld2sd(_amount));\\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\\n }\\n\\n function _estimateSendAndCallFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bytes memory _payload,\\n uint64 _dstGasForCall,\\n bool _useZro,\\n bytes memory _adapterParams\\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\\n // mock the payload for sendAndCall()\\n bytes memory payload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(_amount), _payload, _dstGasForCall);\\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\\n }\\n\\n function _nonblockingLzReceive(\\n uint16 _srcChainId,\\n bytes memory _srcAddress,\\n uint64 _nonce,\\n bytes memory _payload\\n ) internal virtual override {\\n uint8 packetType = _payload.toUint8(0);\\n\\n if (packetType == PT_SEND) {\\n _sendAck(_srcChainId, _srcAddress, _nonce, _payload);\\n } else if (packetType == PT_SEND_AND_CALL) {\\n _sendAndCallAck(_srcChainId, _srcAddress, _nonce, _payload);\\n } else {\\n revert(\\\"OFTCore: unknown packet type\\\");\\n }\\n }\\n\\n function _send(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n address payable _refundAddress,\\n address _zroPaymentAddress,\\n bytes memory _adapterParams\\n ) internal virtual returns (uint amount) {\\n _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\\n\\n (amount, ) = _removeDust(_amount);\\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount); // amount returned should not have dust\\n require(amount > 0, \\\"OFTCore: amount too small\\\");\\n\\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\\n\\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\\n }\\n\\n function _sendAck(uint16 _srcChainId, bytes memory, uint64, bytes memory _payload) internal virtual {\\n (address to, uint64 amountSD) = _decodeSendPayload(_payload);\\n if (to == address(0)) {\\n to = address(0xdead);\\n }\\n\\n uint amount = _sd2ld(amountSD);\\n amount = _creditTo(_srcChainId, to, amount);\\n\\n emit ReceiveFromChain(_srcChainId, to, amount);\\n }\\n\\n function _sendAndCall(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bytes memory _payload,\\n uint64 _dstGasForCall,\\n address payable _refundAddress,\\n address _zroPaymentAddress,\\n bytes memory _adapterParams\\n ) internal virtual returns (uint amount) {\\n _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\\n\\n (amount, ) = _removeDust(_amount);\\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount);\\n require(amount > 0, \\\"OFTCore: amount too small\\\");\\n\\n // encode the msg.sender into the payload instead of _from\\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\\n\\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\\n }\\n\\n function _sendAndCallAck(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual {\\n (bytes32 from, address to, uint64 amountSD, bytes memory payloadForCall, uint64 gasForCall) = _decodeSendAndCallPayload(_payload);\\n\\n bool credited = creditedPackets[_srcChainId][_srcAddress][_nonce];\\n uint amount = _sd2ld(amountSD);\\n\\n // credit to this contract first, and then transfer to receiver only if callOnOFTReceived() succeeds\\n if (!credited) {\\n amount = _creditTo(_srcChainId, address(this), amount);\\n creditedPackets[_srcChainId][_srcAddress][_nonce] = true;\\n }\\n\\n if (!_isContract(to)) {\\n emit NonContractAddress(to);\\n return;\\n }\\n\\n // workaround for stack too deep\\n uint16 srcChainId = _srcChainId;\\n bytes memory srcAddress = _srcAddress;\\n uint64 nonce = _nonce;\\n bytes memory payload = _payload;\\n bytes32 from_ = from;\\n address to_ = to;\\n uint amount_ = amount;\\n bytes memory payloadForCall_ = payloadForCall;\\n\\n // no gas limit for the call if retry\\n uint gas = credited ? gasleft() : gasForCall;\\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\\n gasleft(),\\n 150,\\n abi.encodeWithSelector(this.callOnOFTReceived.selector, srcChainId, srcAddress, nonce, from_, to_, amount_, payloadForCall_, gas)\\n );\\n\\n if (success) {\\n bytes32 hash = keccak256(payload);\\n emit CallOFTReceivedSuccess(srcChainId, srcAddress, nonce, hash);\\n } else {\\n // store the failed message into the nonblockingLzApp\\n _storeFailedMessage(srcChainId, srcAddress, nonce, payload, reason);\\n }\\n }\\n\\n function _isContract(address _account) internal view returns (bool) {\\n return _account.code.length > 0;\\n }\\n\\n function _checkAdapterParams(uint16 _dstChainId, uint16 _pkType, bytes memory _adapterParams, uint _extraGas) internal virtual {\\n if (useCustomAdapterParams) {\\n _checkGasLimit(_dstChainId, _pkType, _adapterParams, _extraGas);\\n } else {\\n require(_adapterParams.length == 0, \\\"OFTCore: _adapterParams must be empty.\\\");\\n }\\n }\\n\\n function _ld2sd(uint _amount) internal view virtual returns (uint64) {\\n uint amountSD = _amount / _ld2sdRate();\\n require(amountSD <= type(uint64).max, \\\"OFTCore: amountSD overflow\\\");\\n return uint64(amountSD);\\n }\\n\\n function _sd2ld(uint64 _amountSD) internal view virtual returns (uint) {\\n return _amountSD * _ld2sdRate();\\n }\\n\\n function _removeDust(uint _amount) internal view virtual returns (uint amountAfter, uint dust) {\\n dust = _amount % _ld2sdRate();\\n amountAfter = _amount - dust;\\n }\\n\\n function _encodeSendPayload(bytes32 _toAddress, uint64 _amountSD) internal view virtual returns (bytes memory) {\\n return abi.encodePacked(PT_SEND, _toAddress, _amountSD);\\n }\\n\\n function _decodeSendPayload(bytes memory _payload) internal view virtual returns (address to, uint64 amountSD) {\\n require(_payload.toUint8(0) == PT_SEND && _payload.length == 41, \\\"OFTCore: invalid payload\\\");\\n\\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\\n amountSD = _payload.toUint64(33);\\n }\\n\\n function _encodeSendAndCallPayload(\\n address _from,\\n bytes32 _toAddress,\\n uint64 _amountSD,\\n bytes memory _payload,\\n uint64 _dstGasForCall\\n ) internal view virtual returns (bytes memory) {\\n return abi.encodePacked(PT_SEND_AND_CALL, _toAddress, _amountSD, _addressToBytes32(_from), _dstGasForCall, _payload);\\n }\\n\\n function _decodeSendAndCallPayload(\\n bytes memory _payload\\n ) internal view virtual returns (bytes32 from, address to, uint64 amountSD, bytes memory payload, uint64 dstGasForCall) {\\n require(_payload.toUint8(0) == PT_SEND_AND_CALL, \\\"OFTCore: invalid payload\\\");\\n\\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\\n amountSD = _payload.toUint64(33);\\n from = _payload.toBytes32(41);\\n dstGasForCall = _payload.toUint64(73);\\n payload = _payload.slice(81, _payload.length - 81);\\n }\\n\\n function _addressToBytes32(address _address) internal pure virtual returns (bytes32) {\\n return bytes32(uint(uint160(_address)));\\n }\\n\\n function _debitFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount) internal virtual returns (uint);\\n\\n function _creditTo(uint16 _srcChainId, address _toAddress, uint _amount) internal virtual returns (uint);\\n\\n function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint);\\n\\n function _ld2sdRate() internal view virtual returns (uint);\\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 uint[44] private __gap;\\n}\\n\",\"keccak256\":\"0xf692d3bf6f8b9064ffd81aaa2f98ecf6a12c46ea653c2b9b205577b30a1f6dc4\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/fee/BaseOFTWithFeeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../OFTCoreV2Upgradeable.sol\\\";\\nimport \\\"./IOFTWithFeeUpgradeable.sol\\\";\\nimport \\\"./FeeUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\n\\nabstract contract BaseOFTWithFeeUpgradeable is OFTCoreV2Upgradeable, FeeUpgradeable, ERC165Upgradeable, IOFTWithFeeUpgradeable {\\n function __BaseOFTWithFeeUpgradeable_init(uint8 _sharedDecimals, address _lzEndpoint) internal onlyInitializing {\\n __Ownable_init_unchained();\\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\\n }\\n\\n function __BaseOFTWithFeeUpgradeable_init_unchained() internal onlyInitializing {}\\n\\n /************************************************************************\\n * public functions\\n ************************************************************************/\\n function sendFrom(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n uint _minAmount,\\n LzCallParams calldata _callParams\\n ) public payable virtual override {\\n (_amount, ) = _payOFTFee(_from, _dstChainId, _amount);\\n _amount = _send(\\n _from,\\n _dstChainId,\\n _toAddress,\\n _amount,\\n _callParams.refundAddress,\\n _callParams.zroPaymentAddress,\\n _callParams.adapterParams\\n );\\n require(_amount >= _minAmount, \\\"BaseOFTWithFee: amount is less than minAmount\\\");\\n }\\n\\n function sendAndCall(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n uint _minAmount,\\n bytes calldata _payload,\\n uint64 _dstGasForCall,\\n LzCallParams calldata _callParams\\n ) public payable virtual override {\\n (_amount, ) = _payOFTFee(_from, _dstChainId, _amount);\\n _amount = _sendAndCall(\\n _from,\\n _dstChainId,\\n _toAddress,\\n _amount,\\n _payload,\\n _dstGasForCall,\\n _callParams.refundAddress,\\n _callParams.zroPaymentAddress,\\n _callParams.adapterParams\\n );\\n require(_amount >= _minAmount, \\\"BaseOFTWithFee: amount is less than minAmount\\\");\\n }\\n\\n /************************************************************************\\n * public view functions\\n ************************************************************************/\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return interfaceId == type(IOFTWithFeeUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n function estimateSendFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bool _useZro,\\n bytes calldata _adapterParams\\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\\n return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams);\\n }\\n\\n function estimateSendAndCallFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bytes calldata _payload,\\n uint64 _dstGasForCall,\\n bool _useZro,\\n bytes calldata _adapterParams\\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\\n return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams);\\n }\\n\\n function circulatingSupply() public view virtual override returns (uint);\\n\\n function token() public view virtual override returns (address);\\n\\n function _transferFrom(\\n address _from,\\n address _to,\\n uint _amount\\n ) internal virtual override(FeeUpgradeable, OFTCoreV2Upgradeable) returns (uint);\\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 uint[50] private __gap;\\n}\\n\",\"keccak256\":\"0xadf0366936e09f6c7b25ad329e6436e6534a5d04b1a0f84abc986a75d2982e44\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/fee/FeeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\nabstract contract FeeUpgradeable is OwnableUpgradeable {\\n uint public constant BP_DENOMINATOR = 10000;\\n\\n mapping(uint16 => FeeConfig) public chainIdToFeeBps;\\n uint16 public defaultFeeBp;\\n address public feeOwner; // defaults to owner\\n\\n struct FeeConfig {\\n uint16 feeBP;\\n bool enabled;\\n }\\n\\n event SetFeeBp(uint16 dstchainId, bool enabled, uint16 feeBp);\\n event SetDefaultFeeBp(uint16 feeBp);\\n event SetFeeOwner(address feeOwner);\\n\\n function __FeeUpgradeable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __FeeUpgradeable_init_unchained() internal onlyInitializing {}\\n\\n function setDefaultFeeBp(uint16 _feeBp) public virtual onlyOwner {\\n require(_feeBp <= BP_DENOMINATOR, \\\"Fee: fee bp must be <= BP_DENOMINATOR\\\");\\n defaultFeeBp = _feeBp;\\n emit SetDefaultFeeBp(defaultFeeBp);\\n }\\n\\n function setFeeBp(uint16 _dstChainId, bool _enabled, uint16 _feeBp) public virtual onlyOwner {\\n require(_feeBp <= BP_DENOMINATOR, \\\"Fee: fee bp must be <= BP_DENOMINATOR\\\");\\n chainIdToFeeBps[_dstChainId] = FeeConfig(_feeBp, _enabled);\\n emit SetFeeBp(_dstChainId, _enabled, _feeBp);\\n }\\n\\n function setFeeOwner(address _feeOwner) public virtual onlyOwner {\\n require(_feeOwner != address(0x0), \\\"Fee: feeOwner cannot be 0x\\\");\\n feeOwner = _feeOwner;\\n emit SetFeeOwner(_feeOwner);\\n }\\n\\n function quoteOFTFee(uint16 _dstChainId, uint _amount) public view virtual returns (uint fee) {\\n FeeConfig memory config = chainIdToFeeBps[_dstChainId];\\n if (config.enabled) {\\n fee = (_amount * config.feeBP) / BP_DENOMINATOR;\\n } else if (defaultFeeBp > 0) {\\n fee = (_amount * defaultFeeBp) / BP_DENOMINATOR;\\n } else {\\n fee = 0;\\n }\\n }\\n\\n function _payOFTFee(address _from, uint16 _dstChainId, uint _amount) internal virtual returns (uint amount, uint fee) {\\n fee = quoteOFTFee(_dstChainId, _amount);\\n amount = _amount - fee;\\n if (fee > 0) {\\n _transferFrom(_from, feeOwner, fee);\\n }\\n }\\n\\n function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint);\\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 uint[45] private __gap;\\n}\\n\",\"keccak256\":\"0x78320049b99326fac520ea3d6f36490911eb3efe239bfe049c031abcb4a169b5\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/fee/IOFTWithFeeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.5.0;\\n\\nimport \\\"../interfaces/ICommonOFTUpgradeable.sol\\\";\\n\\n/**\\n * @dev Interface of the IOFT core standard\\n */\\ninterface IOFTWithFeeUpgradeable is ICommonOFTUpgradeable {\\n /**\\n * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\\n * `_from` the owner of token\\n * `_dstChainId` the destination chain identifier\\n * `_toAddress` can be any size depending on the `dstChainId`.\\n * `_amount` the quantity of tokens in wei\\n * `_minAmount` the minimum amount of tokens to receive on dstChain\\n * `_refundAddress` the address LayerZero refunds if too much message fee is sent\\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\\n */\\n function sendFrom(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n uint _minAmount,\\n LzCallParams calldata _callParams\\n ) external payable;\\n\\n function sendAndCall(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n uint _minAmount,\\n bytes calldata _payload,\\n uint64 _dstGasForCall,\\n LzCallParams calldata _callParams\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x7183906acbe073bdb5a96b225e6ce4a943727a4903881fcea01981359d31b52f\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"hardhat-deploy/solc_0.8/proxy/Proxied.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol\\\";\\nimport \\\"./BaseOFTWithFeeUpgradeable.sol\\\";\\n\\ncontract OFTWithFeePermitUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, ERC20Upgradeable, Proxied, ERC20PermitUpgradeable {\\n uint internal ld2sdRate;\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n function initialize(\\n string memory _name,\\n string memory _symbol,\\n uint8 _sharedDecimals,\\n address _lzEndpoint\\n ) public virtual initializer {\\n __OFTWithFeePermitUpgradeable_init(_name, _symbol, _sharedDecimals, _lzEndpoint);\\n }\\n\\n function __OFTWithFeePermitUpgradeable_init(\\n string memory _name,\\n string memory _symbol,\\n uint8 _sharedDecimals,\\n address _lzEndpoint\\n ) internal onlyInitializing {\\n __Ownable_init_unchained();\\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\\n\\n __ERC20_init_unchained(_name, _symbol);\\n __ERC20Permit_init_unchained(_name);\\n\\n __OFTWithFeePermitUpgradeable_init_unchained(_sharedDecimals);\\n }\\n\\n function __OFTWithFeePermitUpgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\\n uint8 decimals = decimals();\\n require(_sharedDecimals <= decimals, \\\"OFTWithFee: sharedDecimals must be <= decimals\\\");\\n ld2sdRate = 10**(decimals - _sharedDecimals);\\n }\\n\\n /************************************************************************\\n * public functions\\n ************************************************************************/\\n function circulatingSupply() public view virtual override returns (uint) {\\n return totalSupply();\\n }\\n\\n function token() public view virtual override returns (address) {\\n return address(this);\\n }\\n\\n /************************************************************************\\n * internal functions\\n ************************************************************************/\\n function _debitFrom(\\n address _from,\\n uint16,\\n bytes32,\\n uint _amount\\n ) internal virtual override returns (uint) {\\n address spender = _msgSender();\\n if (_from != spender) _spendAllowance(_from, spender, _amount);\\n _burn(_from, _amount);\\n return _amount;\\n }\\n\\n function _creditTo(\\n uint16,\\n address _toAddress,\\n uint _amount\\n ) internal virtual override returns (uint) {\\n _mint(_toAddress, _amount);\\n return _amount;\\n }\\n\\n function _transferFrom(\\n address _from,\\n address _to,\\n uint _amount\\n ) internal virtual override returns (uint) {\\n address spender = _msgSender();\\n // if transfer from this contract, no need to check allowance\\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\\n _transfer(_from, _to, _amount);\\n return _amount;\\n }\\n\\n function _ld2sdRate() internal view virtual override returns (uint) {\\n return ld2sdRate;\\n }\\n}\\n\",\"keccak256\":\"0x7cf045ba633f6e283674c3f6441dc9288092f7227c03bb08fafbaa04295be251\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"hardhat-deploy/solc_0.8/proxy/Proxied.sol\\\";\\nimport \\\"./BaseOFTWithFeeUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\n\\ncontract ProxyOFTWithFeeUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, Proxied {\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n\\n IERC20Upgradeable internal innerToken;\\n uint internal ld2sdRate;\\n\\n // total amount is transferred from this chain to other chains, ensuring the total is less than uint64.max in sd\\n uint public outboundAmount;\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n function initialize(address _token, uint8 _sharedDecimals, address _lzEndpoint) public initializer {\\n __BaseOFTWithFeeUpgradeable_init(_sharedDecimals, _lzEndpoint);\\n\\n innerToken = IERC20Upgradeable(_token);\\n\\n (bool success, bytes memory data) = _token.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n require(success, \\\"ProxyOFTWithFee: failed to get token decimals\\\");\\n uint8 decimals = abi.decode(data, (uint8));\\n\\n require(_sharedDecimals <= decimals, \\\"ProxyOFTWithFee: sharedDecimals must be <= decimals\\\");\\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\\n }\\n\\n /************************************************************************\\n * public functions\\n ************************************************************************/\\n function circulatingSupply() public view virtual override returns (uint) {\\n return innerToken.totalSupply() - outboundAmount;\\n }\\n\\n function token() public view virtual override returns (address) {\\n return address(innerToken);\\n }\\n\\n /************************************************************************\\n * internal functions\\n ************************************************************************/\\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\\n require(_from == _msgSender(), \\\"ProxyOFTWithFee: owner is not send caller\\\");\\n\\n _amount = _transferFrom(_from, address(this), _amount);\\n\\n // _amount still may have dust if the token has transfer fee, then give the dust back to the sender\\n (uint amount, uint dust) = _removeDust(_amount);\\n if (dust > 0) innerToken.safeTransfer(_from, dust);\\n\\n // check total outbound amount\\n outboundAmount += amount;\\n uint cap = _sd2ld(type(uint64).max);\\n require(cap >= outboundAmount, \\\"ProxyOFTWithFee: outboundAmount overflow\\\");\\n\\n return amount;\\n }\\n\\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\\n outboundAmount -= _amount;\\n\\n // tokens are already in this contract, so no need to transfer\\n if (_toAddress == address(this)) {\\n return _amount;\\n }\\n\\n return _transferFrom(address(this), _toAddress, _amount);\\n }\\n\\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\\n uint before = innerToken.balanceOf(_to);\\n if (_from == address(this)) {\\n innerToken.safeTransfer(_to, _amount);\\n } else {\\n innerToken.safeTransferFrom(_from, _to, _amount);\\n }\\n return innerToken.balanceOf(_to) - before;\\n }\\n\\n function _ld2sdRate() internal view virtual override returns (uint) {\\n return ld2sdRate;\\n }\\n}\\n\",\"keccak256\":\"0x90e7b5e27af4caa896c196ce5d1572bfb05429610fc5171be82072d267a42b53\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/interfaces/ICommonOFTUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.5.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface of the IOFT core standard\\n */\\ninterface ICommonOFTUpgradeable is IERC165Upgradeable {\\n struct LzCallParams {\\n address payable refundAddress;\\n address zroPaymentAddress;\\n bytes adapterParams;\\n }\\n\\n /**\\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\\n * _dstChainId - L0 defined chain id to send tokens too\\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\\n * _amount - amount of the tokens to transfer\\n * _useZro - indicates to use zro to pay L0 fees\\n * _adapterParam - flexible bytes array to indicate messaging adapter services in L0\\n */\\n function estimateSendFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bool _useZro,\\n bytes calldata _adapterParams\\n ) external view returns (uint nativeFee, uint zroFee);\\n\\n function estimateSendAndCallFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bytes calldata _payload,\\n uint64 _dstGasForCall,\\n bool _useZro,\\n bytes calldata _adapterParams\\n ) external view returns (uint nativeFee, uint zroFee);\\n\\n /**\\n * @dev returns the circulating amount of tokens on current chain\\n */\\n function circulatingSupply() external view returns (uint);\\n\\n /**\\n * @dev returns the address of the ERC20 token\\n */\\n function token() external view returns (address);\\n}\\n\",\"keccak256\":\"0x22301aa76df1a1b642962585085e70486df5b22db656362b1f986519f297f8aa\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/interfaces/IOFTReceiverV2Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\npragma solidity >=0.5.0;\\n\\ninterface IOFTReceiverV2Upgradeable {\\n /**\\n * @dev Called by the OFT contract when tokens are received from source chain.\\n * @param _srcChainId The chain id of the source chain.\\n * @param _srcAddress The address of the OFT token contract on the source chain.\\n * @param _nonce The nonce of the transaction on the source chain.\\n * @param _from The address of the account who calls the sendAndCall() on the source chain.\\n * @param _amount The amount of tokens to transfer.\\n * @param _payload Additional data with no specified format.\\n */\\n function onOFTReceived(\\n uint16 _srcChainId,\\n bytes calldata _srcAddress,\\n uint64 _nonce,\\n bytes32 _from,\\n uint _amount,\\n bytes calldata _payload\\n ) external;\\n}\\n\",\"keccak256\":\"0xb211e812c5fe61606abddad556545d5395c7020bb61e26a75f1737ceb79cab79\",\"license\":\"BUSL-1.1\"},\"contracts/libraries/BytesLib.sol\":{\"content\":\"// SPDX-License-Identifier: Unlicense\\n/*\\n * @title Solidity Bytes Arrays Utils\\n * @author Gon\\u00e7alo S\\u00e1 \\n *\\n * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.\\n * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.\\n */\\npragma solidity >=0.8.0 <0.9.0;\\n\\nlibrary BytesLib {\\n function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory) {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(\\n 0x40,\\n and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n )\\n )\\n }\\n\\n return tempBytes;\\n }\\n\\n function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {\\n assembly {\\n // Read the first 32 bytes of _preBytes storage, which is the length\\n // of the array. (We don't need to use the offset into the slot\\n // because arrays use the entire slot.)\\n let fslot := sload(_preBytes.slot)\\n // Arrays of 31 bytes or less have an even value in their slot,\\n // while longer arrays have an odd value. The actual length is\\n // the slot divided by two for odd values, and the lowest order\\n // byte divided by two for even values.\\n // If the slot is even, bitwise and the slot with 255 and divide by\\n // two to get the length. If the slot is odd, bitwise and the slot\\n // with -1 and divide by two.\\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\\n let mlength := mload(_postBytes)\\n let newlength := add(slength, mlength)\\n // slength can contain both the length and contents of the array\\n // if length < 32 bytes so let's prepare for that\\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\\n switch add(lt(slength, 32), lt(newlength, 32))\\n case 2 {\\n // Since the new array still fits in the slot, we just need to\\n // update the contents of the slot.\\n // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length\\n sstore(\\n _preBytes.slot,\\n // all the modifications to the slot are inside this\\n // next block\\n add(\\n // we can just add to the slot contents because the\\n // bytes we want to change are the LSBs\\n fslot,\\n add(\\n mul(\\n div(\\n // load the bytes from memory\\n mload(add(_postBytes, 0x20)),\\n // zero all bytes to the right\\n exp(0x100, sub(32, mlength))\\n ),\\n // and now shift left the number of bytes to\\n // leave space for the length in the slot\\n exp(0x100, sub(32, newlength))\\n ),\\n // increase length by the double of the memory\\n // bytes length\\n mul(mlength, 2)\\n )\\n )\\n )\\n }\\n case 1 {\\n // The stored value fits in the slot, but the combined value\\n // will exceed it.\\n // get the keccak hash to get the contents of the array\\n mstore(0x0, _preBytes.slot)\\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\\n\\n // save new length\\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\\n\\n // The contents of the _postBytes array start 32 bytes into\\n // the structure. Our first read should obtain the `submod`\\n // bytes that can fit into the unused space in the last word\\n // of the stored array. To get this, we read 32 bytes starting\\n // from `submod`, so the data we read overlaps with the array\\n // contents by `submod` bytes. Masking the lowest-order\\n // `submod` bytes allows us to add that value directly to the\\n // stored value.\\n\\n let submod := sub(32, slength)\\n let mc := add(_postBytes, submod)\\n let end := add(_postBytes, mlength)\\n let mask := sub(exp(0x100, submod), 1)\\n\\n sstore(sc, add(and(fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00), and(mload(mc), mask)))\\n\\n for {\\n mc := add(mc, 0x20)\\n sc := add(sc, 1)\\n } lt(mc, end) {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } {\\n sstore(sc, mload(mc))\\n }\\n\\n mask := exp(0x100, sub(mc, end))\\n\\n sstore(sc, mul(div(mload(mc), mask), mask))\\n }\\n default {\\n // get the keccak hash to get the contents of the array\\n mstore(0x0, _preBytes.slot)\\n // Start copying to the last used word of the stored array.\\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\\n\\n // save new length\\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\\n\\n // Copy over the first `submod` bytes of the new data as in\\n // case 1 above.\\n let slengthmod := mod(slength, 32)\\n let mlengthmod := mod(mlength, 32)\\n let submod := sub(32, slengthmod)\\n let mc := add(_postBytes, submod)\\n let end := add(_postBytes, mlength)\\n let mask := sub(exp(0x100, submod), 1)\\n\\n sstore(sc, add(sload(sc), and(mload(mc), mask)))\\n\\n for {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } lt(mc, end) {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } {\\n sstore(sc, mload(mc))\\n }\\n\\n mask := exp(0x100, sub(mc, end))\\n\\n sstore(sc, mul(div(mload(mc), mask), mask))\\n }\\n }\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint _start,\\n uint _length\\n ) internal pure returns (bytes memory) {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function toAddress(bytes memory _bytes, uint _start) internal pure returns (address) {\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toUint8(bytes memory _bytes, uint _start) internal pure returns (uint8) {\\n require(_bytes.length >= _start + 1, \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint16(bytes memory _bytes, uint _start) internal pure returns (uint16) {\\n require(_bytes.length >= _start + 2, \\\"toUint16_outOfBounds\\\");\\n uint16 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x2), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint32(bytes memory _bytes, uint _start) internal pure returns (uint32) {\\n require(_bytes.length >= _start + 4, \\\"toUint32_outOfBounds\\\");\\n uint32 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x4), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint64(bytes memory _bytes, uint _start) internal pure returns (uint64) {\\n require(_bytes.length >= _start + 8, \\\"toUint64_outOfBounds\\\");\\n uint64 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x8), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint96(bytes memory _bytes, uint _start) internal pure returns (uint96) {\\n require(_bytes.length >= _start + 12, \\\"toUint96_outOfBounds\\\");\\n uint96 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0xc), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint128(bytes memory _bytes, uint _start) internal pure returns (uint128) {\\n require(_bytes.length >= _start + 16, \\\"toUint128_outOfBounds\\\");\\n uint128 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x10), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint256(bytes memory _bytes, uint _start) internal pure returns (uint) {\\n require(_bytes.length >= _start + 32, \\\"toUint256_outOfBounds\\\");\\n uint tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x20), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toBytes32(bytes memory _bytes, uint _start) internal pure returns (bytes32) {\\n require(_bytes.length >= _start + 32, \\\"toBytes32_outOfBounds\\\");\\n bytes32 tempBytes32;\\n\\n assembly {\\n tempBytes32 := mload(add(add(_bytes, 0x20), _start))\\n }\\n\\n return tempBytes32;\\n }\\n\\n function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {\\n bool success = true;\\n\\n assembly {\\n let length := mload(_preBytes)\\n\\n // if lengths don't match the arrays are not equal\\n switch eq(length, mload(_postBytes))\\n case 1 {\\n // cb is a circuit breaker in the for loop since there's\\n // no said feature for inline assembly loops\\n // cb = 1 - don't breaker\\n // cb = 0 - break\\n let cb := 1\\n\\n let mc := add(_preBytes, 0x20)\\n let end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n // the next line is the loop condition:\\n // while(uint256(mc < end) + cb == 2)\\n } eq(add(lt(mc, end), cb), 2) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // if any of these checks fails then arrays are not equal\\n if iszero(eq(mload(mc), mload(cc))) {\\n // unsuccess:\\n success := 0\\n cb := 0\\n }\\n }\\n }\\n default {\\n // unsuccess:\\n success := 0\\n }\\n }\\n\\n return success;\\n }\\n\\n function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool) {\\n bool success = true;\\n\\n assembly {\\n // we know _preBytes_offset is 0\\n let fslot := sload(_preBytes.slot)\\n // Decode the length of the stored array like in concatStorage().\\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\\n let mlength := mload(_postBytes)\\n\\n // if lengths don't match the arrays are not equal\\n switch eq(slength, mlength)\\n case 1 {\\n // slength can contain both the length and contents of the array\\n // if length < 32 bytes so let's prepare for that\\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\\n if iszero(iszero(slength)) {\\n switch lt(slength, 32)\\n case 1 {\\n // blank the last byte which is the length\\n fslot := mul(div(fslot, 0x100), 0x100)\\n\\n if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {\\n // unsuccess:\\n success := 0\\n }\\n }\\n default {\\n // cb is a circuit breaker in the for loop since there's\\n // no said feature for inline assembly loops\\n // cb = 1 - don't breaker\\n // cb = 0 - break\\n let cb := 1\\n\\n // get the keccak hash to get the contents of the array\\n mstore(0x0, _preBytes.slot)\\n let sc := keccak256(0x0, 0x20)\\n\\n let mc := add(_postBytes, 0x20)\\n let end := add(mc, mlength)\\n\\n // the next line is the loop condition:\\n // while(uint256(mc < end) + cb == 2)\\n for {\\n\\n } eq(add(lt(mc, end), cb), 2) {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } {\\n if iszero(eq(sload(sc), mload(mc))) {\\n // unsuccess:\\n success := 0\\n cb := 0\\n }\\n }\\n }\\n }\\n }\\n default {\\n // unsuccess:\\n success := 0\\n }\\n }\\n\\n return success;\\n }\\n}\\n\",\"keccak256\":\"0x7e64cccdf22a03f513d94960f2145dd801fb5ec88d971de079b5186a9f5e93c4\",\"license\":\"Unlicense\"},\"contracts/libraries/ExcessivelySafeCall.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\npragma solidity >=0.7.6;\\n\\nlibrary ExcessivelySafeCall {\\n uint constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\\n\\n /// @notice Use when you _really_ really _really_ don't trust the called\\n /// contract. This prevents the called contract from causing reversion of\\n /// the caller in as many ways as we can.\\n /// @dev The main difference between this and a solidity low-level call is\\n /// that we limit the number of bytes that the callee can cause to be\\n /// copied to caller memory. This prevents stupid things like malicious\\n /// contracts returning 10,000,000 bytes causing a local OOG when copying\\n /// to memory.\\n /// @param _target The address to call\\n /// @param _gas The amount of gas to forward to the remote contract\\n /// @param _maxCopy The maximum number of bytes of returndata to copy\\n /// to memory.\\n /// @param _calldata The data to send to the remote contract\\n /// @return success and returndata, as `.call()`. Returndata is capped to\\n /// `_maxCopy` bytes.\\n function excessivelySafeCall(\\n address _target,\\n uint _gas,\\n uint16 _maxCopy,\\n bytes memory _calldata\\n ) internal returns (bool, bytes memory) {\\n // set up for assembly call\\n uint _toCopy;\\n bool _success;\\n bytes memory _returnData = new bytes(_maxCopy);\\n // dispatch message to recipient\\n // by assembly calling \\\"handle\\\" function\\n // we call via assembly to avoid memcopying a very large returndata\\n // returned by a malicious contract\\n assembly {\\n _success := call(\\n _gas, // gas\\n _target, // recipient\\n 0, // ether value\\n add(_calldata, 0x20), // inloc\\n mload(_calldata), // inlen\\n 0, // outloc\\n 0 // outlen\\n )\\n // limit our copy to 256 bytes\\n _toCopy := returndatasize()\\n if gt(_toCopy, _maxCopy) {\\n _toCopy := _maxCopy\\n }\\n // Store the length of the copied bytes\\n mstore(_returnData, _toCopy)\\n // copy the bytes from returndata[0:_toCopy]\\n returndatacopy(add(_returnData, 0x20), 0, _toCopy)\\n }\\n return (_success, _returnData);\\n }\\n\\n /// @notice Use when you _really_ really _really_ don't trust the called\\n /// contract. This prevents the called contract from causing reversion of\\n /// the caller in as many ways as we can.\\n /// @dev The main difference between this and a solidity low-level call is\\n /// that we limit the number of bytes that the callee can cause to be\\n /// copied to caller memory. This prevents stupid things like malicious\\n /// contracts returning 10,000,000 bytes causing a local OOG when copying\\n /// to memory.\\n /// @param _target The address to call\\n /// @param _gas The amount of gas to forward to the remote contract\\n /// @param _maxCopy The maximum number of bytes of returndata to copy\\n /// to memory.\\n /// @param _calldata The data to send to the remote contract\\n /// @return success and returndata, as `.call()`. Returndata is capped to\\n /// `_maxCopy` bytes.\\n function excessivelySafeStaticCall(\\n address _target,\\n uint _gas,\\n uint16 _maxCopy,\\n bytes memory _calldata\\n ) internal view returns (bool, bytes memory) {\\n // set up for assembly call\\n uint _toCopy;\\n bool _success;\\n bytes memory _returnData = new bytes(_maxCopy);\\n // dispatch message to recipient\\n // by assembly calling \\\"handle\\\" function\\n // we call via assembly to avoid memcopying a very large returndata\\n // returned by a malicious contract\\n assembly {\\n _success := staticcall(\\n _gas, // gas\\n _target, // recipient\\n add(_calldata, 0x20), // inloc\\n mload(_calldata), // inlen\\n 0, // outloc\\n 0 // outlen\\n )\\n // limit our copy to 256 bytes\\n _toCopy := returndatasize()\\n if gt(_toCopy, _maxCopy) {\\n _toCopy := _maxCopy\\n }\\n // Store the length of the copied bytes\\n mstore(_returnData, _toCopy)\\n // copy the bytes from returndata[0:_toCopy]\\n returndatacopy(add(_returnData, 0x20), 0, _toCopy)\\n }\\n return (_success, _returnData);\\n }\\n\\n /**\\n * @notice Swaps function selectors in encoded contract calls\\n * @dev Allows reuse of encoded calldata for functions with identical\\n * argument types but different names. It simply swaps out the first 4 bytes\\n * for the new selector. This function modifies memory in place, and should\\n * only be used with caution.\\n * @param _newSelector The new 4-byte selector\\n * @param _buf The encoded contract args\\n */\\n function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure {\\n require(_buf.length >= 4);\\n uint _mask = LOW_28_MASK;\\n assembly {\\n // load the first word of\\n let _word := mload(add(_buf, 0x20))\\n // mask out the top 4 bytes\\n // /x\\n _word := and(_word, _mask)\\n _word := or(_newSelector, _word)\\n mstore(add(_buf, 0x20), _word)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd4e52af409b5ec80432292d86fb01906785eb78ac31da3bab4565aabcd6e3e56\",\"license\":\"MIT OR Apache-2.0\"},\"hardhat-deploy/solc_0.8/proxy/Proxied.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract Proxied {\\n /// @notice to be used by initialisation / postUpgrade function so that only the proxy's admin can execute them\\n /// It also allows these functions to be called inside a contructor\\n /// even if the contract is meant to be used without proxy\\n modifier proxied() {\\n address proxyAdminAddress = _proxyAdmin();\\n // With hardhat-deploy proxies\\n // the proxyAdminAddress is zero only for the implementation contract\\n // if the implementation contract want to be used as a standalone/immutable contract\\n // it simply has to execute the `proxied` function\\n // This ensure the proxyAdminAddress is never zero post deployment\\n // And allow you to keep the same code for both proxied contract and immutable contract\\n if (proxyAdminAddress == address(0)) {\\n // ensure can not be called twice when used outside of proxy : no admin\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n sstore(\\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103,\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\\n )\\n }\\n } else {\\n require(msg.sender == proxyAdminAddress);\\n }\\n _;\\n }\\n\\n modifier onlyProxyAdmin() {\\n require(msg.sender == _proxyAdmin(), \\\"NOT_AUTHORIZED\\\");\\n _;\\n }\\n\\n function _proxyAdmin() internal view returns (address ownerAddress) {\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n ownerAddress := sload(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaaceeafeeaf0d200ca3942d8bf14c1c4f787a77f79cc87c08bb668e65acdee29\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61550780620000f36000396000f3fe6080604052600436106103c25760003560e01c80638da5cb5b116101f2578063cbed8b9c1161010d578063eab45d9c116100a0578063ed629c5c1161006f578063ed629c5c14610bd4578063f2fde38b14610bf3578063f5ecbdbc14610c13578063fc0c546a14610c3357600080fd5b8063eab45d9c14610b54578063eaffd49a14610b74578063eb8d72b714610b94578063ecd8f21214610bb457600080fd5b8063dd62ed3e116100dc578063dd62ed3e14610adf578063de7ea79d14610aff578063df2a5b3b14610b1f578063e6a20ae614610b3f57600080fd5b8063cbed8b9c14610a5e578063d1deba1f14610a7e578063d505accf14610a91578063d888296814610ab157600080fd5b8063a6c3d16511610185578063b9818be111610154578063b9818be1146109c2578063baf3292d146109e8578063c44618341461098c578063c83330ce14610a0857600080fd5b8063a6c3d1651461094c578063a9059cbb1461096c578063abe685cd1461098c578063b353aaa7146109a257600080fd5b80639bdb9812116101c15780639bdb98121461089a5780639f38369a146108ec578063a457c2d71461090c578063a4c51df51461092c57600080fd5b80638da5cb5b1461081e5780639358928b14610850578063950c8a741461086557806395d89b411461088557600080fd5b806342d65a8d116102e257806370a08231116102755780637ecebe00116102445780637ecebe001461078457806384b0196e146107a4578063857749b0146107cc5780638cfd8f5c146107e657600080fd5b806370a08231146106f8578063715018a61461072f5780637533d7881461074457806379c0ad4b1461076457600080fd5b80634c42899a116102b15780634c42899a146106545780635a359dc5146106695780635b8c41e61461068957806366ad5c8a146106d857600080fd5b806342d65a8d146105ec578063447705151461060c578063455ba27d146106215780634b104eff1461063457600080fd5b806323b872dd1161035a578063365260b411610329578063365260b41461054a578063395093511461057f5780633d8b38f61461059f5780633f1f4fa4146105bf57600080fd5b806323b872dd146104e05780632cdf0b9514610500578063313ce567146105135780633644e5151461053557600080fd5b8063095ea7b311610396578063095ea7b3146104605780630df374831461048057806310ddb137146104a057806318160ddd146104c057600080fd5b80621d3567146103c757806301ffc9a7146103e957806306fdde031461041e57806307e0db1714610440575b600080fd5b3480156103d357600080fd5b506103e76103e23660046141a6565b610c46565b005b3480156103f557600080fd5b50610409610404366004614239565b610e62565b60405190151581526020015b60405180910390f35b34801561042a57600080fd5b50610433610e99565b60405161041591906142b3565b34801561044c57600080fd5b506103e761045b3660046142c6565b610f2c565b34801561046c57600080fd5b5061040961047b3660046142f6565b610f99565b34801561048c57600080fd5b506103e761049b366004614322565b610fb1565b3480156104ac57600080fd5b506103e76104bb3660046142c6565b610fd0565b3480156104cc57600080fd5b5061018c545b604051908152602001610415565b3480156104ec57600080fd5b506104096104fb36600461433e565b61100c565b6103e761050e366004614391565b611030565b34801561051f57600080fd5b5060125b60405160ff9091168152602001610415565b34801561054157600080fd5b506104d26110d3565b34801561055657600080fd5b5061056a61056536600461441c565b6110e2565b60408051928352602083019190915201610415565b34801561058b57600080fd5b5061040961059a3660046142f6565b611137565b3480156105ab57600080fd5b506104096105ba366004614481565b611159565b3480156105cb57600080fd5b506104d26105da3660046142c6565b60686020526000908152604090205481565b3480156105f857600080fd5b506103e7610607366004614481565b611225565b34801561061857600080fd5b506104d2600081565b6103e761062f3660046144d3565b61128f565b34801561064057600080fd5b506103e761064f36600461458f565b611370565b34801561066057600080fd5b50610523600081565b34801561067557600080fd5b506103e76106843660046142c6565b61142d565b34801561069557600080fd5b506104d26106a4366004614657565b6097602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b3480156106e457600080fd5b506103e76106f33660046141a6565b61149f565b34801561070457600080fd5b506104d261071336600461458f565b6001600160a01b0316600090815261018a602052604090205490565b34801561073b57600080fd5b506103e7611573565b34801561075057600080fd5b5061043361075f3660046142c6565b611587565b34801561077057600080fd5b506103e761077f3660046146c8565b611621565b34801561079057600080fd5b506104d261079f36600461458f565b6116dd565b3480156107b057600080fd5b506107b96116fc565b6040516104159796959493929190614702565b3480156107d857600080fd5b5060c9546105239060ff1681565b3480156107f257600080fd5b506104d2610801366004614798565b606760209081526000928352604080842090915290825290205481565b34801561082a57600080fd5b506033546001600160a01b03165b6040516001600160a01b039091168152602001610415565b34801561085c57600080fd5b506104d261179c565b34801561087157600080fd5b50606954610838906001600160a01b031681565b34801561089157600080fd5b506104336117a8565b3480156108a657600080fd5b506104096108b5366004614657565b60ca602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205460ff1681565b3480156108f857600080fd5b506104336109073660046142c6565b6117b8565b34801561091857600080fd5b506104096109273660046142f6565b6118ce565b34801561093857600080fd5b5061056a6109473660046147cb565b611949565b34801561095857600080fd5b506103e7610967366004614481565b6119d8565b34801561097857600080fd5b506104096109873660046142f6565b611a54565b34801561099857600080fd5b506104d261271081565b3480156109ae57600080fd5b50606554610838906001600160a01b031681565b3480156109ce57600080fd5b5060f854610838906201000090046001600160a01b031681565b3480156109f457600080fd5b506103e7610a0336600461458f565b611a62565b348015610a1457600080fd5b50610a44610a233660046142c6565b60f76020526000908152604090205461ffff81169062010000900460ff1682565b6040805161ffff9093168352901515602083015201610415565b348015610a6a57600080fd5b506103e7610a79366004614884565b611ab8565b6103e7610a8c3660046141a6565b611b26565b348015610a9d57600080fd5b506103e7610aac366004614903565b611d3c565b348015610abd57600080fd5b5060f854610acc9061ffff1681565b60405161ffff9091168152602001610415565b348015610aeb57600080fd5b506104d2610afa366004614971565b611ea0565b348015610b0b57600080fd5b506103e7610b1a3660046149ca565b611ecc565b348015610b2b57600080fd5b506103e7610b3a366004614a50565b611fe5565b348015610b4b57600080fd5b50610523600181565b348015610b6057600080fd5b506103e7610b6f366004614a8c565b612097565b348015610b8057600080fd5b506103e7610b8f366004614aa7565b6120e8565b348015610ba057600080fd5b506103e7610baf366004614481565b612207565b348015610bc057600080fd5b506104d2610bcf366004614322565b612261565b348015610be057600080fd5b5060c95461040990610100900460ff1681565b348015610bff57600080fd5b506103e7610c0e36600461458f565b6122f3565b348015610c1f57600080fd5b50610433610c2e366004614b6f565b61236c565b348015610c3f57600080fd5b5030610838565b6065546001600160a01b0316336001600160a01b031614610cae5760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff861660009081526066602052604081208054610ccc90614bbc565b80601f0160208091040260200160405190810160405280929190818152602001828054610cf890614bbc565b8015610d455780601f10610d1a57610100808354040283529160200191610d45565b820191906000526020600020905b815481529060010190602001808311610d2857829003601f168201915b50505050509050805186869050148015610d60575060008151115b8015610d88575080516020820120604051610d7e9088908890614bf0565b6040518091039020145b610de35760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610ca5565b610e598787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a9350915088908890819084018382808284376000920191909152506123ff92505050565b50505050505050565b60006001600160e01b03198216630d30953d60e31b1480610e9357506301ffc9a760e01b6001600160e01b03198316145b92915050565b606061018d8054610ea990614bbc565b80601f0160208091040260200160405190810160405280929190818152602001828054610ed590614bbc565b8015610f225780601f10610ef757610100808354040283529160200191610f22565b820191906000526020600020905b815481529060010190602001808311610f0557829003601f168201915b5050505050905090565b610f34612478565b6065546040516307e0db1760e01b815261ffff831660048201526001600160a01b03909116906307e0db17906024015b600060405180830381600087803b158015610f7e57600080fd5b505af1158015610f92573d6000803e3d6000fd5b5050505050565b600033610fa78185856124d2565b5060019392505050565b610fb9612478565b61ffff909116600090815260686020526040902055565b610fd8612478565b6065546040516310ddb13760e01b815261ffff831660048201526001600160a01b03909116906310ddb13790602401610f64565b60003361101a8582856125f7565b611025858585612671565b506001949350505050565b61103b86868561281e565b5092506110a986868686611052602087018761458f565b611062604088016020890161458f565b61106f6040890189614c00565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061286792505050565b9250818310156110cb5760405162461bcd60e51b8152600401610ca590614c46565b505050505050565b60006110dd61298b565b905090565b6000806111288888888888888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061299592505050565b91509150965096945050505050565b600033610fa781858561114a8383611ea0565b6111549190614ca9565b6124d2565b61ffff83166000908152606660205260408120805482919061117a90614bbc565b80601f01602080910402602001604051908101604052809291908181526020018280546111a690614bbc565b80156111f35780601f106111c8576101008083540402835291602001916111f3565b820191906000526020600020905b8154815290600101906020018083116111d657829003601f168201915b50505050509050838360405161120a929190614bf0565b60405180910390208180519060200120149150509392505050565b61122d612478565b6065546040516342d65a8d60e01b81526001600160a01b03909116906342d65a8d9061126190869086908690600401614ce5565b600060405180830381600087803b15801561127b57600080fd5b505af1158015610e59573d6000803e3d6000fd5b61129a89898861281e565b50809650506113438989898988888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a92506112ec915050602089018961458f565b6112fc60408a0160208b0161458f565b61130960408b018b614c00565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612a2f92505050565b9550848610156113655760405162461bcd60e51b8152600401610ca590614c46565b505050505050505050565b611378612478565b6001600160a01b0381166113ce5760405162461bcd60e51b815260206004820152601a60248201527f4665653a206665654f776e65722063616e6e6f742062652030780000000000006044820152606401610ca5565b60f8805462010000600160b01b031916620100006001600160a01b038416908102919091179091556040519081527f047912631afa564eebd3db2efe191a0dec62da1fede6bbbc1ffc89d87845b1b5906020015b60405180910390a150565b611435612478565b6127108161ffff16111561145b5760405162461bcd60e51b8152600401610ca590614d03565b60f8805461ffff191661ffff83169081179091556040519081527fd26030ef4a8c225ee12b646eb4466acb41fb96b6cd4660b22d0ba0124e7bdc7490602001611422565b3330146114fd5760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610ca5565b6110cb8686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815289935091508790879081908401838280828437600092019190915250612b2b92505050565b61157b612478565b6115856000612bb2565b565b606660205260009081526040902080546115a090614bbc565b80601f01602080910402602001604051908101604052809291908181526020018280546115cc90614bbc565b80156116195780601f106115ee57610100808354040283529160200191611619565b820191906000526020600020905b8154815290600101906020018083116115fc57829003601f168201915b505050505081565b611629612478565b6127108161ffff16111561164f5760405162461bcd60e51b8152600401610ca590614d03565b60408051808201825261ffff8381168083528515156020808501828152898516600081815260f784528890209651875492511515620100000262ffffff1990931696169590951717909455845192835292820192909252918201527fdd9c9685af3e6dcb56d8f4b88d2595d4add6837a150034e7781c46b6dcf8aaab906060015b60405180910390a1505050565b6001600160a01b03811660009081526101f06020526040812054610e93565b6000606080600080600060606101bc546000801b14801561171e57506101bd54155b6117625760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b6044820152606401610ca5565b61176a612c04565b611772612c14565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60006110dd61018c5490565b606061018e8054610ea990614bbc565b61ffff81166000908152606660205260408120805460609291906117db90614bbc565b80601f016020809104026020016040519081016040528092919081815260200182805461180790614bbc565b80156118545780601f1061182957610100808354040283529160200191611854565b820191906000526020600020905b81548152906001019060200180831161183757829003601f168201915b5050505050905080516000036118ac5760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610ca5565b6118c76000601483516118bf9190614d48565b839190612c24565b9392505050565b600033816118dc8286611ea0565b90508381101561193c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610ca5565b61102582868684036124d2565b6000806119c68b8b8b8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b81528e93508d9250908c908c9081908401838280828437600092019190915250612d3192505050565b91509150995099975050505050505050565b6119e0612478565b8181306040516020016119f593929190614d5b565b60408051601f1981840301815291815261ffff8516600090815260666020522090611a209082614dc7565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce8383836040516116d093929190614ce5565b600033610fa7818585612671565b611a6a612478565b606980546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b90602001611422565b611ac0612478565b6065546040516332fb62e760e21b81526001600160a01b039091169063cbed8b9c90611af89088908890889088908890600401614e86565b600060405180830381600087803b158015611b1257600080fd5b505af1158015611365573d6000803e3d6000fd5b61ffff86166000908152609760205260408082209051611b499088908890614bf0565b90815260408051602092819003830190206001600160401b03871660009081529252902054905080611bc95760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610ca5565b808383604051611bda929190614bf0565b604051809103902014611c395760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610ca5565b61ffff87166000908152609760205260408082209051611c5c9089908990614bf0565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f88018290048202830182019052868252611cf4918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250612b2b92505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051611d2b959493929190614ebf565b60405180910390a150505050505050565b83421115611d8c5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610ca5565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888611dbb8c612dce565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000611e1682612df7565b90506000611e2682878787612e24565b9050896001600160a01b0316816001600160a01b031614611e895760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610ca5565b611e948a8a8a6124d2565b50505050505050505050565b6001600160a01b03918216600090815261018b6020908152604080832093909416825291909152205490565b600054610100900460ff1615808015611eec5750600054600160ff909116105b80611f065750303b158015611f06575060005460ff166001145b611f695760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610ca5565b6000805460ff191660011790558015611f8c576000805461ff0019166101001790555b611f9885858585612e4c565b8015610f92576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050505050565b611fed612478565b600081116120355760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610ca5565b61ffff83811660008181526067602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac0906060016116d0565b61209f612478565b60c980548215156101000261ff00199091161790556040517f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a49061142290831515815260200190565b3330146121375760405162461bcd60e51b815260206004820152601f60248201527f4f4654436f72653a2063616c6c6572206d757374206265204f4654436f7265006044820152606401610ca5565b612142308686612ea9565b9350846001600160a01b03168a61ffff167fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf8660405161218491815260200190565b60405180910390a3604051633fe79aed60e11b81526001600160a01b03861690637fcf35da9083906121c8908e908e908e908e908e908d908d908d90600401614efa565b600060405180830381600088803b1580156121e257600080fd5b5087f11580156121f6573d6000803e3d6000fd5b505050505050505050505050505050565b61220f612478565b61ffff8316600090815260666020526040902061222d828483614f55565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab8383836040516116d093929190614ce5565b61ffff828116600090815260f76020908152604080832081518083019092525493841681526201000090930460ff16158015918401919091529091906122c6578051612710906122b59061ffff1685615014565b6122bf9190615041565b91506122ec565b60f85461ffff16156122e75760f854612710906122b59061ffff1685615014565b600091505b5092915050565b6122fb612478565b6001600160a01b0381166123605760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610ca5565b61236981612bb2565b50565b606554604051633d7b2f6f60e21b815261ffff808716600483015285166024820152306044820152606481018390526060916001600160a01b03169063f5ecbdbc90608401600060405180830381865afa1580156123ce573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526123f69190810190615055565b95945050505050565b6000806124625a60966366ad5c8a60e01b8989898960405160240161242794939291906150c2565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915230929190612efb565b91509150816110cb576110cb8686868685612f87565b6033546001600160a01b031633146115855760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ca5565b6001600160a01b0383166125345760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610ca5565b6001600160a01b0382166125955760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610ca5565b6001600160a01b03838116600081815261018b602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006126038484611ea0565b9050600019811461266b578181101561265e5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610ca5565b61266b84848484036124d2565b50505050565b6001600160a01b0383166126d55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610ca5565b6001600160a01b0382166127375760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610ca5565b6001600160a01b038316600090815261018a6020526040902054818110156127b05760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610ca5565b6001600160a01b03808516600081815261018a602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906128119086815260200190565b60405180910390a361266b565b60008061282b8484612261565b90506128378184614d48565b9150801561285f5760f85461285d9086906201000090046001600160a01b031683612ea9565b505b935093915050565b60006128758782848161301a565b61287e85613099565b50905061288d888888846130c3565b9050600081116128db5760405162461bcd60e51b815260206004820152601960248201527813d19510dbdc994e88185b5bdd5b9d081d1bdbc81cdb585b1b603a1b6044820152606401610ca5565b6000612926876128ea846130f5565b6040805160006020820152602181019390935260c09190911b6001600160c01b0319166041830152805160298184030181526049909201905290565b9050612936888287878734613165565b86896001600160a01b03168961ffff167fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a8560405161297791815260200190565b60405180910390a450979650505050505050565b60006110dd6132ee565b60008060006129a7876128ea886130f5565b60655460405163040a7bb160e41b81529192506001600160a01b0316906340a7bb10906129e0908b90309086908b908b90600401615100565b6040805180830381865afa1580156129fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a209190615154565b92509250509550959350505050565b6000612a47896001846001600160401b03891661301a565b612a5087613099565b509050612a5f8a8a8a846130c3565b905060008111612aad5760405162461bcd60e51b815260206004820152601960248201527813d19510dbdc994e88185b5bdd5b9d081d1bdbc81cdb585b1b603a1b6044820152606401610ca5565b6000612ac4338a612abd856130f5565b8a8a613362565b9050612ad48a8287878734613165565b888b6001600160a01b03168b61ffff167fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a85604051612b1591815260200190565b60405180910390a4509998505050505050505050565b6000612b3782826133a3565b905060ff8116612b5257612b4d858585856133ff565b610f92565b60001960ff821601612b6a57612b4d8585858561348f565b60405162461bcd60e51b815260206004820152601c60248201527f4f4654436f72653a20756e6b6e6f776e207061636b65742074797065000000006044820152606401610ca5565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60606101be8054610ea990614bbc565b60606101bf8054610ea990614bbc565b606081612c3281601f614ca9565b1015612c715760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610ca5565b612c7b8284614ca9565b84511015612cbf5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610ca5565b606082158015612cde5760405191506000825260208201604052612d28565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015612d17578051835260209283019201612cff565b5050858452601f01601f1916604052505b50949350505050565b6000806000612d44338a612abd8b6130f5565b60655460405163040a7bb160e41b81529192506001600160a01b0316906340a7bb1090612d7d908d90309086908b908b90600401615100565b6040805180830381865afa158015612d99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dbd9190615154565b925092505097509795505050505050565b6001600160a01b03811660009081526101f0602052604090208054600181018255905b50919050565b6000610e93612e0461298b565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000612e358787878761369d565b91509150612e428161375e565b5095945050505050565b600054610100900460ff16612e735760405162461bcd60e51b8152600401610ca590615178565b612e7b6138a8565b612e84816138d8565b612e8d82613921565b612e97848461395e565b612ea0846139a0565b61266b826139c7565b600033306001600160a01b03861614801590612ed75750806001600160a01b0316856001600160a01b031614155b15612ee757612ee78582856125f7565b612ef2858585612671565b50909392505050565b6000606060008060008661ffff166001600160401b03811115612f2057612f206145ac565b6040519080825280601f01601f191660200182016040528015612f4a576020820181803683370190505b50905060008087516020890160008d8df191503d925086831115612f6c578692505b828152826000602083013e9093509150505b94509492505050565b8180519060200120609760008761ffff1661ffff16815260200190815260200160002085604051612fb891906151c3565b9081526040805191829003602090810183206001600160401b0388166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c90611fd690879087908790879087906151df565b505050565b60c954610100900460ff161561303b5761303684848484613a77565b61266b565b81511561266b5760405162461bcd60e51b815260206004820152602660248201527f4f4654436f72653a205f61646170746572506172616d73206d7573742062652060448201526532b6b83a3c9760d11b6064820152608401610ca5565b6000806130a66102235490565b6130b09084615231565b90506130bc8184614d48565b9150915091565b6000336001600160a01b03861681146130e1576130e18682856125f7565b6130eb8684613b56565b5090949350505050565b6000806131026102235490565b61310c9084615041565b90506001600160401b03811115610e935760405162461bcd60e51b815260206004820152601a60248201527f4f4654436f72653a20616d6f756e745344206f766572666c6f770000000000006044820152606401610ca5565b61ffff86166000908152606660205260408120805461318390614bbc565b80601f01602080910402602001604051908101604052809291908181526020018280546131af90614bbc565b80156131fc5780601f106131d1576101008083540402835291602001916131fc565b820191906000526020600020905b8154815290600101906020018083116131df57829003601f168201915b50505050509050805160000361326d5760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610ca5565b613278878751613c8d565b60655460405162c5803160e81b81526001600160a01b039091169063c58031009084906132b3908b9086908c908c908c908c90600401615245565b6000604051808303818588803b1580156132cc57600080fd5b505af11580156132e0573d6000803e3d6000fd5b505050505050505050505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613319613cfe565b613321613d58565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6060600185856001600160a01b0389168587604051602001613389969594939291906152ac565b604051602081830303815290604052905095945050505050565b60006133b0826001614ca9565b835110156133f65760405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b6044820152606401610ca5565b50016001015190565b60008061340b83613d8a565b90925090506001600160a01b0382166134245761dead91505b600061342f82613e0f565b905061343c878483613e2e565b9050826001600160a01b03168761ffff167fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf8360405161347e91815260200190565b60405180910390a350505050505050565b60008060008060006134a086613e3a565b94509450945094509450600060ca60008b61ffff1661ffff168152602001908152602001600020896040516134d591906151c3565b90815260408051602092819003830190206001600160401b038b166000908152925281205460ff16915061350885613e0f565b9050816135765761351a8b3083613e2e565b61ffff8c16600090815260ca6020526040908190209051919250600191613542908d906151c3565b90815260408051602092819003830190206001600160401b038d16600090815292529020805460ff19169115159190911790555b6001600160a01b0386163b6135cd576040516001600160a01b03871681527f9aedf5fdba8716db3b6705ca00150643309995d4f818a249ed6dde6677e7792d9060200160405180910390a15050505050505061266b565b8a8a8a8a8a8a868a60008a6135eb578b6001600160401b03166135ed565b5a5b905060008061361f5a609663eaffd49a60e01b8e8e8e8d8d8d8d8d60405160240161242798979695949392919061530d565b915091508115613678578751602089012060405161ffff8d16907fb8890edbfc1c74692f527444645f95489c3703cc2df42e4a366f5d06fa6cd8849061366a908e908e908690615381565b60405180910390a250613685565b6136858b8b8b8b85612f87565b50505050505050505050505050505050505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156136d45750600090506003612f7e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613728573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661375157600060019250925050612f7e565b9660009650945050505050565b6000816004811115613772576137726153af565b0361377a5750565b600181600481111561378e5761378e6153af565b036137db5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610ca5565b60028160048111156137ef576137ef6153af565b0361383c5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610ca5565b6003816004811115613850576138506153af565b036123695760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610ca5565b600054610100900460ff166138cf5760405162461bcd60e51b8152600401610ca590615178565b61158533612bb2565b600054610100900460ff166138ff5760405162461bcd60e51b8152600401610ca590615178565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff166139485760405162461bcd60e51b8152600401610ca590615178565b60c9805460ff191660ff92909216919091179055565b600054610100900460ff166139855760405162461bcd60e51b8152600401610ca590615178565b61018d6139928382614dc7565b5061018e6130158282614dc7565b600054610100900460ff166123695760405162461bcd60e51b8152600401610ca590615178565b600054610100900460ff166139ee5760405162461bcd60e51b8152600401610ca590615178565b601260ff8216811015613a5a5760405162461bcd60e51b815260206004820152602e60248201527f4f4654576974684665653a20736861726564446563696d616c73206d7573742060448201526d6265203c3d20646563696d616c7360901b6064820152608401610ca5565b613a6482826153c5565b613a6f90600a6154c2565b610223555050565b6000613a8283613ef1565b61ffff808716600090815260676020908152604080832093891683529290529081205491925090613ab4908490614ca9565b905060008111613b065760405162461bcd60e51b815260206004820152601a60248201527f4c7a4170703a206d696e4761734c696d6974206e6f74207365740000000000006044820152606401610ca5565b808210156110cb5760405162461bcd60e51b815260206004820152601b60248201527f4c7a4170703a20676173206c696d697420697320746f6f206c6f7700000000006044820152606401610ca5565b6001600160a01b038216613bb65760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610ca5565b6001600160a01b038216600090815261018a602052604090205481811015613c2b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610ca5565b6001600160a01b038316600081815261018a60209081526040808320868603905561018c80548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b61ffff821660009081526068602052604081205490819003613cae57506127105b808211156130155760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152606401610ca5565b600080613d09612c04565b805190915015613d20578051602090910120919050565b6101bc548015613d305792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b600080613d63612c14565b805190915015613d7a578051602090910120919050565b6101bd548015613d305792915050565b60008080613d9884826133a3565b60ff16148015613da9575082516029145b613df05760405162461bcd60e51b815260206004820152601860248201527713d19510dbdc994e881a5b9d985b1a59081c185e5b1bd85960421b6044820152606401610ca5565b613dfb83600d613f4d565b9150613e08836021613fb2565b9050915091565b6000613e1b6102235490565b610e93906001600160401b038416615014565b60006122ec838361400f565b600080806060816001613e4d87836133a3565b60ff1614613e985760405162461bcd60e51b815260206004820152601860248201527713d19510dbdc994e881a5b9d985b1a59081c185e5b1bd85960421b6044820152606401610ca5565b613ea386600d613f4d565b9350613eb0866021613fb2565b9250613ebd8660296140d2565b9450613eca866049613fb2565b9050613ee66051808851613ede9190614d48565b889190612c24565b915091939590929450565b6000602282511015613f455760405162461bcd60e51b815260206004820152601c60248201527f4c7a4170703a20696e76616c69642061646170746572506172616d73000000006044820152606401610ca5565b506022015190565b6000613f5a826014614ca9565b83511015613fa25760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610ca5565b500160200151600160601b900490565b6000613fbf826008614ca9565b835110156140065760405162461bcd60e51b8152602060048201526014602482015273746f55696e7436345f6f75744f66426f756e647360601b6044820152606401610ca5565b50016008015190565b6001600160a01b0382166140655760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610ca5565b8061018c60008282546140789190614ca9565b90915550506001600160a01b038216600081815261018a60209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b60006140df826020614ca9565b835110156141275760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b6044820152606401610ca5565b50016020015190565b803561ffff8116811461414257600080fd5b919050565b60008083601f84011261415957600080fd5b5081356001600160401b0381111561417057600080fd5b60208301915083602082850101111561418857600080fd5b9250929050565b80356001600160401b038116811461414257600080fd5b600080600080600080608087890312156141bf57600080fd5b6141c887614130565b955060208701356001600160401b03808211156141e457600080fd5b6141f08a838b01614147565b909750955085915061420460408a0161418f565b9450606089013591508082111561421a57600080fd5b5061422789828a01614147565b979a9699509497509295939492505050565b60006020828403121561424b57600080fd5b81356001600160e01b0319811681146118c757600080fd5b60005b8381101561427e578181015183820152602001614266565b50506000910152565b6000815180845261429f816020860160208601614263565b601f01601f19169290920160200192915050565b6020815260006118c76020830184614287565b6000602082840312156142d857600080fd5b6118c782614130565b6001600160a01b038116811461236957600080fd5b6000806040838503121561430957600080fd5b8235614314816142e1565b946020939093013593505050565b6000806040838503121561433557600080fd5b61431483614130565b60008060006060848603121561435357600080fd5b833561435e816142e1565b9250602084013561436e816142e1565b929592945050506040919091013590565b600060608284031215612df157600080fd5b60008060008060008060c087890312156143aa57600080fd5b86356143b5816142e1565b95506143c360208801614130565b945060408701359350606087013592506080870135915060a08701356001600160401b038111156143f357600080fd5b6143ff89828a0161437f565b9150509295509295509295565b8035801515811461414257600080fd5b60008060008060008060a0878903121561443557600080fd5b61443e87614130565b9550602087013594506040870135935061445a6060880161440c565b925060808701356001600160401b0381111561447557600080fd5b61422789828a01614147565b60008060006040848603121561449657600080fd5b61449f84614130565b925060208401356001600160401b038111156144ba57600080fd5b6144c686828701614147565b9497909650939450505050565b60008060008060008060008060006101008a8c0312156144f257600080fd5b89356144fd816142e1565b985061450b60208b01614130565b975060408a0135965060608a0135955060808a0135945060a08a01356001600160401b038082111561453c57600080fd5b6145488d838e01614147565b909650945084915061455c60c08d0161418f565b935060e08c013591508082111561457257600080fd5b5061457f8c828d0161437f565b9150509295985092959850929598565b6000602082840312156145a157600080fd5b81356118c7816142e1565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156145ea576145ea6145ac565b604052919050565b60006001600160401b0382111561460b5761460b6145ac565b50601f01601f191660200190565b600061462c614627846145f2565b6145c2565b905082815283838301111561464057600080fd5b828260208301376000602084830101529392505050565b60008060006060848603121561466c57600080fd5b61467584614130565b925060208401356001600160401b0381111561469057600080fd5b8401601f810186136146a157600080fd5b6146b086823560208401614619565b9250506146bf6040850161418f565b90509250925092565b6000806000606084860312156146dd57600080fd5b6146e684614130565b92506146f46020850161440c565b91506146bf60408501614130565b60ff60f81b881681526000602060e08184015261472260e084018a614287565b8381036040850152614734818a614287565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b818110156147865783518352928401929184019160010161476a565b50909c9b505050505050505050505050565b600080604083850312156147ab57600080fd5b6147b483614130565b91506147c260208401614130565b90509250929050565b600080600080600080600080600060e08a8c0312156147e957600080fd5b6147f28a614130565b985060208a0135975060408a0135965060608a01356001600160401b038082111561481c57600080fd5b6148288d838e01614147565b909850965086915061483c60808d0161418f565b955061484a60a08d0161440c565b945060c08c013591508082111561486057600080fd5b5061486d8c828d01614147565b915080935050809150509295985092959850929598565b60008060008060006080868803121561489c57600080fd5b6148a586614130565b94506148b360208701614130565b93506040860135925060608601356001600160401b038111156148d557600080fd5b6148e188828901614147565b969995985093965092949392505050565b803560ff8116811461414257600080fd5b600080600080600080600060e0888a03121561491e57600080fd5b8735614929816142e1565b96506020880135614939816142e1565b95506040880135945060608801359350614955608089016148f2565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561498457600080fd5b823561498f816142e1565b9150602083013561499f816142e1565b809150509250929050565b600082601f8301126149bb57600080fd5b6118c783833560208501614619565b600080600080608085870312156149e057600080fd5b84356001600160401b03808211156149f757600080fd5b614a03888389016149aa565b95506020870135915080821115614a1957600080fd5b50614a26878288016149aa565b935050614a35604086016148f2565b91506060850135614a45816142e1565b939692955090935050565b600080600060608486031215614a6557600080fd5b614a6e84614130565b9250614a7c60208501614130565b9150604084013590509250925092565b600060208284031215614a9e57600080fd5b6118c78261440c565b6000806000806000806000806000806101008b8d031215614ac757600080fd5b614ad08b614130565b995060208b01356001600160401b0380821115614aec57600080fd5b614af88e838f01614147565b909b509950899150614b0c60408e0161418f565b985060608d0135975060808d01359150614b25826142e1565b90955060a08c0135945060c08c01359080821115614b4257600080fd5b50614b4f8d828e01614147565b9150809450508092505060e08b013590509295989b9194979a5092959850565b60008060008060808587031215614b8557600080fd5b614b8e85614130565b9350614b9c60208601614130565b92506040850135614bac816142e1565b9396929550929360600135925050565b600181811c90821680614bd057607f821691505b602082108103612df157634e487b7160e01b600052602260045260246000fd5b8183823760009101908152919050565b6000808335601e19843603018112614c1757600080fd5b8301803591506001600160401b03821115614c3157600080fd5b60200191503681900382131561418857600080fd5b6020808252602d908201527f426173654f4654576974684665653a20616d6f756e74206973206c657373207460408201526c1a185b881b5a5b905b5bdd5b9d609a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e9357610e93614c93565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff841681526040602082015260006123f6604083018486614cbc565b60208082526025908201527f4665653a20666565206270206d757374206265203c3d2042505f44454e4f4d496040820152642720aa27a960d91b606082015260800190565b81810381811115610e9357610e93614c93565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b601f82111561301557600081815260208120601f850160051c81016020861015614da85750805b601f850160051c820191505b818110156110cb57828155600101614db4565b81516001600160401b03811115614de057614de06145ac565b614df481614dee8454614bbc565b84614d81565b602080601f831160018114614e295760008415614e115750858301515b600019600386901b1c1916600185901b1785556110cb565b600085815260208120601f198616915b82811015614e5857888601518255948401946001909101908401614e39565b5085821015614e765787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600061ffff808816835280871660208401525084604083015260806060830152614eb4608083018486614cbc565b979650505050505050565b61ffff86168152608060208201526000614edd608083018688614cbc565b6001600160401b0394909416604083015250606001529392505050565b61ffff8916815260c060208201526000614f1860c08301898b614cbc565b6001600160401b038816604084015286606084015285608084015282810360a0840152614f46818587614cbc565b9b9a5050505050505050505050565b6001600160401b03831115614f6c57614f6c6145ac565b614f8083614f7a8354614bbc565b83614d81565b6000601f841160018114614fb45760008515614f9c5750838201355b600019600387901b1c1916600186901b178355610f92565b600083815260209020601f19861690835b82811015614fe55786850135825560209485019460019092019101614fc5565b50868210156150025760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b8082028115828204841417610e9357610e93614c93565b634e487b7160e01b600052601260045260246000fd5b6000826150505761505061502b565b500490565b60006020828403121561506757600080fd5b81516001600160401b0381111561507d57600080fd5b8201601f8101841361508e57600080fd5b805161509c614627826145f2565b8181528560208385010111156150b157600080fd5b6123f6826020830160208601614263565b61ffff851681526080602082015260006150df6080830186614287565b6001600160401b03851660408401528281036060840152614eb48185614287565b61ffff861681526001600160a01b038516602082015260a06040820181905260009061512e90830186614287565b841515606084015282810360808401526151488185614287565b98975050505050505050565b6000806040838503121561516757600080fd5b505080516020909101519092909150565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600082516151d5818460208701614263565b9190910192915050565b61ffff8616815260a0602082015260006151fc60a0830187614287565b6001600160401b0386166040840152828103606084015261521d8186614287565b905082810360808401526151488185614287565b6000826152405761524061502b565b500690565b61ffff8716815260c06020820152600061526260c0830188614287565b82810360408401526152748188614287565b6001600160a01b0387811660608601528616608085015283810360a0850152905061529f8185614287565b9998505050505050505050565b60ff60f81b8760f81b16815285600182015260006001600160401b0360c01b808760c01b166021840152856029840152808560c01b1660498401525082516152fb816051850160208701614263565b91909101605101979650505050505050565b600061010061ffff8b16835280602084015261532b8184018b614287565b6001600160401b038a166040850152606084018990526001600160a01b038816608085015260a0840187905283810360c0850152905061536b8186614287565b9150508260e08301529998505050505050505050565b6060815260006153946060830186614287565b6001600160401b039490941660208301525060400152919050565b634e487b7160e01b600052602160045260246000fd5b60ff8281168282160390811115610e9357610e93614c93565b600181815b808511156154195781600019048211156153ff576153ff614c93565b8085161561540c57918102915b93841c93908002906153e3565b509250929050565b60008261543057506001610e93565b8161543d57506000610e93565b8160018114615453576002811461545d57615479565b6001915050610e93565b60ff84111561546e5761546e614c93565b50506001821b610e93565b5060208310610133831016604e8410600b841016171561549c575081810a610e93565b6154a683836153de565b80600019048211156154ba576154ba614c93565b029392505050565b60006118c760ff84168361542156fea2646970667358221220a2d471991b5e2e3d6db459143a9592e7c9905f16d400b107910251fd0ff8685364736f6c63430008120033", + "deployedBytecode": "0x6080604052600436106103c25760003560e01c80638da5cb5b116101f2578063cbed8b9c1161010d578063eab45d9c116100a0578063ed629c5c1161006f578063ed629c5c14610bd4578063f2fde38b14610bf3578063f5ecbdbc14610c13578063fc0c546a14610c3357600080fd5b8063eab45d9c14610b54578063eaffd49a14610b74578063eb8d72b714610b94578063ecd8f21214610bb457600080fd5b8063dd62ed3e116100dc578063dd62ed3e14610adf578063de7ea79d14610aff578063df2a5b3b14610b1f578063e6a20ae614610b3f57600080fd5b8063cbed8b9c14610a5e578063d1deba1f14610a7e578063d505accf14610a91578063d888296814610ab157600080fd5b8063a6c3d16511610185578063b9818be111610154578063b9818be1146109c2578063baf3292d146109e8578063c44618341461098c578063c83330ce14610a0857600080fd5b8063a6c3d1651461094c578063a9059cbb1461096c578063abe685cd1461098c578063b353aaa7146109a257600080fd5b80639bdb9812116101c15780639bdb98121461089a5780639f38369a146108ec578063a457c2d71461090c578063a4c51df51461092c57600080fd5b80638da5cb5b1461081e5780639358928b14610850578063950c8a741461086557806395d89b411461088557600080fd5b806342d65a8d116102e257806370a08231116102755780637ecebe00116102445780637ecebe001461078457806384b0196e146107a4578063857749b0146107cc5780638cfd8f5c146107e657600080fd5b806370a08231146106f8578063715018a61461072f5780637533d7881461074457806379c0ad4b1461076457600080fd5b80634c42899a116102b15780634c42899a146106545780635a359dc5146106695780635b8c41e61461068957806366ad5c8a146106d857600080fd5b806342d65a8d146105ec578063447705151461060c578063455ba27d146106215780634b104eff1461063457600080fd5b806323b872dd1161035a578063365260b411610329578063365260b41461054a578063395093511461057f5780633d8b38f61461059f5780633f1f4fa4146105bf57600080fd5b806323b872dd146104e05780632cdf0b9514610500578063313ce567146105135780633644e5151461053557600080fd5b8063095ea7b311610396578063095ea7b3146104605780630df374831461048057806310ddb137146104a057806318160ddd146104c057600080fd5b80621d3567146103c757806301ffc9a7146103e957806306fdde031461041e57806307e0db1714610440575b600080fd5b3480156103d357600080fd5b506103e76103e23660046141a6565b610c46565b005b3480156103f557600080fd5b50610409610404366004614239565b610e62565b60405190151581526020015b60405180910390f35b34801561042a57600080fd5b50610433610e99565b60405161041591906142b3565b34801561044c57600080fd5b506103e761045b3660046142c6565b610f2c565b34801561046c57600080fd5b5061040961047b3660046142f6565b610f99565b34801561048c57600080fd5b506103e761049b366004614322565b610fb1565b3480156104ac57600080fd5b506103e76104bb3660046142c6565b610fd0565b3480156104cc57600080fd5b5061018c545b604051908152602001610415565b3480156104ec57600080fd5b506104096104fb36600461433e565b61100c565b6103e761050e366004614391565b611030565b34801561051f57600080fd5b5060125b60405160ff9091168152602001610415565b34801561054157600080fd5b506104d26110d3565b34801561055657600080fd5b5061056a61056536600461441c565b6110e2565b60408051928352602083019190915201610415565b34801561058b57600080fd5b5061040961059a3660046142f6565b611137565b3480156105ab57600080fd5b506104096105ba366004614481565b611159565b3480156105cb57600080fd5b506104d26105da3660046142c6565b60686020526000908152604090205481565b3480156105f857600080fd5b506103e7610607366004614481565b611225565b34801561061857600080fd5b506104d2600081565b6103e761062f3660046144d3565b61128f565b34801561064057600080fd5b506103e761064f36600461458f565b611370565b34801561066057600080fd5b50610523600081565b34801561067557600080fd5b506103e76106843660046142c6565b61142d565b34801561069557600080fd5b506104d26106a4366004614657565b6097602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b3480156106e457600080fd5b506103e76106f33660046141a6565b61149f565b34801561070457600080fd5b506104d261071336600461458f565b6001600160a01b0316600090815261018a602052604090205490565b34801561073b57600080fd5b506103e7611573565b34801561075057600080fd5b5061043361075f3660046142c6565b611587565b34801561077057600080fd5b506103e761077f3660046146c8565b611621565b34801561079057600080fd5b506104d261079f36600461458f565b6116dd565b3480156107b057600080fd5b506107b96116fc565b6040516104159796959493929190614702565b3480156107d857600080fd5b5060c9546105239060ff1681565b3480156107f257600080fd5b506104d2610801366004614798565b606760209081526000928352604080842090915290825290205481565b34801561082a57600080fd5b506033546001600160a01b03165b6040516001600160a01b039091168152602001610415565b34801561085c57600080fd5b506104d261179c565b34801561087157600080fd5b50606954610838906001600160a01b031681565b34801561089157600080fd5b506104336117a8565b3480156108a657600080fd5b506104096108b5366004614657565b60ca602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205460ff1681565b3480156108f857600080fd5b506104336109073660046142c6565b6117b8565b34801561091857600080fd5b506104096109273660046142f6565b6118ce565b34801561093857600080fd5b5061056a6109473660046147cb565b611949565b34801561095857600080fd5b506103e7610967366004614481565b6119d8565b34801561097857600080fd5b506104096109873660046142f6565b611a54565b34801561099857600080fd5b506104d261271081565b3480156109ae57600080fd5b50606554610838906001600160a01b031681565b3480156109ce57600080fd5b5060f854610838906201000090046001600160a01b031681565b3480156109f457600080fd5b506103e7610a0336600461458f565b611a62565b348015610a1457600080fd5b50610a44610a233660046142c6565b60f76020526000908152604090205461ffff81169062010000900460ff1682565b6040805161ffff9093168352901515602083015201610415565b348015610a6a57600080fd5b506103e7610a79366004614884565b611ab8565b6103e7610a8c3660046141a6565b611b26565b348015610a9d57600080fd5b506103e7610aac366004614903565b611d3c565b348015610abd57600080fd5b5060f854610acc9061ffff1681565b60405161ffff9091168152602001610415565b348015610aeb57600080fd5b506104d2610afa366004614971565b611ea0565b348015610b0b57600080fd5b506103e7610b1a3660046149ca565b611ecc565b348015610b2b57600080fd5b506103e7610b3a366004614a50565b611fe5565b348015610b4b57600080fd5b50610523600181565b348015610b6057600080fd5b506103e7610b6f366004614a8c565b612097565b348015610b8057600080fd5b506103e7610b8f366004614aa7565b6120e8565b348015610ba057600080fd5b506103e7610baf366004614481565b612207565b348015610bc057600080fd5b506104d2610bcf366004614322565b612261565b348015610be057600080fd5b5060c95461040990610100900460ff1681565b348015610bff57600080fd5b506103e7610c0e36600461458f565b6122f3565b348015610c1f57600080fd5b50610433610c2e366004614b6f565b61236c565b348015610c3f57600080fd5b5030610838565b6065546001600160a01b0316336001600160a01b031614610cae5760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff861660009081526066602052604081208054610ccc90614bbc565b80601f0160208091040260200160405190810160405280929190818152602001828054610cf890614bbc565b8015610d455780601f10610d1a57610100808354040283529160200191610d45565b820191906000526020600020905b815481529060010190602001808311610d2857829003601f168201915b50505050509050805186869050148015610d60575060008151115b8015610d88575080516020820120604051610d7e9088908890614bf0565b6040518091039020145b610de35760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610ca5565b610e598787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a9350915088908890819084018382808284376000920191909152506123ff92505050565b50505050505050565b60006001600160e01b03198216630d30953d60e31b1480610e9357506301ffc9a760e01b6001600160e01b03198316145b92915050565b606061018d8054610ea990614bbc565b80601f0160208091040260200160405190810160405280929190818152602001828054610ed590614bbc565b8015610f225780601f10610ef757610100808354040283529160200191610f22565b820191906000526020600020905b815481529060010190602001808311610f0557829003601f168201915b5050505050905090565b610f34612478565b6065546040516307e0db1760e01b815261ffff831660048201526001600160a01b03909116906307e0db17906024015b600060405180830381600087803b158015610f7e57600080fd5b505af1158015610f92573d6000803e3d6000fd5b5050505050565b600033610fa78185856124d2565b5060019392505050565b610fb9612478565b61ffff909116600090815260686020526040902055565b610fd8612478565b6065546040516310ddb13760e01b815261ffff831660048201526001600160a01b03909116906310ddb13790602401610f64565b60003361101a8582856125f7565b611025858585612671565b506001949350505050565b61103b86868561281e565b5092506110a986868686611052602087018761458f565b611062604088016020890161458f565b61106f6040890189614c00565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061286792505050565b9250818310156110cb5760405162461bcd60e51b8152600401610ca590614c46565b505050505050565b60006110dd61298b565b905090565b6000806111288888888888888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061299592505050565b91509150965096945050505050565b600033610fa781858561114a8383611ea0565b6111549190614ca9565b6124d2565b61ffff83166000908152606660205260408120805482919061117a90614bbc565b80601f01602080910402602001604051908101604052809291908181526020018280546111a690614bbc565b80156111f35780601f106111c8576101008083540402835291602001916111f3565b820191906000526020600020905b8154815290600101906020018083116111d657829003601f168201915b50505050509050838360405161120a929190614bf0565b60405180910390208180519060200120149150509392505050565b61122d612478565b6065546040516342d65a8d60e01b81526001600160a01b03909116906342d65a8d9061126190869086908690600401614ce5565b600060405180830381600087803b15801561127b57600080fd5b505af1158015610e59573d6000803e3d6000fd5b61129a89898861281e565b50809650506113438989898988888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a92506112ec915050602089018961458f565b6112fc60408a0160208b0161458f565b61130960408b018b614c00565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612a2f92505050565b9550848610156113655760405162461bcd60e51b8152600401610ca590614c46565b505050505050505050565b611378612478565b6001600160a01b0381166113ce5760405162461bcd60e51b815260206004820152601a60248201527f4665653a206665654f776e65722063616e6e6f742062652030780000000000006044820152606401610ca5565b60f8805462010000600160b01b031916620100006001600160a01b038416908102919091179091556040519081527f047912631afa564eebd3db2efe191a0dec62da1fede6bbbc1ffc89d87845b1b5906020015b60405180910390a150565b611435612478565b6127108161ffff16111561145b5760405162461bcd60e51b8152600401610ca590614d03565b60f8805461ffff191661ffff83169081179091556040519081527fd26030ef4a8c225ee12b646eb4466acb41fb96b6cd4660b22d0ba0124e7bdc7490602001611422565b3330146114fd5760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610ca5565b6110cb8686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815289935091508790879081908401838280828437600092019190915250612b2b92505050565b61157b612478565b6115856000612bb2565b565b606660205260009081526040902080546115a090614bbc565b80601f01602080910402602001604051908101604052809291908181526020018280546115cc90614bbc565b80156116195780601f106115ee57610100808354040283529160200191611619565b820191906000526020600020905b8154815290600101906020018083116115fc57829003601f168201915b505050505081565b611629612478565b6127108161ffff16111561164f5760405162461bcd60e51b8152600401610ca590614d03565b60408051808201825261ffff8381168083528515156020808501828152898516600081815260f784528890209651875492511515620100000262ffffff1990931696169590951717909455845192835292820192909252918201527fdd9c9685af3e6dcb56d8f4b88d2595d4add6837a150034e7781c46b6dcf8aaab906060015b60405180910390a1505050565b6001600160a01b03811660009081526101f06020526040812054610e93565b6000606080600080600060606101bc546000801b14801561171e57506101bd54155b6117625760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b6044820152606401610ca5565b61176a612c04565b611772612c14565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60006110dd61018c5490565b606061018e8054610ea990614bbc565b61ffff81166000908152606660205260408120805460609291906117db90614bbc565b80601f016020809104026020016040519081016040528092919081815260200182805461180790614bbc565b80156118545780601f1061182957610100808354040283529160200191611854565b820191906000526020600020905b81548152906001019060200180831161183757829003601f168201915b5050505050905080516000036118ac5760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610ca5565b6118c76000601483516118bf9190614d48565b839190612c24565b9392505050565b600033816118dc8286611ea0565b90508381101561193c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610ca5565b61102582868684036124d2565b6000806119c68b8b8b8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b81528e93508d9250908c908c9081908401838280828437600092019190915250612d3192505050565b91509150995099975050505050505050565b6119e0612478565b8181306040516020016119f593929190614d5b565b60408051601f1981840301815291815261ffff8516600090815260666020522090611a209082614dc7565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce8383836040516116d093929190614ce5565b600033610fa7818585612671565b611a6a612478565b606980546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b90602001611422565b611ac0612478565b6065546040516332fb62e760e21b81526001600160a01b039091169063cbed8b9c90611af89088908890889088908890600401614e86565b600060405180830381600087803b158015611b1257600080fd5b505af1158015611365573d6000803e3d6000fd5b61ffff86166000908152609760205260408082209051611b499088908890614bf0565b90815260408051602092819003830190206001600160401b03871660009081529252902054905080611bc95760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610ca5565b808383604051611bda929190614bf0565b604051809103902014611c395760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610ca5565b61ffff87166000908152609760205260408082209051611c5c9089908990614bf0565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f88018290048202830182019052868252611cf4918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250612b2b92505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051611d2b959493929190614ebf565b60405180910390a150505050505050565b83421115611d8c5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610ca5565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888611dbb8c612dce565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000611e1682612df7565b90506000611e2682878787612e24565b9050896001600160a01b0316816001600160a01b031614611e895760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610ca5565b611e948a8a8a6124d2565b50505050505050505050565b6001600160a01b03918216600090815261018b6020908152604080832093909416825291909152205490565b600054610100900460ff1615808015611eec5750600054600160ff909116105b80611f065750303b158015611f06575060005460ff166001145b611f695760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610ca5565b6000805460ff191660011790558015611f8c576000805461ff0019166101001790555b611f9885858585612e4c565b8015610f92576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050505050565b611fed612478565b600081116120355760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610ca5565b61ffff83811660008181526067602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac0906060016116d0565b61209f612478565b60c980548215156101000261ff00199091161790556040517f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a49061142290831515815260200190565b3330146121375760405162461bcd60e51b815260206004820152601f60248201527f4f4654436f72653a2063616c6c6572206d757374206265204f4654436f7265006044820152606401610ca5565b612142308686612ea9565b9350846001600160a01b03168a61ffff167fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf8660405161218491815260200190565b60405180910390a3604051633fe79aed60e11b81526001600160a01b03861690637fcf35da9083906121c8908e908e908e908e908e908d908d908d90600401614efa565b600060405180830381600088803b1580156121e257600080fd5b5087f11580156121f6573d6000803e3d6000fd5b505050505050505050505050505050565b61220f612478565b61ffff8316600090815260666020526040902061222d828483614f55565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab8383836040516116d093929190614ce5565b61ffff828116600090815260f76020908152604080832081518083019092525493841681526201000090930460ff16158015918401919091529091906122c6578051612710906122b59061ffff1685615014565b6122bf9190615041565b91506122ec565b60f85461ffff16156122e75760f854612710906122b59061ffff1685615014565b600091505b5092915050565b6122fb612478565b6001600160a01b0381166123605760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610ca5565b61236981612bb2565b50565b606554604051633d7b2f6f60e21b815261ffff808716600483015285166024820152306044820152606481018390526060916001600160a01b03169063f5ecbdbc90608401600060405180830381865afa1580156123ce573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526123f69190810190615055565b95945050505050565b6000806124625a60966366ad5c8a60e01b8989898960405160240161242794939291906150c2565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915230929190612efb565b91509150816110cb576110cb8686868685612f87565b6033546001600160a01b031633146115855760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ca5565b6001600160a01b0383166125345760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610ca5565b6001600160a01b0382166125955760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610ca5565b6001600160a01b03838116600081815261018b602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006126038484611ea0565b9050600019811461266b578181101561265e5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610ca5565b61266b84848484036124d2565b50505050565b6001600160a01b0383166126d55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610ca5565b6001600160a01b0382166127375760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610ca5565b6001600160a01b038316600090815261018a6020526040902054818110156127b05760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610ca5565b6001600160a01b03808516600081815261018a602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906128119086815260200190565b60405180910390a361266b565b60008061282b8484612261565b90506128378184614d48565b9150801561285f5760f85461285d9086906201000090046001600160a01b031683612ea9565b505b935093915050565b60006128758782848161301a565b61287e85613099565b50905061288d888888846130c3565b9050600081116128db5760405162461bcd60e51b815260206004820152601960248201527813d19510dbdc994e88185b5bdd5b9d081d1bdbc81cdb585b1b603a1b6044820152606401610ca5565b6000612926876128ea846130f5565b6040805160006020820152602181019390935260c09190911b6001600160c01b0319166041830152805160298184030181526049909201905290565b9050612936888287878734613165565b86896001600160a01b03168961ffff167fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a8560405161297791815260200190565b60405180910390a450979650505050505050565b60006110dd6132ee565b60008060006129a7876128ea886130f5565b60655460405163040a7bb160e41b81529192506001600160a01b0316906340a7bb10906129e0908b90309086908b908b90600401615100565b6040805180830381865afa1580156129fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a209190615154565b92509250509550959350505050565b6000612a47896001846001600160401b03891661301a565b612a5087613099565b509050612a5f8a8a8a846130c3565b905060008111612aad5760405162461bcd60e51b815260206004820152601960248201527813d19510dbdc994e88185b5bdd5b9d081d1bdbc81cdb585b1b603a1b6044820152606401610ca5565b6000612ac4338a612abd856130f5565b8a8a613362565b9050612ad48a8287878734613165565b888b6001600160a01b03168b61ffff167fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a85604051612b1591815260200190565b60405180910390a4509998505050505050505050565b6000612b3782826133a3565b905060ff8116612b5257612b4d858585856133ff565b610f92565b60001960ff821601612b6a57612b4d8585858561348f565b60405162461bcd60e51b815260206004820152601c60248201527f4f4654436f72653a20756e6b6e6f776e207061636b65742074797065000000006044820152606401610ca5565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60606101be8054610ea990614bbc565b60606101bf8054610ea990614bbc565b606081612c3281601f614ca9565b1015612c715760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610ca5565b612c7b8284614ca9565b84511015612cbf5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610ca5565b606082158015612cde5760405191506000825260208201604052612d28565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015612d17578051835260209283019201612cff565b5050858452601f01601f1916604052505b50949350505050565b6000806000612d44338a612abd8b6130f5565b60655460405163040a7bb160e41b81529192506001600160a01b0316906340a7bb1090612d7d908d90309086908b908b90600401615100565b6040805180830381865afa158015612d99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dbd9190615154565b925092505097509795505050505050565b6001600160a01b03811660009081526101f0602052604090208054600181018255905b50919050565b6000610e93612e0461298b565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000612e358787878761369d565b91509150612e428161375e565b5095945050505050565b600054610100900460ff16612e735760405162461bcd60e51b8152600401610ca590615178565b612e7b6138a8565b612e84816138d8565b612e8d82613921565b612e97848461395e565b612ea0846139a0565b61266b826139c7565b600033306001600160a01b03861614801590612ed75750806001600160a01b0316856001600160a01b031614155b15612ee757612ee78582856125f7565b612ef2858585612671565b50909392505050565b6000606060008060008661ffff166001600160401b03811115612f2057612f206145ac565b6040519080825280601f01601f191660200182016040528015612f4a576020820181803683370190505b50905060008087516020890160008d8df191503d925086831115612f6c578692505b828152826000602083013e9093509150505b94509492505050565b8180519060200120609760008761ffff1661ffff16815260200190815260200160002085604051612fb891906151c3565b9081526040805191829003602090810183206001600160401b0388166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c90611fd690879087908790879087906151df565b505050565b60c954610100900460ff161561303b5761303684848484613a77565b61266b565b81511561266b5760405162461bcd60e51b815260206004820152602660248201527f4f4654436f72653a205f61646170746572506172616d73206d7573742062652060448201526532b6b83a3c9760d11b6064820152608401610ca5565b6000806130a66102235490565b6130b09084615231565b90506130bc8184614d48565b9150915091565b6000336001600160a01b03861681146130e1576130e18682856125f7565b6130eb8684613b56565b5090949350505050565b6000806131026102235490565b61310c9084615041565b90506001600160401b03811115610e935760405162461bcd60e51b815260206004820152601a60248201527f4f4654436f72653a20616d6f756e745344206f766572666c6f770000000000006044820152606401610ca5565b61ffff86166000908152606660205260408120805461318390614bbc565b80601f01602080910402602001604051908101604052809291908181526020018280546131af90614bbc565b80156131fc5780601f106131d1576101008083540402835291602001916131fc565b820191906000526020600020905b8154815290600101906020018083116131df57829003601f168201915b50505050509050805160000361326d5760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610ca5565b613278878751613c8d565b60655460405162c5803160e81b81526001600160a01b039091169063c58031009084906132b3908b9086908c908c908c908c90600401615245565b6000604051808303818588803b1580156132cc57600080fd5b505af11580156132e0573d6000803e3d6000fd5b505050505050505050505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613319613cfe565b613321613d58565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6060600185856001600160a01b0389168587604051602001613389969594939291906152ac565b604051602081830303815290604052905095945050505050565b60006133b0826001614ca9565b835110156133f65760405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b6044820152606401610ca5565b50016001015190565b60008061340b83613d8a565b90925090506001600160a01b0382166134245761dead91505b600061342f82613e0f565b905061343c878483613e2e565b9050826001600160a01b03168761ffff167fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf8360405161347e91815260200190565b60405180910390a350505050505050565b60008060008060006134a086613e3a565b94509450945094509450600060ca60008b61ffff1661ffff168152602001908152602001600020896040516134d591906151c3565b90815260408051602092819003830190206001600160401b038b166000908152925281205460ff16915061350885613e0f565b9050816135765761351a8b3083613e2e565b61ffff8c16600090815260ca6020526040908190209051919250600191613542908d906151c3565b90815260408051602092819003830190206001600160401b038d16600090815292529020805460ff19169115159190911790555b6001600160a01b0386163b6135cd576040516001600160a01b03871681527f9aedf5fdba8716db3b6705ca00150643309995d4f818a249ed6dde6677e7792d9060200160405180910390a15050505050505061266b565b8a8a8a8a8a8a868a60008a6135eb578b6001600160401b03166135ed565b5a5b905060008061361f5a609663eaffd49a60e01b8e8e8e8d8d8d8d8d60405160240161242798979695949392919061530d565b915091508115613678578751602089012060405161ffff8d16907fb8890edbfc1c74692f527444645f95489c3703cc2df42e4a366f5d06fa6cd8849061366a908e908e908690615381565b60405180910390a250613685565b6136858b8b8b8b85612f87565b50505050505050505050505050505050505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156136d45750600090506003612f7e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613728573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661375157600060019250925050612f7e565b9660009650945050505050565b6000816004811115613772576137726153af565b0361377a5750565b600181600481111561378e5761378e6153af565b036137db5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610ca5565b60028160048111156137ef576137ef6153af565b0361383c5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610ca5565b6003816004811115613850576138506153af565b036123695760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610ca5565b600054610100900460ff166138cf5760405162461bcd60e51b8152600401610ca590615178565b61158533612bb2565b600054610100900460ff166138ff5760405162461bcd60e51b8152600401610ca590615178565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff166139485760405162461bcd60e51b8152600401610ca590615178565b60c9805460ff191660ff92909216919091179055565b600054610100900460ff166139855760405162461bcd60e51b8152600401610ca590615178565b61018d6139928382614dc7565b5061018e6130158282614dc7565b600054610100900460ff166123695760405162461bcd60e51b8152600401610ca590615178565b600054610100900460ff166139ee5760405162461bcd60e51b8152600401610ca590615178565b601260ff8216811015613a5a5760405162461bcd60e51b815260206004820152602e60248201527f4f4654576974684665653a20736861726564446563696d616c73206d7573742060448201526d6265203c3d20646563696d616c7360901b6064820152608401610ca5565b613a6482826153c5565b613a6f90600a6154c2565b610223555050565b6000613a8283613ef1565b61ffff808716600090815260676020908152604080832093891683529290529081205491925090613ab4908490614ca9565b905060008111613b065760405162461bcd60e51b815260206004820152601a60248201527f4c7a4170703a206d696e4761734c696d6974206e6f74207365740000000000006044820152606401610ca5565b808210156110cb5760405162461bcd60e51b815260206004820152601b60248201527f4c7a4170703a20676173206c696d697420697320746f6f206c6f7700000000006044820152606401610ca5565b6001600160a01b038216613bb65760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610ca5565b6001600160a01b038216600090815261018a602052604090205481811015613c2b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610ca5565b6001600160a01b038316600081815261018a60209081526040808320868603905561018c80548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b61ffff821660009081526068602052604081205490819003613cae57506127105b808211156130155760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152606401610ca5565b600080613d09612c04565b805190915015613d20578051602090910120919050565b6101bc548015613d305792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b600080613d63612c14565b805190915015613d7a578051602090910120919050565b6101bd548015613d305792915050565b60008080613d9884826133a3565b60ff16148015613da9575082516029145b613df05760405162461bcd60e51b815260206004820152601860248201527713d19510dbdc994e881a5b9d985b1a59081c185e5b1bd85960421b6044820152606401610ca5565b613dfb83600d613f4d565b9150613e08836021613fb2565b9050915091565b6000613e1b6102235490565b610e93906001600160401b038416615014565b60006122ec838361400f565b600080806060816001613e4d87836133a3565b60ff1614613e985760405162461bcd60e51b815260206004820152601860248201527713d19510dbdc994e881a5b9d985b1a59081c185e5b1bd85960421b6044820152606401610ca5565b613ea386600d613f4d565b9350613eb0866021613fb2565b9250613ebd8660296140d2565b9450613eca866049613fb2565b9050613ee66051808851613ede9190614d48565b889190612c24565b915091939590929450565b6000602282511015613f455760405162461bcd60e51b815260206004820152601c60248201527f4c7a4170703a20696e76616c69642061646170746572506172616d73000000006044820152606401610ca5565b506022015190565b6000613f5a826014614ca9565b83511015613fa25760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610ca5565b500160200151600160601b900490565b6000613fbf826008614ca9565b835110156140065760405162461bcd60e51b8152602060048201526014602482015273746f55696e7436345f6f75744f66426f756e647360601b6044820152606401610ca5565b50016008015190565b6001600160a01b0382166140655760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610ca5565b8061018c60008282546140789190614ca9565b90915550506001600160a01b038216600081815261018a60209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b60006140df826020614ca9565b835110156141275760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b6044820152606401610ca5565b50016020015190565b803561ffff8116811461414257600080fd5b919050565b60008083601f84011261415957600080fd5b5081356001600160401b0381111561417057600080fd5b60208301915083602082850101111561418857600080fd5b9250929050565b80356001600160401b038116811461414257600080fd5b600080600080600080608087890312156141bf57600080fd5b6141c887614130565b955060208701356001600160401b03808211156141e457600080fd5b6141f08a838b01614147565b909750955085915061420460408a0161418f565b9450606089013591508082111561421a57600080fd5b5061422789828a01614147565b979a9699509497509295939492505050565b60006020828403121561424b57600080fd5b81356001600160e01b0319811681146118c757600080fd5b60005b8381101561427e578181015183820152602001614266565b50506000910152565b6000815180845261429f816020860160208601614263565b601f01601f19169290920160200192915050565b6020815260006118c76020830184614287565b6000602082840312156142d857600080fd5b6118c782614130565b6001600160a01b038116811461236957600080fd5b6000806040838503121561430957600080fd5b8235614314816142e1565b946020939093013593505050565b6000806040838503121561433557600080fd5b61431483614130565b60008060006060848603121561435357600080fd5b833561435e816142e1565b9250602084013561436e816142e1565b929592945050506040919091013590565b600060608284031215612df157600080fd5b60008060008060008060c087890312156143aa57600080fd5b86356143b5816142e1565b95506143c360208801614130565b945060408701359350606087013592506080870135915060a08701356001600160401b038111156143f357600080fd5b6143ff89828a0161437f565b9150509295509295509295565b8035801515811461414257600080fd5b60008060008060008060a0878903121561443557600080fd5b61443e87614130565b9550602087013594506040870135935061445a6060880161440c565b925060808701356001600160401b0381111561447557600080fd5b61422789828a01614147565b60008060006040848603121561449657600080fd5b61449f84614130565b925060208401356001600160401b038111156144ba57600080fd5b6144c686828701614147565b9497909650939450505050565b60008060008060008060008060006101008a8c0312156144f257600080fd5b89356144fd816142e1565b985061450b60208b01614130565b975060408a0135965060608a0135955060808a0135945060a08a01356001600160401b038082111561453c57600080fd5b6145488d838e01614147565b909650945084915061455c60c08d0161418f565b935060e08c013591508082111561457257600080fd5b5061457f8c828d0161437f565b9150509295985092959850929598565b6000602082840312156145a157600080fd5b81356118c7816142e1565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156145ea576145ea6145ac565b604052919050565b60006001600160401b0382111561460b5761460b6145ac565b50601f01601f191660200190565b600061462c614627846145f2565b6145c2565b905082815283838301111561464057600080fd5b828260208301376000602084830101529392505050565b60008060006060848603121561466c57600080fd5b61467584614130565b925060208401356001600160401b0381111561469057600080fd5b8401601f810186136146a157600080fd5b6146b086823560208401614619565b9250506146bf6040850161418f565b90509250925092565b6000806000606084860312156146dd57600080fd5b6146e684614130565b92506146f46020850161440c565b91506146bf60408501614130565b60ff60f81b881681526000602060e08184015261472260e084018a614287565b8381036040850152614734818a614287565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b818110156147865783518352928401929184019160010161476a565b50909c9b505050505050505050505050565b600080604083850312156147ab57600080fd5b6147b483614130565b91506147c260208401614130565b90509250929050565b600080600080600080600080600060e08a8c0312156147e957600080fd5b6147f28a614130565b985060208a0135975060408a0135965060608a01356001600160401b038082111561481c57600080fd5b6148288d838e01614147565b909850965086915061483c60808d0161418f565b955061484a60a08d0161440c565b945060c08c013591508082111561486057600080fd5b5061486d8c828d01614147565b915080935050809150509295985092959850929598565b60008060008060006080868803121561489c57600080fd5b6148a586614130565b94506148b360208701614130565b93506040860135925060608601356001600160401b038111156148d557600080fd5b6148e188828901614147565b969995985093965092949392505050565b803560ff8116811461414257600080fd5b600080600080600080600060e0888a03121561491e57600080fd5b8735614929816142e1565b96506020880135614939816142e1565b95506040880135945060608801359350614955608089016148f2565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561498457600080fd5b823561498f816142e1565b9150602083013561499f816142e1565b809150509250929050565b600082601f8301126149bb57600080fd5b6118c783833560208501614619565b600080600080608085870312156149e057600080fd5b84356001600160401b03808211156149f757600080fd5b614a03888389016149aa565b95506020870135915080821115614a1957600080fd5b50614a26878288016149aa565b935050614a35604086016148f2565b91506060850135614a45816142e1565b939692955090935050565b600080600060608486031215614a6557600080fd5b614a6e84614130565b9250614a7c60208501614130565b9150604084013590509250925092565b600060208284031215614a9e57600080fd5b6118c78261440c565b6000806000806000806000806000806101008b8d031215614ac757600080fd5b614ad08b614130565b995060208b01356001600160401b0380821115614aec57600080fd5b614af88e838f01614147565b909b509950899150614b0c60408e0161418f565b985060608d0135975060808d01359150614b25826142e1565b90955060a08c0135945060c08c01359080821115614b4257600080fd5b50614b4f8d828e01614147565b9150809450508092505060e08b013590509295989b9194979a5092959850565b60008060008060808587031215614b8557600080fd5b614b8e85614130565b9350614b9c60208601614130565b92506040850135614bac816142e1565b9396929550929360600135925050565b600181811c90821680614bd057607f821691505b602082108103612df157634e487b7160e01b600052602260045260246000fd5b8183823760009101908152919050565b6000808335601e19843603018112614c1757600080fd5b8301803591506001600160401b03821115614c3157600080fd5b60200191503681900382131561418857600080fd5b6020808252602d908201527f426173654f4654576974684665653a20616d6f756e74206973206c657373207460408201526c1a185b881b5a5b905b5bdd5b9d609a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e9357610e93614c93565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff841681526040602082015260006123f6604083018486614cbc565b60208082526025908201527f4665653a20666565206270206d757374206265203c3d2042505f44454e4f4d496040820152642720aa27a960d91b606082015260800190565b81810381811115610e9357610e93614c93565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b601f82111561301557600081815260208120601f850160051c81016020861015614da85750805b601f850160051c820191505b818110156110cb57828155600101614db4565b81516001600160401b03811115614de057614de06145ac565b614df481614dee8454614bbc565b84614d81565b602080601f831160018114614e295760008415614e115750858301515b600019600386901b1c1916600185901b1785556110cb565b600085815260208120601f198616915b82811015614e5857888601518255948401946001909101908401614e39565b5085821015614e765787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600061ffff808816835280871660208401525084604083015260806060830152614eb4608083018486614cbc565b979650505050505050565b61ffff86168152608060208201526000614edd608083018688614cbc565b6001600160401b0394909416604083015250606001529392505050565b61ffff8916815260c060208201526000614f1860c08301898b614cbc565b6001600160401b038816604084015286606084015285608084015282810360a0840152614f46818587614cbc565b9b9a5050505050505050505050565b6001600160401b03831115614f6c57614f6c6145ac565b614f8083614f7a8354614bbc565b83614d81565b6000601f841160018114614fb45760008515614f9c5750838201355b600019600387901b1c1916600186901b178355610f92565b600083815260209020601f19861690835b82811015614fe55786850135825560209485019460019092019101614fc5565b50868210156150025760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b8082028115828204841417610e9357610e93614c93565b634e487b7160e01b600052601260045260246000fd5b6000826150505761505061502b565b500490565b60006020828403121561506757600080fd5b81516001600160401b0381111561507d57600080fd5b8201601f8101841361508e57600080fd5b805161509c614627826145f2565b8181528560208385010111156150b157600080fd5b6123f6826020830160208601614263565b61ffff851681526080602082015260006150df6080830186614287565b6001600160401b03851660408401528281036060840152614eb48185614287565b61ffff861681526001600160a01b038516602082015260a06040820181905260009061512e90830186614287565b841515606084015282810360808401526151488185614287565b98975050505050505050565b6000806040838503121561516757600080fd5b505080516020909101519092909150565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600082516151d5818460208701614263565b9190910192915050565b61ffff8616815260a0602082015260006151fc60a0830187614287565b6001600160401b0386166040840152828103606084015261521d8186614287565b905082810360808401526151488185614287565b6000826152405761524061502b565b500690565b61ffff8716815260c06020820152600061526260c0830188614287565b82810360408401526152748188614287565b6001600160a01b0387811660608601528616608085015283810360a0850152905061529f8185614287565b9998505050505050505050565b60ff60f81b8760f81b16815285600182015260006001600160401b0360c01b808760c01b166021840152856029840152808560c01b1660498401525082516152fb816051850160208701614263565b91909101605101979650505050505050565b600061010061ffff8b16835280602084015261532b8184018b614287565b6001600160401b038a166040850152606084018990526001600160a01b038816608085015260a0840187905283810360c0850152905061536b8186614287565b9150508260e08301529998505050505050505050565b6060815260006153946060830186614287565b6001600160401b039490941660208301525060400152919050565b634e487b7160e01b600052602160045260246000fd5b60ff8281168282160390811115610e9357610e93614c93565b600181815b808511156154195781600019048211156153ff576153ff614c93565b8085161561540c57918102915b93841c93908002906153e3565b509250929050565b60008261543057506001610e93565b8161543d57506000610e93565b8160018114615453576002811461545d57615479565b6001915050610e93565b60ff84111561546e5761546e614c93565b50506001821b610e93565b5060208310610133831016604e8410600b841016171561549c575081810a610e93565b6154a683836153de565b80600019048211156154ba576154ba614c93565b029392505050565b60006118c760ff84168361542156fea2646970667358221220a2d471991b5e2e3d6db459143a9592e7c9905f16d400b107910251fd0ff8685364736f6c63430008120033", + "devdoc": { + "events": { + "Approval(address,address,uint256)": { + "details": "Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance." + }, + "EIP712DomainChanged()": { + "details": "MAY be emitted to signal that the domain could have changed." + }, + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "ReceiveFromChain(uint16,address,uint256)": { + "details": "Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain. `_nonce` is the inbound nonce." + }, + "SendToChain(uint16,address,bytes32,uint256)": { + "details": "Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`) `_nonce` is the outbound nonce" + }, + "Transfer(address,address,uint256)": { + "details": "Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero." + } + }, + "kind": "dev", + "methods": { + "DOMAIN_SEPARATOR()": { + "details": "See {IERC20Permit-DOMAIN_SEPARATOR}." + }, + "allowance(address,address)": { + "details": "See {IERC20-allowance}." + }, + "approve(address,uint256)": { + "details": "See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address." + }, + "balanceOf(address)": { + "details": "See {IERC20-balanceOf}." + }, + "circulatingSupply()": { + "details": "returns the circulating amount of tokens on current chain" + }, + "decimals()": { + "details": "Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}." + }, + "decreaseAllowance(address,uint256)": { + "details": "Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`." + }, + "eip712Domain()": { + "details": "See {EIP-5267}. _Available since v4.9._" + }, + "estimateSendFee(uint16,bytes32,uint256,bool,bytes)": { + "details": "estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`) _dstChainId - L0 defined chain id to send tokens too _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain _amount - amount of the tokens to transfer _useZro - indicates to use zro to pay L0 fees _adapterParam - flexible bytes array to indicate messaging adapter services in L0" + }, + "increaseAllowance(address,uint256)": { + "details": "Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address." + }, + "name()": { + "details": "Returns the name of the token." + }, + "nonces(address)": { + "details": "See {IERC20Permit-nonces}." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)": { + "details": "See {IERC20Permit-permit}." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "sendFrom(address,uint16,bytes32,uint256,uint256,(address,address,bytes))": { + "details": "send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from` `_from` the owner of token `_dstChainId` the destination chain identifier `_toAddress` can be any size depending on the `dstChainId`. `_amount` the quantity of tokens in wei `_minAmount` the minimum amount of tokens to receive on dstChain `_refundAddress` the address LayerZero refunds if too much message fee is sent `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) `_adapterParams` is a flexible bytes array to indicate messaging adapter services" + }, + "symbol()": { + "details": "Returns the symbol of the token, usually a shorter version of the name." + }, + "token()": { + "details": "returns the address of the ERC20 token" + }, + "totalSupply()": { + "details": "See {IERC20-totalSupply}." + }, + "transfer(address,uint256)": { + "details": "See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`." + }, + "transferFrom(address,address,uint256)": { + "details": "See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for ``from``'s tokens of at least `amount`." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 591, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 594, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6194, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 419, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 539, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 15451, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "lzEndpoint", + "offset": 0, + "slot": "101", + "type": "t_contract(ILayerZeroEndpointUpgradeable)16407" + }, + { + "astId": 15455, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "trustedRemoteLookup", + "offset": 0, + "slot": "102", + "type": "t_mapping(t_uint16,t_bytes_storage)" + }, + { + "astId": 15461, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "minDstGasLookup", + "offset": 0, + "slot": "103", + "type": "t_mapping(t_uint16,t_mapping(t_uint16,t_uint256))" + }, + { + "astId": 15465, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "payloadSizeLimitLookup", + "offset": 0, + "slot": "104", + "type": "t_mapping(t_uint16,t_uint256)" + }, + { + "astId": 15467, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "precrime", + "offset": 0, + "slot": "105", + "type": "t_address" + }, + { + "astId": 15999, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "__gap", + "offset": 0, + "slot": "106", + "type": "t_array(t_uint256)45_storage" + }, + { + "astId": 16042, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "failedMessages", + "offset": 0, + "slot": "151", + "type": "t_mapping(t_uint16,t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bytes32)))" + }, + { + "astId": 16261, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 17214, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "sharedDecimals", + "offset": 0, + "slot": "201", + "type": "t_uint8" + }, + { + "astId": 17216, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "useCustomAdapterParams", + "offset": 1, + "slot": "201", + "type": "t_bool" + }, + { + "astId": 17224, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "creditedPackets", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_uint16,t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bool)))" + }, + { + "astId": 18219, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "__gap", + "offset": 0, + "slot": "203", + "type": "t_array(t_uint256)44_storage" + }, + { + "astId": 19588, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "chainIdToFeeBps", + "offset": 0, + "slot": "247", + "type": "t_mapping(t_uint16,t_struct(FeeConfig)19597_storage)" + }, + { + "astId": 19590, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "defaultFeeBp", + "offset": 0, + "slot": "248", + "type": "t_uint16" + }, + { + "astId": 19592, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "feeOwner", + "offset": 2, + "slot": "248", + "type": "t_address" + }, + { + "astId": 19815, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "__gap", + "offset": 0, + "slot": "249", + "type": "t_array(t_uint256)45_storage" + }, + { + "astId": 7385, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "__gap", + "offset": 0, + "slot": "294", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 19574, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "__gap", + "offset": 0, + "slot": "344", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 2672, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_balances", + "offset": 0, + "slot": "394", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 2678, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_allowances", + "offset": 0, + "slot": "395", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 2680, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_totalSupply", + "offset": 0, + "slot": "396", + "type": "t_uint256" + }, + { + "astId": 2682, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_name", + "offset": 0, + "slot": "397", + "type": "t_string_storage" + }, + { + "astId": 2684, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_symbol", + "offset": 0, + "slot": "398", + "type": "t_string_storage" + }, + { + "astId": 3264, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "__gap", + "offset": 0, + "slot": "399", + "type": "t_array(t_uint256)45_storage" + }, + { + "astId": 6882, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_hashedName", + "offset": 0, + "slot": "444", + "type": "t_bytes32" + }, + { + "astId": 6885, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_hashedVersion", + "offset": 0, + "slot": "445", + "type": "t_bytes32" + }, + { + "astId": 6887, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_name", + "offset": 0, + "slot": "446", + "type": "t_string_storage" + }, + { + "astId": 6889, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_version", + "offset": 0, + "slot": "447", + "type": "t_string_storage" + }, + { + "astId": 7147, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "__gap", + "offset": 0, + "slot": "448", + "type": "t_array(t_uint256)48_storage" + }, + { + "astId": 3369, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_nonces", + "offset": 0, + "slot": "496", + "type": "t_mapping(t_address,t_struct(Counter)6201_storage)" + }, + { + "astId": 3377, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_PERMIT_TYPEHASH_DEPRECATED_SLOT", + "offset": 0, + "slot": "497", + "type": "t_bytes32" + }, + { + "astId": 3533, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "__gap", + "offset": 0, + "slot": "498", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 20348, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "ld2sdRate", + "offset": 0, + "slot": "547", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)44_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[44]", + "numberOfBytes": "1408" + }, + "t_array(t_uint256)45_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)48_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[48]", + "numberOfBytes": "1536" + }, + "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_bytes_memory_ptr": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(ILayerZeroEndpointUpgradeable)16407": { + "encoding": "inplace", + "label": "contract ILayerZeroEndpointUpgradeable", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_struct(Counter)6201_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct CountersUpgradeable.Counter)", + "numberOfBytes": "32", + "value": "t_struct(Counter)6201_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bool))": { + "encoding": "mapping", + "key": "t_bytes_memory_ptr", + "label": "mapping(bytes => mapping(uint64 => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint64,t_bool)" + }, + "t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bytes32))": { + "encoding": "mapping", + "key": "t_bytes_memory_ptr", + "label": "mapping(bytes => mapping(uint64 => bytes32))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint64,t_bytes32)" + }, + "t_mapping(t_uint16,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint16,t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bool)))": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => mapping(bytes => mapping(uint64 => bool)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bool))" + }, + "t_mapping(t_uint16,t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bytes32)))": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bytes32))" + }, + "t_mapping(t_uint16,t_mapping(t_uint16,t_uint256))": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => mapping(uint16 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_uint256)" + }, + "t_mapping(t_uint16,t_struct(FeeConfig)19597_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => struct FeeUpgradeable.FeeConfig)", + "numberOfBytes": "32", + "value": "t_struct(FeeConfig)19597_storage" + }, + "t_mapping(t_uint16,t_uint256)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint64,t_bool)": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint64,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Counter)6201_storage": { + "encoding": "inplace", + "label": "struct CountersUpgradeable.Counter", + "members": [ + { + "astId": 6200, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "_value", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_struct(FeeConfig)19597_storage": { + "encoding": "inplace", + "label": "struct FeeUpgradeable.FeeConfig", + "members": [ + { + "astId": 19594, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "feeBP", + "offset": 0, + "slot": "0", + "type": "t_uint16" + }, + { + "astId": 19596, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandOFT", + "label": "enabled", + "offset": 2, + "slot": "0", + "type": "t_bool" + } + ], + "numberOfBytes": "32" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/beam/ForgottenPlaylandOFT_Proxy.json b/deployments/beam/ForgottenPlaylandOFT_Proxy.json new file mode 100644 index 00000000..edb11cbf --- /dev/null +++ b/deployments/beam/ForgottenPlaylandOFT_Proxy.json @@ -0,0 +1,193 @@ +{ + "address": "0xAff7314Bc869ff4AB265ec7Efa8E442F1D978d7a", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xfd7af94c3d841909bd3eeb7e1c72050d4cb1713ae3f9e2a5bda5f824f23429b2", + "receipt": { + "to": null, + "from": "0xbFb53a2c470cdb4FF32eE4F18A93B98F9f55D0E1", + "contractAddress": "0xAff7314Bc869ff4AB265ec7Efa8E442F1D978d7a", + "transactionIndex": 1, + "gasUsed": "613214", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000040000000000000000000000000000020000000000000000000800000000000000000000000000000000400800000000000000002000000000000000000000000080000000000000020000000000000000000000000000080400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xfb1539ce8d3367b49cfdbcc43625870f7cfb9fdfbad5da922534b2d9a829838b", + "transactionHash": "0xfd7af94c3d841909bd3eeb7e1c72050d4cb1713ae3f9e2a5bda5f824f23429b2", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 1804412, + "transactionHash": "0xfd7af94c3d841909bd3eeb7e1c72050d4cb1713ae3f9e2a5bda5f824f23429b2", + "address": "0xAff7314Bc869ff4AB265ec7Efa8E442F1D978d7a", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000bfb53a2c470cdb4ff32ee4f18a93b98f9f55d0e1" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0xfb1539ce8d3367b49cfdbcc43625870f7cfb9fdfbad5da922534b2d9a829838b" + }, + { + "transactionIndex": 1, + "blockNumber": 1804412, + "transactionHash": "0xfd7af94c3d841909bd3eeb7e1c72050d4cb1713ae3f9e2a5bda5f824f23429b2", + "address": "0xAff7314Bc869ff4AB265ec7Efa8E442F1D978d7a", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 2, + "blockHash": "0xfb1539ce8d3367b49cfdbcc43625870f7cfb9fdfbad5da922534b2d9a829838b" + } + ], + "blockNumber": 1804412, + "cumulativeGasUsed": "691354", + "status": 1, + "byzantium": true + }, + "args": [ + "0x156F777eA035c3A96B049BF270DFE39f3813778b", + "0x2A66d51407b84b82b5AFF3DeC4D49f72CBCD322a", + "0xde7ea79d000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000006000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd70000000000000000000000000000000000000000000000000000000000000012466f72676f7474656e20506c61796c616e64000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024650000000000000000000000000000000000000000000000000000000000000" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"Storage slot with the admin of the contract. This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is validated in the constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":\"OptimizedTransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\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 Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\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 function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\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 // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\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 functionCall(target, data, \\\"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(address target, bytes memory data, string memory errorMessage) 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(address target, bytes memory data, uint256 value) 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(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\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\\n // solhint-disable-next-line no-inline-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}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"},\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.7.0;\\n\\nimport \\\"../openzeppelin/proxy/UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract OptimizedTransparentUpgradeableProxy is UpgradeableProxy {\\n address internal immutable _ADMIN;\\n\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(\\n address initialLogic,\\n address initialAdmin,\\n bytes memory _data\\n ) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 slot = _ADMIN_SLOT;\\n\\n _ADMIN = initialAdmin;\\n\\n // still store it to work with EIP-1967\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, initialAdmin)\\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 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, ) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n return _ADMIN;\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x076456d71495e22183c672db71d719bd2dc7cb3b35e5bba21ce37eea1ec30347\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040526040516108fc3803806108fc8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101e9565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b506001600160601b0319606082901b166080527fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035550610297565b6101fc8161025b60201b6103581760201c565b6102375760405162461bcd60e51b81526004018080602001828103825260368152602001806108c66036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028f57508115155b949350505050565b60805160601c6106126102b46000398061047352506106126000f3fe6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c63430007060033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "Storage slot with the admin of the contract. This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is validated in the constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/beam/solcInputs/8313c17822638cfb28f4331864b9ea01.json b/deployments/beam/solcInputs/8313c17822638cfb28f4331864b9ea01.json new file mode 100644 index 00000000..6559728a --- /dev/null +++ b/deployments/beam/solcInputs/8313c17822638cfb28f4331864b9ea01.json @@ -0,0 +1,536 @@ +{ + "language": "Solidity", + "sources": { + "contracts/contracts-upgradable/examples/AvaxOFT.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/NativeOFTWithFeeUpgradeable.sol\";\n\ncontract AvaxOFT is OFTWithFeeUpgradeable {}\n\ncontract AvaxNativeOFT is NativeOFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/OFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\nimport \"./BaseOFTWithFeeUpgradeable.sol\";\n\ncontract OFTWithFeeUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, ERC20Upgradeable, Proxied {\n uint internal ld2sdRate;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(string memory _name, string memory _symbol, uint8 _sharedDecimals, address _lzEndpoint) public virtual initializer {\n __OFTWithFeeUpgradeable_init(_name, _symbol, _sharedDecimals, _lzEndpoint);\n }\n\n function __OFTWithFeeUpgradeable_init(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n\n __ERC20_init_unchained(_name, _symbol);\n\n __OFTWithFeeUpgradeable_init_unchained(_sharedDecimals);\n }\n\n function __OFTWithFeeUpgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\n uint8 decimals = decimals();\n require(_sharedDecimals <= decimals, \"OFTWithFee: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return totalSupply();\n }\n\n function token() public view virtual override returns (address) {\n return address(this);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n if (_from != spender) _spendAllowance(_from, spender, _amount);\n _burn(_from, _amount);\n return _amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n _mint(_toAddress, _amount);\n return _amount;\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n // if transfer from this contract, no need to check allowance\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\n _transfer(_from, _to, _amount);\n return _amount;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/NativeOFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"./OFTWithFeeUpgradeable.sol\";\n\ncontract NativeOFTWithFeeUpgradeable is OFTWithFeeUpgradeable, ReentrancyGuardUpgradeable {\n event Deposit(address indexed _dst, uint _amount);\n event Withdrawal(address indexed _src, uint _amount);\n\n function deposit() public payable {\n _mint(msg.sender, msg.value);\n emit Deposit(msg.sender, msg.value);\n }\n\n function withdraw(uint _amount) external nonReentrant {\n require(balanceOf(msg.sender) >= _amount, \"NativeOFTWithFee: Insufficient balance.\");\n _burn(msg.sender, _amount);\n (bool success, ) = msg.sender.call{value: _amount}(\"\");\n require(success, \"NativeOFTWithFee: failed to unwrap\");\n emit Withdrawal(msg.sender, _amount);\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _debitFromNative(address _from, uint _amount) internal returns (uint messageFee) {\n messageFee = msg.sender == _from ? _debitMsgSender(_amount) : _debitMsgFrom(_from, _amount);\n }\n\n function _debitMsgSender(uint _amount) internal returns (uint messageFee) {\n uint msgSenderBalance = balanceOf(msg.sender);\n\n if (msgSenderBalance < _amount) {\n require(msgSenderBalance + msg.value >= _amount, \"NativeOFTWithFee: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgSenderBalance;\n _mint(address(msg.sender), mintAmount);\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _transfer(msg.sender, address(this), _amount);\n return messageFee;\n }\n\n function _debitMsgFrom(address _from, uint _amount) internal returns (uint messageFee) {\n uint msgFromBalance = balanceOf(_from);\n\n if (msgFromBalance < _amount) {\n require(msgFromBalance + msg.value >= _amount, \"NativeOFTWithFee: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgFromBalance;\n _mint(address(msg.sender), mintAmount);\n\n // transfer the differential amount to the contract\n _transfer(msg.sender, address(this), mintAmount);\n\n // overwrite the _amount to take the rest of the balance from the _from address\n _amount = msgFromBalance;\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _spendAllowance(_from, msg.sender, _amount);\n _transfer(_from, address(this), _amount);\n return messageFee;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal override returns (uint) {\n _burn(address(this), _amount);\n (bool success, ) = _toAddress.call{value: _amount}(\"\");\n require(success, \"NativeOFTWithFee: failed to _creditTo\");\n return _amount;\n }\n\n receive() external payable {\n deposit();\n }\n}\n" + }, + "hardhat-deploy/solc_0.8/proxy/Proxied.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Proxied {\n /// @notice to be used by initialisation / postUpgrade function so that only the proxy's admin can execute them\n /// It also allows these functions to be called inside a contructor\n /// even if the contract is meant to be used without proxy\n modifier proxied() {\n address proxyAdminAddress = _proxyAdmin();\n // With hardhat-deploy proxies\n // the proxyAdminAddress is zero only for the implementation contract\n // if the implementation contract want to be used as a standalone/immutable contract\n // it simply has to execute the `proxied` function\n // This ensure the proxyAdminAddress is never zero post deployment\n // And allow you to keep the same code for both proxied contract and immutable contract\n if (proxyAdminAddress == address(0)) {\n // ensure can not be called twice when used outside of proxy : no admin\n // solhint-disable-next-line security/no-inline-assembly\n assembly {\n sstore(\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103,\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\n )\n }\n } else {\n require(msg.sender == proxyAdminAddress);\n }\n _;\n }\n\n modifier onlyProxyAdmin() {\n require(msg.sender == _proxyAdmin(), \"NOT_AUTHORIZED\");\n _;\n }\n\n function _proxyAdmin() internal view returns (address ownerAddress) {\n // solhint-disable-next-line security/no-inline-assembly\n assembly {\n ownerAddress := sload(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103)\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) 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[45] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/BaseOFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../OFTCoreV2Upgradeable.sol\";\nimport \"./IOFTWithFeeUpgradeable.sol\";\nimport \"./FeeUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\nabstract contract BaseOFTWithFeeUpgradeable is OFTCoreV2Upgradeable, FeeUpgradeable, ERC165Upgradeable, IOFTWithFeeUpgradeable {\n function __BaseOFTWithFeeUpgradeable_init(uint8 _sharedDecimals, address _lzEndpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n }\n\n function __BaseOFTWithFeeUpgradeable_init_unchained() internal onlyInitializing {}\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n (_amount, ) = _payOFTFee(_from, _dstChainId, _amount);\n _amount = _send(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n require(_amount >= _minAmount, \"BaseOFTWithFee: amount is less than minAmount\");\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n (_amount, ) = _payOFTFee(_from, _dstChainId, _amount);\n _amount = _sendAndCall(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _payload,\n _dstGasForCall,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n require(_amount >= _minAmount, \"BaseOFTWithFee: amount is less than minAmount\");\n }\n\n /************************************************************************\n * public view functions\n ************************************************************************/\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IOFTWithFeeUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams);\n }\n\n function estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams);\n }\n\n function circulatingSupply() public view virtual override returns (uint);\n\n function token() public view virtual override returns (address);\n\n function _transferFrom(\n address _from,\n address _to,\n uint _amount\n ) internal virtual override(FeeUpgradeable, OFTCoreV2Upgradeable) returns (uint);\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 uint[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 IERC20Upgradeable {\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(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\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/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) 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" + }, + "contracts/contracts-upgradable/token/oft/v2/OFTCoreV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../../lzApp/NonblockingLzAppUpgradeable.sol\";\nimport \"../../../../libraries/ExcessivelySafeCall.sol\";\nimport \"./interfaces/ICommonOFTUpgradeable.sol\";\nimport \"./interfaces/IOFTReceiverV2Upgradeable.sol\";\n\nabstract contract OFTCoreV2Upgradeable is NonblockingLzAppUpgradeable {\n using BytesLib for bytes;\n using ExcessivelySafeCall for address;\n\n uint public constant NO_EXTRA_GAS = 0;\n\n // packet type\n uint8 public constant PT_SEND = 0;\n uint8 public constant PT_SEND_AND_CALL = 1;\n\n uint8 public sharedDecimals;\n\n bool public useCustomAdapterParams;\n mapping(uint16 => mapping(bytes => mapping(uint64 => bool))) public creditedPackets;\n\n /**\n * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\n * `_nonce` is the outbound nonce\n */\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes32 indexed _toAddress, uint _amount);\n\n /**\n * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain.\n * `_nonce` is the inbound nonce.\n */\n event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount);\n\n event SetUseCustomAdapterParams(bool _useCustomAdapterParams);\n\n event CallOFTReceivedSuccess(uint16 indexed _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _hash);\n\n event NonContractAddress(address _address);\n\n // _sharedDecimals should be the minimum decimals on all chains\n function __OFTCoreV2Upgradeable_init(uint8 _sharedDecimals, address _lzEndpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n }\n\n function __OFTCoreV2Upgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\n sharedDecimals = _sharedDecimals;\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function callOnOFTReceived(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes32 _from,\n address _to,\n uint _amount,\n bytes calldata _payload,\n uint _gasForCall\n ) public virtual {\n require(_msgSender() == address(this), \"OFTCore: caller must be OFTCore\");\n\n // send\n _amount = _transferFrom(address(this), _to, _amount);\n emit ReceiveFromChain(_srcChainId, _to, _amount);\n\n // call\n IOFTReceiverV2Upgradeable(_to).onOFTReceived{gas: _gasForCall}(_srcChainId, _srcAddress, _nonce, _from, _amount, _payload);\n }\n\n function setUseCustomAdapterParams(bool _useCustomAdapterParams) public virtual onlyOwner {\n useCustomAdapterParams = _useCustomAdapterParams;\n emit SetUseCustomAdapterParams(_useCustomAdapterParams);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes memory _adapterParams\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\n // mock the payload for sendFrom()\n bytes memory payload = _encodeSendPayload(_toAddress, _ld2sd(_amount));\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function _estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes memory _adapterParams\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\n // mock the payload for sendAndCall()\n bytes memory payload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(_amount), _payload, _dstGasForCall);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual override {\n uint8 packetType = _payload.toUint8(0);\n\n if (packetType == PT_SEND) {\n _sendAck(_srcChainId, _srcAddress, _nonce, _payload);\n } else if (packetType == PT_SEND_AND_CALL) {\n _sendAndCallAck(_srcChainId, _srcAddress, _nonce, _payload);\n } else {\n revert(\"OFTCore: unknown packet type\");\n }\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount); // amount returned should not have dust\n require(amount > 0, \"OFTCore: amount too small\");\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAck(uint16 _srcChainId, bytes memory, uint64, bytes memory _payload) internal virtual {\n (address to, uint64 amountSD) = _decodeSendPayload(_payload);\n if (to == address(0)) {\n to = address(0xdead);\n }\n\n uint amount = _sd2ld(amountSD);\n amount = _creditTo(_srcChainId, to, amount);\n\n emit ReceiveFromChain(_srcChainId, to, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount);\n require(amount > 0, \"OFTCore: amount too small\");\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCallAck(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual {\n (bytes32 from, address to, uint64 amountSD, bytes memory payloadForCall, uint64 gasForCall) = _decodeSendAndCallPayload(_payload);\n\n bool credited = creditedPackets[_srcChainId][_srcAddress][_nonce];\n uint amount = _sd2ld(amountSD);\n\n // credit to this contract first, and then transfer to receiver only if callOnOFTReceived() succeeds\n if (!credited) {\n amount = _creditTo(_srcChainId, address(this), amount);\n creditedPackets[_srcChainId][_srcAddress][_nonce] = true;\n }\n\n if (!_isContract(to)) {\n emit NonContractAddress(to);\n return;\n }\n\n // workaround for stack too deep\n uint16 srcChainId = _srcChainId;\n bytes memory srcAddress = _srcAddress;\n uint64 nonce = _nonce;\n bytes memory payload = _payload;\n bytes32 from_ = from;\n address to_ = to;\n uint amount_ = amount;\n bytes memory payloadForCall_ = payloadForCall;\n\n // no gas limit for the call if retry\n uint gas = credited ? gasleft() : gasForCall;\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\n gasleft(),\n 150,\n abi.encodeWithSelector(this.callOnOFTReceived.selector, srcChainId, srcAddress, nonce, from_, to_, amount_, payloadForCall_, gas)\n );\n\n if (success) {\n bytes32 hash = keccak256(payload);\n emit CallOFTReceivedSuccess(srcChainId, srcAddress, nonce, hash);\n } else {\n // store the failed message into the nonblockingLzApp\n _storeFailedMessage(srcChainId, srcAddress, nonce, payload, reason);\n }\n }\n\n function _isContract(address _account) internal view returns (bool) {\n return _account.code.length > 0;\n }\n\n function _checkAdapterParams(uint16 _dstChainId, uint16 _pkType, bytes memory _adapterParams, uint _extraGas) internal virtual {\n if (useCustomAdapterParams) {\n _checkGasLimit(_dstChainId, _pkType, _adapterParams, _extraGas);\n } else {\n require(_adapterParams.length == 0, \"OFTCore: _adapterParams must be empty.\");\n }\n }\n\n function _ld2sd(uint _amount) internal view virtual returns (uint64) {\n uint amountSD = _amount / _ld2sdRate();\n require(amountSD <= type(uint64).max, \"OFTCore: amountSD overflow\");\n return uint64(amountSD);\n }\n\n function _sd2ld(uint64 _amountSD) internal view virtual returns (uint) {\n return _amountSD * _ld2sdRate();\n }\n\n function _removeDust(uint _amount) internal view virtual returns (uint amountAfter, uint dust) {\n dust = _amount % _ld2sdRate();\n amountAfter = _amount - dust;\n }\n\n function _encodeSendPayload(bytes32 _toAddress, uint64 _amountSD) internal view virtual returns (bytes memory) {\n return abi.encodePacked(PT_SEND, _toAddress, _amountSD);\n }\n\n function _decodeSendPayload(bytes memory _payload) internal view virtual returns (address to, uint64 amountSD) {\n require(_payload.toUint8(0) == PT_SEND && _payload.length == 41, \"OFTCore: invalid payload\");\n\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\n amountSD = _payload.toUint64(33);\n }\n\n function _encodeSendAndCallPayload(\n address _from,\n bytes32 _toAddress,\n uint64 _amountSD,\n bytes memory _payload,\n uint64 _dstGasForCall\n ) internal view virtual returns (bytes memory) {\n return abi.encodePacked(PT_SEND_AND_CALL, _toAddress, _amountSD, _addressToBytes32(_from), _dstGasForCall, _payload);\n }\n\n function _decodeSendAndCallPayload(\n bytes memory _payload\n ) internal view virtual returns (bytes32 from, address to, uint64 amountSD, bytes memory payload, uint64 dstGasForCall) {\n require(_payload.toUint8(0) == PT_SEND_AND_CALL, \"OFTCore: invalid payload\");\n\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\n amountSD = _payload.toUint64(33);\n from = _payload.toBytes32(41);\n dstGasForCall = _payload.toUint64(73);\n payload = _payload.slice(81, _payload.length - 81);\n }\n\n function _addressToBytes32(address _address) internal pure virtual returns (bytes32) {\n return bytes32(uint(uint160(_address)));\n }\n\n function _debitFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount) internal virtual returns (uint);\n\n function _creditTo(uint16 _srcChainId, address _toAddress, uint _amount) internal virtual returns (uint);\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint);\n\n function _ld2sdRate() internal view virtual returns (uint);\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 uint[44] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/IOFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"../interfaces/ICommonOFTUpgradeable.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface IOFTWithFeeUpgradeable is ICommonOFTUpgradeable {\n /**\n * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\n * `_from` the owner of token\n * `_dstChainId` the destination chain identifier\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_amount` the quantity of tokens in wei\n * `_minAmount` the minimum amount of tokens to receive on dstChain\n * `_refundAddress` the address LayerZero refunds if too much message fee is sent\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n LzCallParams calldata _callParams\n ) external payable;\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) external payable;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/FeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nabstract contract FeeUpgradeable is OwnableUpgradeable {\n uint public constant BP_DENOMINATOR = 10000;\n\n mapping(uint16 => FeeConfig) public chainIdToFeeBps;\n uint16 public defaultFeeBp;\n address public feeOwner; // defaults to owner\n\n struct FeeConfig {\n uint16 feeBP;\n bool enabled;\n }\n\n event SetFeeBp(uint16 dstchainId, bool enabled, uint16 feeBp);\n event SetDefaultFeeBp(uint16 feeBp);\n event SetFeeOwner(address feeOwner);\n\n function __FeeUpgradeable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __FeeUpgradeable_init_unchained() internal onlyInitializing {}\n\n function setDefaultFeeBp(uint16 _feeBp) public virtual onlyOwner {\n require(_feeBp <= BP_DENOMINATOR, \"Fee: fee bp must be <= BP_DENOMINATOR\");\n defaultFeeBp = _feeBp;\n emit SetDefaultFeeBp(defaultFeeBp);\n }\n\n function setFeeBp(uint16 _dstChainId, bool _enabled, uint16 _feeBp) public virtual onlyOwner {\n require(_feeBp <= BP_DENOMINATOR, \"Fee: fee bp must be <= BP_DENOMINATOR\");\n chainIdToFeeBps[_dstChainId] = FeeConfig(_feeBp, _enabled);\n emit SetFeeBp(_dstChainId, _enabled, _feeBp);\n }\n\n function setFeeOwner(address _feeOwner) public virtual onlyOwner {\n require(_feeOwner != address(0x0), \"Fee: feeOwner cannot be 0x\");\n feeOwner = _feeOwner;\n emit SetFeeOwner(_feeOwner);\n }\n\n function quoteOFTFee(uint16 _dstChainId, uint _amount) public view virtual returns (uint fee) {\n FeeConfig memory config = chainIdToFeeBps[_dstChainId];\n if (config.enabled) {\n fee = (_amount * config.feeBP) / BP_DENOMINATOR;\n } else if (defaultFeeBp > 0) {\n fee = (_amount * defaultFeeBp) / BP_DENOMINATOR;\n } else {\n fee = 0;\n }\n }\n\n function _payOFTFee(address _from, uint16 _dstChainId, uint _amount) internal virtual returns (uint amount, uint fee) {\n fee = quoteOFTFee(_dstChainId, _amount);\n amount = _amount - fee;\n if (fee > 0) {\n _transferFrom(_from, feeOwner, fee);\n }\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint);\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 uint[45] private __gap;\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" + }, + "contracts/contracts-upgradable/lzApp/NonblockingLzAppUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"./LzAppUpgradeable.sol\";\nimport \"../../libraries/ExcessivelySafeCall.sol\";\n\n/*\n * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel\n * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking\n * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress)\n */\nabstract contract NonblockingLzAppUpgradeable is Initializable, LzAppUpgradeable {\n using ExcessivelySafeCall for address;\n\n function __NonblockingLzAppUpgradeable_init(address _endpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_endpoint);\n }\n\n function __NonblockingLzAppUpgradeable_init_unchained(address _endpoint) internal onlyInitializing {}\n\n mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages;\n\n event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason);\n event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash);\n\n // overriding the virtual function in LzReceiver\n function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\n gasleft(),\n 150,\n abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)\n );\n // try-catch all errors/exceptions\n if (!success) {\n _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason);\n }\n }\n\n function _storeFailedMessage(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload,\n bytes memory _reason\n ) internal virtual {\n failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload);\n emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason);\n }\n\n function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual {\n // only internal transaction\n require(_msgSender() == address(this), \"NonblockingLzApp: caller must be LzApp\");\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n }\n\n //@notice override this function\n function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\n\n function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual {\n // assert there is message to retry\n bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce];\n require(payloadHash != bytes32(0), \"NonblockingLzApp: no stored message\");\n require(keccak256(_payload) == payloadHash, \"NonblockingLzApp: invalid payload\");\n // clear the stored message\n failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0);\n // execute the message. revert if it fails again\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash);\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 uint[49] private __gap;\n}\n" + }, + "contracts/libraries/ExcessivelySafeCall.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity >=0.7.6;\n\nlibrary ExcessivelySafeCall {\n uint constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\n\n /// @notice Use when you _really_ really _really_ don't trust the called\n /// contract. This prevents the called contract from causing reversion of\n /// the caller in as many ways as we can.\n /// @dev The main difference between this and a solidity low-level call is\n /// that we limit the number of bytes that the callee can cause to be\n /// copied to caller memory. This prevents stupid things like malicious\n /// contracts returning 10,000,000 bytes causing a local OOG when copying\n /// to memory.\n /// @param _target The address to call\n /// @param _gas The amount of gas to forward to the remote contract\n /// @param _maxCopy The maximum number of bytes of returndata to copy\n /// to memory.\n /// @param _calldata The data to send to the remote contract\n /// @return success and returndata, as `.call()`. Returndata is capped to\n /// `_maxCopy` bytes.\n function excessivelySafeCall(\n address _target,\n uint _gas,\n uint16 _maxCopy,\n bytes memory _calldata\n ) internal returns (bool, bytes memory) {\n // set up for assembly call\n uint _toCopy;\n bool _success;\n bytes memory _returnData = new bytes(_maxCopy);\n // dispatch message to recipient\n // by assembly calling \"handle\" function\n // we call via assembly to avoid memcopying a very large returndata\n // returned by a malicious contract\n assembly {\n _success := call(\n _gas, // gas\n _target, // recipient\n 0, // ether value\n add(_calldata, 0x20), // inloc\n mload(_calldata), // inlen\n 0, // outloc\n 0 // outlen\n )\n // limit our copy to 256 bytes\n _toCopy := returndatasize()\n if gt(_toCopy, _maxCopy) {\n _toCopy := _maxCopy\n }\n // Store the length of the copied bytes\n mstore(_returnData, _toCopy)\n // copy the bytes from returndata[0:_toCopy]\n returndatacopy(add(_returnData, 0x20), 0, _toCopy)\n }\n return (_success, _returnData);\n }\n\n /// @notice Use when you _really_ really _really_ don't trust the called\n /// contract. This prevents the called contract from causing reversion of\n /// the caller in as many ways as we can.\n /// @dev The main difference between this and a solidity low-level call is\n /// that we limit the number of bytes that the callee can cause to be\n /// copied to caller memory. This prevents stupid things like malicious\n /// contracts returning 10,000,000 bytes causing a local OOG when copying\n /// to memory.\n /// @param _target The address to call\n /// @param _gas The amount of gas to forward to the remote contract\n /// @param _maxCopy The maximum number of bytes of returndata to copy\n /// to memory.\n /// @param _calldata The data to send to the remote contract\n /// @return success and returndata, as `.call()`. Returndata is capped to\n /// `_maxCopy` bytes.\n function excessivelySafeStaticCall(\n address _target,\n uint _gas,\n uint16 _maxCopy,\n bytes memory _calldata\n ) internal view returns (bool, bytes memory) {\n // set up for assembly call\n uint _toCopy;\n bool _success;\n bytes memory _returnData = new bytes(_maxCopy);\n // dispatch message to recipient\n // by assembly calling \"handle\" function\n // we call via assembly to avoid memcopying a very large returndata\n // returned by a malicious contract\n assembly {\n _success := staticcall(\n _gas, // gas\n _target, // recipient\n add(_calldata, 0x20), // inloc\n mload(_calldata), // inlen\n 0, // outloc\n 0 // outlen\n )\n // limit our copy to 256 bytes\n _toCopy := returndatasize()\n if gt(_toCopy, _maxCopy) {\n _toCopy := _maxCopy\n }\n // Store the length of the copied bytes\n mstore(_returnData, _toCopy)\n // copy the bytes from returndata[0:_toCopy]\n returndatacopy(add(_returnData, 0x20), 0, _toCopy)\n }\n return (_success, _returnData);\n }\n\n /**\n * @notice Swaps function selectors in encoded contract calls\n * @dev Allows reuse of encoded calldata for functions with identical\n * argument types but different names. It simply swaps out the first 4 bytes\n * for the new selector. This function modifies memory in place, and should\n * only be used with caution.\n * @param _newSelector The new 4-byte selector\n * @param _buf The encoded contract args\n */\n function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure {\n require(_buf.length >= 4);\n uint _mask = LOW_28_MASK;\n assembly {\n // load the first word of\n let _word := mload(add(_buf, 0x20))\n // mask out the top 4 bytes\n // /x\n _word := and(_word, _mask)\n _word := or(_newSelector, _word)\n mstore(add(_buf, 0x20), _word)\n }\n }\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/interfaces/ICommonOFTUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface ICommonOFTUpgradeable is IERC165Upgradeable {\n struct LzCallParams {\n address payable refundAddress;\n address zroPaymentAddress;\n bytes adapterParams;\n }\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _amount - amount of the tokens to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParam - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n function estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n /**\n * @dev returns the circulating amount of tokens on current chain\n */\n function circulatingSupply() external view returns (uint);\n\n /**\n * @dev returns the address of the ERC20 token\n */\n function token() external view returns (address);\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/interfaces/IOFTReceiverV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.5.0;\n\ninterface IOFTReceiverV2Upgradeable {\n /**\n * @dev Called by the OFT contract when tokens are received from source chain.\n * @param _srcChainId The chain id of the source chain.\n * @param _srcAddress The address of the OFT token contract on the source chain.\n * @param _nonce The nonce of the transaction on the source chain.\n * @param _from The address of the account who calls the sendAndCall() on the source chain.\n * @param _amount The amount of tokens to transfer.\n * @param _payload Additional data with no specified format.\n */\n function onOFTReceived(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes32 _from,\n uint _amount,\n bytes calldata _payload\n ) external;\n}\n" + }, + "contracts/contracts-upgradable/lzApp/LzAppUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"./interfaces/ILayerZeroReceiverUpgradeable.sol\";\nimport \"./interfaces/ILayerZeroUserApplicationConfigUpgradeable.sol\";\nimport \"./interfaces/ILayerZeroEndpointUpgradeable.sol\";\nimport \"../../libraries/BytesLib.sol\";\n\n/*\n * a generic LzReceiver implementation\n */\nabstract contract LzAppUpgradeable is\n Initializable,\n OwnableUpgradeable,\n ILayerZeroReceiverUpgradeable,\n ILayerZeroUserApplicationConfigUpgradeable\n{\n using BytesLib for bytes;\n\n // ua can not send payload larger than this by default, but it can be changed by the ua owner\n uint public constant DEFAULT_PAYLOAD_SIZE_LIMIT = 10000;\n\n ILayerZeroEndpointUpgradeable public lzEndpoint;\n mapping(uint16 => bytes) public trustedRemoteLookup;\n mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup;\n mapping(uint16 => uint) public payloadSizeLimitLookup;\n address public precrime;\n\n event SetPrecrime(address precrime);\n event SetTrustedRemote(uint16 _remoteChainId, bytes _path);\n event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress);\n event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas);\n\n function __LzAppUpgradeable_init(address _endpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_endpoint);\n }\n\n function __LzAppUpgradeable_init_unchained(address _endpoint) internal onlyInitializing {\n lzEndpoint = ILayerZeroEndpointUpgradeable(_endpoint);\n }\n\n function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override {\n // lzReceive must be called by the endpoint for security\n require(_msgSender() == address(lzEndpoint), \"LzApp: invalid endpoint caller\");\n\n bytes memory trustedRemote = trustedRemoteLookup[_srcChainId];\n // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.\n require(\n _srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote),\n \"LzApp: invalid source sending contract\"\n );\n\n _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n }\n\n // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging\n function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\n\n function _lzSend(\n uint16 _dstChainId,\n bytes memory _payload,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams,\n uint _nativeFee\n ) internal virtual {\n bytes memory trustedRemote = trustedRemoteLookup[_dstChainId];\n require(trustedRemote.length != 0, \"LzApp: destination chain is not a trusted source\");\n _checkPayloadSize(_dstChainId, _payload.length);\n lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual {\n uint providedGasLimit = _getGasLimit(_adapterParams);\n uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas;\n require(minGasLimit > 0, \"LzApp: minGasLimit not set\");\n require(providedGasLimit >= minGasLimit, \"LzApp: gas limit is too low\");\n }\n\n function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) {\n require(_adapterParams.length >= 34, \"LzApp: invalid adapterParams\");\n assembly {\n gasLimit := mload(add(_adapterParams, 34))\n }\n }\n\n function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual {\n uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId];\n if (payloadSizeLimit == 0) {\n // use default if not set\n payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT;\n }\n require(_payloadSize <= payloadSizeLimit, \"LzApp: payload size is too large\");\n }\n\n //---------------------------UserApplication config----------------------------------------\n function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) {\n return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);\n }\n\n // generic config for LayerZero user Application\n function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner {\n lzEndpoint.setConfig(_version, _chainId, _configType, _config);\n }\n\n function setSendVersion(uint16 _version) external override onlyOwner {\n lzEndpoint.setSendVersion(_version);\n }\n\n function setReceiveVersion(uint16 _version) external override onlyOwner {\n lzEndpoint.setReceiveVersion(_version);\n }\n\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner {\n lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress);\n }\n\n // _path = abi.encodePacked(remoteAddress, localAddress)\n // this function set the trusted path for the cross-chain communication\n function setTrustedRemote(uint16 _srcChainId, bytes calldata _path) external onlyOwner {\n trustedRemoteLookup[_srcChainId] = _path;\n emit SetTrustedRemote(_srcChainId, _path);\n }\n\n function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner {\n trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this));\n emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress);\n }\n\n function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) {\n bytes memory path = trustedRemoteLookup[_remoteChainId];\n require(path.length != 0, \"LzApp: no trusted path record\");\n return path.slice(0, path.length - 20); // the last 20 bytes should be address(this)\n }\n\n function setPrecrime(address _precrime) external onlyOwner {\n precrime = _precrime;\n emit SetPrecrime(_precrime);\n }\n\n function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner {\n require(_minGas > 0, \"LzApp: invalid minGas\");\n minDstGasLookup[_dstChainId][_packetType] = _minGas;\n emit SetMinDstGas(_dstChainId, _packetType, _minGas);\n }\n\n // if the size is 0, it means default size limit\n function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner {\n payloadSizeLimitLookup[_dstChainId] = _size;\n }\n\n //--------------------------- VIEW FUNCTION ----------------------------------------\n function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) {\n bytes memory trustedSource = trustedRemoteLookup[_srcChainId];\n return keccak256(trustedSource) == keccak256(_srcAddress);\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 uint[45] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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" + }, + "contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\ninterface ILayerZeroReceiverUpgradeable {\n // @notice LayerZero endpoint will invoke this function to deliver the message on the destination\n // @param _srcChainId - the source endpoint identifier\n // @param _srcAddress - the source sending contract address from the source chain\n // @param _nonce - the ordered message nonce\n // @param _payload - the signed payload is the UA bytes has encoded to be sent\n function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;\n}\n" + }, + "contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroUserApplicationConfigUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\ninterface ILayerZeroUserApplicationConfigUpgradeable {\n // @notice set the configuration of the LayerZero messaging library of the specified version\n // @param _version - messaging library version\n // @param _chainId - the chainId for the pending config change\n // @param _configType - type of configuration. every messaging library has its own convention.\n // @param _config - configuration in the bytes. can encode arbitrary content.\n function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;\n\n // @notice set the send() LayerZero messaging library version to _version\n // @param _version - new messaging library version\n function setSendVersion(uint16 _version) external;\n\n // @notice set the lzReceive() LayerZero messaging library version to _version\n // @param _version - new messaging library version\n function setReceiveVersion(uint16 _version) external;\n\n // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload\n // @param _srcChainId - the chainId of the source chain\n // @param _srcAddress - the contract address of the source contract at the source chain\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;\n}\n" + }, + "contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroEndpointUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"./ILayerZeroUserApplicationConfigUpgradeable.sol\";\n\ninterface ILayerZeroEndpointUpgradeable is ILayerZeroUserApplicationConfigUpgradeable {\n // @notice send a LayerZero message to the specified address at a LayerZero endpoint.\n // @param _dstChainId - the destination chain identifier\n // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains\n // @param _payload - a custom bytes payload to send to the destination contract\n // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address\n // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction\n // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination\n function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;\n\n // @notice used by the messaging library to publish verified payload\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source contract (as bytes) at the source chain\n // @param _dstAddress - the address on destination chain\n // @param _nonce - the unbound message ordering nonce\n // @param _gasLimit - the gas limit for external contract execution\n // @param _payload - verified payload to send to the destination contract\n function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external;\n\n // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);\n\n // @notice get the outboundNonce from this source chain which, consequently, is always an EVM\n // @param _srcAddress - the source chain contract address\n function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);\n\n // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery\n // @param _dstChainId - the destination chain identifier\n // @param _userApplication - the user app address on this EVM chain\n // @param _payload - the custom message to send over LayerZero\n // @param _payInZRO - if false, user app pays the protocol fee in native token\n // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain\n function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee);\n\n // @notice get this Endpoint's immutable source identifier\n function getChainId() external view returns (uint16);\n\n // @notice the interface to retry failed message on this Endpoint destination\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n // @param _payload - the payload to be retried\n function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external;\n\n // @notice query if any STORED payload (message blocking) at the endpoint.\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);\n\n // @notice query if the _libraryAddress is valid for sending msgs.\n // @param _userApplication - the user app address on this EVM chain\n function getSendLibraryAddress(address _userApplication) external view returns (address);\n\n // @notice query if the _libraryAddress is valid for receiving msgs.\n // @param _userApplication - the user app address on this EVM chain\n function getReceiveLibraryAddress(address _userApplication) external view returns (address);\n\n // @notice query if the non-reentrancy guard for send() is on\n // @return true if the guard is on. false otherwise\n function isSendingPayload() external view returns (bool);\n\n // @notice query if the non-reentrancy guard for receive() is on\n // @return true if the guard is on. false otherwise\n function isReceivingPayload() external view returns (bool);\n\n // @notice get the configuration of the LayerZero messaging library of the specified version\n // @param _version - messaging library version\n // @param _chainId - the chainId for the pending config change\n // @param _userApplication - the contract address of the user application\n // @param _configType - type of configuration. every messaging library has its own convention.\n function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory);\n\n // @notice get the send() LayerZero messaging library version\n // @param _userApplication - the contract address of the user application\n function getSendVersion(address _userApplication) external view returns (uint16);\n\n // @notice get the lzReceive() LayerZero messaging library version\n // @param _userApplication - the contract address of the user application\n function getReceiveVersion(address _userApplication) external view returns (uint16);\n}\n" + }, + "contracts/libraries/BytesLib.sol": { + "content": "// SPDX-License-Identifier: Unlicense\n/*\n * @title Solidity Bytes Arrays Utils\n * @author Gonçalo Sá \n *\n * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.\n * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.\n */\npragma solidity >=0.8.0 <0.9.0;\n\nlibrary BytesLib {\n function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory) {\n bytes memory tempBytes;\n\n assembly {\n // Get a location of some free memory and store it in tempBytes as\n // Solidity does for memory variables.\n tempBytes := mload(0x40)\n\n // Store the length of the first bytes array at the beginning of\n // the memory for tempBytes.\n let length := mload(_preBytes)\n mstore(tempBytes, length)\n\n // Maintain a memory counter for the current write location in the\n // temp bytes array by adding the 32 bytes for the array length to\n // the starting location.\n let mc := add(tempBytes, 0x20)\n // Stop copying when the memory counter reaches the length of the\n // first bytes array.\n let end := add(mc, length)\n\n for {\n // Initialize a copy counter to the start of the _preBytes data,\n // 32 bytes into its memory.\n let cc := add(_preBytes, 0x20)\n } lt(mc, end) {\n // Increase both counters by 32 bytes each iteration.\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n // Write the _preBytes data into the tempBytes memory 32 bytes\n // at a time.\n mstore(mc, mload(cc))\n }\n\n // Add the length of _postBytes to the current length of tempBytes\n // and store it as the new length in the first 32 bytes of the\n // tempBytes memory.\n length := mload(_postBytes)\n mstore(tempBytes, add(length, mload(tempBytes)))\n\n // Move the memory counter back from a multiple of 0x20 to the\n // actual end of the _preBytes data.\n mc := end\n // Stop copying when the memory counter reaches the new combined\n // length of the arrays.\n end := add(mc, length)\n\n for {\n let cc := add(_postBytes, 0x20)\n } lt(mc, end) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n // Update the free-memory pointer by padding our last write location\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\n // next 32 byte block, then round down to the nearest multiple of\n // 32. If the sum of the length of the two arrays is zero then add\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\n mstore(\n 0x40,\n and(\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\n not(31) // Round down to the nearest 32 bytes.\n )\n )\n }\n\n return tempBytes;\n }\n\n function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {\n assembly {\n // Read the first 32 bytes of _preBytes storage, which is the length\n // of the array. (We don't need to use the offset into the slot\n // because arrays use the entire slot.)\n let fslot := sload(_preBytes.slot)\n // Arrays of 31 bytes or less have an even value in their slot,\n // while longer arrays have an odd value. The actual length is\n // the slot divided by two for odd values, and the lowest order\n // byte divided by two for even values.\n // If the slot is even, bitwise and the slot with 255 and divide by\n // two to get the length. If the slot is odd, bitwise and the slot\n // with -1 and divide by two.\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\n let mlength := mload(_postBytes)\n let newlength := add(slength, mlength)\n // slength can contain both the length and contents of the array\n // if length < 32 bytes so let's prepare for that\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\n switch add(lt(slength, 32), lt(newlength, 32))\n case 2 {\n // Since the new array still fits in the slot, we just need to\n // update the contents of the slot.\n // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length\n sstore(\n _preBytes.slot,\n // all the modifications to the slot are inside this\n // next block\n add(\n // we can just add to the slot contents because the\n // bytes we want to change are the LSBs\n fslot,\n add(\n mul(\n div(\n // load the bytes from memory\n mload(add(_postBytes, 0x20)),\n // zero all bytes to the right\n exp(0x100, sub(32, mlength))\n ),\n // and now shift left the number of bytes to\n // leave space for the length in the slot\n exp(0x100, sub(32, newlength))\n ),\n // increase length by the double of the memory\n // bytes length\n mul(mlength, 2)\n )\n )\n )\n }\n case 1 {\n // The stored value fits in the slot, but the combined value\n // will exceed it.\n // get the keccak hash to get the contents of the array\n mstore(0x0, _preBytes.slot)\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\n\n // save new length\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\n\n // The contents of the _postBytes array start 32 bytes into\n // the structure. Our first read should obtain the `submod`\n // bytes that can fit into the unused space in the last word\n // of the stored array. To get this, we read 32 bytes starting\n // from `submod`, so the data we read overlaps with the array\n // contents by `submod` bytes. Masking the lowest-order\n // `submod` bytes allows us to add that value directly to the\n // stored value.\n\n let submod := sub(32, slength)\n let mc := add(_postBytes, submod)\n let end := add(_postBytes, mlength)\n let mask := sub(exp(0x100, submod), 1)\n\n sstore(sc, add(and(fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00), and(mload(mc), mask)))\n\n for {\n mc := add(mc, 0x20)\n sc := add(sc, 1)\n } lt(mc, end) {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } {\n sstore(sc, mload(mc))\n }\n\n mask := exp(0x100, sub(mc, end))\n\n sstore(sc, mul(div(mload(mc), mask), mask))\n }\n default {\n // get the keccak hash to get the contents of the array\n mstore(0x0, _preBytes.slot)\n // Start copying to the last used word of the stored array.\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\n\n // save new length\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\n\n // Copy over the first `submod` bytes of the new data as in\n // case 1 above.\n let slengthmod := mod(slength, 32)\n let mlengthmod := mod(mlength, 32)\n let submod := sub(32, slengthmod)\n let mc := add(_postBytes, submod)\n let end := add(_postBytes, mlength)\n let mask := sub(exp(0x100, submod), 1)\n\n sstore(sc, add(sload(sc), and(mload(mc), mask)))\n\n for {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } lt(mc, end) {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } {\n sstore(sc, mload(mc))\n }\n\n mask := exp(0x100, sub(mc, end))\n\n sstore(sc, mul(div(mload(mc), mask), mask))\n }\n }\n }\n\n function slice(\n bytes memory _bytes,\n uint _start,\n uint _length\n ) internal pure returns (bytes memory) {\n require(_length + 31 >= _length, \"slice_overflow\");\n require(_bytes.length >= _start + _length, \"slice_outOfBounds\");\n\n bytes memory tempBytes;\n\n assembly {\n switch iszero(_length)\n case 0 {\n // Get a location of some free memory and store it in tempBytes as\n // Solidity does for memory variables.\n tempBytes := mload(0x40)\n\n // The first word of the slice result is potentially a partial\n // word read from the original array. To read it, we calculate\n // the length of that partial word and start copying that many\n // bytes into the array. The first word we copy will start with\n // data we don't care about, but the last `lengthmod` bytes will\n // land at the beginning of the contents of the new array. When\n // we're done copying, we overwrite the full first word with\n // the actual length of the slice.\n let lengthmod := and(_length, 31)\n\n // The multiplication in the next line is necessary\n // because when slicing multiples of 32 bytes (lengthmod == 0)\n // the following copy loop was copying the origin's length\n // and then ending prematurely not copying everything it should.\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\n let end := add(mc, _length)\n\n for {\n // The multiplication in the next line has the same exact purpose\n // as the one above.\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\n } lt(mc, end) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n mstore(tempBytes, _length)\n\n //update free-memory pointer\n //allocating the array padded to 32 bytes like the compiler does now\n mstore(0x40, and(add(mc, 31), not(31)))\n }\n //if we want a zero-length slice let's just return a zero-length array\n default {\n tempBytes := mload(0x40)\n //zero out the 32 bytes slice we are about to return\n //we need to do it because Solidity does not garbage collect\n mstore(tempBytes, 0)\n\n mstore(0x40, add(tempBytes, 0x20))\n }\n }\n\n return tempBytes;\n }\n\n function toAddress(bytes memory _bytes, uint _start) internal pure returns (address) {\n require(_bytes.length >= _start + 20, \"toAddress_outOfBounds\");\n address tempAddress;\n\n assembly {\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\n }\n\n return tempAddress;\n }\n\n function toUint8(bytes memory _bytes, uint _start) internal pure returns (uint8) {\n require(_bytes.length >= _start + 1, \"toUint8_outOfBounds\");\n uint8 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x1), _start))\n }\n\n return tempUint;\n }\n\n function toUint16(bytes memory _bytes, uint _start) internal pure returns (uint16) {\n require(_bytes.length >= _start + 2, \"toUint16_outOfBounds\");\n uint16 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x2), _start))\n }\n\n return tempUint;\n }\n\n function toUint32(bytes memory _bytes, uint _start) internal pure returns (uint32) {\n require(_bytes.length >= _start + 4, \"toUint32_outOfBounds\");\n uint32 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x4), _start))\n }\n\n return tempUint;\n }\n\n function toUint64(bytes memory _bytes, uint _start) internal pure returns (uint64) {\n require(_bytes.length >= _start + 8, \"toUint64_outOfBounds\");\n uint64 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x8), _start))\n }\n\n return tempUint;\n }\n\n function toUint96(bytes memory _bytes, uint _start) internal pure returns (uint96) {\n require(_bytes.length >= _start + 12, \"toUint96_outOfBounds\");\n uint96 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0xc), _start))\n }\n\n return tempUint;\n }\n\n function toUint128(bytes memory _bytes, uint _start) internal pure returns (uint128) {\n require(_bytes.length >= _start + 16, \"toUint128_outOfBounds\");\n uint128 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x10), _start))\n }\n\n return tempUint;\n }\n\n function toUint256(bytes memory _bytes, uint _start) internal pure returns (uint) {\n require(_bytes.length >= _start + 32, \"toUint256_outOfBounds\");\n uint tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x20), _start))\n }\n\n return tempUint;\n }\n\n function toBytes32(bytes memory _bytes, uint _start) internal pure returns (bytes32) {\n require(_bytes.length >= _start + 32, \"toBytes32_outOfBounds\");\n bytes32 tempBytes32;\n\n assembly {\n tempBytes32 := mload(add(add(_bytes, 0x20), _start))\n }\n\n return tempBytes32;\n }\n\n function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {\n bool success = true;\n\n assembly {\n let length := mload(_preBytes)\n\n // if lengths don't match the arrays are not equal\n switch eq(length, mload(_postBytes))\n case 1 {\n // cb is a circuit breaker in the for loop since there's\n // no said feature for inline assembly loops\n // cb = 1 - don't breaker\n // cb = 0 - break\n let cb := 1\n\n let mc := add(_preBytes, 0x20)\n let end := add(mc, length)\n\n for {\n let cc := add(_postBytes, 0x20)\n // the next line is the loop condition:\n // while(uint256(mc < end) + cb == 2)\n } eq(add(lt(mc, end), cb), 2) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n // if any of these checks fails then arrays are not equal\n if iszero(eq(mload(mc), mload(cc))) {\n // unsuccess:\n success := 0\n cb := 0\n }\n }\n }\n default {\n // unsuccess:\n success := 0\n }\n }\n\n return success;\n }\n\n function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool) {\n bool success = true;\n\n assembly {\n // we know _preBytes_offset is 0\n let fslot := sload(_preBytes.slot)\n // Decode the length of the stored array like in concatStorage().\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\n let mlength := mload(_postBytes)\n\n // if lengths don't match the arrays are not equal\n switch eq(slength, mlength)\n case 1 {\n // slength can contain both the length and contents of the array\n // if length < 32 bytes so let's prepare for that\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\n if iszero(iszero(slength)) {\n switch lt(slength, 32)\n case 1 {\n // blank the last byte which is the length\n fslot := mul(div(fslot, 0x100), 0x100)\n\n if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {\n // unsuccess:\n success := 0\n }\n }\n default {\n // cb is a circuit breaker in the for loop since there's\n // no said feature for inline assembly loops\n // cb = 1 - don't breaker\n // cb = 0 - break\n let cb := 1\n\n // get the keccak hash to get the contents of the array\n mstore(0x0, _preBytes.slot)\n let sc := keccak256(0x0, 0x20)\n\n let mc := add(_postBytes, 0x20)\n let end := add(mc, mlength)\n\n // the next line is the loop condition:\n // while(uint256(mc < end) + cb == 2)\n for {\n\n } eq(add(lt(mc, end), cb), 2) {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } {\n if iszero(eq(sload(sc), mload(mc))) {\n // unsuccess:\n success := 0\n cb := 0\n }\n }\n }\n }\n }\n default {\n // unsuccess:\n success := 0\n }\n }\n\n return success;\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/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\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 ReentrancyGuardUpgradeable is Initializable {\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 function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\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 /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\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" + }, + "contracts/contracts-upgradable/examples/BeamBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/NativeOFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\n\ncontract BeamProxyOFT is ProxyOFTWithFeeUpgradeable {}\n\ncontract BeamNativeOFT is NativeOFTWithFeeUpgradeable {}\n\ncontract BeamOFT is OFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"./BaseOFTWithFeeUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\ncontract ProxyOFTWithFeeUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, Proxied {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n IERC20Upgradeable internal innerToken;\n uint internal ld2sdRate;\n\n // total amount is transferred from this chain to other chains, ensuring the total is less than uint64.max in sd\n uint public outboundAmount;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address _token, uint8 _sharedDecimals, address _lzEndpoint) public initializer {\n __BaseOFTWithFeeUpgradeable_init(_sharedDecimals, _lzEndpoint);\n\n innerToken = IERC20Upgradeable(_token);\n\n (bool success, bytes memory data) = _token.staticcall(abi.encodeWithSignature(\"decimals()\"));\n require(success, \"ProxyOFTWithFee: failed to get token decimals\");\n uint8 decimals = abi.decode(data, (uint8));\n\n require(_sharedDecimals <= decimals, \"ProxyOFTWithFee: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return innerToken.totalSupply() - outboundAmount;\n }\n\n function token() public view virtual override returns (address) {\n return address(innerToken);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n require(_from == _msgSender(), \"ProxyOFTWithFee: owner is not send caller\");\n\n _amount = _transferFrom(_from, address(this), _amount);\n\n // _amount still may have dust if the token has transfer fee, then give the dust back to the sender\n (uint amount, uint dust) = _removeDust(_amount);\n if (dust > 0) innerToken.safeTransfer(_from, dust);\n\n // check total outbound amount\n outboundAmount += amount;\n uint cap = _sd2ld(type(uint64).max);\n require(cap >= outboundAmount, \"ProxyOFTWithFee: outboundAmount overflow\");\n\n return amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n outboundAmount -= _amount;\n\n // tokens are already in this contract, so no need to transfer\n if (_toAddress == address(this)) {\n return _amount;\n }\n\n return _transferFrom(address(this), _toAddress, _amount);\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n uint before = innerToken.balanceOf(_to);\n if (_from == address(this)) {\n innerToken.safeTransfer(_to, _amount);\n } else {\n innerToken.safeTransferFrom(_from, _to, _amount);\n }\n return innerToken.balanceOf(_to) - before;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) 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(IERC20Upgradeable token, address spender, uint256 value) 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 /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable 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(IERC20Upgradeable 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 require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation 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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\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 cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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 IERC20PermitUpgradeable {\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" + }, + "contracts/contracts-upgradable/examples/UsdtOFT.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\n\ncontract UsdtOFT is OFTWithFeeUpgradeable {\n function decimals() public view virtual override returns (uint8) {\n return 6;\n }\n}\n\ncontract UsdtProxyOFT is ProxyOFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/examples/UsdcOFT.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\n\ncontract UsdcOFT is OFTWithFeeUpgradeable {\n function decimals() public view virtual override returns (uint8) {\n return 6;\n }\n}\n\ncontract UsdcProxyOFT is ProxyOFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/examples/GOB.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\n\ncontract GobOFT is OFTWithFeeUpgradeable {}\n\ncontract GobProxyOFT is ProxyOFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/examples/FP.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\n\ncontract ForgottenPlaylandOFT is OFTWithFeePermitUpgradeable {}\n\ncontract ForgottenPlaylandProxyOFT is ProxyOFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol\";\nimport \"./BaseOFTWithFeeUpgradeable.sol\";\n\ncontract OFTWithFeePermitUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, ERC20Upgradeable, Proxied, ERC20PermitUpgradeable {\n uint internal ld2sdRate;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) public virtual initializer {\n __OFTWithFeePermitUpgradeable_init(_name, _symbol, _sharedDecimals, _lzEndpoint);\n }\n\n function __OFTWithFeePermitUpgradeable_init(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n\n __ERC20_init_unchained(_name, _symbol);\n __ERC20Permit_init_unchained(_name);\n\n __OFTWithFeePermitUpgradeable_init_unchained(_sharedDecimals);\n }\n\n function __OFTWithFeePermitUpgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\n uint8 decimals = decimals();\n require(_sharedDecimals <= decimals, \"OFTWithFee: sharedDecimals must be <= decimals\");\n ld2sdRate = 10**(decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return totalSupply();\n }\n\n function token() public view virtual override returns (address) {\n return address(this);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(\n address _from,\n uint16,\n bytes32,\n uint _amount\n ) internal virtual override returns (uint) {\n address spender = _msgSender();\n if (_from != spender) _spendAllowance(_from, spender, _amount);\n _burn(_from, _amount);\n return _amount;\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _amount\n ) internal virtual override returns (uint) {\n _mint(_toAddress, _amount);\n return _amount;\n }\n\n function _transferFrom(\n address _from,\n address _to,\n uint _amount\n ) internal virtual override returns (uint) {\n address spender = _msgSender();\n // if transfer from this contract, no need to check allowance\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\n _transfer(_from, _to, _amount);\n return _amount;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/cryptography/EIP712Upgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation 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 *\n * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n /**\n * @dev See {IERC20Permit-permit}.\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 ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\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/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.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 ECDSAUpgradeable {\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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\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\", StringsUpgradeable.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 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../interfaces/IERC5267Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\n bytes32 private constant _TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /// @custom:oz-renamed-from _HASHED_NAME\n bytes32 private _hashedName;\n /// @custom:oz-renamed-from _HASHED_VERSION\n bytes32 private _hashedVersion;\n\n string private _name;\n string private _version;\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 function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n _name = name;\n _version = version;\n\n // Reset prior values in storage if upgrading\n _hashedName = 0;\n _hashedVersion = 0;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator();\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), 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 ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev See {EIP-5267}.\n *\n * _Available since v4.9._\n */\n function eip712Domain()\n public\n view\n virtual\n override\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\n // and the EIP712 domain is not reliable, as it will be missing name and version.\n require(_hashedName == 0 && _hashedVersion == 0, \"EIP712: Uninitialized\");\n\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n /**\n * @dev The name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Name() internal virtual view returns (string memory) {\n return _name;\n }\n\n /**\n * @dev The version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Version() internal virtual view returns (string memory) {\n return _version;\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\n */\n function _EIP712NameHash() internal view returns (bytes32) {\n string memory name = _EIP712Name();\n if (bytes(name).length > 0) {\n return keccak256(bytes(name));\n } else {\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\n bytes32 hashedName = _hashedName;\n if (hashedName != 0) {\n return hashedName;\n } else {\n return keccak256(\"\");\n }\n }\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\n */\n function _EIP712VersionHash() internal view returns (bytes32) {\n string memory version = _EIP712Version();\n if (bytes(version).length > 0) {\n return keccak256(bytes(version));\n } else {\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\n bytes32 hashedVersion = _hashedVersion;\n if (hashedVersion != 0) {\n return hashedVersion;\n } else {\n return keccak256(\"\");\n }\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[48] 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/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.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 `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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 256, 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 << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267Upgradeable {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/experimental/NativeProxyOFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"../fee/BaseOFTWithFeeUpgradeable.sol\";\n\n/**\n * \"NativeMinter\" Avalanche Subnet precompile interface\n * https://docs.avax.network/build/subnet/upgrade/customize-a-subnet#minting-native-coins\n */\n\ninterface INativeMinter {\n // Mint [amount] number of native coins and send to [addr]\n function mintNativeCoin(address addr, uint256 amount) external;\n}\n\n/**\n * This contract is based on \"NativeOFTV2\" and \"ProxyOFTV2\", and takes advantage of\n * the \"NativeMinter\" Avalanche Subnet precompile to mint and burn native currency\n * on-the-fly instead of locking it up.\n */\n\ncontract NativeProxyOFTWithFeeUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, PausableUpgradeable, Proxied {\n uint internal ld2sdRate;\n uint internal supply;\n INativeMinter internal constant nativeMinter = INativeMinter(address(0x0200000000000000000000000000000000000001));\n address public constant BURN_ADDRESS = 0x0100000000000000000000000000000000000000;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(uint8 _nativeDecimals, uint8 _sharedDecimals, address _lzEndpoint) public initializer {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n __Pausable_init_unchained();\n\n require(_sharedDecimals <= _nativeDecimals, \"NativeProxyOFTWithFee: sharedDecimals must be <= nativeDecimals\");\n ld2sdRate = 10 ** (_nativeDecimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n // allow 0x0 to burn fee instead\n function setFeeOwner(address _feeOwner) public virtual override onlyOwner {\n feeOwner = _feeOwner;\n emit SetFeeOwner(_feeOwner);\n }\n\n // pausable\n function pause(bool _enable) public virtual onlyOwner {\n if (_enable) {\n _pause();\n } else {\n _unpause();\n }\n }\n\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n LzCallParams calldata _callParams\n ) public payable virtual override whenNotPaused {\n return super.sendFrom(_from, _dstChainId, _toAddress, _amount, _minAmount, _callParams);\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override whenNotPaused {\n return super.sendAndCall(_from, _dstChainId, _toAddress, _amount, _minAmount, _payload, _dstGasForCall, _callParams);\n }\n\n function token() public view virtual override returns (address) {\n return address(0);\n }\n\n function circulatingSupply() public view virtual override returns (uint) {\n return supply;\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeProxyOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(amount);\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeProxyOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(amount);\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _debitFromNative(uint _amount) internal virtual whenNotPaused returns (uint messageFee) {\n require(msg.value >= _amount, \"NativeProxyOFTWithFee: Insufficient msg.value\");\n // update the messageFee to take out the token amount\n messageFee = msg.value - _amount;\n\n // burn native tokens\n _burnNative(_amount);\n\n return messageFee;\n }\n\n function _debitFrom(address, uint16, bytes32, uint _amount) internal virtual override whenNotPaused returns (uint) {\n return _debitFromNative(_amount);\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override whenNotPaused returns (uint) {\n // mint native tokens\n _mintNative(_toAddress, _amount);\n\n return _amount;\n }\n\n // native currency transfer\n function _transferFrom(address, address _to, uint _amount) internal virtual override whenNotPaused returns (uint) {\n require(msg.value >= _amount, \"NativeProxyOFTWithFee: Insufficient msg.value\");\n\n (bool success, ) = address(_to).call{value: _amount}(\"\");\n\n require(success, \"NativeProxyOFTWithFee: Transferring native tokens failed\");\n\n return _amount;\n }\n\n // mints native currency (gas tokens) by calling Avalanche's NativeMinter precompile\n function _mintNative(address _toAddress, uint _amount) internal virtual whenNotPaused {\n uint newBalance = msg.sender.balance + _amount;\n nativeMinter.mintNativeCoin(_toAddress, _amount);\n\n require(msg.sender.balance == newBalance, \"NativeProxyOFTWithFee: Minting native tokens failed\");\n\n // update tracker\n supply = supply + _amount;\n }\n\n // burn native tokens sent with tx\n function _burnNative(uint _amount) internal virtual {\n _transferFrom(address(0), BURN_ADDRESS, _amount);\n\n // update tracker\n supply = supply > _amount ? supply - _amount : 0;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\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" + }, + "contracts/contracts-upgradable/token/onft721/ProxyONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol\";\nimport \"./ONFT721CoreUpgradeable.sol\";\n\ncontract ProxyONFT721Upgradeable is Initializable, ONFT721CoreUpgradeable, IERC721ReceiverUpgradeable, Proxied {\n using ERC165CheckerUpgradeable for address;\n\n IERC721Upgradeable public token;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(uint256 _minGasToTransfer, address _lzEndpoint, address _proxyToken) public virtual initializer {\n __ProxyONFT721Upgradeable_init(_minGasToTransfer, _lzEndpoint, _proxyToken);\n }\n\n function __ProxyONFT721Upgradeable_init(uint256 _minGasToTransfer, address _lzEndpoint, address _proxyToken) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __ONFT721CoreUpgradeable_init_unchained(_minGasToTransfer);\n\n __ProxyONFT721Upgradeable_init_unchained(_proxyToken);\n }\n\n function __ProxyONFT721Upgradeable_init_unchained(address _proxyToken) internal onlyInitializing {\n require(_proxyToken.supportsInterface(type(IERC721Upgradeable).interfaceId), \"ProxyONFT721Upgradeable: invalid ERC721 token\");\n token = IERC721Upgradeable(_proxyToken);\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC721ReceiverUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(address _from, uint16, bytes memory, uint _tokenId) internal virtual override {\n require(_from == _msgSender(), \"ProxyONFT721Upgradeable: owner is not send caller\");\n token.safeTransferFrom(_from, address(this), _tokenId);\n }\n\n function _creditTo(uint16, address _toAddress, uint _tokenId) internal virtual override {\n token.safeTransferFrom(address(this), _toAddress, _tokenId);\n }\n\n function onERC721Received(address _operator, address, uint, bytes memory) public virtual override returns (bytes4) {\n // only allow `this` to transfer token from others\n if (_operator != address(this)) return bytes4(0);\n return IERC721ReceiverUpgradeable.onERC721Received.selector;\n }\n\n uint[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165CheckerUpgradeable {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface.\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return\n supportsERC165InterfaceUnchecked(account, type(IERC165Upgradeable).interfaceId) &&\n !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(\n address account,\n bytes4[] memory interfaceIds\n ) internal view returns (bool[] memory) {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n *\n * Some precompiled contracts will falsely indicate support for a given interface, so caution\n * should be exercised when using this function.\n *\n * Interface identification is specified in ERC-165.\n */\n function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {\n // prepare call\n bytes memory encodedParams = abi.encodeWithSelector(IERC165Upgradeable.supportsInterface.selector, interfaceId);\n\n // perform static call\n bool success;\n uint256 returnSize;\n uint256 returnValue;\n assembly {\n success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n returnSize := returndatasize()\n returnValue := mload(0x00)\n }\n\n return success && returnSize >= 0x20 && returnValue > 0;\n }\n}\n" + }, + "contracts/contracts-upgradable/token/onft721/ONFT721CoreUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"./interfaces/IONFT721CoreUpgradeable.sol\";\nimport \"../../lzApp/NonblockingLzAppUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nabstract contract ONFT721CoreUpgradeable is\n Initializable,\n NonblockingLzAppUpgradeable,\n ERC165Upgradeable,\n ReentrancyGuardUpgradeable,\n IONFT721CoreUpgradeable\n{\n uint16 public constant FUNCTION_TYPE_SEND = 1;\n\n struct StoredCredit {\n uint16 srcChainId;\n address toAddress;\n uint256 index; // which index of the tokenIds remain\n bool creditsRemain;\n }\n\n uint256 public minGasToTransferAndStore; // min amount of gas required to transfer, and also store the payload\n mapping(uint16 => uint256) public dstChainIdToBatchLimit;\n mapping(uint16 => uint256) public dstChainIdToTransferGas; // per transfer amount of gas required to mint/transfer on the dst\n mapping(bytes32 => StoredCredit) public storedCredits;\n\n function __ONFT721CoreUpgradeable_init(uint256 _minGasToTransferAndStore, address _lzEndpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __ONFT721CoreUpgradeable_init_unchained(_minGasToTransferAndStore);\n }\n\n function __ONFT721CoreUpgradeable_init_unchained(uint256 _minGasToTransferAndStore) internal onlyInitializing {\n require(_minGasToTransferAndStore > 0, \"ONFT721: minGasToTransferAndStore must be > 0\");\n minGasToTransferAndStore = _minGasToTransferAndStore;\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IONFT721CoreUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _useZro, _adapterParams);\n }\n\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n bytes memory payload = abi.encode(_toAddress, _tokenIds);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _tokenIds, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual {\n // allow 1 by default\n require(_tokenIds.length > 0, \"LzApp: tokenIds[] is empty\");\n require(_tokenIds.length == 1 || _tokenIds.length <= dstChainIdToBatchLimit[_dstChainId], \"ONFT721: batch size exceeds dst batch limit\");\n\n for (uint i = 0; i < _tokenIds.length; i++) {\n _debitFrom(_from, _dstChainId, _toAddress, _tokenIds[i]);\n }\n\n bytes memory payload = abi.encode(_toAddress, _tokenIds);\n\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, dstChainIdToTransferGas[_dstChainId] * _tokenIds.length);\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds);\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 /*_nonce*/,\n bytes memory _payload\n ) internal virtual override {\n // decode and load the toAddress\n (bytes memory toAddressBytes, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[]));\n\n address toAddress;\n assembly {\n toAddress := mload(add(toAddressBytes, 20))\n }\n\n uint nextIndex = _creditTill(_srcChainId, toAddress, 0, tokenIds);\n if (nextIndex < tokenIds.length) {\n // not enough gas to complete transfers, store to be cleared in another tx\n bytes32 hashedPayload = keccak256(_payload);\n storedCredits[hashedPayload] = StoredCredit(_srcChainId, toAddress, nextIndex, true);\n emit CreditStored(hashedPayload, _payload);\n }\n\n emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds);\n }\n\n // Public function for anyone to clear and deliver the remaining batch sent tokenIds\n function clearCredits(bytes memory _payload) external virtual nonReentrant {\n bytes32 hashedPayload = keccak256(_payload);\n require(storedCredits[hashedPayload].creditsRemain, \"ONFT721: no credits stored\");\n\n (, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[]));\n\n uint nextIndex = _creditTill(\n storedCredits[hashedPayload].srcChainId,\n storedCredits[hashedPayload].toAddress,\n storedCredits[hashedPayload].index,\n tokenIds\n );\n require(nextIndex > storedCredits[hashedPayload].index, \"ONFT721: not enough gas to process credit transfer\");\n\n if (nextIndex == tokenIds.length) {\n // cleared the credits, delete the element\n delete storedCredits[hashedPayload];\n emit CreditCleared(hashedPayload);\n } else {\n // store the next index to mint\n storedCredits[hashedPayload] = StoredCredit(\n storedCredits[hashedPayload].srcChainId,\n storedCredits[hashedPayload].toAddress,\n nextIndex,\n true\n );\n }\n }\n\n // When a srcChain has the ability to transfer more chainIds in a single tx than the dst can do.\n // Needs the ability to iterate and stop if the minGasToTransferAndStore is not met\n function _creditTill(uint16 _srcChainId, address _toAddress, uint _startIndex, uint[] memory _tokenIds) internal returns (uint256) {\n uint i = _startIndex;\n while (i < _tokenIds.length) {\n // if not enough gas to process, store this index for next loop\n if (gasleft() < minGasToTransferAndStore) break;\n\n _creditTo(_srcChainId, _toAddress, _tokenIds[i]);\n i++;\n }\n\n // indicates the next index to send of tokenIds,\n // if i == tokenIds.length, we are finished\n return i;\n }\n\n function setMinGasToTransferAndStore(uint256 _minGasToTransferAndStore) external onlyOwner {\n require(_minGasToTransferAndStore > 0, \"ONFT721: minGasToTransferAndStore must be > 0\");\n minGasToTransferAndStore = _minGasToTransferAndStore;\n }\n\n // ensures enough gas in adapter params to handle batch transfer gas amounts on the dst\n function setDstChainIdToTransferGas(uint16 _dstChainId, uint256 _dstChainIdToTransferGas) external onlyOwner {\n require(_dstChainIdToTransferGas > 0, \"ONFT721: dstChainIdToTransferGas must be > 0\");\n dstChainIdToTransferGas[_dstChainId] = _dstChainIdToTransferGas;\n }\n\n // limit on src the amount of tokens to batch send\n function setDstChainIdToBatchLimit(uint16 _dstChainId, uint256 _dstChainIdToBatchLimit) external onlyOwner {\n require(_dstChainIdToBatchLimit > 0, \"ONFT721: dstChainIdToBatchLimit must be > 0\");\n dstChainIdToBatchLimit[_dstChainId] = _dstChainIdToBatchLimit;\n }\n\n function _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId) internal virtual;\n\n function _creditTo(uint16 _srcChainId, address _toAddress, uint _tokenId) internal virtual;\n\n function _toSingletonArray(uint element) internal pure returns (uint[] memory) {\n uint[] memory array = new uint[](1);\n array[0] = element;\n return array;\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 uint[46] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/onft721/interfaces/IONFT721CoreUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\n/**\n * @dev Interface of the ONFT Core Upgradeable standard\n */\ninterface IONFT721CoreUpgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `_tokenIds[]` are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\n * `_nonce` is the outbound nonce from\n */\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds);\n event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint[] _tokenIds);\n\n /**\n * @dev Emitted when `_payload` was received from lz, but not enough gas to deliver all tokenIds\n */\n event CreditStored(bytes32 _hashedPayload, bytes _payload);\n /**\n * @dev Emitted when `_hashedPayload` has been completely delivered\n */\n event CreditCleared(bytes32 _hashedPayload);\n\n /**\n * @dev send token `_tokenId` to (`_dstChainId`, `_toAddress`) from `_from`\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n /**\n * @dev send tokens `_tokenIds[]` to (`_dstChainId`, `_toAddress`) from `_from`\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _tokenId - token Id to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _tokenIds[] - token Ids to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/NativeOFTV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"./OFTV2Upgradeable.sol\";\n\ncontract NativeOFTV2Upgradeable is OFTV2Upgradeable, ReentrancyGuardUpgradeable {\n event Deposit(address indexed _dst, uint _amount);\n event Withdrawal(address indexed _src, uint _amount);\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _sendAndCall(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _payload,\n _dstGasForCall,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n }\n\n function deposit() public payable {\n _mint(msg.sender, msg.value);\n emit Deposit(msg.sender, msg.value);\n }\n\n function withdraw(uint _amount) external nonReentrant {\n require(balanceOf(msg.sender) >= _amount, \"NativeOFTV2: Insufficient balance.\");\n _burn(msg.sender, _amount);\n (bool success, ) = msg.sender.call{value: _amount}(\"\");\n require(success, \"NativeOFTV2: failed to unwrap\");\n emit Withdrawal(msg.sender, _amount);\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTV2: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTV2: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _debitFromNative(address _from, uint _amount) internal returns (uint messageFee) {\n messageFee = msg.sender == _from ? _debitMsgSender(_amount) : _debitMsgFrom(_from, _amount);\n }\n\n function _debitMsgSender(uint _amount) internal returns (uint messageFee) {\n uint msgSenderBalance = balanceOf(msg.sender);\n\n if (msgSenderBalance < _amount) {\n require(msgSenderBalance + msg.value >= _amount, \"NativeOFTV2: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgSenderBalance;\n _mint(address(msg.sender), mintAmount);\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _transfer(msg.sender, address(this), _amount);\n return messageFee;\n }\n\n function _debitMsgFrom(address _from, uint _amount) internal returns (uint messageFee) {\n uint msgFromBalance = balanceOf(_from);\n\n if (msgFromBalance < _amount) {\n require(msgFromBalance + msg.value >= _amount, \"NativeOFTV2: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgFromBalance;\n _mint(address(msg.sender), mintAmount);\n\n // transfer the differential amount to the contract\n _transfer(msg.sender, address(this), mintAmount);\n\n // overwrite the _amount to take the rest of the balance from the _from address\n _amount = msgFromBalance;\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _spendAllowance(_from, msg.sender, _amount);\n _transfer(_from, address(this), _amount);\n return messageFee;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal override returns (uint) {\n _burn(address(this), _amount);\n (bool success, ) = _toAddress.call{value: _amount}(\"\");\n require(success, \"NativeOFTV2: failed to _creditTo\");\n return _amount;\n }\n\n receive() external payable {\n deposit();\n }\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/OFTV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\nimport \"./BaseOFTV2Upgradeable.sol\";\n\ncontract OFTV2Upgradeable is Initializable, BaseOFTV2Upgradeable, ERC20Upgradeable, Proxied {\n uint internal ld2sdRate;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(string memory _name, string memory _symbol, uint8 _sharedDecimals, address _lzEndpoint) public virtual initializer {\n __OFTV2Upgradeable_init(_name, _symbol, _sharedDecimals, _lzEndpoint);\n }\n\n function __OFTV2Upgradeable_init(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n\n __ERC20_init_unchained(_name, _symbol);\n\n __OFTV2Upgradeable_init_unchained(_sharedDecimals);\n }\n\n function __OFTV2Upgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\n uint8 decimals = decimals();\n require(_sharedDecimals <= decimals, \"OFT: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return totalSupply();\n }\n\n function token() public view virtual override returns (address) {\n return address(this);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n if (_from != spender) _spendAllowance(_from, spender, _amount);\n _burn(_from, _amount);\n return _amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n _mint(_toAddress, _amount);\n return _amount;\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n // if transfer from this contract, no need to check allowance\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\n _transfer(_from, _to, _amount);\n return _amount;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\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 uint[49] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/BaseOFTV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./OFTCoreV2Upgradeable.sol\";\nimport \"./interfaces/IOFTV2Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\nabstract contract BaseOFTV2Upgradeable is OFTCoreV2Upgradeable, ERC165Upgradeable, IOFTV2Upgradeable {\n function __BaseOFTV2Upgradeable_init(uint8 _sharedDecimals, address _lzEndpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n }\n\n function __BaseOFTV2Upgradeable_init_unchained() internal onlyInitializing {}\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _sendAndCall(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _payload,\n _dstGasForCall,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n }\n\n /************************************************************************\n * public view functions\n ************************************************************************/\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IOFTV2Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams);\n }\n\n function estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams);\n }\n\n function circulatingSupply() public view virtual override returns (uint);\n\n function token() public view virtual override returns (address);\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 uint[50] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/interfaces/IOFTV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./ICommonOFTUpgradeable.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface IOFTV2Upgradeable is ICommonOFTUpgradeable {\n /**\n * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\n * `_from` the owner of token\n * `_dstChainId` the destination chain identifier\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_amount` the quantity of tokens in wei\n * `_refundAddress` the address LayerZero refunds if too much message fee is sent\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, LzCallParams calldata _callParams) external payable;\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) external payable;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/ProxyOFTV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"./BaseOFTV2Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\ncontract ProxyOFTV2Upgradeable is Initializable, BaseOFTV2Upgradeable, Proxied {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n IERC20Upgradeable internal innerToken;\n uint internal ld2sdRate;\n\n // total amount is transferred from this chain to other chains, ensuring the total is less than uint64.max in sd\n uint public outboundAmount;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address _token, uint8 _sharedDecimals, address _lzEndpoint) public initializer {\n __BaseOFTV2Upgradeable_init(_sharedDecimals, _lzEndpoint);\n\n innerToken = IERC20Upgradeable(_token);\n\n (bool success, bytes memory data) = _token.staticcall(abi.encodeWithSignature(\"decimals()\"));\n require(success, \"ProxyOFT: failed to get token decimals\");\n uint8 decimals = abi.decode(data, (uint8));\n\n require(_sharedDecimals <= decimals, \"ProxyOFT: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return innerToken.totalSupply() - outboundAmount;\n }\n\n function token() public view virtual override returns (address) {\n return address(innerToken);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n require(_from == _msgSender(), \"ProxyOFT: owner is not send caller\");\n\n _amount = _transferFrom(_from, address(this), _amount);\n\n // _amount still may have dust if the token has transfer fee, then give the dust back to the sender\n (uint amount, uint dust) = _removeDust(_amount);\n if (dust > 0) innerToken.safeTransfer(_from, dust);\n\n // check total outbound amount\n outboundAmount += amount;\n uint cap = _sd2ld(type(uint64).max);\n require(cap >= outboundAmount, \"ProxyOFT: outboundAmount overflow\");\n\n return amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n outboundAmount -= _amount;\n\n // tokens are already in this contract, so no need to transfer\n if (_toAddress == address(this)) {\n return _amount;\n }\n\n return _transferFrom(address(this), _toAddress, _amount);\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n uint before = innerToken.balanceOf(_to);\n if (_from == address(this)) {\n innerToken.safeTransfer(_to, _amount);\n } else {\n innerToken.safeTransferFrom(_from, _to, _amount);\n }\n return innerToken.balanceOf(_to) - before;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\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 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 /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\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 */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"./IERC721EnumerableUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\n function __ERC721Enumerable_init() internal onlyInitializing {\n }\n\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\n }\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Upgradeable.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721Upgradeable.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's 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 = ERC721Upgradeable.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\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 uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = 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 /**\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[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\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 */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721RoyaltyUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Royalty.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../common/ERC2981Upgradeable.sol\";\nimport \"../../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC721 with the ERC2981 NFT Royalty Standard, a standardized way to retrieve royalty payment\n * information.\n *\n * Royalty information can be specified globally for all token ids via {ERC2981-_setDefaultRoyalty}, and/or individually for\n * specific token ids via {ERC2981-_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC721RoyaltyUpgradeable is Initializable, ERC2981Upgradeable, ERC721Upgradeable {\n function __ERC721Royalty_init() internal onlyInitializing {\n }\n\n function __ERC721Royalty_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, ERC2981Upgradeable) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {ERC721-_burn}. This override additionally clears the royalty information for the token.\n */\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n _resetTokenRoyalty(tokenId);\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/token/common/ERC2981Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/IERC2981Upgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.\n *\n * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for\n * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the\n * fee is specified in basis points by default.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {\n function __ERC2981_init() internal onlyInitializing {\n }\n\n function __ERC2981_init_unchained() internal onlyInitializing {\n }\n struct RoyaltyInfo {\n address receiver;\n uint96 royaltyFraction;\n }\n\n RoyaltyInfo private _defaultRoyaltyInfo;\n mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) {\n return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @inheritdoc IERC2981Upgradeable\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) {\n RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];\n\n if (royalty.receiver == address(0)) {\n royalty = _defaultRoyaltyInfo;\n }\n\n uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();\n\n return (royalty.receiver, royaltyAmount);\n }\n\n /**\n * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a\n * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an\n * override.\n */\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: invalid receiver\");\n\n _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Removes default royalty information.\n */\n function _deleteDefaultRoyalty() internal virtual {\n delete _defaultRoyaltyInfo;\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: Invalid parameters\");\n\n _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Resets royalty information for the token id back to the global default.\n */\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n delete _tokenRoyaltyInfo[tokenId];\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[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981Upgradeable is IERC165Upgradeable {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount);\n}\n" + }, + "contracts/contracts-upgradable/token/onft1155/ProxyONFT1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol\";\nimport \"./ONFT1155CoreUpgradeable.sol\";\n\ncontract ProxyONFT1155Upgradeable is Initializable, ONFT1155CoreUpgradeable, IERC1155ReceiverUpgradeable, Proxied {\n using ERC165CheckerUpgradeable for address;\n\n IERC1155Upgradeable public token;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address _lzEndpoint, address _proxyToken) public virtual initializer {\n __ProxyONFT1155Upgradeable_init(_lzEndpoint, _proxyToken);\n }\n\n function __ProxyONFT1155Upgradeable_init(address _lzEndpoint, address _proxyToken) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n\n __ProxyONFT1155Upgradeable_init_unchained(_proxyToken);\n }\n\n function __ProxyONFT1155Upgradeable_init_unchained(address _proxyToken) internal onlyInitializing {\n require(_proxyToken.supportsInterface(type(IERC1155Upgradeable).interfaceId), \"ProxyONFT1155Upgradeable: invalid ERC1155 token\");\n token = IERC1155Upgradeable(_proxyToken);\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT1155CoreUpgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IERC1155ReceiverUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(address _from, uint16, bytes memory, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override {\n require(_from == _msgSender(), \"ProxyONFT1155: owner is not send caller\");\n token.safeBatchTransferFrom(_from, address(this), _tokenIds, _amounts, \"\");\n }\n\n function _creditTo(uint16, address _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override {\n token.safeBatchTransferFrom(address(this), _toAddress, _tokenIds, _amounts, \"\");\n }\n\n function onERC1155Received(address _operator, address, uint, uint, bytes memory) public virtual override returns (bytes4) {\n // only allow `this` to tranfser token from others\n if (_operator != address(this)) return bytes4(0);\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address _operator,\n address,\n uint[] memory,\n uint[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n // only allow `this` to tranfser token from others\n if (_operator != address(this)) return bytes4(0);\n return this.onERC1155BatchReceived.selector;\n }\n\n uint[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "contracts/contracts-upgradable/token/onft1155/ONFT1155CoreUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT1155CoreUpgradeable.sol\";\nimport \"../../lzApp/NonblockingLzAppUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\nabstract contract ONFT1155CoreUpgradeable is Initializable, NonblockingLzAppUpgradeable, ERC165Upgradeable, IONFT1155CoreUpgradeable {\n uint public constant NO_EXTRA_GAS = 0;\n uint16 public constant FUNCTION_TYPE_SEND = 1;\n uint16 public constant FUNCTION_TYPE_SEND_BATCH = 2;\n bool public useCustomAdapterParams;\n\n event SetUseCustomAdapterParams(bool _useCustomAdapterParams);\n\n function __ONFT1155CoreUpgradeable_init(address _lzEndpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n }\n\n function __ONFT1155CoreUpgradeable_init_unchained() internal onlyInitializing {}\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IONFT1155CoreUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n uint _amount,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _useZro, _adapterParams);\n }\n\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _sendBatch(\n _from,\n _dstChainId,\n _toAddress,\n _toSingletonArray(_tokenId),\n _toSingletonArray(_amount),\n _refundAddress,\n _zroPaymentAddress,\n _adapterParams\n );\n }\n\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _sendBatch(_from, _dstChainId, _toAddress, _tokenIds, _amounts, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _sendBatch(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual {\n _debitFrom(_from, _dstChainId, _toAddress, _tokenIds, _amounts);\n bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts);\n if (_tokenIds.length == 1) {\n if (useCustomAdapterParams) {\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, NO_EXTRA_GAS);\n } else {\n require(_adapterParams.length == 0, \"LzApp: _adapterParams must be empty.\");\n }\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds[0], _amounts[0]);\n } else if (_tokenIds.length > 1) {\n if (useCustomAdapterParams) {\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND_BATCH, _adapterParams, NO_EXTRA_GAS);\n } else {\n require(_adapterParams.length == 0, \"LzApp: _adapterParams must be empty.\");\n }\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendBatchToChain(_dstChainId, _from, _toAddress, _tokenIds, _amounts);\n }\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 /*_nonce*/,\n bytes memory _payload\n ) internal virtual override {\n // decode and load the toAddress\n (bytes memory toAddressBytes, uint[] memory tokenIds, uint[] memory amounts) = abi.decode(_payload, (bytes, uint[], uint[]));\n address toAddress;\n assembly {\n toAddress := mload(add(toAddressBytes, 20))\n }\n\n _creditTo(_srcChainId, toAddress, tokenIds, amounts);\n\n if (tokenIds.length == 1) {\n emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds[0], amounts[0]);\n } else if (tokenIds.length > 1) {\n emit ReceiveBatchFromChain(_srcChainId, _srcAddress, toAddress, tokenIds, amounts);\n }\n }\n\n function setUseCustomAdapterParams(bool _useCustomAdapterParams) external onlyOwner {\n useCustomAdapterParams = _useCustomAdapterParams;\n emit SetUseCustomAdapterParams(_useCustomAdapterParams);\n }\n\n function _debitFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual;\n\n function _creditTo(uint16 _srcChainId, address _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual;\n\n function _toSingletonArray(uint element) internal pure returns (uint[] memory) {\n uint[] memory array = new uint[](1);\n array[0] = element;\n return array;\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 uint[49] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/onft1155/interfaces/IONFT1155CoreUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Interface of the ONFT Core standard\n */\ninterface IONFT1155CoreUpgradeable is IERC165Upgradeable {\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint _tokenId, uint _amount);\n event SendBatchToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds, uint[] _amounts);\n event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint _tokenId, uint _amount);\n event ReceiveBatchFromChain(\n uint16 indexed _srcChainId,\n bytes indexed _srcAddress,\n address indexed _toAddress,\n uint[] _tokenIds,\n uint[] _amounts\n );\n\n // _from - address where tokens should be deducted from on behalf of\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenId - token Id to transfer\n // _amount - amount of the tokens to transfer\n // _refundAddress - address on src that will receive refund for any overpayment of L0 fees\n // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n // _from - address where tokens should be deducted from on behalf of\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenIds - token Ids to transfer\n // _amounts - amounts of the tokens to transfer\n // _refundAddress - address on src that will receive refund for any overpayment of L0 fees\n // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n uint[] calldata _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenId - token Id to transfer\n // _amount - amount of the tokens to transfer\n // _useZro - indicates to use zro to pay L0 fees\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function estimateSendFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenIds - tokens Id to transfer\n // _amounts - amounts of the tokens to transfer\n // _useZro - indicates to use zro to pay L0 fees\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n uint[] calldata _amounts,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n}\n" + }, + "contracts/lzApp/NonblockingLzApp.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./LzApp.sol\";\nimport \"../libraries/ExcessivelySafeCall.sol\";\n\n/*\n * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel\n * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking\n * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress)\n */\nabstract contract NonblockingLzApp is LzApp {\n using ExcessivelySafeCall for address;\n\n constructor(address _endpoint) LzApp(_endpoint) {}\n\n mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages;\n\n event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason);\n event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash);\n\n // overriding the virtual function in LzReceiver\n function _blockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual override {\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\n gasleft(),\n 150,\n abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)\n );\n if (!success) {\n _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason);\n }\n }\n\n function _storeFailedMessage(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload,\n bytes memory _reason\n ) internal virtual {\n failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload);\n emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason);\n }\n\n function nonblockingLzReceive(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes calldata _payload\n ) public virtual {\n // only internal transaction\n require(_msgSender() == address(this), \"NonblockingLzApp: caller must be LzApp\");\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n }\n\n //@notice override this function\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual;\n\n function retryMessage(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes calldata _payload\n ) public payable virtual {\n // assert there is message to retry\n bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce];\n require(payloadHash != bytes32(0), \"NonblockingLzApp: no stored message\");\n require(keccak256(_payload) == payloadHash, \"NonblockingLzApp: invalid payload\");\n // clear the stored message\n failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0);\n // execute the message. revert if it fails again\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash);\n }\n}\n" + }, + "contracts/lzApp/LzApp.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./interfaces/ILayerZeroReceiver.sol\";\nimport \"./interfaces/ILayerZeroUserApplicationConfig.sol\";\nimport \"./interfaces/ILayerZeroEndpoint.sol\";\nimport \"../libraries/BytesLib.sol\";\n\n/*\n * a generic LzReceiver implementation\n */\nabstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig {\n using BytesLib for bytes;\n\n // ua can not send payload larger than this by default, but it can be changed by the ua owner\n uint public constant DEFAULT_PAYLOAD_SIZE_LIMIT = 10000;\n\n ILayerZeroEndpoint public immutable lzEndpoint;\n mapping(uint16 => bytes) public trustedRemoteLookup;\n mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup;\n mapping(uint16 => uint) public payloadSizeLimitLookup;\n address public precrime;\n\n event SetPrecrime(address precrime);\n event SetTrustedRemote(uint16 _remoteChainId, bytes _path);\n event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress);\n event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas);\n\n constructor(address _endpoint) {\n lzEndpoint = ILayerZeroEndpoint(_endpoint);\n }\n\n function lzReceive(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes calldata _payload\n ) public virtual override {\n // lzReceive must be called by the endpoint for security\n require(_msgSender() == address(lzEndpoint), \"LzApp: invalid endpoint caller\");\n\n bytes memory trustedRemote = trustedRemoteLookup[_srcChainId];\n // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.\n require(\n _srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote),\n \"LzApp: invalid source sending contract\"\n );\n\n _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n }\n\n // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging\n function _blockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual;\n\n function _lzSend(\n uint16 _dstChainId,\n bytes memory _payload,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams,\n uint _nativeFee\n ) internal virtual {\n bytes memory trustedRemote = trustedRemoteLookup[_dstChainId];\n require(trustedRemote.length != 0, \"LzApp: destination chain is not a trusted source\");\n _checkPayloadSize(_dstChainId, _payload.length);\n lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _checkGasLimit(\n uint16 _dstChainId,\n uint16 _type,\n bytes memory _adapterParams,\n uint _extraGas\n ) internal view virtual {\n uint providedGasLimit = _getGasLimit(_adapterParams);\n uint minGasLimit = minDstGasLookup[_dstChainId][_type];\n require(minGasLimit > 0, \"LzApp: minGasLimit not set\");\n require(providedGasLimit >= minGasLimit + _extraGas, \"LzApp: gas limit is too low\");\n }\n\n function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) {\n require(_adapterParams.length >= 34, \"LzApp: invalid adapterParams\");\n assembly {\n gasLimit := mload(add(_adapterParams, 34))\n }\n }\n\n function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual {\n uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId];\n if (payloadSizeLimit == 0) {\n // use default if not set\n payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT;\n }\n require(_payloadSize <= payloadSizeLimit, \"LzApp: payload size is too large\");\n }\n\n //---------------------------UserApplication config----------------------------------------\n function getConfig(\n uint16 _version,\n uint16 _chainId,\n address,\n uint _configType\n ) external view returns (bytes memory) {\n return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);\n }\n\n // generic config for LayerZero user Application\n function setConfig(\n uint16 _version,\n uint16 _chainId,\n uint _configType,\n bytes calldata _config\n ) external override onlyOwner {\n lzEndpoint.setConfig(_version, _chainId, _configType, _config);\n }\n\n function setSendVersion(uint16 _version) external override onlyOwner {\n lzEndpoint.setSendVersion(_version);\n }\n\n function setReceiveVersion(uint16 _version) external override onlyOwner {\n lzEndpoint.setReceiveVersion(_version);\n }\n\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner {\n lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress);\n }\n\n // _path = abi.encodePacked(remoteAddress, localAddress)\n // this function set the trusted path for the cross-chain communication\n function setTrustedRemote(uint16 _remoteChainId, bytes calldata _path) external onlyOwner {\n trustedRemoteLookup[_remoteChainId] = _path;\n emit SetTrustedRemote(_remoteChainId, _path);\n }\n\n function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner {\n trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this));\n emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress);\n }\n\n function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) {\n bytes memory path = trustedRemoteLookup[_remoteChainId];\n require(path.length != 0, \"LzApp: no trusted path record\");\n return path.slice(0, path.length - 20); // the last 20 bytes should be address(this)\n }\n\n function setPrecrime(address _precrime) external onlyOwner {\n precrime = _precrime;\n emit SetPrecrime(_precrime);\n }\n\n function setMinDstGas(\n uint16 _dstChainId,\n uint16 _packetType,\n uint _minGas\n ) external onlyOwner {\n minDstGasLookup[_dstChainId][_packetType] = _minGas;\n emit SetMinDstGas(_dstChainId, _packetType, _minGas);\n }\n\n // if the size is 0, it means default size limit\n function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner {\n payloadSizeLimitLookup[_dstChainId] = _size;\n }\n\n //--------------------------- VIEW FUNCTION ----------------------------------------\n function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) {\n bytes memory trustedSource = trustedRemoteLookup[_srcChainId];\n return keccak256(trustedSource) == keccak256(_srcAddress);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.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 Ownable is Context {\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 constructor() {\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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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" + }, + "contracts/lzApp/interfaces/ILayerZeroReceiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface ILayerZeroReceiver {\n // @notice LayerZero endpoint will invoke this function to deliver the message on the destination\n // @param _srcChainId - the source endpoint identifier\n // @param _srcAddress - the source sending contract address from the source chain\n // @param _nonce - the ordered message nonce\n // @param _payload - the signed payload is the UA bytes has encoded to be sent\n function lzReceive(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes calldata _payload\n ) external;\n}\n" + }, + "contracts/lzApp/interfaces/ILayerZeroUserApplicationConfig.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface ILayerZeroUserApplicationConfig {\n // @notice set the configuration of the LayerZero messaging library of the specified version\n // @param _version - messaging library version\n // @param _chainId - the chainId for the pending config change\n // @param _configType - type of configuration. every messaging library has its own convention.\n // @param _config - configuration in the bytes. can encode arbitrary content.\n function setConfig(\n uint16 _version,\n uint16 _chainId,\n uint _configType,\n bytes calldata _config\n ) external;\n\n // @notice set the send() LayerZero messaging library version to _version\n // @param _version - new messaging library version\n function setSendVersion(uint16 _version) external;\n\n // @notice set the lzReceive() LayerZero messaging library version to _version\n // @param _version - new messaging library version\n function setReceiveVersion(uint16 _version) external;\n\n // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload\n // @param _srcChainId - the chainId of the source chain\n // @param _srcAddress - the contract address of the source contract at the source chain\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;\n}\n" + }, + "contracts/lzApp/interfaces/ILayerZeroEndpoint.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./ILayerZeroUserApplicationConfig.sol\";\n\ninterface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig {\n // @notice send a LayerZero message to the specified address at a LayerZero endpoint.\n // @param _dstChainId - the destination chain identifier\n // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains\n // @param _payload - a custom bytes payload to send to the destination contract\n // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address\n // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction\n // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination\n function send(\n uint16 _dstChainId,\n bytes calldata _destination,\n bytes calldata _payload,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n // @notice used by the messaging library to publish verified payload\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source contract (as bytes) at the source chain\n // @param _dstAddress - the address on destination chain\n // @param _nonce - the unbound message ordering nonce\n // @param _gasLimit - the gas limit for external contract execution\n // @param _payload - verified payload to send to the destination contract\n function receivePayload(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n address _dstAddress,\n uint64 _nonce,\n uint _gasLimit,\n bytes calldata _payload\n ) external;\n\n // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);\n\n // @notice get the outboundNonce from this source chain which, consequently, is always an EVM\n // @param _srcAddress - the source chain contract address\n function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);\n\n // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery\n // @param _dstChainId - the destination chain identifier\n // @param _userApplication - the user app address on this EVM chain\n // @param _payload - the custom message to send over LayerZero\n // @param _payInZRO - if false, user app pays the protocol fee in native token\n // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain\n function estimateFees(\n uint16 _dstChainId,\n address _userApplication,\n bytes calldata _payload,\n bool _payInZRO,\n bytes calldata _adapterParam\n ) external view returns (uint nativeFee, uint zroFee);\n\n // @notice get this Endpoint's immutable source identifier\n function getChainId() external view returns (uint16);\n\n // @notice the interface to retry failed message on this Endpoint destination\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n // @param _payload - the payload to be retried\n function retryPayload(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n bytes calldata _payload\n ) external;\n\n // @notice query if any STORED payload (message blocking) at the endpoint.\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);\n\n // @notice query if the _libraryAddress is valid for sending msgs.\n // @param _userApplication - the user app address on this EVM chain\n function getSendLibraryAddress(address _userApplication) external view returns (address);\n\n // @notice query if the _libraryAddress is valid for receiving msgs.\n // @param _userApplication - the user app address on this EVM chain\n function getReceiveLibraryAddress(address _userApplication) external view returns (address);\n\n // @notice query if the non-reentrancy guard for send() is on\n // @return true if the guard is on. false otherwise\n function isSendingPayload() external view returns (bool);\n\n // @notice query if the non-reentrancy guard for receive() is on\n // @return true if the guard is on. false otherwise\n function isReceivingPayload() external view returns (bool);\n\n // @notice get the configuration of the LayerZero messaging library of the specified version\n // @param _version - messaging library version\n // @param _chainId - the chainId for the pending config change\n // @param _userApplication - the contract address of the user application\n // @param _configType - type of configuration. every messaging library has its own convention.\n function getConfig(\n uint16 _version,\n uint16 _chainId,\n address _userApplication,\n uint _configType\n ) external view returns (bytes memory);\n\n // @notice get the send() LayerZero messaging library version\n // @param _userApplication - the contract address of the user application\n function getSendVersion(address _userApplication) external view returns (uint16);\n\n // @notice get the lzReceive() LayerZero messaging library version\n // @param _userApplication - the contract address of the user application\n function getReceiveVersion(address _userApplication) external view returns (uint16);\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" + }, + "contracts/token/onft721/ONFT721Core.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT721Core.sol\";\nimport \"../../lzApp/NonblockingLzApp.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\nabstract contract ONFT721Core is NonblockingLzApp, ERC165, ReentrancyGuard, IONFT721Core {\n uint16 public constant FUNCTION_TYPE_SEND = 1;\n\n struct StoredCredit {\n uint16 srcChainId;\n address toAddress;\n uint index; // which index of the tokenIds remain\n bool creditsRemain;\n }\n\n uint public minGasToTransferAndStore; // min amount of gas required to transfer, and also store the payload\n mapping(uint16 => uint) public dstChainIdToBatchLimit;\n mapping(uint16 => uint) public dstChainIdToTransferGas; // per transfer amount of gas required to mint/transfer on the dst\n mapping(bytes32 => StoredCredit) public storedCredits;\n\n constructor(uint _minGasToTransferAndStore, address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {\n require(_minGasToTransferAndStore > 0, \"minGasToTransferAndStore must be > 0\");\n minGasToTransferAndStore = _minGasToTransferAndStore;\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IONFT721Core).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _useZro, _adapterParams);\n }\n\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n bytes memory payload = abi.encode(_toAddress, _tokenIds);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _tokenIds, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual {\n // allow 1 by default\n require(_tokenIds.length > 0, \"tokenIds[] is empty\");\n require(_tokenIds.length == 1 || _tokenIds.length <= dstChainIdToBatchLimit[_dstChainId], \"batch size exceeds dst batch limit\");\n\n for (uint i = 0; i < _tokenIds.length; i++) {\n _debitFrom(_from, _dstChainId, _toAddress, _tokenIds[i]);\n }\n\n bytes memory payload = abi.encode(_toAddress, _tokenIds);\n\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, dstChainIdToTransferGas[_dstChainId] * _tokenIds.length);\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds);\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64, /*_nonce*/\n bytes memory _payload\n ) internal virtual override {\n // decode and load the toAddress\n (bytes memory toAddressBytes, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[]));\n\n address toAddress;\n assembly {\n toAddress := mload(add(toAddressBytes, 20))\n }\n\n uint nextIndex = _creditTill(_srcChainId, toAddress, 0, tokenIds);\n if (nextIndex < tokenIds.length) {\n // not enough gas to complete transfers, store to be cleared in another tx\n bytes32 hashedPayload = keccak256(_payload);\n storedCredits[hashedPayload] = StoredCredit(_srcChainId, toAddress, nextIndex, true);\n emit CreditStored(hashedPayload, _payload);\n }\n\n emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds);\n }\n\n // Public function for anyone to clear and deliver the remaining batch sent tokenIds\n function clearCredits(bytes memory _payload) external virtual nonReentrant {\n bytes32 hashedPayload = keccak256(_payload);\n require(storedCredits[hashedPayload].creditsRemain, \"no credits stored\");\n\n (, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[]));\n\n uint nextIndex = _creditTill(\n storedCredits[hashedPayload].srcChainId,\n storedCredits[hashedPayload].toAddress,\n storedCredits[hashedPayload].index,\n tokenIds\n );\n require(nextIndex > storedCredits[hashedPayload].index, \"not enough gas to process credit transfer\");\n\n if (nextIndex == tokenIds.length) {\n // cleared the credits, delete the element\n delete storedCredits[hashedPayload];\n emit CreditCleared(hashedPayload);\n } else {\n // store the next index to mint\n storedCredits[hashedPayload] = StoredCredit(\n storedCredits[hashedPayload].srcChainId,\n storedCredits[hashedPayload].toAddress,\n nextIndex,\n true\n );\n }\n }\n\n // When a srcChain has the ability to transfer more chainIds in a single tx than the dst can do.\n // Needs the ability to iterate and stop if the minGasToTransferAndStore is not met\n function _creditTill(\n uint16 _srcChainId,\n address _toAddress,\n uint _startIndex,\n uint[] memory _tokenIds\n ) internal returns (uint) {\n uint i = _startIndex;\n while (i < _tokenIds.length) {\n // if not enough gas to process, store this index for next loop\n if (gasleft() < minGasToTransferAndStore) break;\n\n _creditTo(_srcChainId, _toAddress, _tokenIds[i]);\n i++;\n }\n\n // indicates the next index to send of tokenIds,\n // if i == tokenIds.length, we are finished\n return i;\n }\n\n function setMinGasToTransferAndStore(uint _minGasToTransferAndStore) external onlyOwner {\n require(_minGasToTransferAndStore > 0, \"minGasToTransferAndStore must be > 0\");\n minGasToTransferAndStore = _minGasToTransferAndStore;\n emit SetMinGasToTransferAndStore(_minGasToTransferAndStore);\n }\n\n // ensures enough gas in adapter params to handle batch transfer gas amounts on the dst\n function setDstChainIdToTransferGas(uint16 _dstChainId, uint _dstChainIdToTransferGas) external onlyOwner {\n require(_dstChainIdToTransferGas > 0, \"dstChainIdToTransferGas must be > 0\");\n dstChainIdToTransferGas[_dstChainId] = _dstChainIdToTransferGas;\n emit SetDstChainIdToTransferGas(_dstChainId, _dstChainIdToTransferGas);\n }\n\n // limit on src the amount of tokens to batch send\n function setDstChainIdToBatchLimit(uint16 _dstChainId, uint _dstChainIdToBatchLimit) external onlyOwner {\n require(_dstChainIdToBatchLimit > 0, \"dstChainIdToBatchLimit must be > 0\");\n dstChainIdToBatchLimit[_dstChainId] = _dstChainIdToBatchLimit;\n emit SetDstChainIdToBatchLimit(_dstChainId, _dstChainIdToBatchLimit);\n }\n\n function _debitFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId\n ) internal virtual;\n\n function _creditTo(\n uint16 _srcChainId,\n address _toAddress,\n uint _tokenId\n ) internal virtual;\n\n function _toSingletonArray(uint element) internal pure returns (uint[] memory) {\n uint[] memory array = new uint[](1);\n array[0] = element;\n return array;\n }\n}\n" + }, + "contracts/token/onft721/interfaces/IONFT721Core.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface of the ONFT Core standard\n */\ninterface IONFT721Core is IERC165 {\n /**\n * @dev Emitted when `_tokenIds[]` are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\n * `_nonce` is the outbound nonce from\n */\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds);\n event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint[] _tokenIds);\n event SetMinGasToTransferAndStore(uint _minGasToTransferAndStore);\n event SetDstChainIdToTransferGas(uint16 _dstChainId, uint _dstChainIdToTransferGas);\n event SetDstChainIdToBatchLimit(uint16 _dstChainId, uint _dstChainIdToBatchLimit);\n\n /**\n * @dev Emitted when `_payload` was received from lz, but not enough gas to deliver all tokenIds\n */\n event CreditStored(bytes32 _hashedPayload, bytes _payload);\n /**\n * @dev Emitted when `_hashedPayload` has been completely delivered\n */\n event CreditCleared(bytes32 _hashedPayload);\n\n /**\n * @dev send token `_tokenId` to (`_dstChainId`, `_toAddress`) from `_from`\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n /**\n * @dev send tokens `_tokenIds[]` to (`_dstChainId`, `_toAddress`) from `_from`\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _tokenId - token Id to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _tokenIds[] - token Ids to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\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/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\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" + }, + "contracts/token/onft721/ProxyONFT721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\nimport \"./ONFT721Core.sol\";\n\ncontract ProxyONFT721 is ONFT721Core, IERC721Receiver {\n using ERC165Checker for address;\n\n IERC721 public immutable token;\n\n constructor(\n uint _minGasToTransfer,\n address _lzEndpoint,\n address _proxyToken\n ) ONFT721Core(_minGasToTransfer, _lzEndpoint) {\n require(_proxyToken.supportsInterface(type(IERC721).interfaceId), \"ProxyONFT721: invalid ERC721 token\");\n token = IERC721(_proxyToken);\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC721Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(\n address _from,\n uint16,\n bytes memory,\n uint _tokenId\n ) internal virtual override {\n require(_from == _msgSender(), \"ProxyONFT721: owner is not send caller\");\n token.safeTransferFrom(_from, address(this), _tokenId);\n }\n\n // TODO apply same changes from regular ONFT721\n function _creditTo(\n uint16,\n address _toAddress,\n uint _tokenId\n ) internal virtual override {\n token.safeTransferFrom(address(this), _toAddress, _tokenId);\n }\n\n function onERC721Received(\n address _operator,\n address,\n uint,\n bytes memory\n ) public virtual override returns (bytes4) {\n // only allow `this` to transfer token from others\n if (_operator != address(this)) return bytes4(0);\n return IERC721Receiver.onERC721Received.selector;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface.\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return\n supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&\n !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(\n address account,\n bytes4[] memory interfaceIds\n ) internal view returns (bool[] memory) {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n *\n * Some precompiled contracts will falsely indicate support for a given interface, so caution\n * should be exercised when using this function.\n *\n * Interface identification is specified in ERC-165.\n */\n function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {\n // prepare call\n bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);\n\n // perform static call\n bool success;\n uint256 returnSize;\n uint256 returnValue;\n assembly {\n success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n returnSize := returndatasize()\n returnValue := mload(0x00)\n }\n\n return success && returnSize >= 0x20 && returnValue > 0;\n }\n}\n" + }, + "contracts/token/onft721/ONFT721A.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"erc721a/contracts/ERC721A.sol\";\nimport \"erc721a/contracts/IERC721A.sol\";\nimport \"./interfaces/IONFT721.sol\";\nimport \"./ONFT721Core.sol\";\n\n// DISCLAIMER:\n// This contract can only be deployed on one chain and must be the first minter of each token id!\n// This is because ERC721A does not have the ability to mint a specific token id.\n// Other chains must have ONFT721 deployed.\n\n// NOTE: this ONFT contract has no public minting logic.\n// must implement your own minting logic in child contract\ncontract ONFT721A is ONFT721Core, ERC721A, ERC721A__IERC721Receiver {\n constructor(\n string memory _name,\n string memory _symbol,\n uint _minGasToTransferAndStore,\n address _lzEndpoint\n ) ERC721A(_name, _symbol) ONFT721Core(_minGasToTransferAndStore, _lzEndpoint) {}\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT721Core, ERC721A) returns (bool) {\n return interfaceId == type(IONFT721Core).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(\n address _from,\n uint16,\n bytes memory,\n uint _tokenId\n ) internal virtual override(ONFT721Core) {\n safeTransferFrom(_from, address(this), _tokenId);\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _tokenId\n ) internal virtual override(ONFT721Core) {\n require(_exists(_tokenId) && ERC721A.ownerOf(_tokenId) == address(this));\n safeTransferFrom(address(this), _toAddress, _tokenId);\n }\n\n function onERC721Received(\n address,\n address,\n uint,\n bytes memory\n ) public virtual override returns (bytes4) {\n return ERC721A__IERC721Receiver.onERC721Received.selector;\n }\n}\n" + }, + "erc721a/contracts/ERC721A.sol": { + "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport './IERC721A.sol';\n\n/**\n * @dev Interface of ERC721 token receiver.\n */\ninterface ERC721A__IERC721Receiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\n/**\n * @title ERC721A\n *\n * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)\n * Non-Fungible Token Standard, including the Metadata extension.\n * Optimized for lower gas during batch mints.\n *\n * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)\n * starting from `_startTokenId()`.\n *\n * Assumptions:\n *\n * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.\n * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).\n */\ncontract ERC721A is IERC721A {\n // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).\n struct TokenApprovalRef {\n address value;\n }\n\n // =============================================================\n // CONSTANTS\n // =============================================================\n\n // Mask of an entry in packed address data.\n uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;\n\n // The bit position of `numberMinted` in packed address data.\n uint256 private constant _BITPOS_NUMBER_MINTED = 64;\n\n // The bit position of `numberBurned` in packed address data.\n uint256 private constant _BITPOS_NUMBER_BURNED = 128;\n\n // The bit position of `aux` in packed address data.\n uint256 private constant _BITPOS_AUX = 192;\n\n // Mask of all 256 bits in packed address data except the 64 bits for `aux`.\n uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;\n\n // The bit position of `startTimestamp` in packed ownership.\n uint256 private constant _BITPOS_START_TIMESTAMP = 160;\n\n // The bit mask of the `burned` bit in packed ownership.\n uint256 private constant _BITMASK_BURNED = 1 << 224;\n\n // The bit position of the `nextInitialized` bit in packed ownership.\n uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;\n\n // The bit mask of the `nextInitialized` bit in packed ownership.\n uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;\n\n // The bit position of `extraData` in packed ownership.\n uint256 private constant _BITPOS_EXTRA_DATA = 232;\n\n // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.\n uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;\n\n // The mask of the lower 160 bits for addresses.\n uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;\n\n // The maximum `quantity` that can be minted with {_mintERC2309}.\n // This limit is to prevent overflows on the address data entries.\n // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}\n // is required to cause an overflow, which is unrealistic.\n uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;\n\n // The `Transfer` event signature is given by:\n // `keccak256(bytes(\"Transfer(address,address,uint256)\"))`.\n bytes32 private constant _TRANSFER_EVENT_SIGNATURE =\n 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;\n\n // =============================================================\n // STORAGE\n // =============================================================\n\n // The next token ID to be minted.\n uint256 private _currentIndex;\n\n // The number of tokens burned.\n uint256 private _burnCounter;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to ownership details\n // An empty struct value does not necessarily mean the token is unowned.\n // See {_packedOwnershipOf} implementation for details.\n //\n // Bits Layout:\n // - [0..159] `addr`\n // - [160..223] `startTimestamp`\n // - [224] `burned`\n // - [225] `nextInitialized`\n // - [232..255] `extraData`\n mapping(uint256 => uint256) private _packedOwnerships;\n\n // Mapping owner address to address data.\n //\n // Bits Layout:\n // - [0..63] `balance`\n // - [64..127] `numberMinted`\n // - [128..191] `numberBurned`\n // - [192..255] `aux`\n mapping(address => uint256) private _packedAddressData;\n\n // Mapping from token ID to approved address.\n mapping(uint256 => TokenApprovalRef) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // =============================================================\n // CONSTRUCTOR\n // =============================================================\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n _currentIndex = _startTokenId();\n }\n\n // =============================================================\n // TOKEN COUNTING OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the starting token ID.\n * To change the starting token ID, please override this function.\n */\n function _startTokenId() internal view virtual returns (uint256) {\n return 0;\n }\n\n /**\n * @dev Returns the next token ID to be minted.\n */\n function _nextTokenId() internal view virtual returns (uint256) {\n return _currentIndex;\n }\n\n /**\n * @dev Returns the total number of tokens in existence.\n * Burned tokens will reduce the count.\n * To get the total number of tokens minted, please see {_totalMinted}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n // Counter underflow is impossible as _burnCounter cannot be incremented\n // more than `_currentIndex - _startTokenId()` times.\n unchecked {\n return _currentIndex - _burnCounter - _startTokenId();\n }\n }\n\n /**\n * @dev Returns the total amount of tokens minted in the contract.\n */\n function _totalMinted() internal view virtual returns (uint256) {\n // Counter underflow is impossible as `_currentIndex` does not decrement,\n // and it is initialized to `_startTokenId()`.\n unchecked {\n return _currentIndex - _startTokenId();\n }\n }\n\n /**\n * @dev Returns the total number of tokens burned.\n */\n function _totalBurned() internal view virtual returns (uint256) {\n return _burnCounter;\n }\n\n // =============================================================\n // ADDRESS DATA OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the number of tokens in `owner`'s account.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n if (owner == address(0)) revert BalanceQueryForZeroAddress();\n return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the number of tokens minted by `owner`.\n */\n function _numberMinted(address owner) internal view returns (uint256) {\n return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the number of tokens burned by or on behalf of `owner`.\n */\n function _numberBurned(address owner) internal view returns (uint256) {\n return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n */\n function _getAux(address owner) internal view returns (uint64) {\n return uint64(_packedAddressData[owner] >> _BITPOS_AUX);\n }\n\n /**\n * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n * If there are multiple variables, please pack them into a uint64.\n */\n function _setAux(address owner, uint64 aux) internal virtual {\n uint256 packed = _packedAddressData[owner];\n uint256 auxCasted;\n // Cast `aux` with assembly to avoid redundant masking.\n assembly {\n auxCasted := aux\n }\n packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);\n _packedAddressData[owner] = packed;\n }\n\n // =============================================================\n // IERC165\n // =============================================================\n\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30000 gas.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n // The interface IDs are constants representing the first 4 bytes\n // of the XOR of all function selectors in the interface.\n // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)\n // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)\n return\n interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.\n interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.\n interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.\n }\n\n // =============================================================\n // IERC721Metadata\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 Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n if (!_exists(tokenId)) revert URIQueryForNonexistentToken();\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, it can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return '';\n }\n\n // =============================================================\n // OWNERSHIPS OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n return address(uint160(_packedOwnershipOf(tokenId)));\n }\n\n /**\n * @dev Gas spent here starts off proportional to the maximum mint batch size.\n * It gradually moves to O(1) as tokens get transferred around over time.\n */\n function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnershipOf(tokenId));\n }\n\n /**\n * @dev Returns the unpacked `TokenOwnership` struct at `index`.\n */\n function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnerships[index]);\n }\n\n /**\n * @dev Initializes the ownership slot minted at `index` for efficiency purposes.\n */\n function _initializeOwnershipAt(uint256 index) internal virtual {\n if (_packedOwnerships[index] == 0) {\n _packedOwnerships[index] = _packedOwnershipOf(index);\n }\n }\n\n /**\n * Returns the packed ownership data of `tokenId`.\n */\n function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {\n uint256 curr = tokenId;\n\n unchecked {\n if (_startTokenId() <= curr)\n if (curr < _currentIndex) {\n uint256 packed = _packedOwnerships[curr];\n // If not burned.\n if (packed & _BITMASK_BURNED == 0) {\n // Invariant:\n // There will always be an initialized ownership slot\n // (i.e. `ownership.addr != address(0) && ownership.burned == false`)\n // before an unintialized ownership slot\n // (i.e. `ownership.addr == address(0) && ownership.burned == false`)\n // Hence, `curr` will not underflow.\n //\n // We can directly compare the packed value.\n // If the address is zero, packed will be zero.\n while (packed == 0) {\n packed = _packedOwnerships[--curr];\n }\n return packed;\n }\n }\n }\n revert OwnerQueryForNonexistentToken();\n }\n\n /**\n * @dev Returns the unpacked `TokenOwnership` struct from `packed`.\n */\n function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {\n ownership.addr = address(uint160(packed));\n ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);\n ownership.burned = packed & _BITMASK_BURNED != 0;\n ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);\n }\n\n /**\n * @dev Packs ownership data into a single uint256.\n */\n function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {\n assembly {\n // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n owner := and(owner, _BITMASK_ADDRESS)\n // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.\n result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))\n }\n }\n\n /**\n * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.\n */\n function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {\n // For branchless setting of the `nextInitialized` flag.\n assembly {\n // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.\n result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))\n }\n }\n\n // =============================================================\n // APPROVAL OPERATIONS\n // =============================================================\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the\n * zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) public payable virtual override {\n address owner = ownerOf(tokenId);\n\n if (_msgSenderERC721A() != owner)\n if (!isApprovedForAll(owner, _msgSenderERC721A())) {\n revert ApprovalCallerNotOwnerNorApproved();\n }\n\n _tokenApprovals[tokenId].value = to;\n emit Approval(owner, to, tokenId);\n }\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();\n\n return _tokenApprovals[tokenId].value;\n }\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom}\n * for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _operatorApprovals[_msgSenderERC721A()][operator] = approved;\n emit ApprovalForAll(_msgSenderERC721A(), operator, approved);\n }\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted. See {_mint}.\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return\n _startTokenId() <= tokenId &&\n tokenId < _currentIndex && // If within bounds,\n _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.\n }\n\n /**\n * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.\n */\n function _isSenderApprovedOrOwner(\n address approvedAddress,\n address owner,\n address msgSender\n ) private pure returns (bool result) {\n assembly {\n // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n owner := and(owner, _BITMASK_ADDRESS)\n // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.\n msgSender := and(msgSender, _BITMASK_ADDRESS)\n // `msgSender == owner || msgSender == approvedAddress`.\n result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))\n }\n }\n\n /**\n * @dev Returns the storage slot and value for the approved address of `tokenId`.\n */\n function _getApprovedSlotAndAddress(uint256 tokenId)\n private\n view\n returns (uint256 approvedAddressSlot, address approvedAddress)\n {\n TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];\n // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.\n assembly {\n approvedAddressSlot := tokenApproval.slot\n approvedAddress := sload(approvedAddressSlot)\n }\n }\n\n // =============================================================\n // TRANSFER OPERATIONS\n // =============================================================\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token\n * by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public payable virtual override {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();\n\n (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);\n\n // The nested ifs save around 20+ gas over a compound boolean condition.\n if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))\n if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();\n\n if (to == address(0)) revert TransferToZeroAddress();\n\n _beforeTokenTransfers(from, to, tokenId, 1);\n\n // Clear approvals from the previous owner.\n assembly {\n if approvedAddress {\n // This is equivalent to `delete _tokenApprovals[tokenId]`.\n sstore(approvedAddressSlot, 0)\n }\n }\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n unchecked {\n // We can directly increment and decrement the balances.\n --_packedAddressData[from]; // Updates: `balance -= 1`.\n ++_packedAddressData[to]; // Updates: `balance += 1`.\n\n // Updates:\n // - `address` to the next owner.\n // - `startTimestamp` to the timestamp of transfering.\n // - `burned` to `false`.\n // - `nextInitialized` to `true`.\n _packedOwnerships[tokenId] = _packOwnershipData(\n to,\n _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)\n );\n\n // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n // If the next slot's address is zero and not burned (i.e. packed value is zero).\n if (_packedOwnerships[nextTokenId] == 0) {\n // If the next slot is within bounds.\n if (nextTokenId != _currentIndex) {\n // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, to, tokenId);\n _afterTokenTransfers(from, to, tokenId, 1);\n }\n\n /**\n * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\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 /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token\n * by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public payable virtual override {\n transferFrom(from, to, tokenId);\n if (to.code.length != 0)\n if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n }\n\n /**\n * @dev Hook that is called before a set of serially-ordered token IDs\n * are about to be transferred. This includes minting.\n * And also called before burning one token.\n *\n * `startTokenId` - the first token ID to be transferred.\n * `quantity` - the amount to be transferred.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, `tokenId` will be burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _beforeTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after a set of serially-ordered token IDs\n * have been transferred. This includes minting.\n * And also called after one token has been burned.\n *\n * `startTokenId` - the first token ID to be transferred.\n * `quantity` - the amount to be transferred.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been\n * transferred to `to`.\n * - When `from` is zero, `tokenId` has been minted for `to`.\n * - When `to` is zero, `tokenId` has been burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _afterTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n /**\n * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.\n *\n * `from` - Previous owner of the given token ID.\n * `to` - Target address that will receive the token.\n * `tokenId` - Token ID to be transferred.\n * `_data` - Optional data to send along with the call.\n *\n * Returns whether the call correctly returned the expected magic value.\n */\n function _checkContractOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (\n bytes4 retval\n ) {\n return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert TransferToNonERC721ReceiverImplementer();\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n\n // =============================================================\n // MINT OPERATIONS\n // =============================================================\n\n /**\n * @dev Mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `quantity` must be greater than 0.\n *\n * Emits a {Transfer} event for each mint.\n */\n function _mint(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n if (quantity == 0) revert MintZeroQuantity();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are incredibly unrealistic.\n // `balance` and `numberMinted` have a maximum limit of 2**64.\n // `tokenId` has a maximum limit of 2**256.\n unchecked {\n // Updates:\n // - `balance += quantity`.\n // - `numberMinted += quantity`.\n //\n // We can directly add to the `balance` and `numberMinted`.\n _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n // Updates:\n // - `address` to the owner.\n // - `startTimestamp` to the timestamp of minting.\n // - `burned` to `false`.\n // - `nextInitialized` to `quantity == 1`.\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)\n );\n\n uint256 toMasked;\n uint256 end = startTokenId + quantity;\n\n // Use assembly to loop and emit the `Transfer` event for gas savings.\n // The duplicated `log4` removes an extra check and reduces stack juggling.\n // The assembly, together with the surrounding Solidity code, have been\n // delicately arranged to nudge the compiler into producing optimized opcodes.\n assembly {\n // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.\n toMasked := and(to, _BITMASK_ADDRESS)\n // Emit the `Transfer` event.\n log4(\n 0, // Start of data (0, since no data).\n 0, // End of data (0, since no data).\n _TRANSFER_EVENT_SIGNATURE, // Signature.\n 0, // `address(0)`.\n toMasked, // `to`.\n startTokenId // `tokenId`.\n )\n\n // The `iszero(eq(,))` check ensures that large values of `quantity`\n // that overflows uint256 will make the loop run out of gas.\n // The compiler will optimize the `iszero` away for performance.\n for {\n let tokenId := add(startTokenId, 1)\n } iszero(eq(tokenId, end)) {\n tokenId := add(tokenId, 1)\n } {\n // Emit the `Transfer` event. Similar to above.\n log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)\n }\n }\n if (toMasked == 0) revert MintToZeroAddress();\n\n _currentIndex = end;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Mints `quantity` tokens and transfers them to `to`.\n *\n * This function is intended for efficient minting only during contract creation.\n *\n * It emits only one {ConsecutiveTransfer} as defined in\n * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),\n * instead of a sequence of {Transfer} event(s).\n *\n * Calling this function outside of contract creation WILL make your contract\n * non-compliant with the ERC721 standard.\n * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309\n * {ConsecutiveTransfer} event is only permissible during contract creation.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `quantity` must be greater than 0.\n *\n * Emits a {ConsecutiveTransfer} event.\n */\n function _mintERC2309(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n if (to == address(0)) revert MintToZeroAddress();\n if (quantity == 0) revert MintZeroQuantity();\n if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are unrealistic due to the above check for `quantity` to be below the limit.\n unchecked {\n // Updates:\n // - `balance += quantity`.\n // - `numberMinted += quantity`.\n //\n // We can directly add to the `balance` and `numberMinted`.\n _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n // Updates:\n // - `address` to the owner.\n // - `startTimestamp` to the timestamp of minting.\n // - `burned` to `false`.\n // - `nextInitialized` to `quantity == 1`.\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)\n );\n\n emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);\n\n _currentIndex = startTokenId + quantity;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Safely mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.\n * - `quantity` must be greater than 0.\n *\n * See {_mint}.\n *\n * Emits a {Transfer} event for each mint.\n */\n function _safeMint(\n address to,\n uint256 quantity,\n bytes memory _data\n ) internal virtual {\n _mint(to, quantity);\n\n unchecked {\n if (to.code.length != 0) {\n uint256 end = _currentIndex;\n uint256 index = end - quantity;\n do {\n if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n } while (index < end);\n // Reentrancy protection.\n if (_currentIndex != end) revert();\n }\n }\n }\n\n /**\n * @dev Equivalent to `_safeMint(to, quantity, '')`.\n */\n function _safeMint(address to, uint256 quantity) internal virtual {\n _safeMint(to, quantity, '');\n }\n\n // =============================================================\n // BURN OPERATIONS\n // =============================================================\n\n /**\n * @dev Equivalent to `_burn(tokenId, false)`.\n */\n function _burn(uint256 tokenId) internal virtual {\n _burn(tokenId, false);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId, bool approvalCheck) internal virtual {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n address from = address(uint160(prevOwnershipPacked));\n\n (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);\n\n if (approvalCheck) {\n // The nested ifs save around 20+ gas over a compound boolean condition.\n if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))\n if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();\n }\n\n _beforeTokenTransfers(from, address(0), tokenId, 1);\n\n // Clear approvals from the previous owner.\n assembly {\n if approvedAddress {\n // This is equivalent to `delete _tokenApprovals[tokenId]`.\n sstore(approvedAddressSlot, 0)\n }\n }\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n unchecked {\n // Updates:\n // - `balance -= 1`.\n // - `numberBurned += 1`.\n //\n // We can directly decrement the balance, and increment the number burned.\n // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.\n _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;\n\n // Updates:\n // - `address` to the last owner.\n // - `startTimestamp` to the timestamp of burning.\n // - `burned` to `true`.\n // - `nextInitialized` to `true`.\n _packedOwnerships[tokenId] = _packOwnershipData(\n from,\n (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)\n );\n\n // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n // If the next slot's address is zero and not burned (i.e. packed value is zero).\n if (_packedOwnerships[nextTokenId] == 0) {\n // If the next slot is within bounds.\n if (nextTokenId != _currentIndex) {\n // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, address(0), tokenId);\n _afterTokenTransfers(from, address(0), tokenId, 1);\n\n // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.\n unchecked {\n _burnCounter++;\n }\n }\n\n // =============================================================\n // EXTRA DATA OPERATIONS\n // =============================================================\n\n /**\n * @dev Directly sets the extra data for the ownership data `index`.\n */\n function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {\n uint256 packed = _packedOwnerships[index];\n if (packed == 0) revert OwnershipNotInitializedForExtraData();\n uint256 extraDataCasted;\n // Cast `extraData` with assembly to avoid redundant masking.\n assembly {\n extraDataCasted := extraData\n }\n packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);\n _packedOwnerships[index] = packed;\n }\n\n /**\n * @dev Called during each token transfer to set the 24bit `extraData` field.\n * Intended to be overridden by the cosumer contract.\n *\n * `previousExtraData` - the value of `extraData` before transfer.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, `tokenId` will be burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _extraData(\n address from,\n address to,\n uint24 previousExtraData\n ) internal view virtual returns (uint24) {}\n\n /**\n * @dev Returns the next extra data for the packed ownership data.\n * The returned result is shifted into position.\n */\n function _nextExtraData(\n address from,\n address to,\n uint256 prevOwnershipPacked\n ) private view returns (uint256) {\n uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);\n return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;\n }\n\n // =============================================================\n // OTHER OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the message sender (defaults to `msg.sender`).\n *\n * If you are writing GSN compatible contracts, you need to override this function.\n */\n function _msgSenderERC721A() internal view virtual returns (address) {\n return msg.sender;\n }\n\n /**\n * @dev Converts a uint256 to its ASCII string decimal representation.\n */\n function _toString(uint256 value) internal pure virtual returns (string memory str) {\n assembly {\n // The maximum value of a uint256 contains 78 digits (1 byte per digit), but\n // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.\n // We will need 1 word for the trailing zeros padding, 1 word for the length,\n // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.\n let m := add(mload(0x40), 0xa0)\n // Update the free memory pointer to allocate.\n mstore(0x40, m)\n // Assign the `str` to the end.\n str := sub(m, 0x20)\n // Zeroize the slot after the string.\n mstore(str, 0)\n\n // Cache the end of the memory to calculate the length later.\n let end := str\n\n // We write the string from rightmost digit to leftmost digit.\n // The following is essentially a do-while loop that also handles the zero case.\n // prettier-ignore\n for { let temp := value } 1 {} {\n str := sub(str, 1)\n // Write the character to the pointer.\n // The ASCII index of the '0' character is 48.\n mstore8(str, add(48, mod(temp, 10)))\n // Keep dividing `temp` until zero.\n temp := div(temp, 10)\n // prettier-ignore\n if iszero(temp) { break }\n }\n\n let length := sub(end, str)\n // Move the pointer 32 bytes leftwards to make room for the length.\n str := sub(str, 0x20)\n // Store the length.\n mstore(str, length)\n }\n }\n}\n" + }, + "erc721a/contracts/IERC721A.sol": { + "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\n/**\n * @dev Interface of ERC721A.\n */\ninterface IERC721A {\n /**\n * The caller must own the token or be an approved operator.\n */\n error ApprovalCallerNotOwnerNorApproved();\n\n /**\n * The token does not exist.\n */\n error ApprovalQueryForNonexistentToken();\n\n /**\n * Cannot query the balance for the zero address.\n */\n error BalanceQueryForZeroAddress();\n\n /**\n * Cannot mint to the zero address.\n */\n error MintToZeroAddress();\n\n /**\n * The quantity of tokens minted must be more than zero.\n */\n error MintZeroQuantity();\n\n /**\n * The token does not exist.\n */\n error OwnerQueryForNonexistentToken();\n\n /**\n * The caller must own the token or be an approved operator.\n */\n error TransferCallerNotOwnerNorApproved();\n\n /**\n * The token must be owned by `from`.\n */\n error TransferFromIncorrectOwner();\n\n /**\n * Cannot safely transfer to a contract that does not implement the\n * ERC721Receiver interface.\n */\n error TransferToNonERC721ReceiverImplementer();\n\n /**\n * Cannot transfer to the zero address.\n */\n error TransferToZeroAddress();\n\n /**\n * The token does not exist.\n */\n error URIQueryForNonexistentToken();\n\n /**\n * The `quantity` minted with ERC2309 exceeds the safety limit.\n */\n error MintERC2309QuantityExceedsLimit();\n\n /**\n * The `extraData` cannot be set on an unintialized ownership slot.\n */\n error OwnershipNotInitializedForExtraData();\n\n // =============================================================\n // STRUCTS\n // =============================================================\n\n struct TokenOwnership {\n // The address of the owner.\n address addr;\n // Stores the start time of ownership with minimal overhead for tokenomics.\n uint64 startTimestamp;\n // Whether the token has been burned.\n bool burned;\n // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.\n uint24 extraData;\n }\n\n // =============================================================\n // TOKEN COUNTERS\n // =============================================================\n\n /**\n * @dev Returns the total number of tokens in existence.\n * Burned tokens will reduce the count.\n * To get the total number of tokens minted, please see {_totalMinted}.\n */\n function totalSupply() external view returns (uint256);\n\n // =============================================================\n // IERC165\n // =============================================================\n\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n\n // =============================================================\n // IERC721\n // =============================================================\n\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables\n * (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in `owner`'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`,\n * checking first that contract recipients are aware of the ERC721 protocol\n * to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move\n * this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external payable;\n\n /**\n * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external payable;\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom}\n * whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token\n * by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external payable;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the\n * zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external payable;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom}\n * for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n // =============================================================\n // IERC721Metadata\n // =============================================================\n\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n\n // =============================================================\n // IERC2309\n // =============================================================\n\n /**\n * @dev Emitted when tokens in `fromTokenId` to `toTokenId`\n * (inclusive) is transferred from `from` to `to`, as defined in the\n * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.\n *\n * See {_mintERC2309} for more details.\n */\n event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);\n}\n" + }, + "contracts/token/onft721/interfaces/IONFT721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./IONFT721Core.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/**\n * @dev Interface of the ONFT standard\n */\ninterface IONFT721 is IONFT721Core, IERC721 {\n\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.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 */\ninterface IERC721Enumerable is IERC721 {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"./IERC721Enumerable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721Enumerable is ERC721, IERC721Enumerable {\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {\n return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Enumerable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's 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 = ERC721.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\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 uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = 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" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\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 IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.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 /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.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 */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) 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/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.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 `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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 256, 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 << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "contracts/token/onft721/mocks/ERC721Mock.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\n\n// for mock purposes only, no limit on minting functionality\ncontract ERC721Mock is ERC721 {\n constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {}\n\n string public baseTokenURI;\n\n function mint(address to, uint tokenId) public {\n _safeMint(to, tokenId, \"\");\n }\n\n function transfer(address to, uint tokenId) public {\n _safeTransfer(msg.sender, to, tokenId, \"\");\n }\n\n function isApprovedOrOwner(address spender, uint tokenId) public view virtual returns (bool) {\n return _isApprovedOrOwner(spender, tokenId);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Royalty.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"../../common/ERC2981.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Extension of ERC721 with the ERC2981 NFT Royalty Standard, a standardized way to retrieve royalty payment\n * information.\n *\n * Royalty information can be specified globally for all token ids via {ERC2981-_setDefaultRoyalty}, and/or individually for\n * specific token ids via {ERC2981-_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC721Royalty is ERC2981, ERC721 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {ERC721-_burn}. This override additionally clears the royalty information for the token.\n */\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n _resetTokenRoyalty(tokenId);\n }\n}\n" + }, + "@openzeppelin/contracts/token/common/ERC2981.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/IERC2981.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.\n *\n * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for\n * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the\n * fee is specified in basis points by default.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC2981 is IERC2981, ERC165 {\n struct RoyaltyInfo {\n address receiver;\n uint96 royaltyFraction;\n }\n\n RoyaltyInfo private _defaultRoyaltyInfo;\n mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {\n return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @inheritdoc IERC2981\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) {\n RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];\n\n if (royalty.receiver == address(0)) {\n royalty = _defaultRoyaltyInfo;\n }\n\n uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();\n\n return (royalty.receiver, royaltyAmount);\n }\n\n /**\n * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a\n * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an\n * override.\n */\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: invalid receiver\");\n\n _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Removes default royalty information.\n */\n function _deleteDefaultRoyalty() internal virtual {\n delete _defaultRoyaltyInfo;\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: Invalid parameters\");\n\n _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Resets royalty information for the token id back to the global default.\n */\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n delete _tokenRoyaltyInfo[tokenId];\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC2981.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981 is IERC165 {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount);\n}\n" + }, + "contracts/token/onft1155/ONFT1155Core.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT1155Core.sol\";\nimport \"../../lzApp/NonblockingLzApp.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract ONFT1155Core is NonblockingLzApp, ERC165, IONFT1155Core {\n uint public constant NO_EXTRA_GAS = 0;\n uint16 public constant FUNCTION_TYPE_SEND = 1;\n uint16 public constant FUNCTION_TYPE_SEND_BATCH = 2;\n bool public useCustomAdapterParams;\n\n event SetUseCustomAdapterParams(bool _useCustomAdapterParams);\n\n constructor(address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {}\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IONFT1155Core).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n uint _amount,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _useZro, _adapterParams);\n }\n\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _sendBatch(\n _from,\n _dstChainId,\n _toAddress,\n _toSingletonArray(_tokenId),\n _toSingletonArray(_amount),\n _refundAddress,\n _zroPaymentAddress,\n _adapterParams\n );\n }\n\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _sendBatch(_from, _dstChainId, _toAddress, _tokenIds, _amounts, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _sendBatch(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual {\n _debitFrom(_from, _dstChainId, _toAddress, _tokenIds, _amounts);\n bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts);\n if (_tokenIds.length == 1) {\n if (useCustomAdapterParams) {\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, NO_EXTRA_GAS);\n } else {\n require(_adapterParams.length == 0, \"LzApp: _adapterParams must be empty.\");\n }\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds[0], _amounts[0]);\n } else if (_tokenIds.length > 1) {\n if (useCustomAdapterParams) {\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND_BATCH, _adapterParams, NO_EXTRA_GAS);\n } else {\n require(_adapterParams.length == 0, \"LzApp: _adapterParams must be empty.\");\n }\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendBatchToChain(_dstChainId, _from, _toAddress, _tokenIds, _amounts);\n }\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64, /*_nonce*/\n bytes memory _payload\n ) internal virtual override {\n // decode and load the toAddress\n (bytes memory toAddressBytes, uint[] memory tokenIds, uint[] memory amounts) = abi.decode(_payload, (bytes, uint[], uint[]));\n address toAddress;\n assembly {\n toAddress := mload(add(toAddressBytes, 20))\n }\n\n _creditTo(_srcChainId, toAddress, tokenIds, amounts);\n\n if (tokenIds.length == 1) {\n emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds[0], amounts[0]);\n } else if (tokenIds.length > 1) {\n emit ReceiveBatchFromChain(_srcChainId, _srcAddress, toAddress, tokenIds, amounts);\n }\n }\n\n function setUseCustomAdapterParams(bool _useCustomAdapterParams) external onlyOwner {\n useCustomAdapterParams = _useCustomAdapterParams;\n emit SetUseCustomAdapterParams(_useCustomAdapterParams);\n }\n\n function _debitFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual;\n\n function _creditTo(\n uint16 _srcChainId,\n address _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual;\n\n function _toSingletonArray(uint element) internal pure returns (uint[] memory) {\n uint[] memory array = new uint[](1);\n array[0] = element;\n return array;\n }\n}\n" + }, + "contracts/token/onft1155/interfaces/IONFT1155Core.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface of the ONFT Core standard\n */\ninterface IONFT1155Core is IERC165 {\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint _tokenId, uint _amount);\n event SendBatchToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds, uint[] _amounts);\n event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint _tokenId, uint _amount);\n event ReceiveBatchFromChain(\n uint16 indexed _srcChainId,\n bytes indexed _srcAddress,\n address indexed _toAddress,\n uint[] _tokenIds,\n uint[] _amounts\n );\n\n // _from - address where tokens should be deducted from on behalf of\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenId - token Id to transfer\n // _amount - amount of the tokens to transfer\n // _refundAddress - address on src that will receive refund for any overpayment of L0 fees\n // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n // _from - address where tokens should be deducted from on behalf of\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenIds - token Ids to transfer\n // _amounts - amounts of the tokens to transfer\n // _refundAddress - address on src that will receive refund for any overpayment of L0 fees\n // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n uint[] calldata _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenId - token Id to transfer\n // _amount - amount of the tokens to transfer\n // _useZro - indicates to use zro to pay L0 fees\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function estimateSendFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenIds - tokens Id to transfer\n // _amounts - amounts of the tokens to transfer\n // _useZro - indicates to use zro to pay L0 fees\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n uint[] calldata _amounts,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n}\n" + }, + "contracts/token/onft1155/ProxyONFT1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ONFT1155Core.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\n\ncontract ProxyONFT1155 is ONFT1155Core, IERC1155Receiver {\n using ERC165Checker for address;\n\n IERC1155 public immutable token;\n\n constructor(address _lzEndpoint, address _proxyToken) ONFT1155Core(_lzEndpoint) {\n require(_proxyToken.supportsInterface(type(IERC1155).interfaceId), \"ProxyONFT1155: invalid ERC1155 token\");\n token = IERC1155(_proxyToken);\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT1155Core, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(\n address _from,\n uint16,\n bytes memory,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual override {\n require(_from == _msgSender(), \"ProxyONFT1155: owner is not send caller\");\n token.safeBatchTransferFrom(_from, address(this), _tokenIds, _amounts, \"\");\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual override {\n token.safeBatchTransferFrom(address(this), _toAddress, _tokenIds, _amounts, \"\");\n }\n\n function onERC1155Received(\n address _operator,\n address,\n uint,\n uint,\n bytes memory\n ) public virtual override returns (bytes4) {\n // only allow `this` to tranfser token from others\n if (_operator != address(this)) return bytes4(0);\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address _operator,\n address,\n uint[] memory,\n uint[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n // only allow `this` to tranfser token from others\n if (_operator != address(this)) return bytes4(0);\n return this.onERC1155BatchReceived.selector;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/ERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155.sol\";\nimport \"./IERC1155Receiver.sol\";\nimport \"./extensions/IERC1155MetadataURI.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n constructor(string memory uri_) {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: address zero is not a valid owner\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155Receiver.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "contracts/token/onft1155/mocks/ERC1155Mock.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/ERC1155.sol\";\n\n// for mock purposes only, no limit on minting functionality\ncontract ERC1155Mock is ERC1155 {\n constructor(string memory uri_) ERC1155(uri_) {}\n\n function mint(\n address _to,\n uint _tokenId,\n uint _amount\n ) public {\n _mint(_to, _tokenId, _amount, \"\");\n }\n\n function mintBatch(\n address _to,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) public {\n _mintBatch(_to, _tokenIds, _amounts, \"\");\n }\n\n function transfer(\n address _to,\n uint _tokenId,\n uint _amount\n ) public {\n _safeTransferFrom(msg.sender, _to, _tokenId, _amount, \"\");\n }\n}\n" + }, + "contracts/token/onft1155/ONFT1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT1155.sol\";\nimport \"./ONFT1155Core.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/ERC1155.sol\";\n\n// NOTE: this ONFT contract has no public minting logic.\n// must implement your own minting logic in child classes\ncontract ONFT1155 is ONFT1155Core, ERC1155, IONFT1155 {\n constructor(string memory _uri, address _lzEndpoint) ERC1155(_uri) ONFT1155Core(_lzEndpoint) {}\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT1155Core, ERC1155, IERC165) returns (bool) {\n return interfaceId == type(IONFT1155).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(\n address _from,\n uint16,\n bytes memory,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual override {\n address spender = _msgSender();\n require(spender == _from || isApprovedForAll(_from, spender), \"ONFT1155: send caller is not owner nor approved\");\n _burnBatch(_from, _tokenIds, _amounts);\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual override {\n _mintBatch(_toAddress, _tokenIds, _amounts, \"\");\n }\n}\n" + }, + "contracts/token/onft1155/interfaces/IONFT1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./IONFT1155Core.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\n\n/**\n * @dev Interface of the ONFT standard\n */\ninterface IONFT1155 is IONFT1155Core, IERC1155 {\n\n}\n" + }, + "contracts/token/onft1155/extensions/ExtendedONFT1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/common/ERC2981.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol\";\nimport \"../ONFT1155.sol\";\n\ncontract ExtendedONFT1155 is Ownable, AccessControl, ERC1155, ERC1155Supply, ERC1155Burnable, ERC2981, ONFT1155 {\n string public name;\n string public symbol;\n\n /********************************************\n *** Constructor\n ********************************************/\n\n constructor(\n string memory _name,\n string memory _symbol,\n string memory _uri,\n uint96 _royaltyBasePoints,\n address _lzEndpoint\n ) ONFT1155(_uri, _lzEndpoint) {\n name = _name;\n symbol = _symbol;\n\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n _setDefaultRoyalty(_msgSender(), _royaltyBasePoints);\n }\n\n /********************************************\n *** Public functions\n ********************************************/\n /**\n * @dev Sets a new token metadata URI.\n */\n function setURI(string memory _uri) external virtual onlyOwner {\n _setURI(_uri);\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external virtual onlyOwner {\n _setDefaultRoyalty(receiver, feeNumerator);\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n */\n function setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) external virtual onlyOwner {\n _setTokenRoyalty(tokenId, receiver, feeNumerator);\n }\n\n /**\n * @dev Transfer to multiple recipients.\n */\n function multiTransferFrom(address from, address[] memory tos, uint256 id, uint256 amount, bytes memory data) public virtual {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"ExtendedONFT1155: caller is not token owner or approved\");\n\n for (uint256 i = 0; i < tos.length; ++i) {\n _safeTransferFrom(from, tos[i], id, amount, data);\n }\n }\n\n /**\n * @dev Batch transfer to multiple recipients.\n */\n function multiBatchTransferFrom(\n address from,\n address[] memory tos,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"ExtendedONFT1155: caller is not token owner or approved\");\n\n for (uint256 i = 0; i < tos.length; ++i) {\n _safeBatchTransferFrom(from, tos[i], ids, amounts, data);\n }\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}. Includes check for token existence.\n */\n function uri(uint256 id) public view virtual override returns (string memory) {\n require(exists(id), \"ExtendedONFT1155: Token ID doesn't exist\");\n\n return super.uri(id);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, ERC2981, ONFT1155, AccessControl) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n /********************************************\n *** Internal functions\n ********************************************/\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override(ERC1155, ERC1155Supply) {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, 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 uint[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.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 * ```solidity\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 * ```solidity\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. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\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(IAccessControl).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 Strings.toHexString(account),\n \" is missing role \",\n Strings.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" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155.sol\";\n\n/**\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\n * own tokens and those that they have been approved to use.\n *\n * _Available since v3.1._\n */\nabstract contract ERC1155Burnable is ERC1155 {\n function burn(address account, uint256 id, uint256 value) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burn(account, id, value);\n }\n\n function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burnBatch(account, ids, values);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155.sol\";\n\n/**\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\n *\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\n * clearly identified. Note: While a totalSupply of 1 might mean the\n * corresponding is an NFT, there is no guarantees that no other token with the\n * same id are not going to be minted.\n */\nabstract contract ERC1155Supply is ERC1155 {\n mapping(uint256 => uint256) private _totalSupply;\n\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) public view virtual returns (uint256) {\n return _totalSupply[id];\n }\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) public view virtual returns (bool) {\n return ERC1155Supply.totalSupply(id) > 0;\n }\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n if (from == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n _totalSupply[ids[i]] += amounts[i];\n }\n }\n\n if (to == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n uint256 supply = _totalSupply[id];\n require(supply >= amount, \"ERC1155: burn amount exceeds totalSupply\");\n unchecked {\n _totalSupply[id] = supply - amount;\n }\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.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 IAccessControl {\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" + }, + "contracts/token/onft721/extensions/ExtendedONFT721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../ONFT721.sol\";\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol\";\n\ncontract ExtendedONFT721 is Ownable, AccessControl, ERC721, ERC721Royalty, ERC721Enumerable, ERC721Burnable, ONFT721 {\n using Strings for uint256;\n\n string internal baseTokenURI;\n\n constructor(\n string memory _name,\n string memory _symbol,\n string memory _baseUri,\n uint96 _royaltyBasePoints,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) ONFT721(_name, _symbol, _minGasToTransfer, _lzEndpoint) {\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n _setDefaultRoyalty(_msgSender(), _royaltyBasePoints);\n baseTokenURI = _baseUri;\n }\n\n /********************************************\n *** Public functions\n ********************************************/\n\n /**\n * @dev Multi-recipient transfer.\n */\n function transferMulti(address from, address[] memory recipients, uint256[] memory tokenIds) public virtual {\n require(recipients.length > 0 && recipients.length == tokenIds.length, \"ERC721: input length mismatch\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n safeTransferFrom(from, recipients[i], tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Batch-Transfer (same recipient).\n */\n function transferBatch(address from, address to, uint256[] memory tokenIds) public virtual {\n require(tokenIds.length > 0, \"ERC721: tokenIds can't be empty\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n safeTransferFrom(from, to, tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Set new token metadata base URI.\n */\n function setBaseURI(string memory _baseUri) public virtual onlyRole(DEFAULT_ADMIN_ROLE) {\n baseTokenURI = _baseUri;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}. Override attaches \".json\" extension to URI.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), \".json\")) : \"\";\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ONFT721, ERC721Royalty, ERC721Enumerable, ERC721, AccessControl) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n /********************************************\n *** Internal functions\n ********************************************/\n\n /**\n * @dev Updateable base token URI override.\n */\n function _baseURI() internal view virtual override returns (string memory) {\n return baseTokenURI;\n }\n\n /**\n * @dev See {ERC721-_burn}.\n */\n function _burn(uint256 tokenId) internal virtual override(ERC721Royalty, ERC721) {\n super._burn(tokenId);\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override(ERC721Enumerable, ERC721) {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n }\n}\n" + }, + "contracts/token/onft721/ONFT721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT721.sol\";\nimport \"./ONFT721Core.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\n\n// NOTE: this ONFT contract has no public minting logic.\n// must implement your own minting logic in child classes\ncontract ONFT721 is ONFT721Core, ERC721, IONFT721 {\n constructor(\n string memory _name,\n string memory _symbol,\n uint _minGasToTransfer,\n address _lzEndpoint\n ) ERC721(_name, _symbol) ONFT721Core(_minGasToTransfer, _lzEndpoint) {}\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT721Core, ERC721, IERC165) returns (bool) {\n return interfaceId == type(IONFT721).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(\n address _from,\n uint16,\n bytes memory,\n uint _tokenId\n ) internal virtual override {\n require(_isApprovedOrOwner(_msgSender(), _tokenId), \"ONFT721: send caller is not owner nor approved\");\n require(ERC721.ownerOf(_tokenId) == _from, \"ONFT721: send from incorrect owner\");\n _transfer(_from, address(this), _tokenId);\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _tokenId\n ) internal virtual override {\n require(!_exists(_tokenId) || (_exists(_tokenId) && ERC721.ownerOf(_tokenId) == address(this)));\n if (!_exists(_tokenId)) {\n _safeMint(_toAddress, _tokenId);\n } else {\n _transfer(address(this), _toAddress, _tokenId);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @title ERC721 Burnable Token\n * @dev ERC721 Token that can be burned (destroyed).\n */\nabstract contract ERC721Burnable is Context, ERC721 {\n /**\n * @dev Burns `tokenId`. See {ERC721-_burn}.\n *\n * Requirements:\n *\n * - The caller must own `tokenId` or be an approved operator.\n */\n function burn(uint256 tokenId) public virtual {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _burn(tokenId);\n }\n}\n" + }, + "contracts/token/onft721/extensions/MinterONFT721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"./ExtendedONFT721.sol\";\n\ncontract MinterONFT721 is ExtendedONFT721 {\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n\n constructor(string memory _name, string memory _symbol, string memory _baseUri, uint96 _royaltyBasePoints, uint256 _minGasToTransfer, address _lzEndpoint) ExtendedONFT721(_name, _symbol, _baseUri, _royaltyBasePoints, _minGasToTransfer, _lzEndpoint) {\n _setupRole(MINTER_ROLE, _msgSender());\n }\n\n /********************************************\n *** Public functions\n ********************************************/\n\n /**\n * @dev Public minting method, Minter-role only.\n */\n function mint(address to, uint256 tokenId) public virtual onlyRole(MINTER_ROLE) {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Multi-recipient minting.\n */\n function mintMulti(address[] memory recipients, uint256[] memory tokenIds) public virtual onlyRole(MINTER_ROLE) {\n require(recipients.length > 0 && recipients.length == tokenIds.length, \"ERC721: input length mismatch\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n _safeMint(recipients[i], tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Batch-Mint (same recipient).\n */\n function mintBatch(address to, uint256[] memory tokenIds) public virtual onlyRole(MINTER_ROLE) {\n require(tokenIds.length > 0, \"ERC721: tokenIds can't be empty\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n _safeMint(to, tokenIds[i], \"\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "contracts/token/oft/v2/fee/OFTWithFee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./BaseOFTWithFee.sol\";\n\ncontract OFTWithFee is BaseOFTWithFee, ERC20 {\n\n uint internal immutable ld2sdRate;\n\n constructor(string memory _name, string memory _symbol, uint8 _sharedDecimals, address _lzEndpoint) ERC20(_name, _symbol) BaseOFTWithFee(_sharedDecimals, _lzEndpoint) {\n uint8 decimals = decimals();\n require(_sharedDecimals <= decimals, \"OFTWithFee: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return totalSupply();\n }\n\n function token() public view virtual override returns (address) {\n return address(this);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n if (_from != spender) _spendAllowance(_from, spender, _amount);\n _burn(_from, _amount);\n return _amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n _mint(_toAddress, _amount);\n return _amount;\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n // if transfer from this contract, no need to check allowance\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\n _transfer(_from, _to, _amount);\n return _amount;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "contracts/token/oft/v2/fee/BaseOFTWithFee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../OFTCoreV2.sol\";\nimport \"./IOFTWithFee.sol\";\nimport \"./Fee.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract BaseOFTWithFee is OFTCoreV2, Fee, ERC165, IOFTWithFee {\n\n constructor(uint8 _sharedDecimals, address _lzEndpoint) OFTCoreV2(_sharedDecimals, _lzEndpoint) {\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, LzCallParams calldata _callParams) public payable virtual override {\n (_amount,) = _payOFTFee(_from, _dstChainId, _amount);\n _amount = _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n require(_amount >= _minAmount, \"BaseOFTWithFee: amount is less than minAmount\");\n }\n\n function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) public payable virtual override {\n (_amount,) = _payOFTFee(_from, _dstChainId, _amount);\n _amount = _sendAndCall(_from, _dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n require(_amount >= _minAmount, \"BaseOFTWithFee: amount is less than minAmount\");\n }\n\n /************************************************************************\n * public view functions\n ************************************************************************/\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IOFTWithFee).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams);\n }\n\n function estimateSendAndCallFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, bool _useZro, bytes calldata _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams);\n }\n\n function circulatingSupply() public view virtual override returns (uint);\n\n function token() public view virtual override returns (address);\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override (Fee, OFTCoreV2) returns (uint);\n}\n" + }, + "contracts/token/oft/v2/OFTCoreV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../../lzApp/NonblockingLzApp.sol\";\nimport \"../../../libraries/ExcessivelySafeCall.sol\";\nimport \"./interfaces/ICommonOFT.sol\";\nimport \"./interfaces/IOFTReceiverV2.sol\";\n\nabstract contract OFTCoreV2 is NonblockingLzApp {\n using BytesLib for bytes;\n using ExcessivelySafeCall for address;\n\n uint public constant NO_EXTRA_GAS = 0;\n\n // packet type\n uint8 public constant PT_SEND = 0;\n uint8 public constant PT_SEND_AND_CALL = 1;\n\n uint8 public immutable sharedDecimals;\n\n mapping(uint16 => mapping(bytes => mapping(uint64 => bool))) public creditedPackets;\n\n /**\n * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\n * `_nonce` is the outbound nonce\n */\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes32 indexed _toAddress, uint _amount);\n\n /**\n * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain.\n * `_nonce` is the inbound nonce.\n */\n event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount);\n\n event CallOFTReceivedSuccess(uint16 indexed _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _hash);\n\n event NonContractAddress(address _address);\n\n // _sharedDecimals should be the minimum decimals on all chains\n constructor(uint8 _sharedDecimals, address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {\n sharedDecimals = _sharedDecimals;\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function callOnOFTReceived(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes32 _from,\n address _to,\n uint _amount,\n bytes calldata _payload,\n uint _gasForCall\n ) public virtual {\n require(_msgSender() == address(this), \"OFTCore: caller must be OFTCore\");\n\n // send\n _amount = _transferFrom(address(this), _to, _amount);\n emit ReceiveFromChain(_srcChainId, _to, _amount);\n\n // call\n IOFTReceiverV2(_to).onOFTReceived{gas: _gasForCall}(_srcChainId, _srcAddress, _nonce, _from, _amount, _payload);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes memory _adapterParams\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\n // mock the payload for sendFrom()\n bytes memory payload = _encodeSendPayload(_toAddress, _ld2sd(_amount));\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function _estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes memory _adapterParams\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\n // mock the payload for sendAndCall()\n bytes memory payload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(_amount), _payload, _dstGasForCall);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual override {\n uint8 packetType = _payload.toUint8(0);\n\n if (packetType == PT_SEND) {\n _sendAck(_srcChainId, _srcAddress, _nonce, _payload);\n } else if (packetType == PT_SEND_AND_CALL) {\n _sendAndCallAck(_srcChainId, _srcAddress, _nonce, _payload);\n } else {\n revert(\"OFTCore: unknown packet type\");\n }\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount); // amount returned should not have dust\n require(amount > 0, \"OFTCore: amount too small\");\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAck(\n uint16 _srcChainId,\n bytes memory,\n uint64,\n bytes memory _payload\n ) internal virtual {\n (address to, uint64 amountSD) = _decodeSendPayload(_payload);\n if (to == address(0)) {\n to = address(0xdead);\n }\n\n uint amount = _sd2ld(amountSD);\n amount = _creditTo(_srcChainId, to, amount);\n\n emit ReceiveFromChain(_srcChainId, to, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount);\n require(amount > 0, \"OFTCore: amount too small\");\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCallAck(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual {\n (bytes32 from, address to, uint64 amountSD, bytes memory payloadForCall, uint64 gasForCall) = _decodeSendAndCallPayload(_payload);\n\n bool credited = creditedPackets[_srcChainId][_srcAddress][_nonce];\n uint amount = _sd2ld(amountSD);\n\n // credit to this contract first, and then transfer to receiver only if callOnOFTReceived() succeeds\n if (!credited) {\n amount = _creditTo(_srcChainId, address(this), amount);\n creditedPackets[_srcChainId][_srcAddress][_nonce] = true;\n }\n\n if (!_isContract(to)) {\n emit NonContractAddress(to);\n return;\n }\n\n // workaround for stack too deep\n uint16 srcChainId = _srcChainId;\n bytes memory srcAddress = _srcAddress;\n uint64 nonce = _nonce;\n bytes memory payload = _payload;\n bytes32 from_ = from;\n address to_ = to;\n uint amount_ = amount;\n bytes memory payloadForCall_ = payloadForCall;\n\n // no gas limit for the call if retry\n uint gas = credited ? gasleft() : gasForCall;\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\n gasleft(),\n 150,\n abi.encodeWithSelector(this.callOnOFTReceived.selector, srcChainId, srcAddress, nonce, from_, to_, amount_, payloadForCall_, gas)\n );\n\n if (success) {\n bytes32 hash = keccak256(payload);\n emit CallOFTReceivedSuccess(srcChainId, srcAddress, nonce, hash);\n } else {\n // store the failed message into the nonblockingLzApp\n _storeFailedMessage(srcChainId, srcAddress, nonce, payload, reason);\n }\n }\n\n function _isContract(address _account) internal view returns (bool) {\n return _account.code.length > 0;\n }\n\n function _ld2sd(uint _amount) internal view virtual returns (uint64) {\n uint amountSD = _amount / _ld2sdRate();\n require(amountSD <= type(uint64).max, \"OFTCore: amountSD overflow\");\n return uint64(amountSD);\n }\n\n function _sd2ld(uint64 _amountSD) internal view virtual returns (uint) {\n return _amountSD * _ld2sdRate();\n }\n\n function _removeDust(uint _amount) internal view virtual returns (uint amountAfter, uint dust) {\n dust = _amount % _ld2sdRate();\n amountAfter = _amount - dust;\n }\n\n function _encodeSendPayload(bytes32 _toAddress, uint64 _amountSD) internal view virtual returns (bytes memory) {\n return abi.encodePacked(PT_SEND, _toAddress, _amountSD);\n }\n\n function _decodeSendPayload(bytes memory _payload) internal view virtual returns (address to, uint64 amountSD) {\n require(_payload.toUint8(0) == PT_SEND && _payload.length == 41, \"OFTCore: invalid payload\");\n\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\n amountSD = _payload.toUint64(33);\n }\n\n function _encodeSendAndCallPayload(\n address _from,\n bytes32 _toAddress,\n uint64 _amountSD,\n bytes memory _payload,\n uint64 _dstGasForCall\n ) internal view virtual returns (bytes memory) {\n return abi.encodePacked(PT_SEND_AND_CALL, _toAddress, _amountSD, _addressToBytes32(_from), _dstGasForCall, _payload);\n }\n\n function _decodeSendAndCallPayload(bytes memory _payload)\n internal\n view\n virtual\n returns (\n bytes32 from,\n address to,\n uint64 amountSD,\n bytes memory payload,\n uint64 dstGasForCall\n )\n {\n require(_payload.toUint8(0) == PT_SEND_AND_CALL, \"OFTCore: invalid payload\");\n\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\n amountSD = _payload.toUint64(33);\n from = _payload.toBytes32(41);\n dstGasForCall = _payload.toUint64(73);\n payload = _payload.slice(81, _payload.length - 81);\n }\n\n function _addressToBytes32(address _address) internal pure virtual returns (bytes32) {\n return bytes32(uint(uint160(_address)));\n }\n\n function _debitFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount\n ) internal virtual returns (uint);\n\n function _creditTo(\n uint16 _srcChainId,\n address _toAddress,\n uint _amount\n ) internal virtual returns (uint);\n\n function _transferFrom(\n address _from,\n address _to,\n uint _amount\n ) internal virtual returns (uint);\n\n function _ld2sdRate() internal view virtual returns (uint);\n}\n" + }, + "contracts/token/oft/v2/fee/IOFTWithFee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"../interfaces/ICommonOFT.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface IOFTWithFee is ICommonOFT {\n\n /**\n * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\n * `_from` the owner of token\n * `_dstChainId` the destination chain identifier\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_amount` the quantity of tokens in wei\n * `_minAmount` the minimum amount of tokens to receive on dstChain\n * `_refundAddress` the address LayerZero refunds if too much message fee is sent\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, LzCallParams calldata _callParams) external payable;\n\n function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) external payable;\n}\n" + }, + "contracts/token/oft/v2/fee/Fee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\nabstract contract Fee is Ownable {\n uint public constant BP_DENOMINATOR = 10000;\n\n mapping(uint16 => FeeConfig) public chainIdToFeeBps;\n uint16 public defaultFeeBp;\n address public feeOwner; // defaults to owner\n\n struct FeeConfig {\n uint16 feeBP;\n bool enabled;\n }\n\n event SetFeeBp(uint16 dstchainId, bool enabled, uint16 feeBp);\n event SetDefaultFeeBp(uint16 feeBp);\n event SetFeeOwner(address feeOwner);\n\n constructor(){\n feeOwner = owner();\n }\n\n function setDefaultFeeBp(uint16 _feeBp) public virtual onlyOwner {\n require(_feeBp <= BP_DENOMINATOR, \"Fee: fee bp must be <= BP_DENOMINATOR\");\n defaultFeeBp = _feeBp;\n emit SetDefaultFeeBp(defaultFeeBp);\n }\n\n function setFeeBp(uint16 _dstChainId, bool _enabled, uint16 _feeBp) public virtual onlyOwner {\n require(_feeBp <= BP_DENOMINATOR, \"Fee: fee bp must be <= BP_DENOMINATOR\");\n chainIdToFeeBps[_dstChainId] = FeeConfig(_feeBp, _enabled);\n emit SetFeeBp(_dstChainId, _enabled, _feeBp);\n }\n\n function setFeeOwner(address _feeOwner) public virtual onlyOwner {\n require(_feeOwner != address(0x0), \"Fee: feeOwner cannot be 0x\");\n feeOwner = _feeOwner;\n emit SetFeeOwner(_feeOwner);\n }\n\n function quoteOFTFee(uint16 _dstChainId, uint _amount) public virtual view returns (uint fee) {\n FeeConfig memory config = chainIdToFeeBps[_dstChainId];\n if (config.enabled) {\n fee = _amount * config.feeBP / BP_DENOMINATOR;\n } else if (defaultFeeBp > 0) {\n fee = _amount * defaultFeeBp / BP_DENOMINATOR;\n } else {\n fee = 0;\n }\n }\n\n function _payOFTFee(address _from, uint16 _dstChainId, uint _amount) internal virtual returns (uint amount, uint fee) {\n fee = quoteOFTFee(_dstChainId, _amount);\n amount = _amount - fee;\n if (fee > 0) {\n _transferFrom(_from, feeOwner, fee);\n }\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint);\n}\n" + }, + "contracts/token/oft/v2/interfaces/ICommonOFT.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface ICommonOFT is IERC165 {\n\n struct LzCallParams {\n address payable refundAddress;\n address zroPaymentAddress;\n bytes adapterParams;\n }\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _amount - amount of the tokens to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParam - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee);\n\n function estimateSendAndCallFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee);\n\n /**\n * @dev returns the circulating amount of tokens on current chain\n */\n function circulatingSupply() external view returns (uint);\n\n /**\n * @dev returns the address of the ERC20 token\n */\n function token() external view returns (address);\n}\n" + }, + "contracts/token/oft/v2/interfaces/IOFTReceiverV2.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.5.0;\n\ninterface IOFTReceiverV2 {\n /**\n * @dev Called by the OFT contract when tokens are received from source chain.\n * @param _srcChainId The chain id of the source chain.\n * @param _srcAddress The address of the OFT token contract on the source chain.\n * @param _nonce The nonce of the transaction on the source chain.\n * @param _from The address of the account who calls the sendAndCall() on the source chain.\n * @param _amount The amount of tokens to transfer.\n * @param _payload Additional data with no specified format.\n */\n function onOFTReceived(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes32 _from, uint _amount, bytes calldata _payload) external;\n}\n" + }, + "contracts/token/oft/v2/fee/ProxyOFTWithFee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./BaseOFTWithFee.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract ProxyOFTWithFee is BaseOFTWithFee {\n using SafeERC20 for IERC20;\n\n IERC20 internal immutable innerToken;\n uint internal immutable ld2sdRate;\n\n // total amount is transferred from this chain to other chains, ensuring the total is less than uint64.max in sd\n uint public outboundAmount;\n\n constructor(address _token, uint8 _sharedDecimals, address _lzEndpoint) BaseOFTWithFee(_sharedDecimals, _lzEndpoint) {\n innerToken = IERC20(_token);\n\n (bool success, bytes memory data) = _token.staticcall(\n abi.encodeWithSignature(\"decimals()\")\n );\n require(success, \"ProxyOFTWithFee: failed to get token decimals\");\n uint8 decimals = abi.decode(data, (uint8));\n\n require(_sharedDecimals <= decimals, \"ProxyOFTWithFee: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return innerToken.totalSupply() - outboundAmount;\n }\n\n function token() public view virtual override returns (address) {\n return address(innerToken);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n require(_from == _msgSender(), \"ProxyOFTWithFee: owner is not send caller\");\n\n _amount = _transferFrom(_from, address(this), _amount);\n\n // _amount still may have dust if the token has transfer fee, then give the dust back to the sender\n (uint amount, uint dust) = _removeDust(_amount);\n if (dust > 0) innerToken.safeTransfer(_from, dust);\n\n // check total outbound amount\n outboundAmount += amount;\n uint cap = _sd2ld(type(uint64).max);\n require(cap >= outboundAmount, \"ProxyOFTWithFee: outboundAmount overflow\");\n\n return amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n outboundAmount -= _amount;\n\n // tokens are already in this contract, so no need to transfer\n if (_toAddress == address(this)) {\n return _amount;\n }\n\n return _transferFrom(address(this), _toAddress, _amount);\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n uint before = innerToken.balanceOf(_to);\n if (_from == address(this)) {\n innerToken.safeTransfer(_to, _amount);\n } else {\n innerToken.safeTransferFrom(_from, _to, _amount);\n }\n return innerToken.balanceOf(_to) - before;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/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 /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) 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(IERC20 token, address spender, uint256 value) 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 /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\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 require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation 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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\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 cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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" + }, + "contracts/token/oft/v2/ProxyOFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./BaseOFTV2.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract ProxyOFTV2 is BaseOFTV2 {\n using SafeERC20 for IERC20;\n\n IERC20 internal immutable innerToken;\n uint internal immutable ld2sdRate;\n\n // total amount is transferred from this chain to other chains, ensuring the total is less than uint64.max in sd\n uint public outboundAmount;\n\n constructor(\n address _token,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) BaseOFTV2(_sharedDecimals, _lzEndpoint) {\n innerToken = IERC20(_token);\n\n (bool success, bytes memory data) = _token.staticcall(abi.encodeWithSignature(\"decimals()\"));\n require(success, \"ProxyOFT: failed to get token decimals\");\n uint8 decimals = abi.decode(data, (uint8));\n\n require(_sharedDecimals <= decimals, \"ProxyOFT: sharedDecimals must be <= decimals\");\n ld2sdRate = 10**(decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return innerToken.totalSupply() - outboundAmount;\n }\n\n function token() public view virtual override returns (address) {\n return address(innerToken);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(\n address _from,\n uint16,\n bytes32,\n uint _amount\n ) internal virtual override returns (uint) {\n require(_from == _msgSender(), \"ProxyOFT: owner is not send caller\");\n\n _amount = _transferFrom(_from, address(this), _amount);\n\n // _amount still may have dust if the token has transfer fee, then give the dust back to the sender\n (uint amount, uint dust) = _removeDust(_amount);\n if (dust > 0) innerToken.safeTransfer(_from, dust);\n\n // check total outbound amount\n outboundAmount += amount;\n uint cap = _sd2ld(type(uint64).max);\n require(cap >= outboundAmount, \"ProxyOFT: outboundAmount overflow\");\n\n return amount;\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _amount\n ) internal virtual override returns (uint) {\n outboundAmount -= _amount;\n\n // tokens are already in this contract, so no need to transfer\n if (_toAddress == address(this)) {\n return _amount;\n }\n\n return _transferFrom(address(this), _toAddress, _amount);\n }\n\n function _transferFrom(\n address _from,\n address _to,\n uint _amount\n ) internal virtual override returns (uint) {\n uint before = innerToken.balanceOf(_to);\n if (_from == address(this)) {\n innerToken.safeTransfer(_to, _amount);\n } else {\n innerToken.safeTransferFrom(_from, _to, _amount);\n }\n return innerToken.balanceOf(_to) - before;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "contracts/token/oft/v2/BaseOFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./OFTCoreV2.sol\";\nimport \"./interfaces/IOFTV2.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract BaseOFTV2 is OFTCoreV2, ERC165, IOFTV2 {\n constructor(uint8 _sharedDecimals, address _lzEndpoint) OFTCoreV2(_sharedDecimals, _lzEndpoint) {}\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _sendAndCall(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _payload,\n _dstGasForCall,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n }\n\n /************************************************************************\n * public view functions\n ************************************************************************/\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IOFTV2).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams);\n }\n\n function estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams);\n }\n\n function circulatingSupply() public view virtual override returns (uint);\n\n function token() public view virtual override returns (address);\n}\n" + }, + "contracts/token/oft/v2/interfaces/IOFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./ICommonOFT.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface IOFTV2 is ICommonOFT {\n\n /**\n * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\n * `_from` the owner of token\n * `_dstChainId` the destination chain identifier\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_amount` the quantity of tokens in wei\n * `_refundAddress` the address LayerZero refunds if too much message fee is sent\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, LzCallParams calldata _callParams) external payable;\n\n function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) external payable;\n}\n" + }, + "contracts/token/oft/v2/mocks/OFTStakingMockV2.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"../interfaces/IOFTV2.sol\";\nimport \"../interfaces/IOFTReceiverV2.sol\";\nimport \"../../../../libraries/BytesLib.sol\";\n\n// OFTStakingMock is an example to integrate with OFT. It shows how to send OFT cross chain with a custom payload and\n// call a receiver contract on the destination chain when oft is received.\ncontract OFTStakingMockV2 is IOFTReceiverV2 {\n using SafeERC20 for IERC20;\n using BytesLib for bytes;\n\n uint64 public constant DST_GAS_FOR_CALL = 300000; // estimate gas usage of onOFTReceived()\n\n // packet type\n uint8 public constant PT_DEPOSIT_TO_REMOTE_CHAIN = 1;\n // ... other types\n\n // variables\n IOFTV2 public oft;\n mapping(uint16 => bytes32) public remoteStakingContracts;\n mapping(address => uint) public balances;\n bool public paused; // for testing try/catch\n\n event Deposit(address from, uint amount);\n event Withdrawal(address to, uint amount);\n event DepositToDstChain(address from, uint16 dstChainId, bytes to, uint amountOut);\n\n // _oft can be any composable OFT contract, e.g. ComposableOFT, ComposableBasedOFT and ComposableProxyOFT.\n constructor(address _oft) {\n oft = IOFTV2(_oft);\n IERC20(oft.token()).safeApprove(_oft, type(uint).max);\n }\n\n function setRemoteStakingContract(uint16 _chainId, bytes32 _stakingContract) external {\n remoteStakingContracts[_chainId] = _stakingContract;\n }\n\n function deposit(uint _amount) external payable {\n IERC20(oft.token()).safeTransferFrom(msg.sender, address(this), _amount);\n balances[msg.sender] += _amount;\n emit Deposit(msg.sender, _amount);\n }\n\n function withdraw(uint _amount) external {\n withdrawTo(_amount, msg.sender);\n }\n\n function withdrawTo(uint _amount, address _to) public {\n require(balances[msg.sender] >= _amount);\n balances[msg.sender] -= _amount;\n IERC20(oft.token()).safeTransfer(_to, _amount);\n emit Withdrawal(msg.sender, _amount);\n }\n\n function depositToDstChain(\n uint16 _dstChainId,\n bytes calldata _to, // address of the owner of token on the destination chain\n uint _amount, // amount of token to deposit\n bytes calldata _adapterParams\n ) external payable {\n bytes32 dstStakingContract = remoteStakingContracts[_dstChainId];\n require(dstStakingContract != bytes32(0), \"invalid _dstChainId\");\n\n // transfer token from sender to this contract\n // if the oft is not the proxy oft, dont need to transfer token to this contract\n // and call sendAndCall() with the msg.sender (_from) instead of address(this)\n // here we use a common pattern to be compatible with all kinds of composable OFT\n IERC20(oft.token()).safeTransferFrom(msg.sender, address(this), _amount);\n\n bytes memory payload = abi.encode(PT_DEPOSIT_TO_REMOTE_CHAIN, _to);\n ICommonOFT.LzCallParams memory callParams = ICommonOFT.LzCallParams(payable(msg.sender), address(0), _adapterParams);\n oft.sendAndCall{value: msg.value}(address(this), _dstChainId, dstStakingContract, _amount, payload, DST_GAS_FOR_CALL, callParams);\n\n emit DepositToDstChain(msg.sender, _dstChainId, _to, _amount);\n }\n\n function quoteForDeposit(\n uint16 _dstChainId,\n bytes calldata _to, // address of the owner of token on the destination chain\n uint _amount, // amount of token to deposit\n bytes calldata _adapterParams\n ) public view returns (uint nativeFee, uint zroFee) {\n bytes32 dstStakingContract = remoteStakingContracts[_dstChainId];\n require(dstStakingContract != bytes32(0), \"invalid _dstChainId\");\n\n bytes memory payload = abi.encode(PT_DEPOSIT_TO_REMOTE_CHAIN, _to);\n return oft.estimateSendAndCallFee(_dstChainId, dstStakingContract, _amount, payload, DST_GAS_FOR_CALL, false, _adapterParams);\n }\n\n //-----------------------------------------------------------------------------------------------------------------------\n function onOFTReceived(uint16 _srcChainId, bytes calldata, uint64, bytes32 _from, uint _amount, bytes memory _payload) external override {\n require(!paused, \"paused\"); // for testing safe call\n require(msg.sender == address(oft), \"only oft can call onOFTReceived()\");\n require(_from == remoteStakingContracts[_srcChainId], \"invalid from\");\n\n uint8 pkType;\n assembly {\n pkType := mload(add(_payload, 32))\n }\n\n if (pkType == PT_DEPOSIT_TO_REMOTE_CHAIN) {\n (, bytes memory toAddrBytes) = abi.decode(_payload, (uint8, bytes));\n\n address to = toAddrBytes.toAddress(0);\n balances[to] += _amount;\n } else {\n revert(\"invalid deposit type\");\n }\n }\n\n function setPaused(bool _paused) external {\n paused = _paused;\n }\n}\n" + }, + "contracts/lzApp/mocks/LZEndpointMock.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.0;\npragma abicoder v2;\n\nimport \"../interfaces/ILayerZeroReceiver.sol\";\nimport \"../interfaces/ILayerZeroEndpoint.sol\";\nimport \"../libs/LzLib.sol\";\n\n/*\nlike a real LayerZero endpoint but can be mocked, which handle message transmission, verification, and receipt.\n- blocking: LayerZero provides ordered delivery of messages from a given sender to a destination chain.\n- non-reentrancy: endpoint has a non-reentrancy guard for both the send() and receive(), respectively.\n- adapter parameters: allows UAs to add arbitrary transaction params in the send() function, like airdrop on destination chain.\nunlike a real LayerZero endpoint, it is\n- no messaging library versioning\n- send() will short circuit to lzReceive()\n- no user application configuration\n*/\ncontract LZEndpointMock is ILayerZeroEndpoint {\n uint8 internal constant _NOT_ENTERED = 1;\n uint8 internal constant _ENTERED = 2;\n\n mapping(address => address) public lzEndpointLookup;\n\n uint16 public mockChainId;\n bool public nextMsgBlocked;\n\n // fee config\n RelayerFeeConfig public relayerFeeConfig;\n ProtocolFeeConfig public protocolFeeConfig;\n uint public oracleFee;\n bytes public defaultAdapterParams;\n\n // path = remote addrss + local address\n // inboundNonce = [srcChainId][path].\n mapping(uint16 => mapping(bytes => uint64)) public inboundNonce;\n //todo: this is a hack\n // outboundNonce = [dstChainId][srcAddress]\n mapping(uint16 => mapping(address => uint64)) public outboundNonce;\n // // outboundNonce = [dstChainId][path].\n // mapping(uint16 => mapping(bytes => uint64)) public outboundNonce;\n // storedPayload = [srcChainId][path]\n mapping(uint16 => mapping(bytes => StoredPayload)) public storedPayload;\n // msgToDeliver = [srcChainId][path]\n mapping(uint16 => mapping(bytes => QueuedPayload[])) public msgsToDeliver;\n\n // reentrancy guard\n uint8 internal _send_entered_state = 1;\n uint8 internal _receive_entered_state = 1;\n\n struct ProtocolFeeConfig {\n uint zroFee;\n uint nativeBP;\n }\n\n struct RelayerFeeConfig {\n uint128 dstPriceRatio; // 10^10\n uint128 dstGasPriceInWei;\n uint128 dstNativeAmtCap;\n uint64 baseGas;\n uint64 gasPerByte;\n }\n\n struct StoredPayload {\n uint64 payloadLength;\n address dstAddress;\n bytes32 payloadHash;\n }\n\n struct QueuedPayload {\n address dstAddress;\n uint64 nonce;\n bytes payload;\n }\n\n modifier sendNonReentrant() {\n require(_send_entered_state == _NOT_ENTERED, \"LayerZeroMock: no send reentrancy\");\n _send_entered_state = _ENTERED;\n _;\n _send_entered_state = _NOT_ENTERED;\n }\n\n modifier receiveNonReentrant() {\n require(_receive_entered_state == _NOT_ENTERED, \"LayerZeroMock: no receive reentrancy\");\n _receive_entered_state = _ENTERED;\n _;\n _receive_entered_state = _NOT_ENTERED;\n }\n\n event UaForceResumeReceive(uint16 chainId, bytes srcAddress);\n event PayloadCleared(uint16 srcChainId, bytes srcAddress, uint64 nonce, address dstAddress);\n event PayloadStored(uint16 srcChainId, bytes srcAddress, address dstAddress, uint64 nonce, bytes payload, bytes reason);\n event ValueTransferFailed(address indexed to, uint indexed quantity);\n\n constructor(uint16 _chainId) {\n mockChainId = _chainId;\n\n // init config\n relayerFeeConfig = RelayerFeeConfig({\n dstPriceRatio: 1e10, // 1:1, same chain, same native coin\n dstGasPriceInWei: 1e10,\n dstNativeAmtCap: 1e19,\n baseGas: 100,\n gasPerByte: 1\n });\n protocolFeeConfig = ProtocolFeeConfig({zroFee: 1e18, nativeBP: 1000}); // BP 0.1\n oracleFee = 1e16;\n defaultAdapterParams = LzLib.buildDefaultAdapterParams(200000);\n }\n\n // ------------------------------ ILayerZeroEndpoint Functions ------------------------------\n function send(\n uint16 _chainId,\n bytes memory _path,\n bytes calldata _payload,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) external payable override sendNonReentrant {\n require(_path.length == 40, \"LayerZeroMock: incorrect remote address size\"); // only support evm chains\n\n address dstAddr;\n assembly {\n dstAddr := mload(add(_path, 20))\n }\n\n address lzEndpoint = lzEndpointLookup[dstAddr];\n require(lzEndpoint != address(0), \"LayerZeroMock: destination LayerZero Endpoint not found\");\n\n // not handle zro token\n bytes memory adapterParams = _adapterParams.length > 0 ? _adapterParams : defaultAdapterParams;\n (uint nativeFee, ) = estimateFees(_chainId, msg.sender, _payload, _zroPaymentAddress != address(0x0), adapterParams);\n require(msg.value >= nativeFee, \"LayerZeroMock: not enough native for fees\");\n\n uint64 nonce = ++outboundNonce[_chainId][msg.sender];\n\n // refund if they send too much\n uint amount = msg.value - nativeFee;\n if (amount > 0) {\n (bool success, ) = _refundAddress.call{value: amount}(\"\");\n require(success, \"LayerZeroMock: failed to refund\");\n }\n\n // Mock the process of receiving msg on dst chain\n // Mock the relayer paying the dstNativeAddr the amount of extra native token\n (, uint extraGas, uint dstNativeAmt, address payable dstNativeAddr) = LzLib.decodeAdapterParams(adapterParams);\n if (dstNativeAmt > 0) {\n (bool success, ) = dstNativeAddr.call{value: dstNativeAmt}(\"\");\n if (!success) {\n emit ValueTransferFailed(dstNativeAddr, dstNativeAmt);\n }\n }\n\n bytes memory srcUaAddress = abi.encodePacked(msg.sender, dstAddr); // cast this address to bytes\n bytes memory payload = _payload;\n LZEndpointMock(lzEndpoint).receivePayload(mockChainId, srcUaAddress, dstAddr, nonce, extraGas, payload);\n }\n\n function receivePayload(\n uint16 _srcChainId,\n bytes calldata _path,\n address _dstAddress,\n uint64 _nonce,\n uint _gasLimit,\n bytes calldata _payload\n ) external override receiveNonReentrant {\n StoredPayload storage sp = storedPayload[_srcChainId][_path];\n\n // assert and increment the nonce. no message shuffling\n require(_nonce == ++inboundNonce[_srcChainId][_path], \"LayerZeroMock: wrong nonce\");\n\n // queue the following msgs inside of a stack to simulate a successful send on src, but not fully delivered on dst\n if (sp.payloadHash != bytes32(0)) {\n QueuedPayload[] storage msgs = msgsToDeliver[_srcChainId][_path];\n QueuedPayload memory newMsg = QueuedPayload(_dstAddress, _nonce, _payload);\n\n // warning, might run into gas issues trying to forward through a bunch of queued msgs\n // shift all the msgs over so we can treat this like a fifo via array.pop()\n if (msgs.length > 0) {\n // extend the array\n msgs.push(newMsg);\n\n // shift all the indexes up for pop()\n for (uint i = 0; i < msgs.length - 1; i++) {\n msgs[i + 1] = msgs[i];\n }\n\n // put the newMsg at the bottom of the stack\n msgs[0] = newMsg;\n } else {\n msgs.push(newMsg);\n }\n } else if (nextMsgBlocked) {\n storedPayload[_srcChainId][_path] = StoredPayload(uint64(_payload.length), _dstAddress, keccak256(_payload));\n emit PayloadStored(_srcChainId, _path, _dstAddress, _nonce, _payload, bytes(\"\"));\n // ensure the next msgs that go through are no longer blocked\n nextMsgBlocked = false;\n } else {\n try ILayerZeroReceiver(_dstAddress).lzReceive{gas: _gasLimit}(_srcChainId, _path, _nonce, _payload) {} catch (bytes memory reason) {\n storedPayload[_srcChainId][_path] = StoredPayload(uint64(_payload.length), _dstAddress, keccak256(_payload));\n emit PayloadStored(_srcChainId, _path, _dstAddress, _nonce, _payload, reason);\n // ensure the next msgs that go through are no longer blocked\n nextMsgBlocked = false;\n }\n }\n }\n\n function getInboundNonce(uint16 _chainID, bytes calldata _path) external view override returns (uint64) {\n return inboundNonce[_chainID][_path];\n }\n\n function getOutboundNonce(uint16 _chainID, address _srcAddress) external view override returns (uint64) {\n return outboundNonce[_chainID][_srcAddress];\n }\n\n function estimateFees(\n uint16 _dstChainId,\n address _userApplication,\n bytes memory _payload,\n bool _payInZRO,\n bytes memory _adapterParams\n ) public view override returns (uint nativeFee, uint zroFee) {\n bytes memory adapterParams = _adapterParams.length > 0 ? _adapterParams : defaultAdapterParams;\n\n // Relayer Fee\n uint relayerFee = _getRelayerFee(_dstChainId, 1, _userApplication, _payload.length, adapterParams);\n\n // LayerZero Fee\n uint protocolFee = _getProtocolFees(_payInZRO, relayerFee, oracleFee);\n _payInZRO ? zroFee = protocolFee : nativeFee = protocolFee;\n\n // return the sum of fees\n nativeFee = nativeFee + relayerFee + oracleFee;\n }\n\n function getChainId() external view override returns (uint16) {\n return mockChainId;\n }\n\n function retryPayload(\n uint16 _srcChainId,\n bytes calldata _path,\n bytes calldata _payload\n ) external override {\n StoredPayload storage sp = storedPayload[_srcChainId][_path];\n require(sp.payloadHash != bytes32(0), \"LayerZeroMock: no stored payload\");\n require(_payload.length == sp.payloadLength && keccak256(_payload) == sp.payloadHash, \"LayerZeroMock: invalid payload\");\n\n address dstAddress = sp.dstAddress;\n // empty the storedPayload\n sp.payloadLength = 0;\n sp.dstAddress = address(0);\n sp.payloadHash = bytes32(0);\n\n uint64 nonce = inboundNonce[_srcChainId][_path];\n\n ILayerZeroReceiver(dstAddress).lzReceive(_srcChainId, _path, nonce, _payload);\n emit PayloadCleared(_srcChainId, _path, nonce, dstAddress);\n }\n\n function hasStoredPayload(uint16 _srcChainId, bytes calldata _path) external view override returns (bool) {\n StoredPayload storage sp = storedPayload[_srcChainId][_path];\n return sp.payloadHash != bytes32(0);\n }\n\n function getSendLibraryAddress(address) external view override returns (address) {\n return address(this);\n }\n\n function getReceiveLibraryAddress(address) external view override returns (address) {\n return address(this);\n }\n\n function isSendingPayload() external view override returns (bool) {\n return _send_entered_state == _ENTERED;\n }\n\n function isReceivingPayload() external view override returns (bool) {\n return _receive_entered_state == _ENTERED;\n }\n\n function getConfig(\n uint16, /*_version*/\n uint16, /*_chainId*/\n address, /*_ua*/\n uint /*_configType*/\n ) external pure override returns (bytes memory) {\n return \"\";\n }\n\n function getSendVersion(\n address /*_userApplication*/\n ) external pure override returns (uint16) {\n return 1;\n }\n\n function getReceiveVersion(\n address /*_userApplication*/\n ) external pure override returns (uint16) {\n return 1;\n }\n\n function setConfig(\n uint16, /*_version*/\n uint16, /*_chainId*/\n uint, /*_configType*/\n bytes memory /*_config*/\n ) external override {}\n\n function setSendVersion(\n uint16 /*version*/\n ) external override {}\n\n function setReceiveVersion(\n uint16 /*version*/\n ) external override {}\n\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _path) external override {\n StoredPayload storage sp = storedPayload[_srcChainId][_path];\n // revert if no messages are cached. safeguard malicious UA behaviour\n require(sp.payloadHash != bytes32(0), \"LayerZeroMock: no stored payload\");\n require(sp.dstAddress == msg.sender, \"LayerZeroMock: invalid caller\");\n\n // empty the storedPayload\n sp.payloadLength = 0;\n sp.dstAddress = address(0);\n sp.payloadHash = bytes32(0);\n\n emit UaForceResumeReceive(_srcChainId, _path);\n\n // resume the receiving of msgs after we force clear the \"stuck\" msg\n _clearMsgQue(_srcChainId, _path);\n }\n\n // ------------------------------ Other Public/External Functions --------------------------------------------------\n\n function getLengthOfQueue(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint) {\n return msgsToDeliver[_srcChainId][_srcAddress].length;\n }\n\n // used to simulate messages received get stored as a payload\n function blockNextMsg() external {\n nextMsgBlocked = true;\n }\n\n function setDestLzEndpoint(address destAddr, address lzEndpointAddr) external {\n lzEndpointLookup[destAddr] = lzEndpointAddr;\n }\n\n function setRelayerPrice(\n uint128 _dstPriceRatio,\n uint128 _dstGasPriceInWei,\n uint128 _dstNativeAmtCap,\n uint64 _baseGas,\n uint64 _gasPerByte\n ) external {\n relayerFeeConfig.dstPriceRatio = _dstPriceRatio;\n relayerFeeConfig.dstGasPriceInWei = _dstGasPriceInWei;\n relayerFeeConfig.dstNativeAmtCap = _dstNativeAmtCap;\n relayerFeeConfig.baseGas = _baseGas;\n relayerFeeConfig.gasPerByte = _gasPerByte;\n }\n\n function setProtocolFee(uint _zroFee, uint _nativeBP) external {\n protocolFeeConfig.zroFee = _zroFee;\n protocolFeeConfig.nativeBP = _nativeBP;\n }\n\n function setOracleFee(uint _oracleFee) external {\n oracleFee = _oracleFee;\n }\n\n function setDefaultAdapterParams(bytes memory _adapterParams) external {\n defaultAdapterParams = _adapterParams;\n }\n\n // --------------------- Internal Functions ---------------------\n // simulates the relayer pushing through the rest of the msgs that got delayed due to the stored payload\n function _clearMsgQue(uint16 _srcChainId, bytes calldata _path) internal {\n QueuedPayload[] storage msgs = msgsToDeliver[_srcChainId][_path];\n\n // warning, might run into gas issues trying to forward through a bunch of queued msgs\n while (msgs.length > 0) {\n QueuedPayload memory payload = msgs[msgs.length - 1];\n ILayerZeroReceiver(payload.dstAddress).lzReceive(_srcChainId, _path, payload.nonce, payload.payload);\n msgs.pop();\n }\n }\n\n function _getProtocolFees(\n bool _payInZro,\n uint _relayerFee,\n uint _oracleFee\n ) internal view returns (uint) {\n if (_payInZro) {\n return protocolFeeConfig.zroFee;\n } else {\n return ((_relayerFee + _oracleFee) * protocolFeeConfig.nativeBP) / 10000;\n }\n }\n\n function _getRelayerFee(\n uint16, /* _dstChainId */\n uint16, /* _outboundProofType */\n address, /* _userApplication */\n uint _payloadSize,\n bytes memory _adapterParams\n ) internal view returns (uint) {\n (uint16 txType, uint extraGas, uint dstNativeAmt, ) = LzLib.decodeAdapterParams(_adapterParams);\n uint totalRemoteToken; // = baseGas + extraGas + requiredNativeAmount\n if (txType == 2) {\n require(relayerFeeConfig.dstNativeAmtCap >= dstNativeAmt, \"LayerZeroMock: dstNativeAmt too large \");\n totalRemoteToken += dstNativeAmt;\n }\n // remoteGasTotal = dstGasPriceInWei * (baseGas + extraGas)\n uint remoteGasTotal = relayerFeeConfig.dstGasPriceInWei * (relayerFeeConfig.baseGas + extraGas);\n totalRemoteToken += remoteGasTotal;\n\n // tokenConversionRate = dstPrice / localPrice\n // basePrice = totalRemoteToken * tokenConversionRate\n uint basePrice = (totalRemoteToken * relayerFeeConfig.dstPriceRatio) / 10**10;\n\n // pricePerByte = (dstGasPriceInWei * gasPerBytes) * tokenConversionRate\n uint pricePerByte = (relayerFeeConfig.dstGasPriceInWei * relayerFeeConfig.gasPerByte * relayerFeeConfig.dstPriceRatio) / 10**10;\n\n return basePrice + _payloadSize * pricePerByte;\n }\n}\n" + }, + "contracts/lzApp/libs/LzLib.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.6.0;\npragma experimental ABIEncoderV2;\n\nlibrary LzLib {\n // LayerZero communication\n struct CallParams {\n address payable refundAddress;\n address zroPaymentAddress;\n }\n\n //---------------------------------------------------------------------------\n // Address type handling\n\n struct AirdropParams {\n uint airdropAmount;\n bytes32 airdropAddress;\n }\n\n function buildAdapterParams(LzLib.AirdropParams memory _airdropParams, uint _uaGasLimit) internal pure returns (bytes memory adapterParams) {\n if (_airdropParams.airdropAmount == 0 && _airdropParams.airdropAddress == bytes32(0x0)) {\n adapterParams = buildDefaultAdapterParams(_uaGasLimit);\n } else {\n adapterParams = buildAirdropAdapterParams(_uaGasLimit, _airdropParams);\n }\n }\n\n // Build Adapter Params\n function buildDefaultAdapterParams(uint _uaGas) internal pure returns (bytes memory) {\n // txType 1\n // bytes [2 32 ]\n // fields [txType extraGas]\n return abi.encodePacked(uint16(1), _uaGas);\n }\n\n function buildAirdropAdapterParams(uint _uaGas, AirdropParams memory _params) internal pure returns (bytes memory) {\n require(_params.airdropAmount > 0, \"Airdrop amount must be greater than 0\");\n require(_params.airdropAddress != bytes32(0x0), \"Airdrop address must be set\");\n\n // txType 2\n // bytes [2 32 32 bytes[] ]\n // fields [txType extraGas dstNativeAmt dstNativeAddress]\n return abi.encodePacked(uint16(2), _uaGas, _params.airdropAmount, _params.airdropAddress);\n }\n\n function getGasLimit(bytes memory _adapterParams) internal pure returns (uint gasLimit) {\n require(_adapterParams.length == 34 || _adapterParams.length > 66, \"Invalid adapterParams\");\n assembly {\n gasLimit := mload(add(_adapterParams, 34))\n }\n }\n\n // Decode Adapter Params\n function decodeAdapterParams(bytes memory _adapterParams)\n internal\n pure\n returns (\n uint16 txType,\n uint uaGas,\n uint airdropAmount,\n address payable airdropAddress\n )\n {\n require(_adapterParams.length == 34 || _adapterParams.length > 66, \"Invalid adapterParams\");\n assembly {\n txType := mload(add(_adapterParams, 2))\n uaGas := mload(add(_adapterParams, 34))\n }\n require(txType == 1 || txType == 2, \"Unsupported txType\");\n require(uaGas > 0, \"Gas too low\");\n\n if (txType == 2) {\n assembly {\n airdropAmount := mload(add(_adapterParams, 66))\n airdropAddress := mload(add(_adapterParams, 86))\n }\n }\n }\n\n //---------------------------------------------------------------------------\n // Address type handling\n function bytes32ToAddress(bytes32 _bytes32Address) internal pure returns (address _address) {\n return address(uint160(uint(_bytes32Address)));\n }\n\n function addressToBytes32(address _address) internal pure returns (bytes32 _bytes32Address) {\n return bytes32(uint(uint160(_address)));\n }\n}\n" + }, + "contracts/contracts-upgradable/token/onft721/extensions/ExtendedONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721RoyaltyUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\";\nimport \"../ONFT721Upgradeable.sol\";\n\ncontract ExtendedONFT721Upgradeable is\n OwnableUpgradeable,\n AccessControlUpgradeable,\n ERC721Upgradeable,\n ERC721RoyaltyUpgradeable,\n ERC721EnumerableUpgradeable,\n ERC721BurnableUpgradeable,\n ONFT721Upgradeable,\n Proxied\n{\n using StringsUpgradeable for uint256;\n\n string internal baseTokenURI;\n\n /********************************************\n *** Initializers\n ********************************************/\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(\n string memory _name,\n string memory _symbol,\n string memory _baseUri,\n uint96 _royaltyBasePoints,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) public virtual initializer {\n __ExtendedONFT721Upgradeable_init(_name, _symbol, _baseUri, _royaltyBasePoints, _minGasToTransfer, _lzEndpoint);\n }\n\n function __ExtendedONFT721Upgradeable_init(\n string memory _name,\n string memory _symbol,\n string memory _baseUri,\n uint96 _royaltyBasePoints,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) internal onlyInitializing {\n __ERC721_init_unchained(_name, _symbol);\n\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __ONFT721CoreUpgradeable_init_unchained(_minGasToTransfer);\n\n __ExtendedONFT721Upgradeable_init_unchained(_baseUri, _royaltyBasePoints);\n }\n\n function __ExtendedONFT721Upgradeable_init_unchained(string memory _baseUri, uint96 _royaltyBasePoints) internal onlyInitializing {\n baseTokenURI = _baseUri;\n\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n _setDefaultRoyalty(_msgSender(), _royaltyBasePoints);\n }\n\n /********************************************\n *** Public functions\n ********************************************/\n\n /**\n * @dev Multi-recipient transfer.\n */\n function transferMulti(address from, address[] memory recipients, uint256[] memory tokenIds) public virtual {\n require(recipients.length > 0 && recipients.length == tokenIds.length, \"ERC721: input length mismatch\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n safeTransferFrom(from, recipients[i], tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Batch-Transfer (same recipient).\n */\n function transferBatch(address from, address to, uint256[] memory tokenIds) public virtual {\n require(tokenIds.length > 0, \"ERC721: tokenIds can't be empty\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n safeTransferFrom(from, to, tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Set new token metadata base URI.\n */\n function setBaseURI(string memory _baseUri) public virtual onlyOwner {\n baseTokenURI = _baseUri;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}. Override attaches \".json\" extension to URI.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), \".json\")) : \"\";\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ONFT721Upgradeable, ERC721RoyaltyUpgradeable, ERC721EnumerableUpgradeable, ERC721Upgradeable, AccessControlUpgradeable)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n /********************************************\n *** Internal functions\n ********************************************/\n\n /**\n * @dev Updateable base token URI override.\n */\n function _baseURI() internal view virtual override returns (string memory) {\n return baseTokenURI;\n }\n\n /**\n * @dev See {ERC721-_burn}.\n */\n function _burn(uint256 tokenId) internal virtual override(ERC721RoyaltyUpgradeable, ERC721Upgradeable) {\n super._burn(tokenId);\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override(ERC721EnumerableUpgradeable, ERC721Upgradeable) {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\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 uint[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\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 * ```solidity\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. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\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/token/ERC721/extensions/ERC721BurnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../utils/ContextUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC721 Burnable Token\n * @dev ERC721 Token that can be burned (destroyed).\n */\nabstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {\n function __ERC721Burnable_init() internal onlyInitializing {\n }\n\n function __ERC721Burnable_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev Burns `tokenId`. See {ERC721-_burn}.\n *\n * Requirements:\n *\n * - The caller must own `tokenId` or be an approved operator.\n */\n function burn(uint256 tokenId) public virtual {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _burn(tokenId);\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" + }, + "contracts/contracts-upgradable/token/onft721/ONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"./interfaces/IONFT721Upgradeable.sol\";\nimport \"./ONFT721CoreUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\n\n// NOTE: this ONFT contract has no public minting logic.\n// must implement your own minting logic in child classes\ncontract ONFT721Upgradeable is Initializable, ONFT721CoreUpgradeable, ERC721Upgradeable, IONFT721Upgradeable {\n function __ONFT721Upgradeable_init(\n string memory _name,\n string memory _symbol,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) internal onlyInitializing {\n __ERC721_init_unchained(_name, _symbol);\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __ONFT721CoreUpgradeable_init_unchained(_minGasToTransfer);\n }\n\n function __ONFT721Upgradeable_init_unchained() internal onlyInitializing {}\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ONFT721CoreUpgradeable, ERC721Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IONFT721Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(address _from, uint16, bytes memory, uint _tokenId) internal virtual override {\n require(_isApprovedOrOwner(_msgSender(), _tokenId), \"ONFT721: send caller is not owner nor approved\");\n require(ERC721Upgradeable.ownerOf(_tokenId) == _from, \"ONFT721: send from incorrect owner\");\n _transfer(_from, address(this), _tokenId);\n }\n\n function _creditTo(uint16, address _toAddress, uint _tokenId) internal virtual override {\n require(!_exists(_tokenId) || (_exists(_tokenId) && ERC721Upgradeable.ownerOf(_tokenId) == address(this)));\n if (!_exists(_tokenId)) {\n _safeMint(_toAddress, _tokenId);\n } else {\n _transfer(address(this), _toAddress, _tokenId);\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 uint[50] 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" + }, + "contracts/contracts-upgradable/token/onft721/interfaces/IONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"./IONFT721CoreUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\n\n/**\n * @dev Interface of the ONFT Upgradeable standard\n */\ninterface IONFT721Upgradeable is IONFT721CoreUpgradeable, IERC721Upgradeable {\n\n}\n" + }, + "contracts/contracts-upgradable/token/onft721/extensions/MinterONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"./ExtendedONFT721Upgradeable.sol\";\n\ncontract MinterONFT721Upgradeable is ExtendedONFT721Upgradeable {\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n\n /********************************************\n *** Public functions\n ********************************************/\n\n function initialize(\n string memory _name,\n string memory _symbol,\n string memory _baseUri,\n uint96 _royaltyBasePoints,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) public virtual override initializer {\n __MinterONFT721Upgradeable_init(_name, _symbol, _baseUri, _royaltyBasePoints, _minGasToTransfer, _lzEndpoint);\n }\n\n function __MinterONFT721Upgradeable_init(\n string memory _name,\n string memory _symbol,\n string memory _baseUri,\n uint96 _royaltyBasePoints,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) internal onlyInitializing {\n __ERC721_init_unchained(_name, _symbol);\n\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __ONFT721CoreUpgradeable_init_unchained(_minGasToTransfer);\n\n __ExtendedONFT721Upgradeable_init_unchained(_baseUri, _royaltyBasePoints);\n\n __MinterONFT721Upgradeable_init_unchained();\n }\n\n function __MinterONFT721Upgradeable_init_unchained() internal onlyInitializing {\n _setupRole(MINTER_ROLE, _msgSender());\n }\n\n /**\n * @dev Public minting method, Minter-role only.\n */\n function mint(address to, uint256 tokenId) public virtual onlyRole(MINTER_ROLE) {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Multi-recipient minting.\n */\n function mintMulti(address[] memory recipients, uint256[] memory tokenIds) public virtual onlyRole(MINTER_ROLE) {\n require(recipients.length > 0 && recipients.length == tokenIds.length, \"ERC721: input length mismatch\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n _safeMint(recipients[i], tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Batch-Mint (same recipient).\n */\n function mintBatch(address to, uint256[] memory tokenIds) public virtual onlyRole(MINTER_ROLE) {\n require(tokenIds.length > 0, \"ERC721: tokenIds can't be empty\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n _safeMint(to, tokenIds[i], \"\");\n }\n }\n}\n" + }, + "contracts/contracts-upgradable/examples/ExampleONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.2;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"../token/onft721/ONFT721Upgradeable.sol\";\n\ncontract ExampleONFT721Upgradeable is Initializable, ONFT721Upgradeable, Proxied {\n function initialize(string memory _name, string memory _symbol, uint256 _minGasToTransfer, address _lzEndpoint) public initializer {\n __ONFT721Upgradeable_init(_name, _symbol, _minGasToTransfer, _lzEndpoint);\n }\n\n function mint(address _tokenOwner, uint _newId) external {\n _safeMint(_tokenOwner, _newId);\n }\n}\n" + }, + "contracts/contracts-upgradable/token/onft1155/extensions/ExtendedONFT1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\";\nimport \"../ONFT1155Upgradeable.sol\";\n\ncontract ExtendedONFT1155Upgradeable is\n Initializable,\n OwnableUpgradeable,\n AccessControlUpgradeable,\n ERC1155Upgradeable,\n ERC1155SupplyUpgradeable,\n ERC1155BurnableUpgradeable,\n ERC2981Upgradeable,\n ONFT1155Upgradeable,\n Proxied\n{\n string public name;\n string public symbol;\n\n /********************************************\n *** Initializers\n ********************************************/\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(\n string memory _name,\n string memory _symbol,\n string memory _uri,\n uint96 _royaltyBasePoints,\n address _lzEndpoint\n ) public virtual initializer {\n __ExtendedONFT1155Upgradeable_init(_name, _symbol, _uri, _royaltyBasePoints, _lzEndpoint);\n }\n\n function __ExtendedONFT1155Upgradeable_init(\n string memory _name,\n string memory _symbol,\n string memory _uri,\n uint96 _royaltyBasePoints,\n address _lzEndpoint\n ) internal onlyInitializing {\n __ERC1155_init_unchained(_uri);\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n\n __ExtendedONFT721Upgradeable_init_unchained(_name, _symbol, _royaltyBasePoints);\n }\n\n function __ExtendedONFT721Upgradeable_init_unchained(\n string memory _name,\n string memory _symbol,\n uint96 _royaltyBasePoints\n ) internal onlyInitializing {\n name = _name;\n symbol = _symbol;\n\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n _setDefaultRoyalty(_msgSender(), _royaltyBasePoints);\n }\n\n /********************************************\n *** Public functions\n ********************************************/\n /**\n * @dev Sets a new token metadata URI.\n */\n function setURI(string memory _uri) external virtual onlyOwner {\n _setURI(_uri);\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external virtual onlyOwner {\n _setDefaultRoyalty(receiver, feeNumerator);\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n */\n function setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) external virtual onlyOwner {\n _setTokenRoyalty(tokenId, receiver, feeNumerator);\n }\n\n /**\n * @dev Transfer to multiple recipients.\n */\n function multiTransferFrom(address from, address[] memory tos, uint256 id, uint256 amount, bytes memory data) public virtual {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"ExtendedONFT1155: caller is not token owner or approved\");\n\n for (uint256 i = 0; i < tos.length; ++i) {\n _safeTransferFrom(from, tos[i], id, amount, data);\n }\n }\n\n /**\n * @dev Batch transfer to multiple recipients.\n */\n function multiBatchTransferFrom(\n address from,\n address[] memory tos,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"ExtendedONFT1155: caller is not token owner or approved\");\n\n for (uint256 i = 0; i < tos.length; ++i) {\n _safeBatchTransferFrom(from, tos[i], ids, amounts, data);\n }\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}. Includes check for token existence.\n */\n function uri(uint256 id) public view virtual override returns (string memory) {\n require(exists(id), \"ExtendedONFT1155: Token ID doesn't exist\");\n\n return super.uri(id);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Upgradeable, ERC2981Upgradeable, ONFT1155Upgradeable, AccessControlUpgradeable) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n /********************************************\n *** Internal functions\n ********************************************/\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, 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 uint[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\n * own tokens and those that they have been approved to use.\n *\n * _Available since v3.1._\n */\nabstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Burnable_init() internal onlyInitializing {\n }\n\n function __ERC1155Burnable_init_unchained() internal onlyInitializing {\n }\n function burn(address account, uint256 id, uint256 value) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burn(account, id, value);\n }\n\n function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burnBatch(account, ids, values);\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/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\n *\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\n * clearly identified. Note: While a totalSupply of 1 might mean the\n * corresponding is an NFT, there is no guarantees that no other token with the\n * same id are not going to be minted.\n */\nabstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Supply_init() internal onlyInitializing {\n }\n\n function __ERC1155Supply_init_unchained() internal onlyInitializing {\n }\n mapping(uint256 => uint256) private _totalSupply;\n\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) public view virtual returns (uint256) {\n return _totalSupply[id];\n }\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) public view virtual returns (bool) {\n return ERC1155SupplyUpgradeable.totalSupply(id) > 0;\n }\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n if (from == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n _totalSupply[ids[i]] += amounts[i];\n }\n }\n\n if (to == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n uint256 supply = _totalSupply[id];\n require(supply >= amount, \"ERC1155: burn amount exceeds totalSupply\");\n unchecked {\n _totalSupply[id] = supply - amount;\n }\n }\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" + }, + "contracts/contracts-upgradable/token/onft1155/ONFT1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT1155Upgradeable.sol\";\nimport \"./ONFT1155CoreUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\";\n\n// NOTE: this ONFT contract has no public minting logic.\n// must implement your own minting logic in child classes\ncontract ONFT1155Upgradeable is Initializable, ONFT1155CoreUpgradeable, ERC1155Upgradeable, IONFT1155Upgradeable {\n function __ONFT1155Upgradeable_init(string memory _uri, address _lzEndpoint) internal onlyInitializing {\n __ERC1155_init_unchained(_uri);\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n }\n\n function __ONFT1155Upgradeable_init_unchained() internal onlyInitializing {}\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ONFT1155CoreUpgradeable, ERC1155Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IONFT1155Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(address _from, uint16, bytes memory, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override {\n address spender = _msgSender();\n require(spender == _from || isApprovedForAll(_from, spender), \"ONFT1155: send caller is not owner nor approved\");\n _burnBatch(_from, _tokenIds, _amounts);\n }\n\n function _creditTo(uint16, address _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override {\n _mintBatch(_toAddress, _tokenIds, _amounts, \"\");\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 uint[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155Upgradeable.sol\";\nimport \"./IERC1155ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC1155MetadataURIUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\n using AddressUpgradeable for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\n __ERC1155_init_unchained(uri_);\n }\n\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: address zero is not a valid owner\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\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[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Upgradeable.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "contracts/contracts-upgradable/token/onft1155/interfaces/IONFT1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./IONFT1155CoreUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\";\n\n/**\n * @dev Interface of the ONFT standard\n */\ninterface IONFT1155Upgradeable is IONFT1155CoreUpgradeable, IERC1155Upgradeable {\n\n}\n" + }, + "contracts/contracts-upgradable/examples/ExampleONFT1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.2;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"../token/onft1155/ONFT1155Upgradeable.sol\";\n\ncontract ExampleONFT1155Upgradeable is Initializable, ONFT1155Upgradeable, Proxied {\n function initialize(string memory _uri, address _lzEndpoint, uint _amount) public initializer {\n __ONFT1155Upgradeable_init(_uri, _lzEndpoint);\n if (_amount > 0) {\n _mint(_msgSender(), 1, _amount, \"\");\n }\n }\n\n function mintBatch(address _to, uint256[] memory _ids, uint256[] memory _amounts) external {\n _mintBatch(_to, _ids, _amounts, \"\");\n }\n\n function mint(address _to, uint256 _id, uint256 _amount) external {\n _mint(_to, _id, _amount, \"\");\n }\n}\n" + }, + "contracts/token/oft/v2/OFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./BaseOFTV2.sol\";\n\ncontract OFTV2 is BaseOFTV2, ERC20 {\n uint internal immutable ld2sdRate;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) ERC20(_name, _symbol) BaseOFTV2(_sharedDecimals, _lzEndpoint) {\n uint8 decimals = decimals();\n require(_sharedDecimals <= decimals, \"OFT: sharedDecimals must be <= decimals\");\n ld2sdRate = 10**(decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return totalSupply();\n }\n\n function token() public view virtual override returns (address) {\n return address(this);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(\n address _from,\n uint16,\n bytes32,\n uint _amount\n ) internal virtual override returns (uint) {\n address spender = _msgSender();\n if (_from != spender) _spendAllowance(_from, spender, _amount);\n _burn(_from, _amount);\n return _amount;\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _amount\n ) internal virtual override returns (uint) {\n _mint(_toAddress, _amount);\n return _amount;\n }\n\n function _transferFrom(\n address _from,\n address _to,\n uint _amount\n ) internal virtual override returns (uint) {\n address spender = _msgSender();\n // if transfer from this contract, no need to check allowance\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\n _transfer(_from, _to, _amount);\n return _amount;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "contracts/token/oft/v2/NativeOFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"./OFTV2.sol\";\n\ncontract NativeOFTV2 is OFTV2, ReentrancyGuard {\n event Deposit(address indexed _dst, uint _amount);\n event Withdrawal(address indexed _src, uint _amount);\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) OFTV2(_name, _symbol, _sharedDecimals, _lzEndpoint) {}\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _sendAndCall(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _payload,\n _dstGasForCall,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n }\n\n function deposit() public payable {\n _mint(msg.sender, msg.value);\n emit Deposit(msg.sender, msg.value);\n }\n\n function withdraw(uint _amount) external nonReentrant {\n require(balanceOf(msg.sender) >= _amount, \"NativeOFTV2: Insufficient balance.\");\n _burn(msg.sender, _amount);\n (bool success, ) = msg.sender.call{value: _amount}(\"\");\n require(success, \"NativeOFTV2: failed to unwrap\");\n emit Withdrawal(msg.sender, _amount);\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTV2: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTV2: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _debitFromNative(address _from, uint _amount) internal returns (uint messageFee) {\n messageFee = msg.sender == _from ? _debitMsgSender(_amount) : _debitMsgFrom(_from, _amount);\n }\n\n function _debitMsgSender(uint _amount) internal returns (uint messageFee) {\n uint msgSenderBalance = balanceOf(msg.sender);\n\n if (msgSenderBalance < _amount) {\n require(msgSenderBalance + msg.value >= _amount, \"NativeOFTV2: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgSenderBalance;\n _mint(address(msg.sender), mintAmount);\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _transfer(msg.sender, address(this), _amount);\n return messageFee;\n }\n\n function _debitMsgFrom(address _from, uint _amount) internal returns (uint messageFee) {\n uint msgFromBalance = balanceOf(_from);\n\n if (msgFromBalance < _amount) {\n require(msgFromBalance + msg.value >= _amount, \"NativeOFTV2: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgFromBalance;\n _mint(address(msg.sender), mintAmount);\n\n // transfer the differential amount to the contract\n _transfer(msg.sender, address(this), mintAmount);\n\n // overwrite the _amount to take the rest of the balance from the _from address\n _amount = msgFromBalance;\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _spendAllowance(_from, msg.sender, _amount);\n _transfer(_from, address(this), _amount);\n return messageFee;\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _amount\n ) internal override returns (uint) {\n _burn(address(this), _amount);\n (bool success, ) = _toAddress.call{value: _amount}(\"\");\n require(success, \"NativeOFTV2: failed to _creditTo\");\n return _amount;\n }\n\n receive() external payable {\n deposit();\n }\n}\n" + }, + "contracts/token/oft/v2/fee/NativeOFTWithFee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"./OFTWithFee.sol\";\n\ncontract NativeOFTWithFee is OFTWithFee, ReentrancyGuard {\n\n event Deposit(address indexed _dst, uint _amount);\n event Withdrawal(address indexed _src, uint _amount);\n\n constructor(string memory _name, string memory _symbol, uint8 _sharedDecimals, address _lzEndpoint) OFTWithFee(_name, _symbol, _sharedDecimals, _lzEndpoint) {}\n\n function deposit() public payable {\n _mint(msg.sender, msg.value);\n emit Deposit(msg.sender, msg.value);\n }\n\n function withdraw(uint _amount) external nonReentrant {\n require(balanceOf(msg.sender) >= _amount, \"NativeOFTWithFee: Insufficient balance.\");\n _burn(msg.sender, _amount);\n (bool success, ) = msg.sender.call{value: _amount}(\"\");\n require(success, \"NativeOFTWithFee: failed to unwrap\");\n emit Withdrawal(msg.sender, _amount);\n }\n\n function _send(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual override returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount,) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes memory _payload, uint64 _dstGasForCall, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual override returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount,) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _debitFromNative(address _from, uint _amount) internal returns (uint messageFee) {\n messageFee = msg.sender == _from ? _debitMsgSender(_amount) : _debitMsgFrom(_from, _amount);\n }\n\n function _debitMsgSender(uint _amount) internal returns (uint messageFee) {\n uint msgSenderBalance = balanceOf(msg.sender);\n\n if (msgSenderBalance < _amount) {\n require(msgSenderBalance + msg.value >= _amount, \"NativeOFTWithFee: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgSenderBalance;\n _mint(address(msg.sender), mintAmount);\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _transfer(msg.sender, address(this), _amount);\n return messageFee;\n }\n\n function _debitMsgFrom(address _from, uint _amount) internal returns (uint messageFee) {\n uint msgFromBalance = balanceOf(_from);\n\n if (msgFromBalance < _amount) {\n require(msgFromBalance + msg.value >= _amount, \"NativeOFTWithFee: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgFromBalance;\n _mint(address(msg.sender), mintAmount);\n\n // transfer the differential amount to the contract\n _transfer(msg.sender, address(this), mintAmount);\n\n // overwrite the _amount to take the rest of the balance from the _from address\n _amount = msgFromBalance;\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _spendAllowance(_from, msg.sender, _amount);\n _transfer(_from, address(this), _amount);\n return messageFee;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal override returns(uint) {\n _burn(address(this), _amount);\n (bool success, ) = _toAddress.call{value: _amount}(\"\");\n require(success, \"NativeOFTWithFee: failed to _creditTo\");\n return _amount;\n }\n\n receive() external payable {\n deposit();\n }\n}" + }, + "contracts/token/oft/v2/mocks/OFTV2Mock.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../OFTV2.sol\";\n\n// @dev mock OFTV2 demonstrating how to inherit OFTV2\ncontract OFTV2Mock is OFTV2 {\n constructor(address _layerZeroEndpoint, uint _initialSupply, uint8 _sharedDecimals) OFTV2(\"ExampleOFT\", \"OFT\", _sharedDecimals, _layerZeroEndpoint) {\n _mint(_msgSender(), _initialSupply);\n }\n}\n" + }, + "contracts/examples/ExampleOFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../token/oft/v2/OFTV2.sol\";\n\n/// @title A LayerZero OmnichainFungibleToken example of BasedOFT\n/// @notice Use this contract only on the BASE CHAIN. It locks tokens on source, on outgoing send(), and unlocks tokens when receiving from other chains.\ncontract ExampleOFTV2 is OFTV2 {\n constructor(address _layerZeroEndpoint, uint _initialSupply, uint8 _sharedDecimals) OFTV2(\"ExampleOFT\", \"OFT\", _sharedDecimals, _layerZeroEndpoint) {\n _mint(_msgSender(), _initialSupply);\n }\n}\n" + }, + "contracts/mocks/USDMock.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\n// this is a MOCK\nabstract contract Faucet is ERC20 {\n mapping(address => uint256) public lastClaimedAt;\n uint256 public constant FAUCET_DRIP = 100; // eth\n uint256 public constant COOLDOWN = 3600; // sec\n uint256 internal pow;\n\n constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) {\n pow = 10 ** decimals();\n _mint(msg.sender, 100000000 * pow);\n }\n\n function canClaim(address account) public view returns (bool) {\n return lastClaimedAt[account] + COOLDOWN < block.timestamp;\n }\n\n function claim() external {\n require(canClaim(msg.sender), \"wallet claimed recently\");\n\n lastClaimedAt[msg.sender] = block.timestamp;\n _mint(msg.sender, FAUCET_DRIP * pow);\n }\n}\n\nabstract contract USDFaucet is Faucet {\n function decimals() public view virtual override returns (uint8) {\n return 6;\n }\n}\n\ncontract USDCMock is USDFaucet {\n constructor() Faucet(\"USD Coin\", \"USDC\") {}\n}\n\ncontract USDTMock is USDFaucet {\n constructor() Faucet(\"Tether USD\", \"USDT\") {}\n}\n\ncontract BeamMock is Faucet {\n constructor() Faucet(\"Beam\", \"BEAM\") {}\n}\n" + }, + "contracts/mocks/ERC20Mock.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\n// this is a MOCK\ncontract ERC20Mock is ERC20 {\n constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) {}\n\n function mint(address _to, uint _amount) public {\n _mint(_to, _amount);\n }\n}\n" + }, + "contracts/token/onft721/mocks/ONFT721Mock.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.0;\n\nimport \"../ONFT721.sol\";\n\ncontract ONFT721Mock is ONFT721 {\n constructor(\n string memory _name,\n string memory _symbol,\n uint _minGasToStore,\n address _layerZeroEndpoint\n ) ONFT721(_name, _symbol, _minGasToStore, _layerZeroEndpoint) {}\n\n function mint(address _tokenOwner, uint _newId) external payable {\n _safeMint(_tokenOwner, _newId);\n }\n\n function rawOwnerOf(uint tokenId) public view returns (address) {\n if (_exists(tokenId)) {\n return ownerOf(tokenId);\n }\n return address(0);\n }\n}\n" + }, + "contracts/token/onft721/mocks/ONFT721AMock.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.4;\n\nimport \"../ONFT721A.sol\";\n\n// DISCLAIMER: This contract can only be deployed on one chain when deployed and calling\n// setTrustedRemotes with remote contracts. This is due to the sequential way 721A mints tokenIds.\n// This contract must be the first minter of each token id\ncontract ONFT721AMock is ONFT721A {\n constructor(\n string memory _name,\n string memory _symbol,\n uint _minGasToTransferAndStore,\n address _layerZeroEndpoint\n ) ONFT721A(_name, _symbol, _minGasToTransferAndStore, _layerZeroEndpoint) {}\n\n function mint(uint _amount) external payable {\n _safeMint(msg.sender, _amount, \"\");\n }\n}\n" + }, + "contracts/examples/PingPong.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n//\n// Note: You will need to fund each deployed contract with gas.\n//\n// PingPong sends a LayerZero message back and forth between chains\n// a predetermined number of times (or until it runs out of gas).\n//\n// Demonstrates:\n// 1. a recursive feature of calling send() from inside lzReceive()\n// 2. how to `estimateFees` for a send()'ing a LayerZero message\n// 3. the contract pays the message fee\n\npragma solidity ^0.8.0;\npragma abicoder v2;\n\nimport \"../lzApp/NonblockingLzApp.sol\";\n\n/// @title PingPong\n/// @notice Sends a LayerZero message back and forth between chains a predetermined number of times.\ncontract PingPong is NonblockingLzApp {\n\n /// @dev event emitted every ping() to keep track of consecutive pings count\n event Ping(uint256 pingCount);\n\n /// @param _endpoint The LayerZero endpoint address.\n constructor(address _endpoint) NonblockingLzApp(_endpoint) {}\n\n /// @notice Pings the destination chain, along with the current number of pings sent.\n /// @param _dstChainId The destination chain ID.\n /// @param _totalPings The total number of pings to send.\n function ping(\n uint16 _dstChainId,\n uint256 _totalPings\n ) public {\n _ping(_dstChainId, 0, _totalPings);\n }\n\n /// @dev Internal function to ping the destination chain, along with the current number of pings sent.\n /// @param _dstChainId The destination chain ID.\n /// @param _pings The current ping count.\n /// @param _totalPings The total number of pings to send.\n function _ping(\n uint16 _dstChainId,\n uint256 _pings,\n uint256 _totalPings\n ) internal {\n require(address(this).balance > 0, \"This contract ran out of money.\");\n\n // encode the payload with the number of pings\n bytes memory payload = abi.encode(_pings, _totalPings);\n\n // encode the adapter parameters\n uint16 version = 1;\n uint256 gasForDestinationLzReceive = 350000;\n bytes memory adapterParams = abi.encodePacked(version, gasForDestinationLzReceive);\n\n // send LayerZero message\n _lzSend( // {value: messageFee} will be paid out of this contract!\n _dstChainId, // destination chainId\n payload, // abi.encode()'ed bytes\n payable(this), // (msg.sender will be this contract) refund address (LayerZero will refund any extra gas back to caller of send())\n address(0x0), // future param, unused for this example\n adapterParams, // v1 adapterParams, specify custom destination gas qty\n address(this).balance\n );\n }\n\n /// @dev Internal function to handle incoming Ping messages.\n /// @param _srcChainId The source chain ID from which the message originated.\n /// @param _payload The payload of the incoming message.\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory, /*_srcAddress*/\n uint64, /*_nonce*/\n bytes memory _payload\n ) internal override {\n // decode the number of pings sent thus far\n (uint256 pingCount, uint256 totalPings) = abi.decode(_payload, (uint256, uint256));\n ++pingCount;\n emit Ping(pingCount);\n\n // *pong* back to the other side\n if (pingCount < totalPings) {\n _ping(_srcChainId, pingCount, totalPings);\n }\n }\n\n // allow this contract to receive ether\n receive() external payable {}\n}\n" + }, + "contracts/examples/OmniCounter.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\npragma abicoder v2;\n\nimport \"../lzApp/NonblockingLzApp.sol\";\n\n/// @title A LayerZero example sending a cross chain message from a source chain to a destination chain to increment a counter\ncontract OmniCounter is NonblockingLzApp {\n bytes public constant PAYLOAD = \"\\x01\\x02\\x03\\x04\";\n uint public counter;\n\n constructor(address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {}\n\n function _nonblockingLzReceive(\n uint16,\n bytes memory,\n uint64,\n bytes memory\n ) internal override {\n counter += 1;\n }\n\n function estimateFee(\n uint16 _dstChainId,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view returns (uint nativeFee, uint zroFee) {\n return lzEndpoint.estimateFees(_dstChainId, address(this), PAYLOAD, _useZro, _adapterParams);\n }\n\n function incrementCounter(uint16 _dstChainId) public payable {\n _lzSend(_dstChainId, PAYLOAD, payable(msg.sender), address(0x0), bytes(\"\"), msg.value);\n }\n\n function setOracle(uint16 dstChainId, address oracle) external onlyOwner {\n uint TYPE_ORACLE = 6;\n // set the Oracle\n lzEndpoint.setConfig(lzEndpoint.getSendVersion(address(this)), dstChainId, TYPE_ORACLE, abi.encode(oracle));\n }\n\n function getOracle(uint16 remoteChainId) external view returns (address _oracle) {\n bytes memory bytesOracle = lzEndpoint.getConfig(lzEndpoint.getSendVersion(address(this)), remoteChainId, address(this), 6);\n assembly {\n _oracle := mload(add(bytesOracle, 32))\n }\n }\n}\n" + }, + "contracts/examples/GasDrop.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../lzApp/NonblockingLzApp.sol\";\n\n/// @title GasDrop\n/// @notice A contract for sending and receiving gas across chains using LayerZero's NonblockingLzApp.\ncontract GasDrop is NonblockingLzApp {\n\n /// @notice The version of the adapterParams.\n uint16 public constant VERSION = 2;\n \n /// @notice The default amount of gas to be used on the destination chain.\n uint public dstGas = 25000;\n\n /// @dev Emitted when the destination gas is updated.\n event SetDstGas(uint dstGas);\n \n /// @dev Emitted when a gas drop is sent.\n event SendGasDrop(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint _amount);\n \n /// @dev Emitted when a gas drop is received on this chain.\n event ReceiveGasDrop(uint16 indexed _srcChainId, address indexed _from, bytes indexed _toAddress, uint _amount);\n\n /// @param _endpoint The LayerZero endpoint address.\n constructor(address _endpoint) NonblockingLzApp(_endpoint) {}\n\n /// @dev Internal function to handle incoming LayerZero messages and emit a ReceiveGasDrop event.\n /// @param _srcChainId The source chain ID from where the message originated.\n /// @param _payload The payload of the incoming message.\n function _nonblockingLzReceive(uint16 _srcChainId, bytes memory, uint64, bytes memory _payload) internal virtual override {\n (uint amount, address fromAddress, bytes memory toAddress) = abi.decode(_payload, (uint, address, bytes));\n emit ReceiveGasDrop(_srcChainId, fromAddress, toAddress, amount);\n }\n\n /// @notice Estimate the fee for sending a gas drop to other chains.\n /// @param _dstChainId Array of destination chain IDs.\n /// @param _toAddress Array of destination addresses.\n /// @param _amount Array of amounts to send.\n /// @param _useZro Whether to use ZRO for payment or not.\n /// @return nativeFee The total native fee for all destinations.\n /// @return zroFee The total ZRO fee for all destinations.\n function estimateSendFee(uint16[] calldata _dstChainId, bytes[] calldata _toAddress, uint[] calldata _amount, bool _useZro) external view virtual returns (uint nativeFee, uint zroFee) {\n require(_dstChainId.length == _toAddress.length, \"_dstChainId and _toAddress must be same size\");\n require(_toAddress.length == _amount.length, \"_toAddress and _amount must be same size\");\n for(uint i = 0; i < _dstChainId.length; i++) {\n bytes memory adapterParams = abi.encodePacked(VERSION, dstGas, _amount[i], _toAddress[i]);\n bytes memory payload = abi.encode(_amount[i], msg.sender, _toAddress[i]);\n (uint native, uint zro) = lzEndpoint.estimateFees(_dstChainId[i], address(this), payload, _useZro, adapterParams);\n nativeFee += native;\n zroFee += zro;\n }\n }\n\n /// @notice Send gas drops to other chains.\n /// @param _dstChainId Array of destination chain IDs.\n /// @param _toAddress Array of destination addresses.\n /// @param _amount Array of amounts to send.\n /// @param _refundAddress Address for refunds.\n /// @param _zroPaymentAddress Address for ZRO payments.\n function gasDrop(uint16[] calldata _dstChainId, bytes[] calldata _toAddress, uint[] calldata _amount, address payable _refundAddress, address _zroPaymentAddress) external payable virtual {\n require(_dstChainId.length == _toAddress.length, \"_dstChainId and _toAddress must be same size\");\n require(_toAddress.length == _amount.length, \"_toAddress and _amount must be same size\");\n uint _dstGas = dstGas;\n for(uint i = 0; i < _dstChainId.length; i++) {\n bytes memory adapterParams = abi.encodePacked(VERSION, _dstGas, _amount[i], _toAddress[i]);\n bytes memory payload = abi.encode(_amount[i], msg.sender, _toAddress[i]);\n address payable refundAddress = (i == _dstChainId.length - 1) ? _refundAddress : payable(address(this));\n _lzSend(_dstChainId[i], payload, refundAddress, _zroPaymentAddress, adapterParams, address(this).balance);\n emit SendGasDrop(_dstChainId[i], msg.sender, _toAddress[i], _amount[i]);\n }\n }\n\n /// @notice Update the destination gas amount.\n /// @param _dstGas The new destination gas amount.\n function setDstGas(uint _dstGas) external onlyOwner {\n dstGas = _dstGas;\n emit SetDstGas(dstGas);\n }\n\n /// @dev Fallback function to receive Ether.\n receive() external payable {}\n}\n" + }, + "contracts/contracts-upgradable/examples/Domi.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\n\ncontract DomiOFT is OFTWithFeeUpgradeable {}\n\ncontract DomiProxyOFT is ProxyOFTWithFeeUpgradeable {}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "storageLayout", + "devdoc", + "userdoc", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/ethereum/ForgottenPlaylandProxyOFT.json b/deployments/ethereum/ForgottenPlaylandProxyOFT.json new file mode 100644 index 00000000..7adcc262 --- /dev/null +++ b/deployments/ethereum/ForgottenPlaylandProxyOFT.json @@ -0,0 +1,1618 @@ +{ + "address": "0xBb6CA854D6a812943decd0AaeA45aE98e760321f", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_hash", + "type": "bytes32" + } + ], + "name": "CallOFTReceivedSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } + ], + "name": "MessageFailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "NonContractAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": true, + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "ReceiveFromChain", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_payloadHash", + "type": "bytes32" + } + ], + "name": "RetryMessageSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": true, + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "SendToChain", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "feeBp", + "type": "uint16" + } + ], + "name": "SetDefaultFeeBp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "dstchainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "feeBp", + "type": "uint16" + } + ], + "name": "SetFeeBp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "feeOwner", + "type": "address" + } + ], + "name": "SetFeeOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "_type", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_minDstGas", + "type": "uint256" + } + ], + "name": "SetMinDstGas", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "precrime", + "type": "address" + } + ], + "name": "SetPrecrime", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_path", + "type": "bytes" + } + ], + "name": "SetTrustedRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_remoteAddress", + "type": "bytes" + } + ], + "name": "SetTrustedRemoteAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "_useCustomAdapterParams", + "type": "bool" + } + ], + "name": "SetUseCustomAdapterParams", + "type": "event" + }, + { + "inputs": [], + "name": "BP_DENOMINATOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_PAYLOAD_SIZE_LIMIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NO_EXTRA_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PT_SEND", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PT_SEND_AND_CALL", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "_from", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_gasForCall", + "type": "uint256" + } + ], + "name": "callOnOFTReceived", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "chainIdToFeeBps", + "outputs": [ + { + "internalType": "uint16", + "name": "feeBP", + "type": "uint16" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "circulatingSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "creditedPackets", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultFeeBp", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_dstGasForCall", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "_useZro", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "_adapterParams", + "type": "bytes" + } + ], + "name": "estimateSendAndCallFee", + "outputs": [ + { + "internalType": "uint256", + "name": "nativeFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "zroFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_useZro", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "_adapterParams", + "type": "bytes" + } + ], + "name": "estimateSendFee", + "outputs": [ + { + "internalType": "uint256", + "name": "nativeFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "zroFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "failedMessages", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + } + ], + "name": "forceResumeReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_chainId", + "type": "uint16" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_configType", + "type": "uint256" + } + ], + "name": "getConfig", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + } + ], + "name": "getTrustedRemoteAddress", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint8", + "name": "_sharedDecimals", + "type": "uint8" + }, + { + "internalType": "address", + "name": "_lzEndpoint", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + } + ], + "name": "isTrustedRemote", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lzEndpoint", + "outputs": [ + { + "internalType": "contract ILayerZeroEndpointUpgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "lzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "minDstGasLookup", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "nonblockingLzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "outboundAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "payloadSizeLimitLookup", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "precrime", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "quoteOFTFee", + "outputs": [ + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "retryMessage", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_dstGasForCall", + "type": "uint64" + }, + { + "components": [ + { + "internalType": "address payable", + "name": "refundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "zroPaymentAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "adapterParams", + "type": "bytes" + } + ], + "internalType": "struct ICommonOFTUpgradeable.LzCallParams", + "name": "_callParams", + "type": "tuple" + } + ], + "name": "sendAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address payable", + "name": "refundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "zroPaymentAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "adapterParams", + "type": "bytes" + } + ], + "internalType": "struct ICommonOFTUpgradeable.LzCallParams", + "name": "_callParams", + "type": "tuple" + } + ], + "name": "sendFrom", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_chainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_configType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_config", + "type": "bytes" + } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_feeBp", + "type": "uint16" + } + ], + "name": "setDefaultFeeBp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bool", + "name": "_enabled", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "_feeBp", + "type": "uint16" + } + ], + "name": "setFeeBp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeOwner", + "type": "address" + } + ], + "name": "setFeeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_packetType", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_minGas", + "type": "uint256" + } + ], + "name": "setMinDstGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_size", + "type": "uint256" + } + ], + "name": "setPayloadSizeLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_precrime", + "type": "address" + } + ], + "name": "setPrecrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + } + ], + "name": "setReceiveVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + } + ], + "name": "setSendVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_path", + "type": "bytes" + } + ], + "name": "setTrustedRemote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_remoteAddress", + "type": "bytes" + } + ], + "name": "setTrustedRemoteAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_useCustomAdapterParams", + "type": "bool" + } + ], + "name": "setUseCustomAdapterParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sharedDecimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "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": "token", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "trustedRemoteLookup", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "useCustomAdapterParams", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xece0eda2a1733d6d50cb5229fc7fbd2f856a5790ce7711c1608e82c1bb7b12d6", + "receipt": { + "to": null, + "from": "0xbFb53a2c470cdb4FF32eE4F18A93B98F9f55D0E1", + "contractAddress": "0xBb6CA854D6a812943decd0AaeA45aE98e760321f", + "transactionIndex": 53, + "gasUsed": "591228", + "logsBloom": "0x00040000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000001000000040000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000002000000000000000000000000080000000000800000000000000000000000000000000080400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2804b5f9bfc20f11e9bea6d061075e68cd099ac4171f5a12b3d8a138dcd049ea", + "transactionHash": "0xece0eda2a1733d6d50cb5229fc7fbd2f856a5790ce7711c1608e82c1bb7b12d6", + "logs": [ + { + "transactionIndex": 53, + "blockNumber": 19325784, + "transactionHash": "0xece0eda2a1733d6d50cb5229fc7fbd2f856a5790ce7711c1608e82c1bb7b12d6", + "address": "0xBb6CA854D6a812943decd0AaeA45aE98e760321f", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000bfb53a2c470cdb4ff32ee4f18a93b98f9f55d0e1" + ], + "data": "0x", + "logIndex": 247, + "blockHash": "0x2804b5f9bfc20f11e9bea6d061075e68cd099ac4171f5a12b3d8a138dcd049ea" + }, + { + "transactionIndex": 53, + "blockNumber": 19325784, + "transactionHash": "0xece0eda2a1733d6d50cb5229fc7fbd2f856a5790ce7711c1608e82c1bb7b12d6", + "address": "0xBb6CA854D6a812943decd0AaeA45aE98e760321f", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 248, + "blockHash": "0x2804b5f9bfc20f11e9bea6d061075e68cd099ac4171f5a12b3d8a138dcd049ea" + } + ], + "blockNumber": 19325784, + "cumulativeGasUsed": "8717437", + "status": 1, + "byzantium": true + }, + "args": [ + "0xDC2dc789ee5aD91Fb9f712d770Df1D67095584E2", + "0x965B104e250648d01d4B3b72BaC751Cde809D29E", + "0xf35f9e45000000000000000000000000eeee2a2e650697d2a8e8bc990c2f3d04203be06f000000000000000000000000000000000000000000000000000000000000000600000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"Storage slot with the admin of the contract. This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is validated in the constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":\"OptimizedTransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\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 Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\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 function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\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 // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\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 functionCall(target, data, \\\"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(address target, bytes memory data, string memory errorMessage) 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(address target, bytes memory data, uint256 value) 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(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\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\\n // solhint-disable-next-line no-inline-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}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"},\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.7.0;\\n\\nimport \\\"../openzeppelin/proxy/UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract OptimizedTransparentUpgradeableProxy is UpgradeableProxy {\\n address internal immutable _ADMIN;\\n\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(\\n address initialLogic,\\n address initialAdmin,\\n bytes memory _data\\n ) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 slot = _ADMIN_SLOT;\\n\\n _ADMIN = initialAdmin;\\n\\n // still store it to work with EIP-1967\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, initialAdmin)\\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 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, ) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n return _ADMIN;\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x076456d71495e22183c672db71d719bd2dc7cb3b35e5bba21ce37eea1ec30347\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040526040516108fc3803806108fc8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101e9565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b506001600160601b0319606082901b166080527fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035550610297565b6101fc8161025b60201b6103581760201c565b6102375760405162461bcd60e51b81526004018080602001828103825260368152602001806108c66036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028f57508115155b949350505050565b60805160601c6106126102b46000398061047352506106126000f3fe6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c63430007060033", + "execute": { + "methodName": "initialize", + "args": [ + "0xEeee2A2E650697d2A8e8BC990C2f3d04203bE06f", + 6, + "0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675" + ] + }, + "implementation": "0xDC2dc789ee5aD91Fb9f712d770Df1D67095584E2", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "Storage slot with the admin of the contract. This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is validated in the constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/ethereum/ForgottenPlaylandProxyOFT_Implementation.json b/deployments/ethereum/ForgottenPlaylandProxyOFT_Implementation.json new file mode 100644 index 00000000..1bdfc71f --- /dev/null +++ b/deployments/ethereum/ForgottenPlaylandProxyOFT_Implementation.json @@ -0,0 +1,1885 @@ +{ + "address": "0xDC2dc789ee5aD91Fb9f712d770Df1D67095584E2", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_hash", + "type": "bytes32" + } + ], + "name": "CallOFTReceivedSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_reason", + "type": "bytes" + } + ], + "name": "MessageFailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "NonContractAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": true, + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "ReceiveFromChain", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_payloadHash", + "type": "bytes32" + } + ], + "name": "RetryMessageSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": true, + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "SendToChain", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "feeBp", + "type": "uint16" + } + ], + "name": "SetDefaultFeeBp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "dstchainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "feeBp", + "type": "uint16" + } + ], + "name": "SetFeeBp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "feeOwner", + "type": "address" + } + ], + "name": "SetFeeOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "_type", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_minDstGas", + "type": "uint256" + } + ], + "name": "SetMinDstGas", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "precrime", + "type": "address" + } + ], + "name": "SetPrecrime", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_path", + "type": "bytes" + } + ], + "name": "SetTrustedRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_remoteAddress", + "type": "bytes" + } + ], + "name": "SetTrustedRemoteAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "_useCustomAdapterParams", + "type": "bool" + } + ], + "name": "SetUseCustomAdapterParams", + "type": "event" + }, + { + "inputs": [], + "name": "BP_DENOMINATOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_PAYLOAD_SIZE_LIMIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NO_EXTRA_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PT_SEND", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PT_SEND_AND_CALL", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "_from", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_gasForCall", + "type": "uint256" + } + ], + "name": "callOnOFTReceived", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "chainIdToFeeBps", + "outputs": [ + { + "internalType": "uint16", + "name": "feeBP", + "type": "uint16" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "circulatingSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "creditedPackets", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultFeeBp", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_dstGasForCall", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "_useZro", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "_adapterParams", + "type": "bytes" + } + ], + "name": "estimateSendAndCallFee", + "outputs": [ + { + "internalType": "uint256", + "name": "nativeFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "zroFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_useZro", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "_adapterParams", + "type": "bytes" + } + ], + "name": "estimateSendFee", + "outputs": [ + { + "internalType": "uint256", + "name": "nativeFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "zroFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "failedMessages", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + } + ], + "name": "forceResumeReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_chainId", + "type": "uint16" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_configType", + "type": "uint256" + } + ], + "name": "getConfig", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + } + ], + "name": "getTrustedRemoteAddress", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint8", + "name": "_sharedDecimals", + "type": "uint8" + }, + { + "internalType": "address", + "name": "_lzEndpoint", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + } + ], + "name": "isTrustedRemote", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lzEndpoint", + "outputs": [ + { + "internalType": "contract ILayerZeroEndpointUpgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "lzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "minDstGasLookup", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "nonblockingLzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "outboundAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "payloadSizeLimitLookup", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "precrime", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "quoteOFTFee", + "outputs": [ + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_srcAddress", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_nonce", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + } + ], + "name": "retryMessage", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_payload", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "_dstGasForCall", + "type": "uint64" + }, + { + "components": [ + { + "internalType": "address payable", + "name": "refundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "zroPaymentAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "adapterParams", + "type": "bytes" + } + ], + "internalType": "struct ICommonOFTUpgradeable.LzCallParams", + "name": "_callParams", + "type": "tuple" + } + ], + "name": "sendAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "_toAddress", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address payable", + "name": "refundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "zroPaymentAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "adapterParams", + "type": "bytes" + } + ], + "internalType": "struct ICommonOFTUpgradeable.LzCallParams", + "name": "_callParams", + "type": "tuple" + } + ], + "name": "sendFrom", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_chainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_configType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_config", + "type": "bytes" + } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_feeBp", + "type": "uint16" + } + ], + "name": "setDefaultFeeBp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "bool", + "name": "_enabled", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "_feeBp", + "type": "uint16" + } + ], + "name": "setFeeBp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeOwner", + "type": "address" + } + ], + "name": "setFeeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "_packetType", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_minGas", + "type": "uint256" + } + ], + "name": "setMinDstGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "_size", + "type": "uint256" + } + ], + "name": "setPayloadSizeLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_precrime", + "type": "address" + } + ], + "name": "setPrecrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + } + ], + "name": "setReceiveVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_version", + "type": "uint16" + } + ], + "name": "setSendVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_path", + "type": "bytes" + } + ], + "name": "setTrustedRemote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_remoteChainId", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_remoteAddress", + "type": "bytes" + } + ], + "name": "setTrustedRemoteAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_useCustomAdapterParams", + "type": "bool" + } + ], + "name": "setUseCustomAdapterParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sharedDecimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "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": "token", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "trustedRemoteLookup", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "useCustomAdapterParams", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xfcb97b3e1b40c540bd235bdb514efc9f1bc74f2df39124b9ab1d2401d25ecf8d", + "receipt": { + "to": null, + "from": "0xbFb53a2c470cdb4FF32eE4F18A93B98F9f55D0E1", + "contractAddress": "0xDC2dc789ee5aD91Fb9f712d770Df1D67095584E2", + "transactionIndex": 36, + "gasUsed": "4143743", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000001000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x1ed1208fbd3c03a9177a411e0f819e4a440833fada3506e746c872146a3b8a42", + "transactionHash": "0xfcb97b3e1b40c540bd235bdb514efc9f1bc74f2df39124b9ab1d2401d25ecf8d", + "logs": [ + { + "transactionIndex": 36, + "blockNumber": 19325783, + "transactionHash": "0xfcb97b3e1b40c540bd235bdb514efc9f1bc74f2df39124b9ab1d2401d25ecf8d", + "address": "0xDC2dc789ee5aD91Fb9f712d770Df1D67095584E2", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 119, + "blockHash": "0x1ed1208fbd3c03a9177a411e0f819e4a440833fada3506e746c872146a3b8a42" + } + ], + "blockNumber": 19325783, + "cumulativeGasUsed": "10518337", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "8313c17822638cfb28f4331864b9ea01", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_hash\",\"type\":\"bytes32\"}],\"name\":\"CallOFTReceivedSuccess\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_reason\",\"type\":\"bytes\"}],\"name\":\"MessageFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"NonContractAddress\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"ReceiveFromChain\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_payloadHash\",\"type\":\"bytes32\"}],\"name\":\"RetryMessageSuccess\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_toAddress\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"SendToChain\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"feeBp\",\"type\":\"uint16\"}],\"name\":\"SetDefaultFeeBp\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"dstchainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"feeBp\",\"type\":\"uint16\"}],\"name\":\"SetFeeBp\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeOwner\",\"type\":\"address\"}],\"name\":\"SetFeeOwner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_type\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minDstGas\",\"type\":\"uint256\"}],\"name\":\"SetMinDstGas\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"precrime\",\"type\":\"address\"}],\"name\":\"SetPrecrime\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_remoteChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_path\",\"type\":\"bytes\"}],\"name\":\"SetTrustedRemote\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"_remoteChainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_remoteAddress\",\"type\":\"bytes\"}],\"name\":\"SetTrustedRemoteAddress\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_useCustomAdapterParams\",\"type\":\"bool\"}],\"name\":\"SetUseCustomAdapterParams\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BP_DENOMINATOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_PAYLOAD_SIZE_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NO_EXTRA_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PT_SEND\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PT_SEND_AND_CALL\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"_from\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_gasForCall\",\"type\":\"uint256\"}],\"name\":\"callOnOFTReceived\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"chainIdToFeeBps\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"feeBP\",\"type\":\"uint16\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"circulatingSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"name\":\"creditedPackets\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultFeeBp\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes32\",\"name\":\"_toAddress\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_dstGasForCall\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"_useZro\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"_adapterParams\",\"type\":\"bytes\"}],\"name\":\"estimateSendAndCallFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"nativeFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"zroFee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes32\",\"name\":\"_toAddress\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"_useZro\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"_adapterParams\",\"type\":\"bytes\"}],\"name\":\"estimateSendFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"nativeFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"zroFee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"name\":\"failedMessages\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"}],\"name\":\"forceResumeReceive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_version\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"_chainId\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_configType\",\"type\":\"uint256\"}],\"name\":\"getConfig\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_remoteChainId\",\"type\":\"uint16\"}],\"name\":\"getTrustedRemoteAddress\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_sharedDecimals\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"_lzEndpoint\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"}],\"name\":\"isTrustedRemote\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lzEndpoint\",\"outputs\":[{\"internalType\":\"contract ILayerZeroEndpointUpgradeable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"}],\"name\":\"lzReceive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"minDstGasLookup\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"}],\"name\":\"nonblockingLzReceive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outboundAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"payloadSizeLimitLookup\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precrime\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"quoteOFTFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_nonce\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"}],\"name\":\"retryMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes32\",\"name\":\"_toAddress\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"_dstGasForCall\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"address payable\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"zroPaymentAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"adapterParams\",\"type\":\"bytes\"}],\"internalType\":\"struct ICommonOFTUpgradeable.LzCallParams\",\"name\":\"_callParams\",\"type\":\"tuple\"}],\"name\":\"sendAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes32\",\"name\":\"_toAddress\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address payable\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"zroPaymentAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"adapterParams\",\"type\":\"bytes\"}],\"internalType\":\"struct ICommonOFTUpgradeable.LzCallParams\",\"name\":\"_callParams\",\"type\":\"tuple\"}],\"name\":\"sendFrom\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_version\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"_chainId\",\"type\":\"uint16\"},{\"internalType\":\"uint256\",\"name\":\"_configType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_config\",\"type\":\"bytes\"}],\"name\":\"setConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_feeBp\",\"type\":\"uint16\"}],\"name\":\"setDefaultFeeBp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"bool\",\"name\":\"_enabled\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"_feeBp\",\"type\":\"uint16\"}],\"name\":\"setFeeBp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_feeOwner\",\"type\":\"address\"}],\"name\":\"setFeeOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"_packetType\",\"type\":\"uint16\"},{\"internalType\":\"uint256\",\"name\":\"_minGas\",\"type\":\"uint256\"}],\"name\":\"setMinDstGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"uint256\",\"name\":\"_size\",\"type\":\"uint256\"}],\"name\":\"setPayloadSizeLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_precrime\",\"type\":\"address\"}],\"name\":\"setPrecrime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_version\",\"type\":\"uint16\"}],\"name\":\"setReceiveVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_version\",\"type\":\"uint16\"}],\"name\":\"setSendVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_srcChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_path\",\"type\":\"bytes\"}],\"name\":\"setTrustedRemote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_remoteChainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_remoteAddress\",\"type\":\"bytes\"}],\"name\":\"setTrustedRemoteAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_useCustomAdapterParams\",\"type\":\"bool\"}],\"name\":\"setUseCustomAdapterParams\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sharedDecimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"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\":\"token\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"trustedRemoteLookup\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"useCustomAdapterParams\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"ReceiveFromChain(uint16,address,uint256)\":{\"details\":\"Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain. `_nonce` is the inbound nonce.\"},\"SendToChain(uint16,address,bytes32,uint256)\":{\"details\":\"Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`) `_nonce` is the outbound nonce\"}},\"kind\":\"dev\",\"methods\":{\"circulatingSupply()\":{\"details\":\"returns the circulating amount of tokens on current chain\"},\"estimateSendFee(uint16,bytes32,uint256,bool,bytes)\":{\"details\":\"estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`) _dstChainId - L0 defined chain id to send tokens too _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain _amount - amount of the tokens to transfer _useZro - indicates to use zro to pay L0 fees _adapterParam - flexible bytes array to indicate messaging adapter services in L0\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"sendFrom(address,uint16,bytes32,uint256,uint256,(address,address,bytes))\":{\"details\":\"send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from` `_from` the owner of token `_dstChainId` the destination chain identifier `_toAddress` can be any size depending on the `dstChainId`. `_amount` the quantity of tokens in wei `_minAmount` the minimum amount of tokens to receive on dstChain `_refundAddress` the address LayerZero refunds if too much message fee is sent `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) `_adapterParams` is a flexible bytes array to indicate messaging adapter services\"},\"token()\":{\"details\":\"returns the address of the ERC20 token\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts-upgradable/examples/FP.sol\":\"ForgottenPlaylandProxyOFT\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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\":\"0x4075622496acc77fd6d4de4cc30a8577a744d5c75afad33fdeacf1704d6eda98\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\\n\\npragma solidity ^0.8.0;\\n\\ninterface IERC5267Upgradeable {\\n /**\\n * @dev MAY be emitted to signal that the domain could have changed.\\n */\\n event EIP712DomainChanged();\\n\\n /**\\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\\n * signature.\\n */\\n function eip712Domain()\\n external\\n view\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n );\\n}\\n\",\"keccak256\":\"0xe562dab443278837fa50faddb76743399e942181881db8dccaea3bd1712994db\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (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 * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\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\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20Upgradeable.sol\\\";\\nimport \\\"./extensions/IERC20MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * The default value of {decimals} is 18. To change this, you should override\\n * this function so it returns a different value.\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC20_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the default value returned by this function, unless\\n * it's overridden.\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, allowance(owner, spender) + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = allowance(owner, spender);\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `from` to `to`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(address from, address to, uint256 amount) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\\n // decrementing then incrementing.\\n _balances[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n unchecked {\\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\\n _balances[account] += amount;\\n }\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n // Overflow not possible: amount <= accountBalance <= totalSupply.\\n _totalSupply -= amount;\\n }\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(address owner, address spender, uint256 amount) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 amount) 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[45] private __gap;\\n}\\n\",\"keccak256\":\"0xd14a627157b9a411d2410713e5dd3a377e9064bd5c194a90748bbf27ea625784\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 IERC20Upgradeable {\\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(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x0e1f0f5f62f67a881cd1a9597acbc0a5e4071f3c2c10449a183b922ae7272e3f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20PermitUpgradeable.sol\\\";\\nimport \\\"../ERC20Upgradeable.sol\\\";\\nimport \\\"../../../utils/cryptography/ECDSAUpgradeable.sol\\\";\\nimport \\\"../../../utils/cryptography/EIP712Upgradeable.sol\\\";\\nimport \\\"../../../utils/CountersUpgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation 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 *\\n * _Available since v3.4._\\n *\\n * @custom:storage-size 51\\n */\\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\\n using CountersUpgradeable for CountersUpgradeable.Counter;\\n\\n mapping(address => CountersUpgradeable.Counter) private _nonces;\\n\\n // solhint-disable-next-line var-name-mixedcase\\n bytes32 private constant _PERMIT_TYPEHASH =\\n keccak256(\\\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\\\");\\n /**\\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\\n * However, to ensure consistency with the upgradeable transpiler, we will continue\\n * to reserve a slot.\\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\\n\\n /**\\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\\\"1\\\"`.\\n *\\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\\n */\\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\\n __EIP712_init_unchained(name, \\\"1\\\");\\n }\\n\\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\\n\\n /**\\n * @dev See {IERC20Permit-permit}.\\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 ) public virtual override {\\n require(block.timestamp <= deadline, \\\"ERC20Permit: expired deadline\\\");\\n\\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\\n\\n bytes32 hash = _hashTypedDataV4(structHash);\\n\\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\\n require(signer == owner, \\\"ERC20Permit: invalid signature\\\");\\n\\n _approve(owner, spender, value);\\n }\\n\\n /**\\n * @dev See {IERC20Permit-nonces}.\\n */\\n function nonces(address owner) public view virtual override returns (uint256) {\\n return _nonces[owner].current();\\n }\\n\\n /**\\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\\n return _domainSeparatorV4();\\n }\\n\\n /**\\n * @dev \\\"Consume a nonce\\\": return the current value and increment.\\n *\\n * _Available since v4.1._\\n */\\n function _useNonce(address owner) internal virtual returns (uint256 current) {\\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\\n current = nonce.current();\\n nonce.increment();\\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\":\"0x3988ac03e4819acd4b5adf41de7d43c1471748ddc2d73d2c7aca1e3827402e5d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x605434219ebbe4653f703640f06969faa5a1d78f0bfef878e5ddbb1ca369ceeb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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 IERC20PermitUpgradeable {\\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\":\"0xd60f939a3ca0199014d079b4dd66aa757954334947d81eb5c1d35d7a83061ab3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20Upgradeable.sol\\\";\\nimport \\\"../extensions/IERC20PermitUpgradeable.sol\\\";\\nimport \\\"../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {\\n using AddressUpgradeable for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) 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(IERC20Upgradeable token, address spender, uint256 value) 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 /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20PermitUpgradeable 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(IERC20Upgradeable 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 require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation 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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\\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 cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0x23b997be73d3dd46885262704f0f8cfc7273fdadfe303d37969a9561373972b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) 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\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"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/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\nimport \\\"./math/SignedMathUpgradeable.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 `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMathUpgradeable.abs(value))));\\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 /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0xb96dc79b65b7c37937919dcdb356a969ce0aa2e8338322bf4dc027a3c9c9a7eb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../StringsUpgradeable.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 ECDSAUpgradeable {\\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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\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\\\", StringsUpgradeable.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 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0xa014f65d84b02827055d99993ccdbfb4b56b2c9e91eb278d82a93330659d06e4\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.8;\\n\\nimport \\\"./ECDSAUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC5267Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.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 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\\n *\\n * _Available since v3.4._\\n *\\n * @custom:storage-size 52\\n */\\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\\n bytes32 private constant _TYPE_HASH =\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\");\\n\\n /// @custom:oz-renamed-from _HASHED_NAME\\n bytes32 private _hashedName;\\n /// @custom:oz-renamed-from _HASHED_VERSION\\n bytes32 private _hashedVersion;\\n\\n string private _name;\\n string private _version;\\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 function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\\n __EIP712_init_unchained(name, version);\\n }\\n\\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\\n _name = name;\\n _version = version;\\n\\n // Reset prior values in storage if upgrading\\n _hashedName = 0;\\n _hashedVersion = 0;\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n return _buildDomainSeparator();\\n }\\n\\n function _buildDomainSeparator() private view returns (bytes32) {\\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), 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 ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n\\n /**\\n * @dev See {EIP-5267}.\\n *\\n * _Available since v4.9._\\n */\\n function eip712Domain()\\n public\\n view\\n virtual\\n override\\n returns (\\n bytes1 fields,\\n string memory name,\\n string memory version,\\n uint256 chainId,\\n address verifyingContract,\\n bytes32 salt,\\n uint256[] memory extensions\\n )\\n {\\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\\n // and the EIP712 domain is not reliable, as it will be missing name and version.\\n require(_hashedName == 0 && _hashedVersion == 0, \\\"EIP712: Uninitialized\\\");\\n\\n return (\\n hex\\\"0f\\\", // 01111\\n _EIP712Name(),\\n _EIP712Version(),\\n block.chainid,\\n address(this),\\n bytes32(0),\\n new uint256[](0)\\n );\\n }\\n\\n /**\\n * @dev The name parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Name() internal virtual view returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev The version parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712Version() internal virtual view returns (string memory) {\\n return _version;\\n }\\n\\n /**\\n * @dev The hash of the name parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\\n */\\n function _EIP712NameHash() internal view returns (bytes32) {\\n string memory name = _EIP712Name();\\n if (bytes(name).length > 0) {\\n return keccak256(bytes(name));\\n } else {\\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\\n bytes32 hashedName = _hashedName;\\n if (hashedName != 0) {\\n return hashedName;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\n }\\n }\\n\\n /**\\n * @dev The hash of the version parameter for the EIP712 domain.\\n *\\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\\n */\\n function _EIP712VersionHash() internal view returns (bytes32) {\\n string memory version = _EIP712Version();\\n if (bytes(version).length > 0) {\\n return keccak256(bytes(version));\\n } else {\\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\\n bytes32 hashedVersion = _hashedVersion;\\n if (hashedVersion != 0) {\\n return hashedVersion;\\n } else {\\n return keccak256(\\\"\\\");\\n }\\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[48] private __gap;\\n}\\n\",\"keccak256\":\"0xeb8d6be406a373771724922eb41b5d593bc8e2dc705daa22cd1145cfc8f5a3a0\",\"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.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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 256, 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 << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2bc0007987c229ae7624eb29be6a9b84f6a6a5872f76248b15208b131ea41c4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMathUpgradeable {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x88f6b7bba3ee33eeb741f9a0f5bc98b6e6e352d0fe4905377bb328590f84095a\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/examples/FP.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.18;\\n\\nimport \\\"../token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol\\\";\\nimport \\\"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\\\";\\n\\ncontract ForgottenPlaylandOFT is OFTWithFeePermitUpgradeable {}\\n\\ncontract ForgottenPlaylandProxyOFT is ProxyOFTWithFeeUpgradeable {}\\n\",\"keccak256\":\"0xff3b15c60765d3c002a4d7a4729766449b34694d1ab46b97d8ed67f4fb4b130b\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/lzApp/LzAppUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"./interfaces/ILayerZeroReceiverUpgradeable.sol\\\";\\nimport \\\"./interfaces/ILayerZeroUserApplicationConfigUpgradeable.sol\\\";\\nimport \\\"./interfaces/ILayerZeroEndpointUpgradeable.sol\\\";\\nimport \\\"../../libraries/BytesLib.sol\\\";\\n\\n/*\\n * a generic LzReceiver implementation\\n */\\nabstract contract LzAppUpgradeable is\\n Initializable,\\n OwnableUpgradeable,\\n ILayerZeroReceiverUpgradeable,\\n ILayerZeroUserApplicationConfigUpgradeable\\n{\\n using BytesLib for bytes;\\n\\n // ua can not send payload larger than this by default, but it can be changed by the ua owner\\n uint public constant DEFAULT_PAYLOAD_SIZE_LIMIT = 10000;\\n\\n ILayerZeroEndpointUpgradeable public lzEndpoint;\\n mapping(uint16 => bytes) public trustedRemoteLookup;\\n mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup;\\n mapping(uint16 => uint) public payloadSizeLimitLookup;\\n address public precrime;\\n\\n event SetPrecrime(address precrime);\\n event SetTrustedRemote(uint16 _remoteChainId, bytes _path);\\n event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress);\\n event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas);\\n\\n function __LzAppUpgradeable_init(address _endpoint) internal onlyInitializing {\\n __Ownable_init_unchained();\\n __LzAppUpgradeable_init_unchained(_endpoint);\\n }\\n\\n function __LzAppUpgradeable_init_unchained(address _endpoint) internal onlyInitializing {\\n lzEndpoint = ILayerZeroEndpointUpgradeable(_endpoint);\\n }\\n\\n function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override {\\n // lzReceive must be called by the endpoint for security\\n require(_msgSender() == address(lzEndpoint), \\\"LzApp: invalid endpoint caller\\\");\\n\\n bytes memory trustedRemote = trustedRemoteLookup[_srcChainId];\\n // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.\\n require(\\n _srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote),\\n \\\"LzApp: invalid source sending contract\\\"\\n );\\n\\n _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\\n }\\n\\n // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging\\n function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\\n\\n function _lzSend(\\n uint16 _dstChainId,\\n bytes memory _payload,\\n address payable _refundAddress,\\n address _zroPaymentAddress,\\n bytes memory _adapterParams,\\n uint _nativeFee\\n ) internal virtual {\\n bytes memory trustedRemote = trustedRemoteLookup[_dstChainId];\\n require(trustedRemote.length != 0, \\\"LzApp: destination chain is not a trusted source\\\");\\n _checkPayloadSize(_dstChainId, _payload.length);\\n lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams);\\n }\\n\\n function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual {\\n uint providedGasLimit = _getGasLimit(_adapterParams);\\n uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas;\\n require(minGasLimit > 0, \\\"LzApp: minGasLimit not set\\\");\\n require(providedGasLimit >= minGasLimit, \\\"LzApp: gas limit is too low\\\");\\n }\\n\\n function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) {\\n require(_adapterParams.length >= 34, \\\"LzApp: invalid adapterParams\\\");\\n assembly {\\n gasLimit := mload(add(_adapterParams, 34))\\n }\\n }\\n\\n function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual {\\n uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId];\\n if (payloadSizeLimit == 0) {\\n // use default if not set\\n payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT;\\n }\\n require(_payloadSize <= payloadSizeLimit, \\\"LzApp: payload size is too large\\\");\\n }\\n\\n //---------------------------UserApplication config----------------------------------------\\n function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) {\\n return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);\\n }\\n\\n // generic config for LayerZero user Application\\n function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner {\\n lzEndpoint.setConfig(_version, _chainId, _configType, _config);\\n }\\n\\n function setSendVersion(uint16 _version) external override onlyOwner {\\n lzEndpoint.setSendVersion(_version);\\n }\\n\\n function setReceiveVersion(uint16 _version) external override onlyOwner {\\n lzEndpoint.setReceiveVersion(_version);\\n }\\n\\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner {\\n lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress);\\n }\\n\\n // _path = abi.encodePacked(remoteAddress, localAddress)\\n // this function set the trusted path for the cross-chain communication\\n function setTrustedRemote(uint16 _srcChainId, bytes calldata _path) external onlyOwner {\\n trustedRemoteLookup[_srcChainId] = _path;\\n emit SetTrustedRemote(_srcChainId, _path);\\n }\\n\\n function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner {\\n trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this));\\n emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress);\\n }\\n\\n function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) {\\n bytes memory path = trustedRemoteLookup[_remoteChainId];\\n require(path.length != 0, \\\"LzApp: no trusted path record\\\");\\n return path.slice(0, path.length - 20); // the last 20 bytes should be address(this)\\n }\\n\\n function setPrecrime(address _precrime) external onlyOwner {\\n precrime = _precrime;\\n emit SetPrecrime(_precrime);\\n }\\n\\n function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner {\\n require(_minGas > 0, \\\"LzApp: invalid minGas\\\");\\n minDstGasLookup[_dstChainId][_packetType] = _minGas;\\n emit SetMinDstGas(_dstChainId, _packetType, _minGas);\\n }\\n\\n // if the size is 0, it means default size limit\\n function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner {\\n payloadSizeLimitLookup[_dstChainId] = _size;\\n }\\n\\n //--------------------------- VIEW FUNCTION ----------------------------------------\\n function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) {\\n bytes memory trustedSource = trustedRemoteLookup[_srcChainId];\\n return keccak256(trustedSource) == keccak256(_srcAddress);\\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 uint[45] private __gap;\\n}\\n\",\"keccak256\":\"0x7c17b736a978ee67fdaaf41963d93f78ddc8f6671597bac75d7a88c4bc3e0529\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/lzApp/NonblockingLzAppUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"./LzAppUpgradeable.sol\\\";\\nimport \\\"../../libraries/ExcessivelySafeCall.sol\\\";\\n\\n/*\\n * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel\\n * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking\\n * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress)\\n */\\nabstract contract NonblockingLzAppUpgradeable is Initializable, LzAppUpgradeable {\\n using ExcessivelySafeCall for address;\\n\\n function __NonblockingLzAppUpgradeable_init(address _endpoint) internal onlyInitializing {\\n __Ownable_init_unchained();\\n __LzAppUpgradeable_init_unchained(_endpoint);\\n }\\n\\n function __NonblockingLzAppUpgradeable_init_unchained(address _endpoint) internal onlyInitializing {}\\n\\n mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages;\\n\\n event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason);\\n event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash);\\n\\n // overriding the virtual function in LzReceiver\\n function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {\\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\\n gasleft(),\\n 150,\\n abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)\\n );\\n // try-catch all errors/exceptions\\n if (!success) {\\n _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason);\\n }\\n }\\n\\n function _storeFailedMessage(\\n uint16 _srcChainId,\\n bytes memory _srcAddress,\\n uint64 _nonce,\\n bytes memory _payload,\\n bytes memory _reason\\n ) internal virtual {\\n failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload);\\n emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason);\\n }\\n\\n function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual {\\n // only internal transaction\\n require(_msgSender() == address(this), \\\"NonblockingLzApp: caller must be LzApp\\\");\\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\\n }\\n\\n //@notice override this function\\n function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\\n\\n function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual {\\n // assert there is message to retry\\n bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce];\\n require(payloadHash != bytes32(0), \\\"NonblockingLzApp: no stored message\\\");\\n require(keccak256(_payload) == payloadHash, \\\"NonblockingLzApp: invalid payload\\\");\\n // clear the stored message\\n failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0);\\n // execute the message. revert if it fails again\\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\\n emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash);\\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 uint[49] private __gap;\\n}\\n\",\"keccak256\":\"0xe5e6cad4f4150cffaf48c7588b934e8b43762505d9d4e600f2fcdbc271fb7b20\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroEndpointUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"./ILayerZeroUserApplicationConfigUpgradeable.sol\\\";\\n\\ninterface ILayerZeroEndpointUpgradeable is ILayerZeroUserApplicationConfigUpgradeable {\\n // @notice send a LayerZero message to the specified address at a LayerZero endpoint.\\n // @param _dstChainId - the destination chain identifier\\n // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains\\n // @param _payload - a custom bytes payload to send to the destination contract\\n // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address\\n // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction\\n // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination\\n function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;\\n\\n // @notice used by the messaging library to publish verified payload\\n // @param _srcChainId - the source chain identifier\\n // @param _srcAddress - the source contract (as bytes) at the source chain\\n // @param _dstAddress - the address on destination chain\\n // @param _nonce - the unbound message ordering nonce\\n // @param _gasLimit - the gas limit for external contract execution\\n // @param _payload - verified payload to send to the destination contract\\n function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external;\\n\\n // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain\\n // @param _srcChainId - the source chain identifier\\n // @param _srcAddress - the source chain contract address\\n function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);\\n\\n // @notice get the outboundNonce from this source chain which, consequently, is always an EVM\\n // @param _srcAddress - the source chain contract address\\n function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);\\n\\n // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery\\n // @param _dstChainId - the destination chain identifier\\n // @param _userApplication - the user app address on this EVM chain\\n // @param _payload - the custom message to send over LayerZero\\n // @param _payInZRO - if false, user app pays the protocol fee in native token\\n // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain\\n function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee);\\n\\n // @notice get this Endpoint's immutable source identifier\\n function getChainId() external view returns (uint16);\\n\\n // @notice the interface to retry failed message on this Endpoint destination\\n // @param _srcChainId - the source chain identifier\\n // @param _srcAddress - the source chain contract address\\n // @param _payload - the payload to be retried\\n function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external;\\n\\n // @notice query if any STORED payload (message blocking) at the endpoint.\\n // @param _srcChainId - the source chain identifier\\n // @param _srcAddress - the source chain contract address\\n function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);\\n\\n // @notice query if the _libraryAddress is valid for sending msgs.\\n // @param _userApplication - the user app address on this EVM chain\\n function getSendLibraryAddress(address _userApplication) external view returns (address);\\n\\n // @notice query if the _libraryAddress is valid for receiving msgs.\\n // @param _userApplication - the user app address on this EVM chain\\n function getReceiveLibraryAddress(address _userApplication) external view returns (address);\\n\\n // @notice query if the non-reentrancy guard for send() is on\\n // @return true if the guard is on. false otherwise\\n function isSendingPayload() external view returns (bool);\\n\\n // @notice query if the non-reentrancy guard for receive() is on\\n // @return true if the guard is on. false otherwise\\n function isReceivingPayload() external view returns (bool);\\n\\n // @notice get the configuration of the LayerZero messaging library of the specified version\\n // @param _version - messaging library version\\n // @param _chainId - the chainId for the pending config change\\n // @param _userApplication - the contract address of the user application\\n // @param _configType - type of configuration. every messaging library has its own convention.\\n function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory);\\n\\n // @notice get the send() LayerZero messaging library version\\n // @param _userApplication - the contract address of the user application\\n function getSendVersion(address _userApplication) external view returns (uint16);\\n\\n // @notice get the lzReceive() LayerZero messaging library version\\n // @param _userApplication - the contract address of the user application\\n function getReceiveVersion(address _userApplication) external view returns (uint16);\\n}\\n\",\"keccak256\":\"0x748e7abf8908f264c6fff8ea7730b1766ab5a262be7962404f7d263066b41487\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.2;\\n\\ninterface ILayerZeroReceiverUpgradeable {\\n // @notice LayerZero endpoint will invoke this function to deliver the message on the destination\\n // @param _srcChainId - the source endpoint identifier\\n // @param _srcAddress - the source sending contract address from the source chain\\n // @param _nonce - the ordered message nonce\\n // @param _payload - the signed payload is the UA bytes has encoded to be sent\\n function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;\\n}\\n\",\"keccak256\":\"0x6ce5593a1247719f7209cad8068573c249674b41b859c6379ace1baaea0ed2a3\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroUserApplicationConfigUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.2;\\n\\ninterface ILayerZeroUserApplicationConfigUpgradeable {\\n // @notice set the configuration of the LayerZero messaging library of the specified version\\n // @param _version - messaging library version\\n // @param _chainId - the chainId for the pending config change\\n // @param _configType - type of configuration. every messaging library has its own convention.\\n // @param _config - configuration in the bytes. can encode arbitrary content.\\n function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;\\n\\n // @notice set the send() LayerZero messaging library version to _version\\n // @param _version - new messaging library version\\n function setSendVersion(uint16 _version) external;\\n\\n // @notice set the lzReceive() LayerZero messaging library version to _version\\n // @param _version - new messaging library version\\n function setReceiveVersion(uint16 _version) external;\\n\\n // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload\\n // @param _srcChainId - the chainId of the source chain\\n // @param _srcAddress - the contract address of the source contract at the source chain\\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;\\n}\\n\",\"keccak256\":\"0xa808baa32db12c453b982320e0c9a8c07aec8c0f3bb36ac2ed26f3ad47476879\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/OFTCoreV2Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../../lzApp/NonblockingLzAppUpgradeable.sol\\\";\\nimport \\\"../../../../libraries/ExcessivelySafeCall.sol\\\";\\nimport \\\"./interfaces/ICommonOFTUpgradeable.sol\\\";\\nimport \\\"./interfaces/IOFTReceiverV2Upgradeable.sol\\\";\\n\\nabstract contract OFTCoreV2Upgradeable is NonblockingLzAppUpgradeable {\\n using BytesLib for bytes;\\n using ExcessivelySafeCall for address;\\n\\n uint public constant NO_EXTRA_GAS = 0;\\n\\n // packet type\\n uint8 public constant PT_SEND = 0;\\n uint8 public constant PT_SEND_AND_CALL = 1;\\n\\n uint8 public sharedDecimals;\\n\\n bool public useCustomAdapterParams;\\n mapping(uint16 => mapping(bytes => mapping(uint64 => bool))) public creditedPackets;\\n\\n /**\\n * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\\n * `_nonce` is the outbound nonce\\n */\\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes32 indexed _toAddress, uint _amount);\\n\\n /**\\n * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain.\\n * `_nonce` is the inbound nonce.\\n */\\n event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount);\\n\\n event SetUseCustomAdapterParams(bool _useCustomAdapterParams);\\n\\n event CallOFTReceivedSuccess(uint16 indexed _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _hash);\\n\\n event NonContractAddress(address _address);\\n\\n // _sharedDecimals should be the minimum decimals on all chains\\n function __OFTCoreV2Upgradeable_init(uint8 _sharedDecimals, address _lzEndpoint) internal onlyInitializing {\\n __Ownable_init_unchained();\\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\\n }\\n\\n function __OFTCoreV2Upgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\\n sharedDecimals = _sharedDecimals;\\n }\\n\\n /************************************************************************\\n * public functions\\n ************************************************************************/\\n function callOnOFTReceived(\\n uint16 _srcChainId,\\n bytes calldata _srcAddress,\\n uint64 _nonce,\\n bytes32 _from,\\n address _to,\\n uint _amount,\\n bytes calldata _payload,\\n uint _gasForCall\\n ) public virtual {\\n require(_msgSender() == address(this), \\\"OFTCore: caller must be OFTCore\\\");\\n\\n // send\\n _amount = _transferFrom(address(this), _to, _amount);\\n emit ReceiveFromChain(_srcChainId, _to, _amount);\\n\\n // call\\n IOFTReceiverV2Upgradeable(_to).onOFTReceived{gas: _gasForCall}(_srcChainId, _srcAddress, _nonce, _from, _amount, _payload);\\n }\\n\\n function setUseCustomAdapterParams(bool _useCustomAdapterParams) public virtual onlyOwner {\\n useCustomAdapterParams = _useCustomAdapterParams;\\n emit SetUseCustomAdapterParams(_useCustomAdapterParams);\\n }\\n\\n /************************************************************************\\n * internal functions\\n ************************************************************************/\\n function _estimateSendFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bool _useZro,\\n bytes memory _adapterParams\\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\\n // mock the payload for sendFrom()\\n bytes memory payload = _encodeSendPayload(_toAddress, _ld2sd(_amount));\\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\\n }\\n\\n function _estimateSendAndCallFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bytes memory _payload,\\n uint64 _dstGasForCall,\\n bool _useZro,\\n bytes memory _adapterParams\\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\\n // mock the payload for sendAndCall()\\n bytes memory payload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(_amount), _payload, _dstGasForCall);\\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\\n }\\n\\n function _nonblockingLzReceive(\\n uint16 _srcChainId,\\n bytes memory _srcAddress,\\n uint64 _nonce,\\n bytes memory _payload\\n ) internal virtual override {\\n uint8 packetType = _payload.toUint8(0);\\n\\n if (packetType == PT_SEND) {\\n _sendAck(_srcChainId, _srcAddress, _nonce, _payload);\\n } else if (packetType == PT_SEND_AND_CALL) {\\n _sendAndCallAck(_srcChainId, _srcAddress, _nonce, _payload);\\n } else {\\n revert(\\\"OFTCore: unknown packet type\\\");\\n }\\n }\\n\\n function _send(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n address payable _refundAddress,\\n address _zroPaymentAddress,\\n bytes memory _adapterParams\\n ) internal virtual returns (uint amount) {\\n _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\\n\\n (amount, ) = _removeDust(_amount);\\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount); // amount returned should not have dust\\n require(amount > 0, \\\"OFTCore: amount too small\\\");\\n\\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\\n\\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\\n }\\n\\n function _sendAck(uint16 _srcChainId, bytes memory, uint64, bytes memory _payload) internal virtual {\\n (address to, uint64 amountSD) = _decodeSendPayload(_payload);\\n if (to == address(0)) {\\n to = address(0xdead);\\n }\\n\\n uint amount = _sd2ld(amountSD);\\n amount = _creditTo(_srcChainId, to, amount);\\n\\n emit ReceiveFromChain(_srcChainId, to, amount);\\n }\\n\\n function _sendAndCall(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bytes memory _payload,\\n uint64 _dstGasForCall,\\n address payable _refundAddress,\\n address _zroPaymentAddress,\\n bytes memory _adapterParams\\n ) internal virtual returns (uint amount) {\\n _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\\n\\n (amount, ) = _removeDust(_amount);\\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount);\\n require(amount > 0, \\\"OFTCore: amount too small\\\");\\n\\n // encode the msg.sender into the payload instead of _from\\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\\n\\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\\n }\\n\\n function _sendAndCallAck(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual {\\n (bytes32 from, address to, uint64 amountSD, bytes memory payloadForCall, uint64 gasForCall) = _decodeSendAndCallPayload(_payload);\\n\\n bool credited = creditedPackets[_srcChainId][_srcAddress][_nonce];\\n uint amount = _sd2ld(amountSD);\\n\\n // credit to this contract first, and then transfer to receiver only if callOnOFTReceived() succeeds\\n if (!credited) {\\n amount = _creditTo(_srcChainId, address(this), amount);\\n creditedPackets[_srcChainId][_srcAddress][_nonce] = true;\\n }\\n\\n if (!_isContract(to)) {\\n emit NonContractAddress(to);\\n return;\\n }\\n\\n // workaround for stack too deep\\n uint16 srcChainId = _srcChainId;\\n bytes memory srcAddress = _srcAddress;\\n uint64 nonce = _nonce;\\n bytes memory payload = _payload;\\n bytes32 from_ = from;\\n address to_ = to;\\n uint amount_ = amount;\\n bytes memory payloadForCall_ = payloadForCall;\\n\\n // no gas limit for the call if retry\\n uint gas = credited ? gasleft() : gasForCall;\\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\\n gasleft(),\\n 150,\\n abi.encodeWithSelector(this.callOnOFTReceived.selector, srcChainId, srcAddress, nonce, from_, to_, amount_, payloadForCall_, gas)\\n );\\n\\n if (success) {\\n bytes32 hash = keccak256(payload);\\n emit CallOFTReceivedSuccess(srcChainId, srcAddress, nonce, hash);\\n } else {\\n // store the failed message into the nonblockingLzApp\\n _storeFailedMessage(srcChainId, srcAddress, nonce, payload, reason);\\n }\\n }\\n\\n function _isContract(address _account) internal view returns (bool) {\\n return _account.code.length > 0;\\n }\\n\\n function _checkAdapterParams(uint16 _dstChainId, uint16 _pkType, bytes memory _adapterParams, uint _extraGas) internal virtual {\\n if (useCustomAdapterParams) {\\n _checkGasLimit(_dstChainId, _pkType, _adapterParams, _extraGas);\\n } else {\\n require(_adapterParams.length == 0, \\\"OFTCore: _adapterParams must be empty.\\\");\\n }\\n }\\n\\n function _ld2sd(uint _amount) internal view virtual returns (uint64) {\\n uint amountSD = _amount / _ld2sdRate();\\n require(amountSD <= type(uint64).max, \\\"OFTCore: amountSD overflow\\\");\\n return uint64(amountSD);\\n }\\n\\n function _sd2ld(uint64 _amountSD) internal view virtual returns (uint) {\\n return _amountSD * _ld2sdRate();\\n }\\n\\n function _removeDust(uint _amount) internal view virtual returns (uint amountAfter, uint dust) {\\n dust = _amount % _ld2sdRate();\\n amountAfter = _amount - dust;\\n }\\n\\n function _encodeSendPayload(bytes32 _toAddress, uint64 _amountSD) internal view virtual returns (bytes memory) {\\n return abi.encodePacked(PT_SEND, _toAddress, _amountSD);\\n }\\n\\n function _decodeSendPayload(bytes memory _payload) internal view virtual returns (address to, uint64 amountSD) {\\n require(_payload.toUint8(0) == PT_SEND && _payload.length == 41, \\\"OFTCore: invalid payload\\\");\\n\\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\\n amountSD = _payload.toUint64(33);\\n }\\n\\n function _encodeSendAndCallPayload(\\n address _from,\\n bytes32 _toAddress,\\n uint64 _amountSD,\\n bytes memory _payload,\\n uint64 _dstGasForCall\\n ) internal view virtual returns (bytes memory) {\\n return abi.encodePacked(PT_SEND_AND_CALL, _toAddress, _amountSD, _addressToBytes32(_from), _dstGasForCall, _payload);\\n }\\n\\n function _decodeSendAndCallPayload(\\n bytes memory _payload\\n ) internal view virtual returns (bytes32 from, address to, uint64 amountSD, bytes memory payload, uint64 dstGasForCall) {\\n require(_payload.toUint8(0) == PT_SEND_AND_CALL, \\\"OFTCore: invalid payload\\\");\\n\\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\\n amountSD = _payload.toUint64(33);\\n from = _payload.toBytes32(41);\\n dstGasForCall = _payload.toUint64(73);\\n payload = _payload.slice(81, _payload.length - 81);\\n }\\n\\n function _addressToBytes32(address _address) internal pure virtual returns (bytes32) {\\n return bytes32(uint(uint160(_address)));\\n }\\n\\n function _debitFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount) internal virtual returns (uint);\\n\\n function _creditTo(uint16 _srcChainId, address _toAddress, uint _amount) internal virtual returns (uint);\\n\\n function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint);\\n\\n function _ld2sdRate() internal view virtual returns (uint);\\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 uint[44] private __gap;\\n}\\n\",\"keccak256\":\"0xf692d3bf6f8b9064ffd81aaa2f98ecf6a12c46ea653c2b9b205577b30a1f6dc4\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/fee/BaseOFTWithFeeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../OFTCoreV2Upgradeable.sol\\\";\\nimport \\\"./IOFTWithFeeUpgradeable.sol\\\";\\nimport \\\"./FeeUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\\\";\\n\\nabstract contract BaseOFTWithFeeUpgradeable is OFTCoreV2Upgradeable, FeeUpgradeable, ERC165Upgradeable, IOFTWithFeeUpgradeable {\\n function __BaseOFTWithFeeUpgradeable_init(uint8 _sharedDecimals, address _lzEndpoint) internal onlyInitializing {\\n __Ownable_init_unchained();\\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\\n }\\n\\n function __BaseOFTWithFeeUpgradeable_init_unchained() internal onlyInitializing {}\\n\\n /************************************************************************\\n * public functions\\n ************************************************************************/\\n function sendFrom(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n uint _minAmount,\\n LzCallParams calldata _callParams\\n ) public payable virtual override {\\n (_amount, ) = _payOFTFee(_from, _dstChainId, _amount);\\n _amount = _send(\\n _from,\\n _dstChainId,\\n _toAddress,\\n _amount,\\n _callParams.refundAddress,\\n _callParams.zroPaymentAddress,\\n _callParams.adapterParams\\n );\\n require(_amount >= _minAmount, \\\"BaseOFTWithFee: amount is less than minAmount\\\");\\n }\\n\\n function sendAndCall(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n uint _minAmount,\\n bytes calldata _payload,\\n uint64 _dstGasForCall,\\n LzCallParams calldata _callParams\\n ) public payable virtual override {\\n (_amount, ) = _payOFTFee(_from, _dstChainId, _amount);\\n _amount = _sendAndCall(\\n _from,\\n _dstChainId,\\n _toAddress,\\n _amount,\\n _payload,\\n _dstGasForCall,\\n _callParams.refundAddress,\\n _callParams.zroPaymentAddress,\\n _callParams.adapterParams\\n );\\n require(_amount >= _minAmount, \\\"BaseOFTWithFee: amount is less than minAmount\\\");\\n }\\n\\n /************************************************************************\\n * public view functions\\n ************************************************************************/\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return interfaceId == type(IOFTWithFeeUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n function estimateSendFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bool _useZro,\\n bytes calldata _adapterParams\\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\\n return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams);\\n }\\n\\n function estimateSendAndCallFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bytes calldata _payload,\\n uint64 _dstGasForCall,\\n bool _useZro,\\n bytes calldata _adapterParams\\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\\n return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams);\\n }\\n\\n function circulatingSupply() public view virtual override returns (uint);\\n\\n function token() public view virtual override returns (address);\\n\\n function _transferFrom(\\n address _from,\\n address _to,\\n uint _amount\\n ) internal virtual override(FeeUpgradeable, OFTCoreV2Upgradeable) returns (uint);\\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 uint[50] private __gap;\\n}\\n\",\"keccak256\":\"0xadf0366936e09f6c7b25ad329e6436e6534a5d04b1a0f84abc986a75d2982e44\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/fee/FeeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\nabstract contract FeeUpgradeable is OwnableUpgradeable {\\n uint public constant BP_DENOMINATOR = 10000;\\n\\n mapping(uint16 => FeeConfig) public chainIdToFeeBps;\\n uint16 public defaultFeeBp;\\n address public feeOwner; // defaults to owner\\n\\n struct FeeConfig {\\n uint16 feeBP;\\n bool enabled;\\n }\\n\\n event SetFeeBp(uint16 dstchainId, bool enabled, uint16 feeBp);\\n event SetDefaultFeeBp(uint16 feeBp);\\n event SetFeeOwner(address feeOwner);\\n\\n function __FeeUpgradeable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __FeeUpgradeable_init_unchained() internal onlyInitializing {}\\n\\n function setDefaultFeeBp(uint16 _feeBp) public virtual onlyOwner {\\n require(_feeBp <= BP_DENOMINATOR, \\\"Fee: fee bp must be <= BP_DENOMINATOR\\\");\\n defaultFeeBp = _feeBp;\\n emit SetDefaultFeeBp(defaultFeeBp);\\n }\\n\\n function setFeeBp(uint16 _dstChainId, bool _enabled, uint16 _feeBp) public virtual onlyOwner {\\n require(_feeBp <= BP_DENOMINATOR, \\\"Fee: fee bp must be <= BP_DENOMINATOR\\\");\\n chainIdToFeeBps[_dstChainId] = FeeConfig(_feeBp, _enabled);\\n emit SetFeeBp(_dstChainId, _enabled, _feeBp);\\n }\\n\\n function setFeeOwner(address _feeOwner) public virtual onlyOwner {\\n require(_feeOwner != address(0x0), \\\"Fee: feeOwner cannot be 0x\\\");\\n feeOwner = _feeOwner;\\n emit SetFeeOwner(_feeOwner);\\n }\\n\\n function quoteOFTFee(uint16 _dstChainId, uint _amount) public view virtual returns (uint fee) {\\n FeeConfig memory config = chainIdToFeeBps[_dstChainId];\\n if (config.enabled) {\\n fee = (_amount * config.feeBP) / BP_DENOMINATOR;\\n } else if (defaultFeeBp > 0) {\\n fee = (_amount * defaultFeeBp) / BP_DENOMINATOR;\\n } else {\\n fee = 0;\\n }\\n }\\n\\n function _payOFTFee(address _from, uint16 _dstChainId, uint _amount) internal virtual returns (uint amount, uint fee) {\\n fee = quoteOFTFee(_dstChainId, _amount);\\n amount = _amount - fee;\\n if (fee > 0) {\\n _transferFrom(_from, feeOwner, fee);\\n }\\n }\\n\\n function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint);\\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 uint[45] private __gap;\\n}\\n\",\"keccak256\":\"0x78320049b99326fac520ea3d6f36490911eb3efe239bfe049c031abcb4a169b5\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/fee/IOFTWithFeeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.5.0;\\n\\nimport \\\"../interfaces/ICommonOFTUpgradeable.sol\\\";\\n\\n/**\\n * @dev Interface of the IOFT core standard\\n */\\ninterface IOFTWithFeeUpgradeable is ICommonOFTUpgradeable {\\n /**\\n * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\\n * `_from` the owner of token\\n * `_dstChainId` the destination chain identifier\\n * `_toAddress` can be any size depending on the `dstChainId`.\\n * `_amount` the quantity of tokens in wei\\n * `_minAmount` the minimum amount of tokens to receive on dstChain\\n * `_refundAddress` the address LayerZero refunds if too much message fee is sent\\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\\n */\\n function sendFrom(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n uint _minAmount,\\n LzCallParams calldata _callParams\\n ) external payable;\\n\\n function sendAndCall(\\n address _from,\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n uint _minAmount,\\n bytes calldata _payload,\\n uint64 _dstGasForCall,\\n LzCallParams calldata _callParams\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x7183906acbe073bdb5a96b225e6ce4a943727a4903881fcea01981359d31b52f\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"hardhat-deploy/solc_0.8/proxy/Proxied.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol\\\";\\nimport \\\"./BaseOFTWithFeeUpgradeable.sol\\\";\\n\\ncontract OFTWithFeePermitUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, ERC20Upgradeable, Proxied, ERC20PermitUpgradeable {\\n uint internal ld2sdRate;\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n function initialize(\\n string memory _name,\\n string memory _symbol,\\n uint8 _sharedDecimals,\\n address _lzEndpoint\\n ) public virtual initializer {\\n __OFTWithFeePermitUpgradeable_init(_name, _symbol, _sharedDecimals, _lzEndpoint);\\n }\\n\\n function __OFTWithFeePermitUpgradeable_init(\\n string memory _name,\\n string memory _symbol,\\n uint8 _sharedDecimals,\\n address _lzEndpoint\\n ) internal onlyInitializing {\\n __Ownable_init_unchained();\\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\\n\\n __ERC20_init_unchained(_name, _symbol);\\n __ERC20Permit_init_unchained(_name);\\n\\n __OFTWithFeePermitUpgradeable_init_unchained(_sharedDecimals);\\n }\\n\\n function __OFTWithFeePermitUpgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\\n uint8 decimals = decimals();\\n require(_sharedDecimals <= decimals, \\\"OFTWithFee: sharedDecimals must be <= decimals\\\");\\n ld2sdRate = 10**(decimals - _sharedDecimals);\\n }\\n\\n /************************************************************************\\n * public functions\\n ************************************************************************/\\n function circulatingSupply() public view virtual override returns (uint) {\\n return totalSupply();\\n }\\n\\n function token() public view virtual override returns (address) {\\n return address(this);\\n }\\n\\n /************************************************************************\\n * internal functions\\n ************************************************************************/\\n function _debitFrom(\\n address _from,\\n uint16,\\n bytes32,\\n uint _amount\\n ) internal virtual override returns (uint) {\\n address spender = _msgSender();\\n if (_from != spender) _spendAllowance(_from, spender, _amount);\\n _burn(_from, _amount);\\n return _amount;\\n }\\n\\n function _creditTo(\\n uint16,\\n address _toAddress,\\n uint _amount\\n ) internal virtual override returns (uint) {\\n _mint(_toAddress, _amount);\\n return _amount;\\n }\\n\\n function _transferFrom(\\n address _from,\\n address _to,\\n uint _amount\\n ) internal virtual override returns (uint) {\\n address spender = _msgSender();\\n // if transfer from this contract, no need to check allowance\\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\\n _transfer(_from, _to, _amount);\\n return _amount;\\n }\\n\\n function _ld2sdRate() internal view virtual override returns (uint) {\\n return ld2sdRate;\\n }\\n}\\n\",\"keccak256\":\"0x7cf045ba633f6e283674c3f6441dc9288092f7227c03bb08fafbaa04295be251\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"hardhat-deploy/solc_0.8/proxy/Proxied.sol\\\";\\nimport \\\"./BaseOFTWithFeeUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\\\";\\n\\ncontract ProxyOFTWithFeeUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, Proxied {\\n using SafeERC20Upgradeable for IERC20Upgradeable;\\n\\n IERC20Upgradeable internal innerToken;\\n uint internal ld2sdRate;\\n\\n // total amount is transferred from this chain to other chains, ensuring the total is less than uint64.max in sd\\n uint public outboundAmount;\\n\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n function initialize(address _token, uint8 _sharedDecimals, address _lzEndpoint) public initializer {\\n __BaseOFTWithFeeUpgradeable_init(_sharedDecimals, _lzEndpoint);\\n\\n innerToken = IERC20Upgradeable(_token);\\n\\n (bool success, bytes memory data) = _token.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n require(success, \\\"ProxyOFTWithFee: failed to get token decimals\\\");\\n uint8 decimals = abi.decode(data, (uint8));\\n\\n require(_sharedDecimals <= decimals, \\\"ProxyOFTWithFee: sharedDecimals must be <= decimals\\\");\\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\\n }\\n\\n /************************************************************************\\n * public functions\\n ************************************************************************/\\n function circulatingSupply() public view virtual override returns (uint) {\\n return innerToken.totalSupply() - outboundAmount;\\n }\\n\\n function token() public view virtual override returns (address) {\\n return address(innerToken);\\n }\\n\\n /************************************************************************\\n * internal functions\\n ************************************************************************/\\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\\n require(_from == _msgSender(), \\\"ProxyOFTWithFee: owner is not send caller\\\");\\n\\n _amount = _transferFrom(_from, address(this), _amount);\\n\\n // _amount still may have dust if the token has transfer fee, then give the dust back to the sender\\n (uint amount, uint dust) = _removeDust(_amount);\\n if (dust > 0) innerToken.safeTransfer(_from, dust);\\n\\n // check total outbound amount\\n outboundAmount += amount;\\n uint cap = _sd2ld(type(uint64).max);\\n require(cap >= outboundAmount, \\\"ProxyOFTWithFee: outboundAmount overflow\\\");\\n\\n return amount;\\n }\\n\\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\\n outboundAmount -= _amount;\\n\\n // tokens are already in this contract, so no need to transfer\\n if (_toAddress == address(this)) {\\n return _amount;\\n }\\n\\n return _transferFrom(address(this), _toAddress, _amount);\\n }\\n\\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\\n uint before = innerToken.balanceOf(_to);\\n if (_from == address(this)) {\\n innerToken.safeTransfer(_to, _amount);\\n } else {\\n innerToken.safeTransferFrom(_from, _to, _amount);\\n }\\n return innerToken.balanceOf(_to) - before;\\n }\\n\\n function _ld2sdRate() internal view virtual override returns (uint) {\\n return ld2sdRate;\\n }\\n}\\n\",\"keccak256\":\"0x90e7b5e27af4caa896c196ce5d1572bfb05429610fc5171be82072d267a42b53\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/interfaces/ICommonOFTUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.5.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface of the IOFT core standard\\n */\\ninterface ICommonOFTUpgradeable is IERC165Upgradeable {\\n struct LzCallParams {\\n address payable refundAddress;\\n address zroPaymentAddress;\\n bytes adapterParams;\\n }\\n\\n /**\\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\\n * _dstChainId - L0 defined chain id to send tokens too\\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\\n * _amount - amount of the tokens to transfer\\n * _useZro - indicates to use zro to pay L0 fees\\n * _adapterParam - flexible bytes array to indicate messaging adapter services in L0\\n */\\n function estimateSendFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bool _useZro,\\n bytes calldata _adapterParams\\n ) external view returns (uint nativeFee, uint zroFee);\\n\\n function estimateSendAndCallFee(\\n uint16 _dstChainId,\\n bytes32 _toAddress,\\n uint _amount,\\n bytes calldata _payload,\\n uint64 _dstGasForCall,\\n bool _useZro,\\n bytes calldata _adapterParams\\n ) external view returns (uint nativeFee, uint zroFee);\\n\\n /**\\n * @dev returns the circulating amount of tokens on current chain\\n */\\n function circulatingSupply() external view returns (uint);\\n\\n /**\\n * @dev returns the address of the ERC20 token\\n */\\n function token() external view returns (address);\\n}\\n\",\"keccak256\":\"0x22301aa76df1a1b642962585085e70486df5b22db656362b1f986519f297f8aa\",\"license\":\"MIT\"},\"contracts/contracts-upgradable/token/oft/v2/interfaces/IOFTReceiverV2Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\npragma solidity >=0.5.0;\\n\\ninterface IOFTReceiverV2Upgradeable {\\n /**\\n * @dev Called by the OFT contract when tokens are received from source chain.\\n * @param _srcChainId The chain id of the source chain.\\n * @param _srcAddress The address of the OFT token contract on the source chain.\\n * @param _nonce The nonce of the transaction on the source chain.\\n * @param _from The address of the account who calls the sendAndCall() on the source chain.\\n * @param _amount The amount of tokens to transfer.\\n * @param _payload Additional data with no specified format.\\n */\\n function onOFTReceived(\\n uint16 _srcChainId,\\n bytes calldata _srcAddress,\\n uint64 _nonce,\\n bytes32 _from,\\n uint _amount,\\n bytes calldata _payload\\n ) external;\\n}\\n\",\"keccak256\":\"0xb211e812c5fe61606abddad556545d5395c7020bb61e26a75f1737ceb79cab79\",\"license\":\"BUSL-1.1\"},\"contracts/libraries/BytesLib.sol\":{\"content\":\"// SPDX-License-Identifier: Unlicense\\n/*\\n * @title Solidity Bytes Arrays Utils\\n * @author Gon\\u00e7alo S\\u00e1 \\n *\\n * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.\\n * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.\\n */\\npragma solidity >=0.8.0 <0.9.0;\\n\\nlibrary BytesLib {\\n function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory) {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(\\n 0x40,\\n and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n )\\n )\\n }\\n\\n return tempBytes;\\n }\\n\\n function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {\\n assembly {\\n // Read the first 32 bytes of _preBytes storage, which is the length\\n // of the array. (We don't need to use the offset into the slot\\n // because arrays use the entire slot.)\\n let fslot := sload(_preBytes.slot)\\n // Arrays of 31 bytes or less have an even value in their slot,\\n // while longer arrays have an odd value. The actual length is\\n // the slot divided by two for odd values, and the lowest order\\n // byte divided by two for even values.\\n // If the slot is even, bitwise and the slot with 255 and divide by\\n // two to get the length. If the slot is odd, bitwise and the slot\\n // with -1 and divide by two.\\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\\n let mlength := mload(_postBytes)\\n let newlength := add(slength, mlength)\\n // slength can contain both the length and contents of the array\\n // if length < 32 bytes so let's prepare for that\\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\\n switch add(lt(slength, 32), lt(newlength, 32))\\n case 2 {\\n // Since the new array still fits in the slot, we just need to\\n // update the contents of the slot.\\n // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length\\n sstore(\\n _preBytes.slot,\\n // all the modifications to the slot are inside this\\n // next block\\n add(\\n // we can just add to the slot contents because the\\n // bytes we want to change are the LSBs\\n fslot,\\n add(\\n mul(\\n div(\\n // load the bytes from memory\\n mload(add(_postBytes, 0x20)),\\n // zero all bytes to the right\\n exp(0x100, sub(32, mlength))\\n ),\\n // and now shift left the number of bytes to\\n // leave space for the length in the slot\\n exp(0x100, sub(32, newlength))\\n ),\\n // increase length by the double of the memory\\n // bytes length\\n mul(mlength, 2)\\n )\\n )\\n )\\n }\\n case 1 {\\n // The stored value fits in the slot, but the combined value\\n // will exceed it.\\n // get the keccak hash to get the contents of the array\\n mstore(0x0, _preBytes.slot)\\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\\n\\n // save new length\\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\\n\\n // The contents of the _postBytes array start 32 bytes into\\n // the structure. Our first read should obtain the `submod`\\n // bytes that can fit into the unused space in the last word\\n // of the stored array. To get this, we read 32 bytes starting\\n // from `submod`, so the data we read overlaps with the array\\n // contents by `submod` bytes. Masking the lowest-order\\n // `submod` bytes allows us to add that value directly to the\\n // stored value.\\n\\n let submod := sub(32, slength)\\n let mc := add(_postBytes, submod)\\n let end := add(_postBytes, mlength)\\n let mask := sub(exp(0x100, submod), 1)\\n\\n sstore(sc, add(and(fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00), and(mload(mc), mask)))\\n\\n for {\\n mc := add(mc, 0x20)\\n sc := add(sc, 1)\\n } lt(mc, end) {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } {\\n sstore(sc, mload(mc))\\n }\\n\\n mask := exp(0x100, sub(mc, end))\\n\\n sstore(sc, mul(div(mload(mc), mask), mask))\\n }\\n default {\\n // get the keccak hash to get the contents of the array\\n mstore(0x0, _preBytes.slot)\\n // Start copying to the last used word of the stored array.\\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\\n\\n // save new length\\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\\n\\n // Copy over the first `submod` bytes of the new data as in\\n // case 1 above.\\n let slengthmod := mod(slength, 32)\\n let mlengthmod := mod(mlength, 32)\\n let submod := sub(32, slengthmod)\\n let mc := add(_postBytes, submod)\\n let end := add(_postBytes, mlength)\\n let mask := sub(exp(0x100, submod), 1)\\n\\n sstore(sc, add(sload(sc), and(mload(mc), mask)))\\n\\n for {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } lt(mc, end) {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } {\\n sstore(sc, mload(mc))\\n }\\n\\n mask := exp(0x100, sub(mc, end))\\n\\n sstore(sc, mul(div(mload(mc), mask), mask))\\n }\\n }\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint _start,\\n uint _length\\n ) internal pure returns (bytes memory) {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function toAddress(bytes memory _bytes, uint _start) internal pure returns (address) {\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toUint8(bytes memory _bytes, uint _start) internal pure returns (uint8) {\\n require(_bytes.length >= _start + 1, \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint16(bytes memory _bytes, uint _start) internal pure returns (uint16) {\\n require(_bytes.length >= _start + 2, \\\"toUint16_outOfBounds\\\");\\n uint16 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x2), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint32(bytes memory _bytes, uint _start) internal pure returns (uint32) {\\n require(_bytes.length >= _start + 4, \\\"toUint32_outOfBounds\\\");\\n uint32 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x4), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint64(bytes memory _bytes, uint _start) internal pure returns (uint64) {\\n require(_bytes.length >= _start + 8, \\\"toUint64_outOfBounds\\\");\\n uint64 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x8), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint96(bytes memory _bytes, uint _start) internal pure returns (uint96) {\\n require(_bytes.length >= _start + 12, \\\"toUint96_outOfBounds\\\");\\n uint96 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0xc), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint128(bytes memory _bytes, uint _start) internal pure returns (uint128) {\\n require(_bytes.length >= _start + 16, \\\"toUint128_outOfBounds\\\");\\n uint128 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x10), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint256(bytes memory _bytes, uint _start) internal pure returns (uint) {\\n require(_bytes.length >= _start + 32, \\\"toUint256_outOfBounds\\\");\\n uint tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x20), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toBytes32(bytes memory _bytes, uint _start) internal pure returns (bytes32) {\\n require(_bytes.length >= _start + 32, \\\"toBytes32_outOfBounds\\\");\\n bytes32 tempBytes32;\\n\\n assembly {\\n tempBytes32 := mload(add(add(_bytes, 0x20), _start))\\n }\\n\\n return tempBytes32;\\n }\\n\\n function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {\\n bool success = true;\\n\\n assembly {\\n let length := mload(_preBytes)\\n\\n // if lengths don't match the arrays are not equal\\n switch eq(length, mload(_postBytes))\\n case 1 {\\n // cb is a circuit breaker in the for loop since there's\\n // no said feature for inline assembly loops\\n // cb = 1 - don't breaker\\n // cb = 0 - break\\n let cb := 1\\n\\n let mc := add(_preBytes, 0x20)\\n let end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n // the next line is the loop condition:\\n // while(uint256(mc < end) + cb == 2)\\n } eq(add(lt(mc, end), cb), 2) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // if any of these checks fails then arrays are not equal\\n if iszero(eq(mload(mc), mload(cc))) {\\n // unsuccess:\\n success := 0\\n cb := 0\\n }\\n }\\n }\\n default {\\n // unsuccess:\\n success := 0\\n }\\n }\\n\\n return success;\\n }\\n\\n function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool) {\\n bool success = true;\\n\\n assembly {\\n // we know _preBytes_offset is 0\\n let fslot := sload(_preBytes.slot)\\n // Decode the length of the stored array like in concatStorage().\\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\\n let mlength := mload(_postBytes)\\n\\n // if lengths don't match the arrays are not equal\\n switch eq(slength, mlength)\\n case 1 {\\n // slength can contain both the length and contents of the array\\n // if length < 32 bytes so let's prepare for that\\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\\n if iszero(iszero(slength)) {\\n switch lt(slength, 32)\\n case 1 {\\n // blank the last byte which is the length\\n fslot := mul(div(fslot, 0x100), 0x100)\\n\\n if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {\\n // unsuccess:\\n success := 0\\n }\\n }\\n default {\\n // cb is a circuit breaker in the for loop since there's\\n // no said feature for inline assembly loops\\n // cb = 1 - don't breaker\\n // cb = 0 - break\\n let cb := 1\\n\\n // get the keccak hash to get the contents of the array\\n mstore(0x0, _preBytes.slot)\\n let sc := keccak256(0x0, 0x20)\\n\\n let mc := add(_postBytes, 0x20)\\n let end := add(mc, mlength)\\n\\n // the next line is the loop condition:\\n // while(uint256(mc < end) + cb == 2)\\n for {\\n\\n } eq(add(lt(mc, end), cb), 2) {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } {\\n if iszero(eq(sload(sc), mload(mc))) {\\n // unsuccess:\\n success := 0\\n cb := 0\\n }\\n }\\n }\\n }\\n }\\n default {\\n // unsuccess:\\n success := 0\\n }\\n }\\n\\n return success;\\n }\\n}\\n\",\"keccak256\":\"0x7e64cccdf22a03f513d94960f2145dd801fb5ec88d971de079b5186a9f5e93c4\",\"license\":\"Unlicense\"},\"contracts/libraries/ExcessivelySafeCall.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\npragma solidity >=0.7.6;\\n\\nlibrary ExcessivelySafeCall {\\n uint constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\\n\\n /// @notice Use when you _really_ really _really_ don't trust the called\\n /// contract. This prevents the called contract from causing reversion of\\n /// the caller in as many ways as we can.\\n /// @dev The main difference between this and a solidity low-level call is\\n /// that we limit the number of bytes that the callee can cause to be\\n /// copied to caller memory. This prevents stupid things like malicious\\n /// contracts returning 10,000,000 bytes causing a local OOG when copying\\n /// to memory.\\n /// @param _target The address to call\\n /// @param _gas The amount of gas to forward to the remote contract\\n /// @param _maxCopy The maximum number of bytes of returndata to copy\\n /// to memory.\\n /// @param _calldata The data to send to the remote contract\\n /// @return success and returndata, as `.call()`. Returndata is capped to\\n /// `_maxCopy` bytes.\\n function excessivelySafeCall(\\n address _target,\\n uint _gas,\\n uint16 _maxCopy,\\n bytes memory _calldata\\n ) internal returns (bool, bytes memory) {\\n // set up for assembly call\\n uint _toCopy;\\n bool _success;\\n bytes memory _returnData = new bytes(_maxCopy);\\n // dispatch message to recipient\\n // by assembly calling \\\"handle\\\" function\\n // we call via assembly to avoid memcopying a very large returndata\\n // returned by a malicious contract\\n assembly {\\n _success := call(\\n _gas, // gas\\n _target, // recipient\\n 0, // ether value\\n add(_calldata, 0x20), // inloc\\n mload(_calldata), // inlen\\n 0, // outloc\\n 0 // outlen\\n )\\n // limit our copy to 256 bytes\\n _toCopy := returndatasize()\\n if gt(_toCopy, _maxCopy) {\\n _toCopy := _maxCopy\\n }\\n // Store the length of the copied bytes\\n mstore(_returnData, _toCopy)\\n // copy the bytes from returndata[0:_toCopy]\\n returndatacopy(add(_returnData, 0x20), 0, _toCopy)\\n }\\n return (_success, _returnData);\\n }\\n\\n /// @notice Use when you _really_ really _really_ don't trust the called\\n /// contract. This prevents the called contract from causing reversion of\\n /// the caller in as many ways as we can.\\n /// @dev The main difference between this and a solidity low-level call is\\n /// that we limit the number of bytes that the callee can cause to be\\n /// copied to caller memory. This prevents stupid things like malicious\\n /// contracts returning 10,000,000 bytes causing a local OOG when copying\\n /// to memory.\\n /// @param _target The address to call\\n /// @param _gas The amount of gas to forward to the remote contract\\n /// @param _maxCopy The maximum number of bytes of returndata to copy\\n /// to memory.\\n /// @param _calldata The data to send to the remote contract\\n /// @return success and returndata, as `.call()`. Returndata is capped to\\n /// `_maxCopy` bytes.\\n function excessivelySafeStaticCall(\\n address _target,\\n uint _gas,\\n uint16 _maxCopy,\\n bytes memory _calldata\\n ) internal view returns (bool, bytes memory) {\\n // set up for assembly call\\n uint _toCopy;\\n bool _success;\\n bytes memory _returnData = new bytes(_maxCopy);\\n // dispatch message to recipient\\n // by assembly calling \\\"handle\\\" function\\n // we call via assembly to avoid memcopying a very large returndata\\n // returned by a malicious contract\\n assembly {\\n _success := staticcall(\\n _gas, // gas\\n _target, // recipient\\n add(_calldata, 0x20), // inloc\\n mload(_calldata), // inlen\\n 0, // outloc\\n 0 // outlen\\n )\\n // limit our copy to 256 bytes\\n _toCopy := returndatasize()\\n if gt(_toCopy, _maxCopy) {\\n _toCopy := _maxCopy\\n }\\n // Store the length of the copied bytes\\n mstore(_returnData, _toCopy)\\n // copy the bytes from returndata[0:_toCopy]\\n returndatacopy(add(_returnData, 0x20), 0, _toCopy)\\n }\\n return (_success, _returnData);\\n }\\n\\n /**\\n * @notice Swaps function selectors in encoded contract calls\\n * @dev Allows reuse of encoded calldata for functions with identical\\n * argument types but different names. It simply swaps out the first 4 bytes\\n * for the new selector. This function modifies memory in place, and should\\n * only be used with caution.\\n * @param _newSelector The new 4-byte selector\\n * @param _buf The encoded contract args\\n */\\n function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure {\\n require(_buf.length >= 4);\\n uint _mask = LOW_28_MASK;\\n assembly {\\n // load the first word of\\n let _word := mload(add(_buf, 0x20))\\n // mask out the top 4 bytes\\n // /x\\n _word := and(_word, _mask)\\n _word := or(_newSelector, _word)\\n mstore(add(_buf, 0x20), _word)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd4e52af409b5ec80432292d86fb01906785eb78ac31da3bab4565aabcd6e3e56\",\"license\":\"MIT OR Apache-2.0\"},\"hardhat-deploy/solc_0.8/proxy/Proxied.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract Proxied {\\n /// @notice to be used by initialisation / postUpgrade function so that only the proxy's admin can execute them\\n /// It also allows these functions to be called inside a contructor\\n /// even if the contract is meant to be used without proxy\\n modifier proxied() {\\n address proxyAdminAddress = _proxyAdmin();\\n // With hardhat-deploy proxies\\n // the proxyAdminAddress is zero only for the implementation contract\\n // if the implementation contract want to be used as a standalone/immutable contract\\n // it simply has to execute the `proxied` function\\n // This ensure the proxyAdminAddress is never zero post deployment\\n // And allow you to keep the same code for both proxied contract and immutable contract\\n if (proxyAdminAddress == address(0)) {\\n // ensure can not be called twice when used outside of proxy : no admin\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n sstore(\\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103,\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\\n )\\n }\\n } else {\\n require(msg.sender == proxyAdminAddress);\\n }\\n _;\\n }\\n\\n modifier onlyProxyAdmin() {\\n require(msg.sender == _proxyAdmin(), \\\"NOT_AUTHORIZED\\\");\\n _;\\n }\\n\\n function _proxyAdmin() internal view returns (address ownerAddress) {\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n ownerAddress := sload(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaaceeafeeaf0d200ca3942d8bf14c1c4f787a77f79cc87c08bb668e65acdee29\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61497e80620000f36000396000f3fe6080604052600436106102c85760003560e01c80639689cb0511610175578063d1deba1f116100dc578063eb8d72b711610095578063f2fde38b1161006f578063f2fde38b14610930578063f35f9e4514610950578063f5ecbdbc14610970578063fc0c546a1461099057600080fd5b8063eb8d72b7146108d1578063ecd8f212146108f1578063ed629c5c1461091157600080fd5b8063d1deba1f1461081b578063d88829681461082e578063df2a5b3b1461085c578063e6a20ae61461087c578063eab45d9c14610891578063eaffd49a146108b157600080fd5b8063b353aaa71161012e578063b353aaa71461073f578063b9818be11461075f578063baf3292d14610785578063c446183414610729578063c83330ce146107a5578063cbed8b9c146107fb57600080fd5b80639689cb05146106605780639bdb9812146106775780639f38369a146106c9578063a4c51df5146106e9578063a6c3d16514610709578063abe685cd1461072957600080fd5b80634b104eff116102345780637533d788116101ed5780638cfd8f5c116101c75780638cfd8f5c146105c15780638da5cb5b146105f95780639358928b1461062b578063950c8a741461064057600080fd5b80637533d7881461055a57806379c0ad4b14610587578063857749b0146105a757600080fd5b80634b104eff1461046f5780634c42899a1461048f5780635a359dc5146104b65780635b8c41e6146104d657806366ad5c8a14610525578063715018a61461054557600080fd5b8063365260b411610286578063365260b4146103975780633d8b38f6146103cc5780633f1f4fa4146103ec57806342d65a8d146104275780634477051514610447578063455ba27d1461045c57600080fd5b80621d3567146102cd57806301ffc9a7146102ef57806307e0db17146103245780630df374831461034457806310ddb137146103645780632cdf0b9514610384575b600080fd5b3480156102d957600080fd5b506102ed6102e83660046137e5565b6109af565b005b3480156102fb57600080fd5b5061030f61030a366004613878565b610bcb565b60405190151581526020015b60405180910390f35b34801561033057600080fd5b506102ed61033f3660046138a2565b610c02565b34801561035057600080fd5b506102ed61035f3660046138bd565b610c6f565b34801561037057600080fd5b506102ed61037f3660046138a2565b610c8e565b6102ed610392366004613914565b610cca565b3480156103a357600080fd5b506103b76103b236600461399d565b610d6d565b6040805192835260208301919091520161031b565b3480156103d857600080fd5b5061030f6103e7366004613a04565b610dc2565b3480156103f857600080fd5b506104196104073660046138a2565b60686020526000908152604090205481565b60405190815260200161031b565b34801561043357600080fd5b506102ed610442366004613a04565b610e8f565b34801561045357600080fd5b50610419600081565b6102ed61046a366004613a56565b610ef9565b34801561047b57600080fd5b506102ed61048a366004613b12565b610fda565b34801561049b57600080fd5b506104a4600081565b60405160ff909116815260200161031b565b3480156104c257600080fd5b506102ed6104d13660046138a2565b611097565b3480156104e257600080fd5b506104196104f1366004613b9c565b6097602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b34801561053157600080fd5b506102ed6105403660046137e5565b611109565b34801561055157600080fd5b506102ed6111dd565b34801561056657600080fd5b5061057a6105753660046138a2565b6111f1565b60405161031b9190613c8c565b34801561059357600080fd5b506102ed6105a2366004613c9f565b61128b565b3480156105b357600080fd5b5060c9546104a49060ff1681565b3480156105cd57600080fd5b506104196105dc366004613cdb565b606760209081526000928352604080842090915290825290205481565b34801561060557600080fd5b506033546001600160a01b03165b6040516001600160a01b03909116815260200161031b565b34801561063757600080fd5b50610419611347565b34801561064c57600080fd5b50606954610613906001600160a01b031681565b34801561066c57600080fd5b5061041961018c5481565b34801561068357600080fd5b5061030f610692366004613b9c565b60ca602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205460ff1681565b3480156106d557600080fd5b5061057a6106e43660046138a2565b6113ca565b3480156106f557600080fd5b506103b7610704366004613d0e565b6114d9565b34801561071557600080fd5b506102ed610724366004613a04565b611568565b34801561073557600080fd5b5061041961271081565b34801561074b57600080fd5b50606554610613906001600160a01b031681565b34801561076b57600080fd5b5060f854610613906201000090046001600160a01b031681565b34801561079157600080fd5b506102ed6107a0366004613b12565b6115e4565b3480156107b157600080fd5b506107e16107c03660046138a2565b60f76020526000908152604090205461ffff81169062010000900460ff1682565b6040805161ffff909316835290151560208301520161031b565b34801561080757600080fd5b506102ed610816366004613dcb565b61163a565b6102ed6108293660046137e5565b6116a8565b34801561083a57600080fd5b5060f8546108499061ffff1681565b60405161ffff909116815260200161031b565b34801561086857600080fd5b506102ed610877366004613e39565b6118be565b34801561088857600080fd5b506104a4600181565b34801561089d57600080fd5b506102ed6108ac366004613e75565b611970565b3480156108bd57600080fd5b506102ed6108cc366004613e92565b6119c1565b3480156108dd57600080fd5b506102ed6108ec366004613a04565b611ae0565b3480156108fd57600080fd5b5061041961090c3660046138bd565b611b3a565b34801561091d57600080fd5b5060c95461030f90610100900460ff1681565b34801561093c57600080fd5b506102ed61094b366004613b12565b611bcc565b34801561095c57600080fd5b506102ed61096b366004613f69565b611c45565b34801561097c57600080fd5b5061057a61098b366004613fb4565b611f05565b34801561099c57600080fd5b5061018a546001600160a01b0316610613565b6065546001600160a01b0316336001600160a01b031614610a175760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff861660009081526066602052604081208054610a3590614001565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6190614001565b8015610aae5780601f10610a8357610100808354040283529160200191610aae565b820191906000526020600020905b815481529060010190602001808311610a9157829003601f168201915b50505050509050805186869050148015610ac9575060008151115b8015610af1575080516020820120604051610ae79088908890614035565b6040518091039020145b610b4c5760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610a0e565b610bc28787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250611f9a92505050565b50505050505050565b60006001600160e01b03198216630d30953d60e31b1480610bfc57506301ffc9a760e01b6001600160e01b03198316145b92915050565b610c0a612013565b6065546040516307e0db1760e01b815261ffff831660048201526001600160a01b03909116906307e0db17906024015b600060405180830381600087803b158015610c5457600080fd5b505af1158015610c68573d6000803e3d6000fd5b5050505050565b610c77612013565b61ffff909116600090815260686020526040902055565b610c96612013565b6065546040516310ddb13760e01b815261ffff831660048201526001600160a01b03909116906310ddb13790602401610c3a565b610cd586868561206d565b509250610d4386868686610cec6020870187613b12565b610cfc6040880160208901613b12565b610d096040890189614045565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506120b692505050565b925081831015610d655760405162461bcd60e51b8152600401610a0e9061408b565b505050505050565b600080610db38888888888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506121da92505050565b91509150965096945050505050565b61ffff831660009081526066602052604081208054829190610de390614001565b80601f0160208091040260200160405190810160405280929190818152602001828054610e0f90614001565b8015610e5c5780601f10610e3157610100808354040283529160200191610e5c565b820191906000526020600020905b815481529060010190602001808311610e3f57829003601f168201915b505050505090508383604051610e73929190614035565b60405180910390208180519060200120149150505b9392505050565b610e97612013565b6065546040516342d65a8d60e01b81526001600160a01b03909116906342d65a8d90610ecb90869086908690600401614101565b600060405180830381600087803b158015610ee557600080fd5b505af1158015610bc2573d6000803e3d6000fd5b610f0489898861206d565b5080965050610fad8989898988888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250610f569150506020890189613b12565b610f6660408a0160208b01613b12565b610f7360408b018b614045565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061227492505050565b955084861015610fcf5760405162461bcd60e51b8152600401610a0e9061408b565b505050505050505050565b610fe2612013565b6001600160a01b0381166110385760405162461bcd60e51b815260206004820152601a60248201527f4665653a206665654f776e65722063616e6e6f742062652030780000000000006044820152606401610a0e565b60f8805462010000600160b01b031916620100006001600160a01b038416908102919091179091556040519081527f047912631afa564eebd3db2efe191a0dec62da1fede6bbbc1ffc89d87845b1b5906020015b60405180910390a150565b61109f612013565b6127108161ffff1611156110c55760405162461bcd60e51b8152600401610a0e9061411f565b60f8805461ffff191661ffff83169081179091556040519081527fd26030ef4a8c225ee12b646eb4466acb41fb96b6cd4660b22d0ba0124e7bdc749060200161108c565b3330146111675760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610a0e565b610d658686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f89018190048102820181019092528781528993509150879087908190840183828082843760009201919091525061237092505050565b6111e5612013565b6111ef60006123f7565b565b6066602052600090815260409020805461120a90614001565b80601f016020809104026020016040519081016040528092919081815260200182805461123690614001565b80156112835780601f1061125857610100808354040283529160200191611283565b820191906000526020600020905b81548152906001019060200180831161126657829003601f168201915b505050505081565b611293612013565b6127108161ffff1611156112b95760405162461bcd60e51b8152600401610a0e9061411f565b60408051808201825261ffff8381168083528515156020808501828152898516600081815260f784528890209651875492511515620100000262ffffff1990931696169590951717909455845192835292820192909252918201527fdd9c9685af3e6dcb56d8f4b88d2595d4add6837a150034e7781c46b6dcf8aaab906060015b60405180910390a1505050565b61018c5461018a54604080516318160ddd60e01b81529051600093926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015611397573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bb9190614164565b6113c59190614193565b905090565b61ffff81166000908152606660205260408120805460609291906113ed90614001565b80601f016020809104026020016040519081016040528092919081815260200182805461141990614001565b80156114665780601f1061143b57610100808354040283529160200191611466565b820191906000526020600020905b81548152906001019060200180831161144957829003601f168201915b5050505050905080516000036114be5760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610a0e565b610e886000601483516114d19190614193565b839190612449565b6000806115568b8b8b8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b81528e93508d9250908c908c908190840183828082843760009201919091525061255692505050565b91509150995099975050505050505050565b611570612013565b818130604051602001611585939291906141a6565b60408051601f1981840301815291815261ffff85166000908152606660205220906115b09082614212565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce83838360405161133a93929190614101565b6115ec612013565b606980546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b9060200161108c565b611642612013565b6065546040516332fb62e760e21b81526001600160a01b039091169063cbed8b9c9061167a90889088908890889088906004016142d1565b600060405180830381600087803b15801561169457600080fd5b505af1158015610fcf573d6000803e3d6000fd5b61ffff861660009081526097602052604080822090516116cb9088908890614035565b90815260408051602092819003830190206001600160401b0387166000908152925290205490508061174b5760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610a0e565b80838360405161175c929190614035565b6040518091039020146117bb5760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610a0e565b61ffff871660009081526097602052604080822090516117de9089908990614035565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f88018290048202830182019052868252611876918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a93509150889088908190840183828082843760009201919091525061237092505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e587878787856040516118ad9594939291906142ff565b60405180910390a150505050505050565b6118c6612013565b6000811161190e5760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610a0e565b61ffff83811660008181526067602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac09060600161133a565b611978612013565b60c980548215156101000261ff00199091161790556040517f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a49061108c90831515815260200190565b333014611a105760405162461bcd60e51b815260206004820152601f60248201527f4f4654436f72653a2063616c6c6572206d757374206265204f4654436f7265006044820152606401610a0e565b611a1b3086866125f3565b9350846001600160a01b03168a61ffff167fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf86604051611a5d91815260200190565b60405180910390a3604051633fe79aed60e11b81526001600160a01b03861690637fcf35da908390611aa1908e908e908e908e908e908d908d908d9060040161433a565b600060405180830381600088803b158015611abb57600080fd5b5087f1158015611acf573d6000803e3d6000fd5b505050505050505050505050505050565b611ae8612013565b61ffff83166000908152606660205260409020611b06828483614395565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab83838360405161133a93929190614101565b61ffff828116600090815260f76020908152604080832081518083019092525493841681526201000090930460ff1615801591840191909152909190611b9f57805161271090611b8e9061ffff1685614454565b611b989190614481565b9150611bc5565b60f85461ffff1615611bc05760f85461271090611b8e9061ffff1685614454565b600091505b5092915050565b611bd4612013565b6001600160a01b038116611c395760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a0e565b611c42816123f7565b50565b600054610100900460ff1615808015611c655750600054600160ff909116105b80611c7f5750303b158015611c7f575060005460ff166001145b611ce25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610a0e565b6000805460ff191660011790558015611d05576000805461ff0019166101001790555b611d0f8383612730565b61018a80546001600160a01b0386166001600160a01b0319909116811790915560408051600481526024810182526020810180516001600160e01b031663313ce56760e01b179052905160009283929091611d6a9190614495565b600060405180830381855afa9150503d8060008114611da5576040519150601f19603f3d011682016040523d82523d6000602084013e611daa565b606091505b509150915081611e125760405162461bcd60e51b815260206004820152602d60248201527f50726f78794f4654576974684665653a206661696c656420746f20676574207460448201526c6f6b656e20646563696d616c7360981b6064820152608401610a0e565b600081806020019051810190611e2891906144b1565b90508060ff168660ff161115611e9c5760405162461bcd60e51b815260206004820152603360248201527f50726f78794f4654576974684665653a20736861726564446563696d616c73206044820152726d757374206265203c3d20646563696d616c7360681b6064820152608401610a0e565b611ea686826144ce565b611eb190600a6145cb565b61018b55505081159050611eff576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b606554604051633d7b2f6f60e21b815261ffff808716600483015285166024820152306044820152606481018390526060916001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015611f67573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f8f91908101906145da565b90505b949350505050565b600080611ffd5a60966366ad5c8a60e01b89898989604051602401611fc29493929190614647565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915230929190612775565b9150915081610d6557610d6586868686856127ff565b6033546001600160a01b031633146111ef5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a0e565b60008061207a8484611b3a565b90506120868184614193565b915080156120ae5760f8546120ac9086906201000090046001600160a01b0316836125f3565b505b935093915050565b60006120c48782848161289c565b6120cd8561291b565b5090506120dc88888884612945565b90506000811161212a5760405162461bcd60e51b815260206004820152601960248201527813d19510dbdc994e88185b5bdd5b9d081d1bdbc81cdb585b1b603a1b6044820152606401610a0e565b60006121758761213984612a8a565b6040805160006020820152602181019390935260c09190911b6001600160c01b0319166041830152805160298184030181526049909201905290565b9050612185888287878734612afa565b86896001600160a01b03168961ffff167fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a856040516121c691815260200190565b60405180910390a450979650505050505050565b60008060006121ec8761213988612a8a565b60655460405163040a7bb160e41b81529192506001600160a01b0316906340a7bb1090612225908b90309086908b908b90600401614685565b6040805180830381865afa158015612241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226591906146d9565b92509250509550959350505050565b600061228c896001846001600160401b03891661289c565b6122958761291b565b5090506122a48a8a8a84612945565b9050600081116122f25760405162461bcd60e51b815260206004820152601960248201527813d19510dbdc994e88185b5bdd5b9d081d1bdbc81cdb585b1b603a1b6044820152606401610a0e565b6000612309338a61230285612a8a565b8a8a612c83565b90506123198a8287878734612afa565b888b6001600160a01b03168b61ffff167fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a8560405161235a91815260200190565b60405180910390a4509998505050505050505050565b600061237c8282612cc4565b905060ff81166123975761239285858585612d20565b610c68565b60001960ff8216016123af5761239285858585612db0565b60405162461bcd60e51b815260206004820152601c60248201527f4f4654436f72653a20756e6b6e6f776e207061636b65742074797065000000006044820152606401610a0e565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60608161245781601f6146fd565b10156124965760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610a0e565b6124a082846146fd565b845110156124e45760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610a0e565b606082158015612503576040519150600082526020820160405261254d565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561253c578051835260209283019201612524565b5050858452601f01601f1916604052505b50949350505050565b6000806000612569338a6123028b612a8a565b60655460405163040a7bb160e41b81529192506001600160a01b0316906340a7bb10906125a2908d90309086908b908b90600401614685565b6040805180830381865afa1580156125be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125e291906146d9565b925092505097509795505050505050565b61018a546040516370a0823160e01b81526001600160a01b03848116600483015260009283929116906370a0823190602401602060405180830381865afa158015612642573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126669190614164565b9050306001600160a01b038616036126955761018a54612690906001600160a01b03168585612fbe565b6126ae565b61018a546126ae906001600160a01b0316868686613026565b61018a546040516370a0823160e01b81526001600160a01b038681166004830152839216906370a0823190602401602060405180830381865afa1580156126f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271d9190614164565b6127279190614193565b95945050505050565b600054610100900460ff166127575760405162461bcd60e51b8152600401610a0e90614710565b61275f61305e565b6127688161308e565b612771826130d7565b5050565b6000606060008060008661ffff166001600160401b0381111561279a5761279a613b2f565b6040519080825280601f01601f1916602001820160405280156127c4576020820181803683370190505b50905060008087516020890160008d8df191503d9250868311156127e6578692505b828152826000602083013e909890975095505050505050565b8180519060200120609760008761ffff1661ffff168152602001908152602001600020856040516128309190614495565b9081526040805191829003602090810183206001600160401b0388166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c9061288d908790879087908790879061475b565b60405180910390a15050505050565b60c954610100900460ff16156128bd576128b884848484613114565b611eff565b815115611eff5760405162461bcd60e51b815260206004820152602660248201527f4f4654436f72653a205f61646170746572506172616d73206d7573742062652060448201526532b6b83a3c9760d11b6064820152608401610a0e565b60008061292861018b5490565b61293290846147ad565b905061293e8184614193565b9150915091565b60006001600160a01b03851633146129b15760405162461bcd60e51b815260206004820152602960248201527f50726f78794f4654576974684665653a206f776e6572206973206e6f7420736560448201526837321031b0b63632b960b91b6064820152608401610a0e565b6129bc8530846125f3565b91506000806129ca8461291b565b909250905080156129ed5761018a546129ed906001600160a01b03168883612fbe565b8161018c6000828254612a0091906146fd565b9091555060009050612a186001600160401b036131f3565b905061018c54811015612a7e5760405162461bcd60e51b815260206004820152602860248201527f50726f78794f4654576974684665653a206f7574626f756e64416d6f756e74206044820152676f766572666c6f7760c01b6064820152608401610a0e565b50909695505050505050565b600080612a9761018b5490565b612aa19084614481565b90506001600160401b03811115610bfc5760405162461bcd60e51b815260206004820152601a60248201527f4f4654436f72653a20616d6f756e745344206f766572666c6f770000000000006044820152606401610a0e565b61ffff861660009081526066602052604081208054612b1890614001565b80601f0160208091040260200160405190810160405280929190818152602001828054612b4490614001565b8015612b915780601f10612b6657610100808354040283529160200191612b91565b820191906000526020600020905b815481529060010190602001808311612b7457829003601f168201915b505050505090508051600003612c025760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610a0e565b612c0d878751613212565b60655460405162c5803160e81b81526001600160a01b039091169063c5803100908490612c48908b9086908c908c908c908c906004016147c1565b6000604051808303818588803b158015612c6157600080fd5b505af1158015612c75573d6000803e3d6000fd5b505050505050505050505050565b6060600185856001600160a01b0389168587604051602001612caa96959493929190614828565b604051602081830303815290604052905095945050505050565b6000612cd18260016146fd565b83511015612d175760405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b6044820152606401610a0e565b50016001015190565b600080612d2c83613283565b90925090506001600160a01b038216612d455761dead91505b6000612d50826131f3565b9050612d5d878483613308565b9050826001600160a01b03168761ffff167fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf83604051612d9f91815260200190565b60405180910390a350505050505050565b6000806000806000612dc186613344565b94509450945094509450600060ca60008b61ffff1661ffff16815260200190815260200160002089604051612df69190614495565b90815260408051602092819003830190206001600160401b038b166000908152925281205460ff169150612e29856131f3565b905081612e9757612e3b8b3083613308565b61ffff8c16600090815260ca6020526040908190209051919250600191612e63908d90614495565b90815260408051602092819003830190206001600160401b038d16600090815292529020805460ff19169115159190911790555b6001600160a01b0386163b612eee576040516001600160a01b03871681527f9aedf5fdba8716db3b6705ca00150643309995d4f818a249ed6dde6677e7792d9060200160405180910390a150505050505050611eff565b8a8a8a8a8a8a868a60008a612f0c578b6001600160401b0316612f0e565b5a5b9050600080612f405a609663eaffd49a60e01b8e8e8e8d8d8d8d8d604051602401611fc2989796959493929190614889565b915091508115612f99578751602089012060405161ffff8d16907fb8890edbfc1c74692f527444645f95489c3703cc2df42e4a366f5d06fa6cd88490612f8b908e908e9086906148fd565b60405180910390a250612fa6565b612fa68b8b8b8b856127ff565b50505050505050505050505050505050505050505050565b6040516001600160a01b03831660248201526044810182905261302190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526133fb565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611eff9085906323b872dd60e01b90608401612fea565b600054610100900460ff166130855760405162461bcd60e51b8152600401610a0e90614710565b6111ef336123f7565b600054610100900460ff166130b55760405162461bcd60e51b8152600401610a0e90614710565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff166130fe5760405162461bcd60e51b8152600401610a0e90614710565b60c9805460ff191660ff92909216919091179055565b600061311f836134d0565b61ffff8087166000908152606760209081526040808320938916835292905290812054919250906131519084906146fd565b9050600081116131a35760405162461bcd60e51b815260206004820152601a60248201527f4c7a4170703a206d696e4761734c696d6974206e6f74207365740000000000006044820152606401610a0e565b80821015610d655760405162461bcd60e51b815260206004820152601b60248201527f4c7a4170703a20676173206c696d697420697320746f6f206c6f7700000000006044820152606401610a0e565b60006131ff61018b5490565b610bfc906001600160401b038416614454565b61ffff82166000908152606860205260408120549081900361323357506127105b808211156130215760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152606401610a0e565b600080806132918482612cc4565b60ff161480156132a2575082516029145b6132e95760405162461bcd60e51b815260206004820152601860248201527713d19510dbdc994e881a5b9d985b1a59081c185e5b1bd85960421b6044820152606401610a0e565b6132f483600d61352c565b9150613301836021613591565b9050915091565b60008161018c600082825461331d9190614193565b9091555050306001600160a01b03841603613339575080610e88565b611f923084846125f3565b6000808060608160016133578783612cc4565b60ff16146133a25760405162461bcd60e51b815260206004820152601860248201527713d19510dbdc994e881a5b9d985b1a59081c185e5b1bd85960421b6044820152606401610a0e565b6133ad86600d61352c565b93506133ba866021613591565b92506133c78660296135ee565b94506133d4866049613591565b90506133f060518088516133e89190614193565b889190612449565b915091939590929450565b6000613450826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661364c9092919063ffffffff16565b9050805160001480613471575080806020019051810190613471919061492b565b6130215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a0e565b60006022825110156135245760405162461bcd60e51b815260206004820152601c60248201527f4c7a4170703a20696e76616c69642061646170746572506172616d73000000006044820152606401610a0e565b506022015190565b60006135398260146146fd565b835110156135815760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610a0e565b500160200151600160601b900490565b600061359e8260086146fd565b835110156135e55760405162461bcd60e51b8152602060048201526014602482015273746f55696e7436345f6f75744f66426f756e647360601b6044820152606401610a0e565b50016008015190565b60006135fb8260206146fd565b835110156136435760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b6044820152606401610a0e565b50016020015190565b6060611f92848460008585600080866001600160a01b031685876040516136739190614495565b60006040518083038185875af1925050503d80600081146136b0576040519150601f19603f3d011682016040523d82523d6000602084013e6136b5565b606091505b50915091506136c6878383876136d1565b979650505050505050565b60608315613740578251600003613739576001600160a01b0385163b6137395760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a0e565b5081611f92565b611f9283838151156137555781518083602001fd5b8060405162461bcd60e51b8152600401610a0e9190613c8c565b803561ffff8116811461378157600080fd5b919050565b60008083601f84011261379857600080fd5b5081356001600160401b038111156137af57600080fd5b6020830191508360208285010111156137c757600080fd5b9250929050565b80356001600160401b038116811461378157600080fd5b600080600080600080608087890312156137fe57600080fd5b6138078761376f565b955060208701356001600160401b038082111561382357600080fd5b61382f8a838b01613786565b909750955085915061384360408a016137ce565b9450606089013591508082111561385957600080fd5b5061386689828a01613786565b979a9699509497509295939492505050565b60006020828403121561388a57600080fd5b81356001600160e01b031981168114610e8857600080fd5b6000602082840312156138b457600080fd5b610e888261376f565b600080604083850312156138d057600080fd5b6138d98361376f565b946020939093013593505050565b6001600160a01b0381168114611c4257600080fd5b60006060828403121561390e57600080fd5b50919050565b60008060008060008060c0878903121561392d57600080fd5b8635613938816138e7565b95506139466020880161376f565b945060408701359350606087013592506080870135915060a08701356001600160401b0381111561397657600080fd5b61398289828a016138fc565b9150509295509295509295565b8015158114611c4257600080fd5b60008060008060008060a087890312156139b657600080fd5b6139bf8761376f565b9550602087013594506040870135935060608701356139dd8161398f565b925060808701356001600160401b038111156139f857600080fd5b61386689828a01613786565b600080600060408486031215613a1957600080fd5b613a228461376f565b925060208401356001600160401b03811115613a3d57600080fd5b613a4986828701613786565b9497909650939450505050565b60008060008060008060008060006101008a8c031215613a7557600080fd5b8935613a80816138e7565b9850613a8e60208b0161376f565b975060408a0135965060608a0135955060808a0135945060a08a01356001600160401b0380821115613abf57600080fd5b613acb8d838e01613786565b9096509450849150613adf60c08d016137ce565b935060e08c0135915080821115613af557600080fd5b50613b028c828d016138fc565b9150509295985092959850929598565b600060208284031215613b2457600080fd5b8135610e88816138e7565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613b6d57613b6d613b2f565b604052919050565b60006001600160401b03821115613b8e57613b8e613b2f565b50601f01601f191660200190565b600080600060608486031215613bb157600080fd5b613bba8461376f565b925060208401356001600160401b03811115613bd557600080fd5b8401601f81018613613be657600080fd5b8035613bf9613bf482613b75565b613b45565b818152876020838501011115613c0e57600080fd5b81602084016020830137600060208383010152809450505050613c33604085016137ce565b90509250925092565b60005b83811015613c57578181015183820152602001613c3f565b50506000910152565b60008151808452613c78816020860160208601613c3c565b601f01601f19169290920160200192915050565b602081526000610e886020830184613c60565b600080600060608486031215613cb457600080fd5b613cbd8461376f565b92506020840135613ccd8161398f565b9150613c336040850161376f565b60008060408385031215613cee57600080fd5b613cf78361376f565b9150613d056020840161376f565b90509250929050565b600080600080600080600080600060e08a8c031215613d2c57600080fd5b613d358a61376f565b985060208a0135975060408a0135965060608a01356001600160401b0380821115613d5f57600080fd5b613d6b8d838e01613786565b9098509650869150613d7f60808d016137ce565b955060a08c01359150613d918261398f565b90935060c08b01359080821115613da757600080fd5b50613db48c828d01613786565b915080935050809150509295985092959850929598565b600080600080600060808688031215613de357600080fd5b613dec8661376f565b9450613dfa6020870161376f565b93506040860135925060608601356001600160401b03811115613e1c57600080fd5b613e2888828901613786565b969995985093965092949392505050565b600080600060608486031215613e4e57600080fd5b613e578461376f565b9250613e656020850161376f565b9150604084013590509250925092565b600060208284031215613e8757600080fd5b8135610e888161398f565b6000806000806000806000806000806101008b8d031215613eb257600080fd5b613ebb8b61376f565b995060208b01356001600160401b0380821115613ed757600080fd5b613ee38e838f01613786565b909b509950899150613ef760408e016137ce565b985060608d0135975060808d01359150613f10826138e7565b90955060a08c0135945060c08c01359080821115613f2d57600080fd5b50613f3a8d828e01613786565b9150809450508092505060e08b013590509295989b9194979a5092959850565b60ff81168114611c4257600080fd5b600080600060608486031215613f7e57600080fd5b8335613f89816138e7565b92506020840135613f9981613f5a565b91506040840135613fa9816138e7565b809150509250925092565b60008060008060808587031215613fca57600080fd5b613fd38561376f565b9350613fe16020860161376f565b92506040850135613ff1816138e7565b9396929550929360600135925050565b600181811c9082168061401557607f821691505b60208210810361390e57634e487b7160e01b600052602260045260246000fd5b8183823760009101908152919050565b6000808335601e1984360301811261405c57600080fd5b8301803591506001600160401b0382111561407657600080fd5b6020019150368190038213156137c757600080fd5b6020808252602d908201527f426173654f4654576974684665653a20616d6f756e74206973206c657373207460408201526c1a185b881b5a5b905b5bdd5b9d609a1b606082015260800190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000611f8f6040830184866140d8565b60208082526025908201527f4665653a20666565206270206d757374206265203c3d2042505f44454e4f4d496040820152642720aa27a960d91b606082015260800190565b60006020828403121561417657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610bfc57610bfc61417d565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b601f82111561302157600081815260208120601f850160051c810160208610156141f35750805b601f850160051c820191505b81811015610d65578281556001016141ff565b81516001600160401b0381111561422b5761422b613b2f565b61423f816142398454614001565b846141cc565b602080601f831160018114614274576000841561425c5750858301515b600019600386901b1c1916600185901b178555610d65565b600085815260208120601f198616915b828110156142a357888601518255948401946001909101908401614284565b50858210156142c15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600061ffff8088168352808716602084015250846040830152608060608301526136c66080830184866140d8565b61ffff8616815260806020820152600061431d6080830186886140d8565b6001600160401b0394909416604083015250606001529392505050565b61ffff8916815260c06020820152600061435860c08301898b6140d8565b6001600160401b038816604084015286606084015285608084015282810360a08401526143868185876140d8565b9b9a5050505050505050505050565b6001600160401b038311156143ac576143ac613b2f565b6143c0836143ba8354614001565b836141cc565b6000601f8411600181146143f457600085156143dc5750838201355b600019600387901b1c1916600186901b178355610c68565b600083815260209020601f19861690835b828110156144255786850135825560209485019460019092019101614405565b50868210156144425760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b8082028115828204841417610bfc57610bfc61417d565b634e487b7160e01b600052601260045260246000fd5b6000826144905761449061446b565b500490565b600082516144a7818460208701613c3c565b9190910192915050565b6000602082840312156144c357600080fd5b8151610e8881613f5a565b60ff8281168282160390811115610bfc57610bfc61417d565b600181815b808511156145225781600019048211156145085761450861417d565b8085161561451557918102915b93841c93908002906144ec565b509250929050565b60008261453957506001610bfc565b8161454657506000610bfc565b816001811461455c576002811461456657614582565b6001915050610bfc565b60ff8411156145775761457761417d565b50506001821b610bfc565b5060208310610133831016604e8410600b84101617156145a5575081810a610bfc565b6145af83836144e7565b80600019048211156145c3576145c361417d565b029392505050565b6000610e8860ff84168361452a565b6000602082840312156145ec57600080fd5b81516001600160401b0381111561460257600080fd5b8201601f8101841361461357600080fd5b8051614621613bf482613b75565b81815285602083850101111561463657600080fd5b612727826020830160208601613c3c565b61ffff851681526080602082015260006146646080830186613c60565b6001600160401b038516604084015282810360608401526136c68185613c60565b61ffff861681526001600160a01b038516602082015260a0604082018190526000906146b390830186613c60565b841515606084015282810360808401526146cd8185613c60565b98975050505050505050565b600080604083850312156146ec57600080fd5b505080516020909101519092909150565b80820180821115610bfc57610bfc61417d565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b61ffff8616815260a06020820152600061477860a0830187613c60565b6001600160401b038616604084015282810360608401526147998186613c60565b905082810360808401526146cd8185613c60565b6000826147bc576147bc61446b565b500690565b61ffff8716815260c0602082015260006147de60c0830188613c60565b82810360408401526147f08188613c60565b6001600160a01b0387811660608601528616608085015283810360a0850152905061481b8185613c60565b9998505050505050505050565b60ff60f81b8760f81b16815285600182015260006001600160401b0360c01b808760c01b166021840152856029840152808560c01b166049840152508251614877816051850160208701613c3c565b91909101605101979650505050505050565b600061010061ffff8b1683528060208401526148a78184018b613c60565b6001600160401b038a166040850152606084018990526001600160a01b038816608085015260a0840187905283810360c085015290506148e78186613c60565b9150508260e08301529998505050505050505050565b6060815260006149106060830186613c60565b6001600160401b039490941660208301525060400152919050565b60006020828403121561493d57600080fd5b8151610e888161398f56fea2646970667358221220360ce8d7a4ee2823aa0b2c7c682e8bc3aba2c629bcae185a3caae4bc51f4c0bb64736f6c63430008120033", + "deployedBytecode": "0x6080604052600436106102c85760003560e01c80639689cb0511610175578063d1deba1f116100dc578063eb8d72b711610095578063f2fde38b1161006f578063f2fde38b14610930578063f35f9e4514610950578063f5ecbdbc14610970578063fc0c546a1461099057600080fd5b8063eb8d72b7146108d1578063ecd8f212146108f1578063ed629c5c1461091157600080fd5b8063d1deba1f1461081b578063d88829681461082e578063df2a5b3b1461085c578063e6a20ae61461087c578063eab45d9c14610891578063eaffd49a146108b157600080fd5b8063b353aaa71161012e578063b353aaa71461073f578063b9818be11461075f578063baf3292d14610785578063c446183414610729578063c83330ce146107a5578063cbed8b9c146107fb57600080fd5b80639689cb05146106605780639bdb9812146106775780639f38369a146106c9578063a4c51df5146106e9578063a6c3d16514610709578063abe685cd1461072957600080fd5b80634b104eff116102345780637533d788116101ed5780638cfd8f5c116101c75780638cfd8f5c146105c15780638da5cb5b146105f95780639358928b1461062b578063950c8a741461064057600080fd5b80637533d7881461055a57806379c0ad4b14610587578063857749b0146105a757600080fd5b80634b104eff1461046f5780634c42899a1461048f5780635a359dc5146104b65780635b8c41e6146104d657806366ad5c8a14610525578063715018a61461054557600080fd5b8063365260b411610286578063365260b4146103975780633d8b38f6146103cc5780633f1f4fa4146103ec57806342d65a8d146104275780634477051514610447578063455ba27d1461045c57600080fd5b80621d3567146102cd57806301ffc9a7146102ef57806307e0db17146103245780630df374831461034457806310ddb137146103645780632cdf0b9514610384575b600080fd5b3480156102d957600080fd5b506102ed6102e83660046137e5565b6109af565b005b3480156102fb57600080fd5b5061030f61030a366004613878565b610bcb565b60405190151581526020015b60405180910390f35b34801561033057600080fd5b506102ed61033f3660046138a2565b610c02565b34801561035057600080fd5b506102ed61035f3660046138bd565b610c6f565b34801561037057600080fd5b506102ed61037f3660046138a2565b610c8e565b6102ed610392366004613914565b610cca565b3480156103a357600080fd5b506103b76103b236600461399d565b610d6d565b6040805192835260208301919091520161031b565b3480156103d857600080fd5b5061030f6103e7366004613a04565b610dc2565b3480156103f857600080fd5b506104196104073660046138a2565b60686020526000908152604090205481565b60405190815260200161031b565b34801561043357600080fd5b506102ed610442366004613a04565b610e8f565b34801561045357600080fd5b50610419600081565b6102ed61046a366004613a56565b610ef9565b34801561047b57600080fd5b506102ed61048a366004613b12565b610fda565b34801561049b57600080fd5b506104a4600081565b60405160ff909116815260200161031b565b3480156104c257600080fd5b506102ed6104d13660046138a2565b611097565b3480156104e257600080fd5b506104196104f1366004613b9c565b6097602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b34801561053157600080fd5b506102ed6105403660046137e5565b611109565b34801561055157600080fd5b506102ed6111dd565b34801561056657600080fd5b5061057a6105753660046138a2565b6111f1565b60405161031b9190613c8c565b34801561059357600080fd5b506102ed6105a2366004613c9f565b61128b565b3480156105b357600080fd5b5060c9546104a49060ff1681565b3480156105cd57600080fd5b506104196105dc366004613cdb565b606760209081526000928352604080842090915290825290205481565b34801561060557600080fd5b506033546001600160a01b03165b6040516001600160a01b03909116815260200161031b565b34801561063757600080fd5b50610419611347565b34801561064c57600080fd5b50606954610613906001600160a01b031681565b34801561066c57600080fd5b5061041961018c5481565b34801561068357600080fd5b5061030f610692366004613b9c565b60ca602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205460ff1681565b3480156106d557600080fd5b5061057a6106e43660046138a2565b6113ca565b3480156106f557600080fd5b506103b7610704366004613d0e565b6114d9565b34801561071557600080fd5b506102ed610724366004613a04565b611568565b34801561073557600080fd5b5061041961271081565b34801561074b57600080fd5b50606554610613906001600160a01b031681565b34801561076b57600080fd5b5060f854610613906201000090046001600160a01b031681565b34801561079157600080fd5b506102ed6107a0366004613b12565b6115e4565b3480156107b157600080fd5b506107e16107c03660046138a2565b60f76020526000908152604090205461ffff81169062010000900460ff1682565b6040805161ffff909316835290151560208301520161031b565b34801561080757600080fd5b506102ed610816366004613dcb565b61163a565b6102ed6108293660046137e5565b6116a8565b34801561083a57600080fd5b5060f8546108499061ffff1681565b60405161ffff909116815260200161031b565b34801561086857600080fd5b506102ed610877366004613e39565b6118be565b34801561088857600080fd5b506104a4600181565b34801561089d57600080fd5b506102ed6108ac366004613e75565b611970565b3480156108bd57600080fd5b506102ed6108cc366004613e92565b6119c1565b3480156108dd57600080fd5b506102ed6108ec366004613a04565b611ae0565b3480156108fd57600080fd5b5061041961090c3660046138bd565b611b3a565b34801561091d57600080fd5b5060c95461030f90610100900460ff1681565b34801561093c57600080fd5b506102ed61094b366004613b12565b611bcc565b34801561095c57600080fd5b506102ed61096b366004613f69565b611c45565b34801561097c57600080fd5b5061057a61098b366004613fb4565b611f05565b34801561099c57600080fd5b5061018a546001600160a01b0316610613565b6065546001600160a01b0316336001600160a01b031614610a175760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff861660009081526066602052604081208054610a3590614001565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6190614001565b8015610aae5780601f10610a8357610100808354040283529160200191610aae565b820191906000526020600020905b815481529060010190602001808311610a9157829003601f168201915b50505050509050805186869050148015610ac9575060008151115b8015610af1575080516020820120604051610ae79088908890614035565b6040518091039020145b610b4c5760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610a0e565b610bc28787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250611f9a92505050565b50505050505050565b60006001600160e01b03198216630d30953d60e31b1480610bfc57506301ffc9a760e01b6001600160e01b03198316145b92915050565b610c0a612013565b6065546040516307e0db1760e01b815261ffff831660048201526001600160a01b03909116906307e0db17906024015b600060405180830381600087803b158015610c5457600080fd5b505af1158015610c68573d6000803e3d6000fd5b5050505050565b610c77612013565b61ffff909116600090815260686020526040902055565b610c96612013565b6065546040516310ddb13760e01b815261ffff831660048201526001600160a01b03909116906310ddb13790602401610c3a565b610cd586868561206d565b509250610d4386868686610cec6020870187613b12565b610cfc6040880160208901613b12565b610d096040890189614045565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506120b692505050565b925081831015610d655760405162461bcd60e51b8152600401610a0e9061408b565b505050505050565b600080610db38888888888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506121da92505050565b91509150965096945050505050565b61ffff831660009081526066602052604081208054829190610de390614001565b80601f0160208091040260200160405190810160405280929190818152602001828054610e0f90614001565b8015610e5c5780601f10610e3157610100808354040283529160200191610e5c565b820191906000526020600020905b815481529060010190602001808311610e3f57829003601f168201915b505050505090508383604051610e73929190614035565b60405180910390208180519060200120149150505b9392505050565b610e97612013565b6065546040516342d65a8d60e01b81526001600160a01b03909116906342d65a8d90610ecb90869086908690600401614101565b600060405180830381600087803b158015610ee557600080fd5b505af1158015610bc2573d6000803e3d6000fd5b610f0489898861206d565b5080965050610fad8989898988888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250610f569150506020890189613b12565b610f6660408a0160208b01613b12565b610f7360408b018b614045565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061227492505050565b955084861015610fcf5760405162461bcd60e51b8152600401610a0e9061408b565b505050505050505050565b610fe2612013565b6001600160a01b0381166110385760405162461bcd60e51b815260206004820152601a60248201527f4665653a206665654f776e65722063616e6e6f742062652030780000000000006044820152606401610a0e565b60f8805462010000600160b01b031916620100006001600160a01b038416908102919091179091556040519081527f047912631afa564eebd3db2efe191a0dec62da1fede6bbbc1ffc89d87845b1b5906020015b60405180910390a150565b61109f612013565b6127108161ffff1611156110c55760405162461bcd60e51b8152600401610a0e9061411f565b60f8805461ffff191661ffff83169081179091556040519081527fd26030ef4a8c225ee12b646eb4466acb41fb96b6cd4660b22d0ba0124e7bdc749060200161108c565b3330146111675760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610a0e565b610d658686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f89018190048102820181019092528781528993509150879087908190840183828082843760009201919091525061237092505050565b6111e5612013565b6111ef60006123f7565b565b6066602052600090815260409020805461120a90614001565b80601f016020809104026020016040519081016040528092919081815260200182805461123690614001565b80156112835780601f1061125857610100808354040283529160200191611283565b820191906000526020600020905b81548152906001019060200180831161126657829003601f168201915b505050505081565b611293612013565b6127108161ffff1611156112b95760405162461bcd60e51b8152600401610a0e9061411f565b60408051808201825261ffff8381168083528515156020808501828152898516600081815260f784528890209651875492511515620100000262ffffff1990931696169590951717909455845192835292820192909252918201527fdd9c9685af3e6dcb56d8f4b88d2595d4add6837a150034e7781c46b6dcf8aaab906060015b60405180910390a1505050565b61018c5461018a54604080516318160ddd60e01b81529051600093926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015611397573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bb9190614164565b6113c59190614193565b905090565b61ffff81166000908152606660205260408120805460609291906113ed90614001565b80601f016020809104026020016040519081016040528092919081815260200182805461141990614001565b80156114665780601f1061143b57610100808354040283529160200191611466565b820191906000526020600020905b81548152906001019060200180831161144957829003601f168201915b5050505050905080516000036114be5760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610a0e565b610e886000601483516114d19190614193565b839190612449565b6000806115568b8b8b8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b81528e93508d9250908c908c908190840183828082843760009201919091525061255692505050565b91509150995099975050505050505050565b611570612013565b818130604051602001611585939291906141a6565b60408051601f1981840301815291815261ffff85166000908152606660205220906115b09082614212565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce83838360405161133a93929190614101565b6115ec612013565b606980546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b9060200161108c565b611642612013565b6065546040516332fb62e760e21b81526001600160a01b039091169063cbed8b9c9061167a90889088908890889088906004016142d1565b600060405180830381600087803b15801561169457600080fd5b505af1158015610fcf573d6000803e3d6000fd5b61ffff861660009081526097602052604080822090516116cb9088908890614035565b90815260408051602092819003830190206001600160401b0387166000908152925290205490508061174b5760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610a0e565b80838360405161175c929190614035565b6040518091039020146117bb5760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610a0e565b61ffff871660009081526097602052604080822090516117de9089908990614035565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f88018290048202830182019052868252611876918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a93509150889088908190840183828082843760009201919091525061237092505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e587878787856040516118ad9594939291906142ff565b60405180910390a150505050505050565b6118c6612013565b6000811161190e5760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610a0e565b61ffff83811660008181526067602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac09060600161133a565b611978612013565b60c980548215156101000261ff00199091161790556040517f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a49061108c90831515815260200190565b333014611a105760405162461bcd60e51b815260206004820152601f60248201527f4f4654436f72653a2063616c6c6572206d757374206265204f4654436f7265006044820152606401610a0e565b611a1b3086866125f3565b9350846001600160a01b03168a61ffff167fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf86604051611a5d91815260200190565b60405180910390a3604051633fe79aed60e11b81526001600160a01b03861690637fcf35da908390611aa1908e908e908e908e908e908d908d908d9060040161433a565b600060405180830381600088803b158015611abb57600080fd5b5087f1158015611acf573d6000803e3d6000fd5b505050505050505050505050505050565b611ae8612013565b61ffff83166000908152606660205260409020611b06828483614395565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab83838360405161133a93929190614101565b61ffff828116600090815260f76020908152604080832081518083019092525493841681526201000090930460ff1615801591840191909152909190611b9f57805161271090611b8e9061ffff1685614454565b611b989190614481565b9150611bc5565b60f85461ffff1615611bc05760f85461271090611b8e9061ffff1685614454565b600091505b5092915050565b611bd4612013565b6001600160a01b038116611c395760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a0e565b611c42816123f7565b50565b600054610100900460ff1615808015611c655750600054600160ff909116105b80611c7f5750303b158015611c7f575060005460ff166001145b611ce25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610a0e565b6000805460ff191660011790558015611d05576000805461ff0019166101001790555b611d0f8383612730565b61018a80546001600160a01b0386166001600160a01b0319909116811790915560408051600481526024810182526020810180516001600160e01b031663313ce56760e01b179052905160009283929091611d6a9190614495565b600060405180830381855afa9150503d8060008114611da5576040519150601f19603f3d011682016040523d82523d6000602084013e611daa565b606091505b509150915081611e125760405162461bcd60e51b815260206004820152602d60248201527f50726f78794f4654576974684665653a206661696c656420746f20676574207460448201526c6f6b656e20646563696d616c7360981b6064820152608401610a0e565b600081806020019051810190611e2891906144b1565b90508060ff168660ff161115611e9c5760405162461bcd60e51b815260206004820152603360248201527f50726f78794f4654576974684665653a20736861726564446563696d616c73206044820152726d757374206265203c3d20646563696d616c7360681b6064820152608401610a0e565b611ea686826144ce565b611eb190600a6145cb565b61018b55505081159050611eff576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b606554604051633d7b2f6f60e21b815261ffff808716600483015285166024820152306044820152606481018390526060916001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015611f67573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f8f91908101906145da565b90505b949350505050565b600080611ffd5a60966366ad5c8a60e01b89898989604051602401611fc29493929190614647565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915230929190612775565b9150915081610d6557610d6586868686856127ff565b6033546001600160a01b031633146111ef5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a0e565b60008061207a8484611b3a565b90506120868184614193565b915080156120ae5760f8546120ac9086906201000090046001600160a01b0316836125f3565b505b935093915050565b60006120c48782848161289c565b6120cd8561291b565b5090506120dc88888884612945565b90506000811161212a5760405162461bcd60e51b815260206004820152601960248201527813d19510dbdc994e88185b5bdd5b9d081d1bdbc81cdb585b1b603a1b6044820152606401610a0e565b60006121758761213984612a8a565b6040805160006020820152602181019390935260c09190911b6001600160c01b0319166041830152805160298184030181526049909201905290565b9050612185888287878734612afa565b86896001600160a01b03168961ffff167fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a856040516121c691815260200190565b60405180910390a450979650505050505050565b60008060006121ec8761213988612a8a565b60655460405163040a7bb160e41b81529192506001600160a01b0316906340a7bb1090612225908b90309086908b908b90600401614685565b6040805180830381865afa158015612241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226591906146d9565b92509250509550959350505050565b600061228c896001846001600160401b03891661289c565b6122958761291b565b5090506122a48a8a8a84612945565b9050600081116122f25760405162461bcd60e51b815260206004820152601960248201527813d19510dbdc994e88185b5bdd5b9d081d1bdbc81cdb585b1b603a1b6044820152606401610a0e565b6000612309338a61230285612a8a565b8a8a612c83565b90506123198a8287878734612afa565b888b6001600160a01b03168b61ffff167fd81fc9b8523134ed613870ed029d6170cbb73aa6a6bc311b9a642689fb9df59a8560405161235a91815260200190565b60405180910390a4509998505050505050505050565b600061237c8282612cc4565b905060ff81166123975761239285858585612d20565b610c68565b60001960ff8216016123af5761239285858585612db0565b60405162461bcd60e51b815260206004820152601c60248201527f4f4654436f72653a20756e6b6e6f776e207061636b65742074797065000000006044820152606401610a0e565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60608161245781601f6146fd565b10156124965760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610a0e565b6124a082846146fd565b845110156124e45760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610a0e565b606082158015612503576040519150600082526020820160405261254d565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561253c578051835260209283019201612524565b5050858452601f01601f1916604052505b50949350505050565b6000806000612569338a6123028b612a8a565b60655460405163040a7bb160e41b81529192506001600160a01b0316906340a7bb10906125a2908d90309086908b908b90600401614685565b6040805180830381865afa1580156125be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125e291906146d9565b925092505097509795505050505050565b61018a546040516370a0823160e01b81526001600160a01b03848116600483015260009283929116906370a0823190602401602060405180830381865afa158015612642573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126669190614164565b9050306001600160a01b038616036126955761018a54612690906001600160a01b03168585612fbe565b6126ae565b61018a546126ae906001600160a01b0316868686613026565b61018a546040516370a0823160e01b81526001600160a01b038681166004830152839216906370a0823190602401602060405180830381865afa1580156126f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271d9190614164565b6127279190614193565b95945050505050565b600054610100900460ff166127575760405162461bcd60e51b8152600401610a0e90614710565b61275f61305e565b6127688161308e565b612771826130d7565b5050565b6000606060008060008661ffff166001600160401b0381111561279a5761279a613b2f565b6040519080825280601f01601f1916602001820160405280156127c4576020820181803683370190505b50905060008087516020890160008d8df191503d9250868311156127e6578692505b828152826000602083013e909890975095505050505050565b8180519060200120609760008761ffff1661ffff168152602001908152602001600020856040516128309190614495565b9081526040805191829003602090810183206001600160401b0388166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c9061288d908790879087908790879061475b565b60405180910390a15050505050565b60c954610100900460ff16156128bd576128b884848484613114565b611eff565b815115611eff5760405162461bcd60e51b815260206004820152602660248201527f4f4654436f72653a205f61646170746572506172616d73206d7573742062652060448201526532b6b83a3c9760d11b6064820152608401610a0e565b60008061292861018b5490565b61293290846147ad565b905061293e8184614193565b9150915091565b60006001600160a01b03851633146129b15760405162461bcd60e51b815260206004820152602960248201527f50726f78794f4654576974684665653a206f776e6572206973206e6f7420736560448201526837321031b0b63632b960b91b6064820152608401610a0e565b6129bc8530846125f3565b91506000806129ca8461291b565b909250905080156129ed5761018a546129ed906001600160a01b03168883612fbe565b8161018c6000828254612a0091906146fd565b9091555060009050612a186001600160401b036131f3565b905061018c54811015612a7e5760405162461bcd60e51b815260206004820152602860248201527f50726f78794f4654576974684665653a206f7574626f756e64416d6f756e74206044820152676f766572666c6f7760c01b6064820152608401610a0e565b50909695505050505050565b600080612a9761018b5490565b612aa19084614481565b90506001600160401b03811115610bfc5760405162461bcd60e51b815260206004820152601a60248201527f4f4654436f72653a20616d6f756e745344206f766572666c6f770000000000006044820152606401610a0e565b61ffff861660009081526066602052604081208054612b1890614001565b80601f0160208091040260200160405190810160405280929190818152602001828054612b4490614001565b8015612b915780601f10612b6657610100808354040283529160200191612b91565b820191906000526020600020905b815481529060010190602001808311612b7457829003601f168201915b505050505090508051600003612c025760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610a0e565b612c0d878751613212565b60655460405162c5803160e81b81526001600160a01b039091169063c5803100908490612c48908b9086908c908c908c908c906004016147c1565b6000604051808303818588803b158015612c6157600080fd5b505af1158015612c75573d6000803e3d6000fd5b505050505050505050505050565b6060600185856001600160a01b0389168587604051602001612caa96959493929190614828565b604051602081830303815290604052905095945050505050565b6000612cd18260016146fd565b83511015612d175760405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b6044820152606401610a0e565b50016001015190565b600080612d2c83613283565b90925090506001600160a01b038216612d455761dead91505b6000612d50826131f3565b9050612d5d878483613308565b9050826001600160a01b03168761ffff167fbf551ec93859b170f9b2141bd9298bf3f64322c6f7beb2543a0cb669834118bf83604051612d9f91815260200190565b60405180910390a350505050505050565b6000806000806000612dc186613344565b94509450945094509450600060ca60008b61ffff1661ffff16815260200190815260200160002089604051612df69190614495565b90815260408051602092819003830190206001600160401b038b166000908152925281205460ff169150612e29856131f3565b905081612e9757612e3b8b3083613308565b61ffff8c16600090815260ca6020526040908190209051919250600191612e63908d90614495565b90815260408051602092819003830190206001600160401b038d16600090815292529020805460ff19169115159190911790555b6001600160a01b0386163b612eee576040516001600160a01b03871681527f9aedf5fdba8716db3b6705ca00150643309995d4f818a249ed6dde6677e7792d9060200160405180910390a150505050505050611eff565b8a8a8a8a8a8a868a60008a612f0c578b6001600160401b0316612f0e565b5a5b9050600080612f405a609663eaffd49a60e01b8e8e8e8d8d8d8d8d604051602401611fc2989796959493929190614889565b915091508115612f99578751602089012060405161ffff8d16907fb8890edbfc1c74692f527444645f95489c3703cc2df42e4a366f5d06fa6cd88490612f8b908e908e9086906148fd565b60405180910390a250612fa6565b612fa68b8b8b8b856127ff565b50505050505050505050505050505050505050505050565b6040516001600160a01b03831660248201526044810182905261302190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526133fb565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611eff9085906323b872dd60e01b90608401612fea565b600054610100900460ff166130855760405162461bcd60e51b8152600401610a0e90614710565b6111ef336123f7565b600054610100900460ff166130b55760405162461bcd60e51b8152600401610a0e90614710565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff166130fe5760405162461bcd60e51b8152600401610a0e90614710565b60c9805460ff191660ff92909216919091179055565b600061311f836134d0565b61ffff8087166000908152606760209081526040808320938916835292905290812054919250906131519084906146fd565b9050600081116131a35760405162461bcd60e51b815260206004820152601a60248201527f4c7a4170703a206d696e4761734c696d6974206e6f74207365740000000000006044820152606401610a0e565b80821015610d655760405162461bcd60e51b815260206004820152601b60248201527f4c7a4170703a20676173206c696d697420697320746f6f206c6f7700000000006044820152606401610a0e565b60006131ff61018b5490565b610bfc906001600160401b038416614454565b61ffff82166000908152606860205260408120549081900361323357506127105b808211156130215760405162461bcd60e51b815260206004820181905260248201527f4c7a4170703a207061796c6f61642073697a6520697320746f6f206c617267656044820152606401610a0e565b600080806132918482612cc4565b60ff161480156132a2575082516029145b6132e95760405162461bcd60e51b815260206004820152601860248201527713d19510dbdc994e881a5b9d985b1a59081c185e5b1bd85960421b6044820152606401610a0e565b6132f483600d61352c565b9150613301836021613591565b9050915091565b60008161018c600082825461331d9190614193565b9091555050306001600160a01b03841603613339575080610e88565b611f923084846125f3565b6000808060608160016133578783612cc4565b60ff16146133a25760405162461bcd60e51b815260206004820152601860248201527713d19510dbdc994e881a5b9d985b1a59081c185e5b1bd85960421b6044820152606401610a0e565b6133ad86600d61352c565b93506133ba866021613591565b92506133c78660296135ee565b94506133d4866049613591565b90506133f060518088516133e89190614193565b889190612449565b915091939590929450565b6000613450826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661364c9092919063ffffffff16565b9050805160001480613471575080806020019051810190613471919061492b565b6130215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a0e565b60006022825110156135245760405162461bcd60e51b815260206004820152601c60248201527f4c7a4170703a20696e76616c69642061646170746572506172616d73000000006044820152606401610a0e565b506022015190565b60006135398260146146fd565b835110156135815760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610a0e565b500160200151600160601b900490565b600061359e8260086146fd565b835110156135e55760405162461bcd60e51b8152602060048201526014602482015273746f55696e7436345f6f75744f66426f756e647360601b6044820152606401610a0e565b50016008015190565b60006135fb8260206146fd565b835110156136435760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b6044820152606401610a0e565b50016020015190565b6060611f92848460008585600080866001600160a01b031685876040516136739190614495565b60006040518083038185875af1925050503d80600081146136b0576040519150601f19603f3d011682016040523d82523d6000602084013e6136b5565b606091505b50915091506136c6878383876136d1565b979650505050505050565b60608315613740578251600003613739576001600160a01b0385163b6137395760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a0e565b5081611f92565b611f9283838151156137555781518083602001fd5b8060405162461bcd60e51b8152600401610a0e9190613c8c565b803561ffff8116811461378157600080fd5b919050565b60008083601f84011261379857600080fd5b5081356001600160401b038111156137af57600080fd5b6020830191508360208285010111156137c757600080fd5b9250929050565b80356001600160401b038116811461378157600080fd5b600080600080600080608087890312156137fe57600080fd5b6138078761376f565b955060208701356001600160401b038082111561382357600080fd5b61382f8a838b01613786565b909750955085915061384360408a016137ce565b9450606089013591508082111561385957600080fd5b5061386689828a01613786565b979a9699509497509295939492505050565b60006020828403121561388a57600080fd5b81356001600160e01b031981168114610e8857600080fd5b6000602082840312156138b457600080fd5b610e888261376f565b600080604083850312156138d057600080fd5b6138d98361376f565b946020939093013593505050565b6001600160a01b0381168114611c4257600080fd5b60006060828403121561390e57600080fd5b50919050565b60008060008060008060c0878903121561392d57600080fd5b8635613938816138e7565b95506139466020880161376f565b945060408701359350606087013592506080870135915060a08701356001600160401b0381111561397657600080fd5b61398289828a016138fc565b9150509295509295509295565b8015158114611c4257600080fd5b60008060008060008060a087890312156139b657600080fd5b6139bf8761376f565b9550602087013594506040870135935060608701356139dd8161398f565b925060808701356001600160401b038111156139f857600080fd5b61386689828a01613786565b600080600060408486031215613a1957600080fd5b613a228461376f565b925060208401356001600160401b03811115613a3d57600080fd5b613a4986828701613786565b9497909650939450505050565b60008060008060008060008060006101008a8c031215613a7557600080fd5b8935613a80816138e7565b9850613a8e60208b0161376f565b975060408a0135965060608a0135955060808a0135945060a08a01356001600160401b0380821115613abf57600080fd5b613acb8d838e01613786565b9096509450849150613adf60c08d016137ce565b935060e08c0135915080821115613af557600080fd5b50613b028c828d016138fc565b9150509295985092959850929598565b600060208284031215613b2457600080fd5b8135610e88816138e7565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613b6d57613b6d613b2f565b604052919050565b60006001600160401b03821115613b8e57613b8e613b2f565b50601f01601f191660200190565b600080600060608486031215613bb157600080fd5b613bba8461376f565b925060208401356001600160401b03811115613bd557600080fd5b8401601f81018613613be657600080fd5b8035613bf9613bf482613b75565b613b45565b818152876020838501011115613c0e57600080fd5b81602084016020830137600060208383010152809450505050613c33604085016137ce565b90509250925092565b60005b83811015613c57578181015183820152602001613c3f565b50506000910152565b60008151808452613c78816020860160208601613c3c565b601f01601f19169290920160200192915050565b602081526000610e886020830184613c60565b600080600060608486031215613cb457600080fd5b613cbd8461376f565b92506020840135613ccd8161398f565b9150613c336040850161376f565b60008060408385031215613cee57600080fd5b613cf78361376f565b9150613d056020840161376f565b90509250929050565b600080600080600080600080600060e08a8c031215613d2c57600080fd5b613d358a61376f565b985060208a0135975060408a0135965060608a01356001600160401b0380821115613d5f57600080fd5b613d6b8d838e01613786565b9098509650869150613d7f60808d016137ce565b955060a08c01359150613d918261398f565b90935060c08b01359080821115613da757600080fd5b50613db48c828d01613786565b915080935050809150509295985092959850929598565b600080600080600060808688031215613de357600080fd5b613dec8661376f565b9450613dfa6020870161376f565b93506040860135925060608601356001600160401b03811115613e1c57600080fd5b613e2888828901613786565b969995985093965092949392505050565b600080600060608486031215613e4e57600080fd5b613e578461376f565b9250613e656020850161376f565b9150604084013590509250925092565b600060208284031215613e8757600080fd5b8135610e888161398f565b6000806000806000806000806000806101008b8d031215613eb257600080fd5b613ebb8b61376f565b995060208b01356001600160401b0380821115613ed757600080fd5b613ee38e838f01613786565b909b509950899150613ef760408e016137ce565b985060608d0135975060808d01359150613f10826138e7565b90955060a08c0135945060c08c01359080821115613f2d57600080fd5b50613f3a8d828e01613786565b9150809450508092505060e08b013590509295989b9194979a5092959850565b60ff81168114611c4257600080fd5b600080600060608486031215613f7e57600080fd5b8335613f89816138e7565b92506020840135613f9981613f5a565b91506040840135613fa9816138e7565b809150509250925092565b60008060008060808587031215613fca57600080fd5b613fd38561376f565b9350613fe16020860161376f565b92506040850135613ff1816138e7565b9396929550929360600135925050565b600181811c9082168061401557607f821691505b60208210810361390e57634e487b7160e01b600052602260045260246000fd5b8183823760009101908152919050565b6000808335601e1984360301811261405c57600080fd5b8301803591506001600160401b0382111561407657600080fd5b6020019150368190038213156137c757600080fd5b6020808252602d908201527f426173654f4654576974684665653a20616d6f756e74206973206c657373207460408201526c1a185b881b5a5b905b5bdd5b9d609a1b606082015260800190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000611f8f6040830184866140d8565b60208082526025908201527f4665653a20666565206270206d757374206265203c3d2042505f44454e4f4d496040820152642720aa27a960d91b606082015260800190565b60006020828403121561417657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610bfc57610bfc61417d565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b601f82111561302157600081815260208120601f850160051c810160208610156141f35750805b601f850160051c820191505b81811015610d65578281556001016141ff565b81516001600160401b0381111561422b5761422b613b2f565b61423f816142398454614001565b846141cc565b602080601f831160018114614274576000841561425c5750858301515b600019600386901b1c1916600185901b178555610d65565b600085815260208120601f198616915b828110156142a357888601518255948401946001909101908401614284565b50858210156142c15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600061ffff8088168352808716602084015250846040830152608060608301526136c66080830184866140d8565b61ffff8616815260806020820152600061431d6080830186886140d8565b6001600160401b0394909416604083015250606001529392505050565b61ffff8916815260c06020820152600061435860c08301898b6140d8565b6001600160401b038816604084015286606084015285608084015282810360a08401526143868185876140d8565b9b9a5050505050505050505050565b6001600160401b038311156143ac576143ac613b2f565b6143c0836143ba8354614001565b836141cc565b6000601f8411600181146143f457600085156143dc5750838201355b600019600387901b1c1916600186901b178355610c68565b600083815260209020601f19861690835b828110156144255786850135825560209485019460019092019101614405565b50868210156144425760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b8082028115828204841417610bfc57610bfc61417d565b634e487b7160e01b600052601260045260246000fd5b6000826144905761449061446b565b500490565b600082516144a7818460208701613c3c565b9190910192915050565b6000602082840312156144c357600080fd5b8151610e8881613f5a565b60ff8281168282160390811115610bfc57610bfc61417d565b600181815b808511156145225781600019048211156145085761450861417d565b8085161561451557918102915b93841c93908002906144ec565b509250929050565b60008261453957506001610bfc565b8161454657506000610bfc565b816001811461455c576002811461456657614582565b6001915050610bfc565b60ff8411156145775761457761417d565b50506001821b610bfc565b5060208310610133831016604e8410600b84101617156145a5575081810a610bfc565b6145af83836144e7565b80600019048211156145c3576145c361417d565b029392505050565b6000610e8860ff84168361452a565b6000602082840312156145ec57600080fd5b81516001600160401b0381111561460257600080fd5b8201601f8101841361461357600080fd5b8051614621613bf482613b75565b81815285602083850101111561463657600080fd5b612727826020830160208601613c3c565b61ffff851681526080602082015260006146646080830186613c60565b6001600160401b038516604084015282810360608401526136c68185613c60565b61ffff861681526001600160a01b038516602082015260a0604082018190526000906146b390830186613c60565b841515606084015282810360808401526146cd8185613c60565b98975050505050505050565b600080604083850312156146ec57600080fd5b505080516020909101519092909150565b80820180821115610bfc57610bfc61417d565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b61ffff8616815260a06020820152600061477860a0830187613c60565b6001600160401b038616604084015282810360608401526147998186613c60565b905082810360808401526146cd8185613c60565b6000826147bc576147bc61446b565b500690565b61ffff8716815260c0602082015260006147de60c0830188613c60565b82810360408401526147f08188613c60565b6001600160a01b0387811660608601528616608085015283810360a0850152905061481b8185613c60565b9998505050505050505050565b60ff60f81b8760f81b16815285600182015260006001600160401b0360c01b808760c01b166021840152856029840152808560c01b166049840152508251614877816051850160208701613c3c565b91909101605101979650505050505050565b600061010061ffff8b1683528060208401526148a78184018b613c60565b6001600160401b038a166040850152606084018990526001600160a01b038816608085015260a0840187905283810360c085015290506148e78186613c60565b9150508260e08301529998505050505050505050565b6060815260006149106060830186613c60565b6001600160401b039490941660208301525060400152919050565b60006020828403121561493d57600080fd5b8151610e888161398f56fea2646970667358221220360ce8d7a4ee2823aa0b2c7c682e8bc3aba2c629bcae185a3caae4bc51f4c0bb64736f6c63430008120033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "ReceiveFromChain(uint16,address,uint256)": { + "details": "Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain. `_nonce` is the inbound nonce." + }, + "SendToChain(uint16,address,bytes32,uint256)": { + "details": "Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`) `_nonce` is the outbound nonce" + } + }, + "kind": "dev", + "methods": { + "circulatingSupply()": { + "details": "returns the circulating amount of tokens on current chain" + }, + "estimateSendFee(uint16,bytes32,uint256,bool,bytes)": { + "details": "estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`) _dstChainId - L0 defined chain id to send tokens too _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain _amount - amount of the tokens to transfer _useZro - indicates to use zro to pay L0 fees _adapterParam - flexible bytes array to indicate messaging adapter services in L0" + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "sendFrom(address,uint16,bytes32,uint256,uint256,(address,address,bytes))": { + "details": "send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from` `_from` the owner of token `_dstChainId` the destination chain identifier `_toAddress` can be any size depending on the `dstChainId`. `_amount` the quantity of tokens in wei `_minAmount` the minimum amount of tokens to receive on dstChain `_refundAddress` the address LayerZero refunds if too much message fee is sent `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) `_adapterParams` is a flexible bytes array to indicate messaging adapter services" + }, + "token()": { + "details": "returns the address of the ERC20 token" + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 591, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 594, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6194, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 419, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 539, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 15451, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "lzEndpoint", + "offset": 0, + "slot": "101", + "type": "t_contract(ILayerZeroEndpointUpgradeable)16407" + }, + { + "astId": 15455, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "trustedRemoteLookup", + "offset": 0, + "slot": "102", + "type": "t_mapping(t_uint16,t_bytes_storage)" + }, + { + "astId": 15461, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "minDstGasLookup", + "offset": 0, + "slot": "103", + "type": "t_mapping(t_uint16,t_mapping(t_uint16,t_uint256))" + }, + { + "astId": 15465, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "payloadSizeLimitLookup", + "offset": 0, + "slot": "104", + "type": "t_mapping(t_uint16,t_uint256)" + }, + { + "astId": 15467, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "precrime", + "offset": 0, + "slot": "105", + "type": "t_address" + }, + { + "astId": 15999, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "__gap", + "offset": 0, + "slot": "106", + "type": "t_array(t_uint256)45_storage" + }, + { + "astId": 16042, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "failedMessages", + "offset": 0, + "slot": "151", + "type": "t_mapping(t_uint16,t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bytes32)))" + }, + { + "astId": 16261, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 17214, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "sharedDecimals", + "offset": 0, + "slot": "201", + "type": "t_uint8" + }, + { + "astId": 17216, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "useCustomAdapterParams", + "offset": 1, + "slot": "201", + "type": "t_bool" + }, + { + "astId": 17224, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "creditedPackets", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_uint16,t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bool)))" + }, + { + "astId": 18219, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "__gap", + "offset": 0, + "slot": "203", + "type": "t_array(t_uint256)44_storage" + }, + { + "astId": 19588, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "chainIdToFeeBps", + "offset": 0, + "slot": "247", + "type": "t_mapping(t_uint16,t_struct(FeeConfig)19597_storage)" + }, + { + "astId": 19590, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "defaultFeeBp", + "offset": 0, + "slot": "248", + "type": "t_uint16" + }, + { + "astId": 19592, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "feeOwner", + "offset": 2, + "slot": "248", + "type": "t_address" + }, + { + "astId": 19815, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "__gap", + "offset": 0, + "slot": "249", + "type": "t_array(t_uint256)45_storage" + }, + { + "astId": 7385, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "__gap", + "offset": 0, + "slot": "294", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 19574, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "__gap", + "offset": 0, + "slot": "344", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 20833, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "innerToken", + "offset": 0, + "slot": "394", + "type": "t_contract(IERC20Upgradeable)3343" + }, + { + "astId": 20835, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "ld2sdRate", + "offset": 0, + "slot": "395", + "type": "t_uint256" + }, + { + "astId": 20837, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "outboundAmount", + "offset": 0, + "slot": "396", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)44_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[44]", + "numberOfBytes": "1408" + }, + "t_array(t_uint256)45_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "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_bytes_memory_ptr": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(IERC20Upgradeable)3343": { + "encoding": "inplace", + "label": "contract IERC20Upgradeable", + "numberOfBytes": "20" + }, + "t_contract(ILayerZeroEndpointUpgradeable)16407": { + "encoding": "inplace", + "label": "contract ILayerZeroEndpointUpgradeable", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bool))": { + "encoding": "mapping", + "key": "t_bytes_memory_ptr", + "label": "mapping(bytes => mapping(uint64 => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint64,t_bool)" + }, + "t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bytes32))": { + "encoding": "mapping", + "key": "t_bytes_memory_ptr", + "label": "mapping(bytes => mapping(uint64 => bytes32))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint64,t_bytes32)" + }, + "t_mapping(t_uint16,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint16,t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bool)))": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => mapping(bytes => mapping(uint64 => bool)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bool))" + }, + "t_mapping(t_uint16,t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bytes32)))": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes_memory_ptr,t_mapping(t_uint64,t_bytes32))" + }, + "t_mapping(t_uint16,t_mapping(t_uint16,t_uint256))": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => mapping(uint16 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_uint256)" + }, + "t_mapping(t_uint16,t_struct(FeeConfig)19597_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => struct FeeUpgradeable.FeeConfig)", + "numberOfBytes": "32", + "value": "t_struct(FeeConfig)19597_storage" + }, + "t_mapping(t_uint16,t_uint256)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint64,t_bool)": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint64,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_struct(FeeConfig)19597_storage": { + "encoding": "inplace", + "label": "struct FeeUpgradeable.FeeConfig", + "members": [ + { + "astId": 19594, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "feeBP", + "offset": 0, + "slot": "0", + "type": "t_uint16" + }, + { + "astId": 19596, + "contract": "contracts/contracts-upgradable/examples/FP.sol:ForgottenPlaylandProxyOFT", + "label": "enabled", + "offset": 2, + "slot": "0", + "type": "t_bool" + } + ], + "numberOfBytes": "32" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/ethereum/ForgottenPlaylandProxyOFT_Proxy.json b/deployments/ethereum/ForgottenPlaylandProxyOFT_Proxy.json new file mode 100644 index 00000000..c947740d --- /dev/null +++ b/deployments/ethereum/ForgottenPlaylandProxyOFT_Proxy.json @@ -0,0 +1,193 @@ +{ + "address": "0xBb6CA854D6a812943decd0AaeA45aE98e760321f", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "initialLogic", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xece0eda2a1733d6d50cb5229fc7fbd2f856a5790ce7711c1608e82c1bb7b12d6", + "receipt": { + "to": null, + "from": "0xbFb53a2c470cdb4FF32eE4F18A93B98F9f55D0E1", + "contractAddress": "0xBb6CA854D6a812943decd0AaeA45aE98e760321f", + "transactionIndex": 53, + "gasUsed": "591228", + "logsBloom": "0x00040000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000001000000040000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000002000000000000000000000000080000000000800000000000000000000000000000000080400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2804b5f9bfc20f11e9bea6d061075e68cd099ac4171f5a12b3d8a138dcd049ea", + "transactionHash": "0xece0eda2a1733d6d50cb5229fc7fbd2f856a5790ce7711c1608e82c1bb7b12d6", + "logs": [ + { + "transactionIndex": 53, + "blockNumber": 19325784, + "transactionHash": "0xece0eda2a1733d6d50cb5229fc7fbd2f856a5790ce7711c1608e82c1bb7b12d6", + "address": "0xBb6CA854D6a812943decd0AaeA45aE98e760321f", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000bfb53a2c470cdb4ff32ee4f18a93b98f9f55d0e1" + ], + "data": "0x", + "logIndex": 247, + "blockHash": "0x2804b5f9bfc20f11e9bea6d061075e68cd099ac4171f5a12b3d8a138dcd049ea" + }, + { + "transactionIndex": 53, + "blockNumber": 19325784, + "transactionHash": "0xece0eda2a1733d6d50cb5229fc7fbd2f856a5790ce7711c1608e82c1bb7b12d6", + "address": "0xBb6CA854D6a812943decd0AaeA45aE98e760321f", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 248, + "blockHash": "0x2804b5f9bfc20f11e9bea6d061075e68cd099ac4171f5a12b3d8a138dcd049ea" + } + ], + "blockNumber": 19325784, + "cumulativeGasUsed": "8717437", + "status": 1, + "byzantium": true + }, + "args": [ + "0xDC2dc789ee5aD91Fb9f712d770Df1D67095584E2", + "0x965B104e250648d01d4B3b72BaC751Cde809D29E", + "0xf35f9e45000000000000000000000000eeee2a2e650697d2a8e8bc990c2f3d04203be06f000000000000000000000000000000000000000000000000000000000000000600000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675" + ], + "numDeployments": 1, + "solcInputHash": "1635d55d57a0a2552952c0d22586ed23", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialLogic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAdmin\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"stateVariables\":{\"_ADMIN_SLOT\":{\"details\":\"Storage slot with the admin of the contract. This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is validated in the constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":\"OptimizedTransparentUpgradeableProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.7/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n * \\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n * \\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 { revert(0, returndatasize()) }\\n default { return(0, returndatasize()) }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal virtual view returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n * \\n * This function does not return to its internall call site, it will return directly to the external caller.\\n */\\n function _fallback() internal {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive () payable external {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n * \\n * If overriden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {\\n }\\n}\\n\",\"keccak256\":\"0xc33f9858a67e34c77831163d5611d21fc627dfd2c303806a98a6c9db5a01b034\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/proxy/UpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Proxy.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n * \\n * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see\\n * {TransparentUpgradeableProxy}.\\n */\\ncontract UpgradeableProxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n * \\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.implementation\\\")) - 1));\\n _setImplementation(_logic);\\n if(_data.length > 0) {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success,) = _logic.delegatecall(_data);\\n require(success);\\n }\\n }\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\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 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal override view returns (address impl) {\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n impl := sload(slot)\\n }\\n }\\n\\n /**\\n * @dev Upgrades the proxy to a new implementation.\\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 Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"UpgradeableProxy: new implementation is not a contract\\\");\\n\\n bytes32 slot = _IMPLEMENTATION_SLOT;\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, newImplementation)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd68f4c11941712db79a61b9dca81a5db663cfacec3d7bb19f8d2c23bb1ab8afe\",\"license\":\"MIT\"},\"solc_0.7/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.7.0;\\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 function isContract(address account) internal view returns (bool) {\\n // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\\n // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\\n // for accounts without code, i.e. `keccak256('')`\\n bytes32 codehash;\\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { codehash := extcodehash(account) }\\n return (codehash != accountHash && codehash != 0x0);\\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 // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\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 functionCall(target, data, \\\"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(address target, bytes memory data, string memory errorMessage) 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(address target, bytes memory data, uint256 value) 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(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n return _functionCallWithValue(target, data, value, errorMessage);\\n }\\n\\n function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);\\n if (success) {\\n return returndata;\\n } else {\\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\\n // solhint-disable-next-line no-inline-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}\\n\",\"keccak256\":\"0x698f929f1097637d051976b322a2d532c27df022b09010e8d091e2888a5ebdf8\",\"license\":\"MIT\"},\"solc_0.7/proxy/OptimizedTransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.7.0;\\n\\nimport \\\"../openzeppelin/proxy/UpgradeableProxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.\\n */\\ncontract OptimizedTransparentUpgradeableProxy is UpgradeableProxy {\\n address internal immutable _ADMIN;\\n\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.\\n */\\n constructor(\\n address initialLogic,\\n address initialAdmin,\\n bytes memory _data\\n ) payable UpgradeableProxy(initialLogic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 slot = _ADMIN_SLOT;\\n\\n _ADMIN = initialAdmin;\\n\\n // still store it to work with EIP-1967\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n sstore(slot, initialAdmin)\\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 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _admin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address) {\\n return _admin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address) {\\n return _implementation();\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeTo(newImplementation);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeTo(newImplementation);\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, ) = newImplementation.delegatecall(data);\\n require(success);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view returns (address adm) {\\n return _ADMIN;\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _admin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0x076456d71495e22183c672db71d719bd2dc7cb3b35e5bba21ce37eea1ec30347\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040526040516108fc3803806108fc8339818101604052606081101561002657600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005157600080fd5b90830190602082018581111561006657600080fd5b825164010000000081118282018810171561008057600080fd5b82525081516020918201929091019080838360005b838110156100ad578181015183820152602001610095565b50505050905090810190601f1680156100da5780820380516001836020036101000a031916815260200191505b50604052508491508290506100ee826101e9565b8051156101a6576000826001600160a01b0316826040518082805190602001908083835b602083106101315780518252601f199092019160209182019101610112565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b50509050806101a457600080fd5b505b506101ae9050565b506001600160601b0319606082901b166080527fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035550610297565b6101fc8161025b60201b6103581760201c565b6102375760405162461bcd60e51b81526004018080602001828103825260368152602001806108c66036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061028f57508115155b949350505050565b60805160601c6106126102b46000398061047352506106126000f3fe6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c634300070600335570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374", + "deployedBytecode": "0x6080604052600436106100435760003560e01c80633659cfe61461005a5780634f1ef2861461009a5780635c60da1b14610127578063f851a4401461016557610052565b366100525761005061017a565b005b61005061017a565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610194565b610050600480360360408110156100b057600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100e857600080fd5b8201836020820111156100fa57600080fd5b8035906020019184600183028401116401000000008311171561011c57600080fd5b5090925090506101e8565b34801561013357600080fd5b5061013c6102bc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017157600080fd5b5061013c610313565b610182610394565b61019261018d610428565b61044d565b565b61019c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101dd576101d881610495565b6101e5565b6101e561017a565b50565b6101f0610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102af5761022c83610495565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610296576040519150601f19603f3d011682016040523d82523d6000602084013e61029b565b606091505b50509050806102a957600080fd5b506102b7565b6102b761017a565b505050565b60006102c6610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610428565b9050610310565b61031061017a565b90565b600061031d610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030857610301610471565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061038c57508115155b949350505050565b61039c610471565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604281526020018061059b6042913960600191505060405180910390fd5b610192610192565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561046c573d6000f35b3d6000fd5b7f000000000000000000000000000000000000000000000000000000000000000090565b61049e816104e2565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6104eb81610358565b610540576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806105656036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe5570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a26469706673582212200f42fc9d1f991236ae26e240c8505def958528031655d7dd335d3988cc0c88f564736f6c63430007060033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "stateVariables": { + "_ADMIN_SLOT": { + "details": "Storage slot with the admin of the contract. This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is validated in the constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/ethereum/solcInputs/8313c17822638cfb28f4331864b9ea01.json b/deployments/ethereum/solcInputs/8313c17822638cfb28f4331864b9ea01.json new file mode 100644 index 00000000..6559728a --- /dev/null +++ b/deployments/ethereum/solcInputs/8313c17822638cfb28f4331864b9ea01.json @@ -0,0 +1,536 @@ +{ + "language": "Solidity", + "sources": { + "contracts/contracts-upgradable/examples/AvaxOFT.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/NativeOFTWithFeeUpgradeable.sol\";\n\ncontract AvaxOFT is OFTWithFeeUpgradeable {}\n\ncontract AvaxNativeOFT is NativeOFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/OFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\nimport \"./BaseOFTWithFeeUpgradeable.sol\";\n\ncontract OFTWithFeeUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, ERC20Upgradeable, Proxied {\n uint internal ld2sdRate;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(string memory _name, string memory _symbol, uint8 _sharedDecimals, address _lzEndpoint) public virtual initializer {\n __OFTWithFeeUpgradeable_init(_name, _symbol, _sharedDecimals, _lzEndpoint);\n }\n\n function __OFTWithFeeUpgradeable_init(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n\n __ERC20_init_unchained(_name, _symbol);\n\n __OFTWithFeeUpgradeable_init_unchained(_sharedDecimals);\n }\n\n function __OFTWithFeeUpgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\n uint8 decimals = decimals();\n require(_sharedDecimals <= decimals, \"OFTWithFee: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return totalSupply();\n }\n\n function token() public view virtual override returns (address) {\n return address(this);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n if (_from != spender) _spendAllowance(_from, spender, _amount);\n _burn(_from, _amount);\n return _amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n _mint(_toAddress, _amount);\n return _amount;\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n // if transfer from this contract, no need to check allowance\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\n _transfer(_from, _to, _amount);\n return _amount;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/NativeOFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"./OFTWithFeeUpgradeable.sol\";\n\ncontract NativeOFTWithFeeUpgradeable is OFTWithFeeUpgradeable, ReentrancyGuardUpgradeable {\n event Deposit(address indexed _dst, uint _amount);\n event Withdrawal(address indexed _src, uint _amount);\n\n function deposit() public payable {\n _mint(msg.sender, msg.value);\n emit Deposit(msg.sender, msg.value);\n }\n\n function withdraw(uint _amount) external nonReentrant {\n require(balanceOf(msg.sender) >= _amount, \"NativeOFTWithFee: Insufficient balance.\");\n _burn(msg.sender, _amount);\n (bool success, ) = msg.sender.call{value: _amount}(\"\");\n require(success, \"NativeOFTWithFee: failed to unwrap\");\n emit Withdrawal(msg.sender, _amount);\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _debitFromNative(address _from, uint _amount) internal returns (uint messageFee) {\n messageFee = msg.sender == _from ? _debitMsgSender(_amount) : _debitMsgFrom(_from, _amount);\n }\n\n function _debitMsgSender(uint _amount) internal returns (uint messageFee) {\n uint msgSenderBalance = balanceOf(msg.sender);\n\n if (msgSenderBalance < _amount) {\n require(msgSenderBalance + msg.value >= _amount, \"NativeOFTWithFee: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgSenderBalance;\n _mint(address(msg.sender), mintAmount);\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _transfer(msg.sender, address(this), _amount);\n return messageFee;\n }\n\n function _debitMsgFrom(address _from, uint _amount) internal returns (uint messageFee) {\n uint msgFromBalance = balanceOf(_from);\n\n if (msgFromBalance < _amount) {\n require(msgFromBalance + msg.value >= _amount, \"NativeOFTWithFee: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgFromBalance;\n _mint(address(msg.sender), mintAmount);\n\n // transfer the differential amount to the contract\n _transfer(msg.sender, address(this), mintAmount);\n\n // overwrite the _amount to take the rest of the balance from the _from address\n _amount = msgFromBalance;\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _spendAllowance(_from, msg.sender, _amount);\n _transfer(_from, address(this), _amount);\n return messageFee;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal override returns (uint) {\n _burn(address(this), _amount);\n (bool success, ) = _toAddress.call{value: _amount}(\"\");\n require(success, \"NativeOFTWithFee: failed to _creditTo\");\n return _amount;\n }\n\n receive() external payable {\n deposit();\n }\n}\n" + }, + "hardhat-deploy/solc_0.8/proxy/Proxied.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Proxied {\n /// @notice to be used by initialisation / postUpgrade function so that only the proxy's admin can execute them\n /// It also allows these functions to be called inside a contructor\n /// even if the contract is meant to be used without proxy\n modifier proxied() {\n address proxyAdminAddress = _proxyAdmin();\n // With hardhat-deploy proxies\n // the proxyAdminAddress is zero only for the implementation contract\n // if the implementation contract want to be used as a standalone/immutable contract\n // it simply has to execute the `proxied` function\n // This ensure the proxyAdminAddress is never zero post deployment\n // And allow you to keep the same code for both proxied contract and immutable contract\n if (proxyAdminAddress == address(0)) {\n // ensure can not be called twice when used outside of proxy : no admin\n // solhint-disable-next-line security/no-inline-assembly\n assembly {\n sstore(\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103,\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\n )\n }\n } else {\n require(msg.sender == proxyAdminAddress);\n }\n _;\n }\n\n modifier onlyProxyAdmin() {\n require(msg.sender == _proxyAdmin(), \"NOT_AUTHORIZED\");\n _;\n }\n\n function _proxyAdmin() internal view returns (address ownerAddress) {\n // solhint-disable-next-line security/no-inline-assembly\n assembly {\n ownerAddress := sload(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103)\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) 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[45] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/BaseOFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../OFTCoreV2Upgradeable.sol\";\nimport \"./IOFTWithFeeUpgradeable.sol\";\nimport \"./FeeUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\nabstract contract BaseOFTWithFeeUpgradeable is OFTCoreV2Upgradeable, FeeUpgradeable, ERC165Upgradeable, IOFTWithFeeUpgradeable {\n function __BaseOFTWithFeeUpgradeable_init(uint8 _sharedDecimals, address _lzEndpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n }\n\n function __BaseOFTWithFeeUpgradeable_init_unchained() internal onlyInitializing {}\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n (_amount, ) = _payOFTFee(_from, _dstChainId, _amount);\n _amount = _send(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n require(_amount >= _minAmount, \"BaseOFTWithFee: amount is less than minAmount\");\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n (_amount, ) = _payOFTFee(_from, _dstChainId, _amount);\n _amount = _sendAndCall(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _payload,\n _dstGasForCall,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n require(_amount >= _minAmount, \"BaseOFTWithFee: amount is less than minAmount\");\n }\n\n /************************************************************************\n * public view functions\n ************************************************************************/\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IOFTWithFeeUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams);\n }\n\n function estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams);\n }\n\n function circulatingSupply() public view virtual override returns (uint);\n\n function token() public view virtual override returns (address);\n\n function _transferFrom(\n address _from,\n address _to,\n uint _amount\n ) internal virtual override(FeeUpgradeable, OFTCoreV2Upgradeable) returns (uint);\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 uint[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 IERC20Upgradeable {\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(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\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/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) 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" + }, + "contracts/contracts-upgradable/token/oft/v2/OFTCoreV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../../lzApp/NonblockingLzAppUpgradeable.sol\";\nimport \"../../../../libraries/ExcessivelySafeCall.sol\";\nimport \"./interfaces/ICommonOFTUpgradeable.sol\";\nimport \"./interfaces/IOFTReceiverV2Upgradeable.sol\";\n\nabstract contract OFTCoreV2Upgradeable is NonblockingLzAppUpgradeable {\n using BytesLib for bytes;\n using ExcessivelySafeCall for address;\n\n uint public constant NO_EXTRA_GAS = 0;\n\n // packet type\n uint8 public constant PT_SEND = 0;\n uint8 public constant PT_SEND_AND_CALL = 1;\n\n uint8 public sharedDecimals;\n\n bool public useCustomAdapterParams;\n mapping(uint16 => mapping(bytes => mapping(uint64 => bool))) public creditedPackets;\n\n /**\n * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\n * `_nonce` is the outbound nonce\n */\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes32 indexed _toAddress, uint _amount);\n\n /**\n * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain.\n * `_nonce` is the inbound nonce.\n */\n event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount);\n\n event SetUseCustomAdapterParams(bool _useCustomAdapterParams);\n\n event CallOFTReceivedSuccess(uint16 indexed _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _hash);\n\n event NonContractAddress(address _address);\n\n // _sharedDecimals should be the minimum decimals on all chains\n function __OFTCoreV2Upgradeable_init(uint8 _sharedDecimals, address _lzEndpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n }\n\n function __OFTCoreV2Upgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\n sharedDecimals = _sharedDecimals;\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function callOnOFTReceived(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes32 _from,\n address _to,\n uint _amount,\n bytes calldata _payload,\n uint _gasForCall\n ) public virtual {\n require(_msgSender() == address(this), \"OFTCore: caller must be OFTCore\");\n\n // send\n _amount = _transferFrom(address(this), _to, _amount);\n emit ReceiveFromChain(_srcChainId, _to, _amount);\n\n // call\n IOFTReceiverV2Upgradeable(_to).onOFTReceived{gas: _gasForCall}(_srcChainId, _srcAddress, _nonce, _from, _amount, _payload);\n }\n\n function setUseCustomAdapterParams(bool _useCustomAdapterParams) public virtual onlyOwner {\n useCustomAdapterParams = _useCustomAdapterParams;\n emit SetUseCustomAdapterParams(_useCustomAdapterParams);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes memory _adapterParams\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\n // mock the payload for sendFrom()\n bytes memory payload = _encodeSendPayload(_toAddress, _ld2sd(_amount));\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function _estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes memory _adapterParams\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\n // mock the payload for sendAndCall()\n bytes memory payload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(_amount), _payload, _dstGasForCall);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual override {\n uint8 packetType = _payload.toUint8(0);\n\n if (packetType == PT_SEND) {\n _sendAck(_srcChainId, _srcAddress, _nonce, _payload);\n } else if (packetType == PT_SEND_AND_CALL) {\n _sendAndCallAck(_srcChainId, _srcAddress, _nonce, _payload);\n } else {\n revert(\"OFTCore: unknown packet type\");\n }\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount); // amount returned should not have dust\n require(amount > 0, \"OFTCore: amount too small\");\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAck(uint16 _srcChainId, bytes memory, uint64, bytes memory _payload) internal virtual {\n (address to, uint64 amountSD) = _decodeSendPayload(_payload);\n if (to == address(0)) {\n to = address(0xdead);\n }\n\n uint amount = _sd2ld(amountSD);\n amount = _creditTo(_srcChainId, to, amount);\n\n emit ReceiveFromChain(_srcChainId, to, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount);\n require(amount > 0, \"OFTCore: amount too small\");\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCallAck(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual {\n (bytes32 from, address to, uint64 amountSD, bytes memory payloadForCall, uint64 gasForCall) = _decodeSendAndCallPayload(_payload);\n\n bool credited = creditedPackets[_srcChainId][_srcAddress][_nonce];\n uint amount = _sd2ld(amountSD);\n\n // credit to this contract first, and then transfer to receiver only if callOnOFTReceived() succeeds\n if (!credited) {\n amount = _creditTo(_srcChainId, address(this), amount);\n creditedPackets[_srcChainId][_srcAddress][_nonce] = true;\n }\n\n if (!_isContract(to)) {\n emit NonContractAddress(to);\n return;\n }\n\n // workaround for stack too deep\n uint16 srcChainId = _srcChainId;\n bytes memory srcAddress = _srcAddress;\n uint64 nonce = _nonce;\n bytes memory payload = _payload;\n bytes32 from_ = from;\n address to_ = to;\n uint amount_ = amount;\n bytes memory payloadForCall_ = payloadForCall;\n\n // no gas limit for the call if retry\n uint gas = credited ? gasleft() : gasForCall;\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\n gasleft(),\n 150,\n abi.encodeWithSelector(this.callOnOFTReceived.selector, srcChainId, srcAddress, nonce, from_, to_, amount_, payloadForCall_, gas)\n );\n\n if (success) {\n bytes32 hash = keccak256(payload);\n emit CallOFTReceivedSuccess(srcChainId, srcAddress, nonce, hash);\n } else {\n // store the failed message into the nonblockingLzApp\n _storeFailedMessage(srcChainId, srcAddress, nonce, payload, reason);\n }\n }\n\n function _isContract(address _account) internal view returns (bool) {\n return _account.code.length > 0;\n }\n\n function _checkAdapterParams(uint16 _dstChainId, uint16 _pkType, bytes memory _adapterParams, uint _extraGas) internal virtual {\n if (useCustomAdapterParams) {\n _checkGasLimit(_dstChainId, _pkType, _adapterParams, _extraGas);\n } else {\n require(_adapterParams.length == 0, \"OFTCore: _adapterParams must be empty.\");\n }\n }\n\n function _ld2sd(uint _amount) internal view virtual returns (uint64) {\n uint amountSD = _amount / _ld2sdRate();\n require(amountSD <= type(uint64).max, \"OFTCore: amountSD overflow\");\n return uint64(amountSD);\n }\n\n function _sd2ld(uint64 _amountSD) internal view virtual returns (uint) {\n return _amountSD * _ld2sdRate();\n }\n\n function _removeDust(uint _amount) internal view virtual returns (uint amountAfter, uint dust) {\n dust = _amount % _ld2sdRate();\n amountAfter = _amount - dust;\n }\n\n function _encodeSendPayload(bytes32 _toAddress, uint64 _amountSD) internal view virtual returns (bytes memory) {\n return abi.encodePacked(PT_SEND, _toAddress, _amountSD);\n }\n\n function _decodeSendPayload(bytes memory _payload) internal view virtual returns (address to, uint64 amountSD) {\n require(_payload.toUint8(0) == PT_SEND && _payload.length == 41, \"OFTCore: invalid payload\");\n\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\n amountSD = _payload.toUint64(33);\n }\n\n function _encodeSendAndCallPayload(\n address _from,\n bytes32 _toAddress,\n uint64 _amountSD,\n bytes memory _payload,\n uint64 _dstGasForCall\n ) internal view virtual returns (bytes memory) {\n return abi.encodePacked(PT_SEND_AND_CALL, _toAddress, _amountSD, _addressToBytes32(_from), _dstGasForCall, _payload);\n }\n\n function _decodeSendAndCallPayload(\n bytes memory _payload\n ) internal view virtual returns (bytes32 from, address to, uint64 amountSD, bytes memory payload, uint64 dstGasForCall) {\n require(_payload.toUint8(0) == PT_SEND_AND_CALL, \"OFTCore: invalid payload\");\n\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\n amountSD = _payload.toUint64(33);\n from = _payload.toBytes32(41);\n dstGasForCall = _payload.toUint64(73);\n payload = _payload.slice(81, _payload.length - 81);\n }\n\n function _addressToBytes32(address _address) internal pure virtual returns (bytes32) {\n return bytes32(uint(uint160(_address)));\n }\n\n function _debitFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount) internal virtual returns (uint);\n\n function _creditTo(uint16 _srcChainId, address _toAddress, uint _amount) internal virtual returns (uint);\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint);\n\n function _ld2sdRate() internal view virtual returns (uint);\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 uint[44] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/IOFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"../interfaces/ICommonOFTUpgradeable.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface IOFTWithFeeUpgradeable is ICommonOFTUpgradeable {\n /**\n * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\n * `_from` the owner of token\n * `_dstChainId` the destination chain identifier\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_amount` the quantity of tokens in wei\n * `_minAmount` the minimum amount of tokens to receive on dstChain\n * `_refundAddress` the address LayerZero refunds if too much message fee is sent\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n LzCallParams calldata _callParams\n ) external payable;\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) external payable;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/FeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nabstract contract FeeUpgradeable is OwnableUpgradeable {\n uint public constant BP_DENOMINATOR = 10000;\n\n mapping(uint16 => FeeConfig) public chainIdToFeeBps;\n uint16 public defaultFeeBp;\n address public feeOwner; // defaults to owner\n\n struct FeeConfig {\n uint16 feeBP;\n bool enabled;\n }\n\n event SetFeeBp(uint16 dstchainId, bool enabled, uint16 feeBp);\n event SetDefaultFeeBp(uint16 feeBp);\n event SetFeeOwner(address feeOwner);\n\n function __FeeUpgradeable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __FeeUpgradeable_init_unchained() internal onlyInitializing {}\n\n function setDefaultFeeBp(uint16 _feeBp) public virtual onlyOwner {\n require(_feeBp <= BP_DENOMINATOR, \"Fee: fee bp must be <= BP_DENOMINATOR\");\n defaultFeeBp = _feeBp;\n emit SetDefaultFeeBp(defaultFeeBp);\n }\n\n function setFeeBp(uint16 _dstChainId, bool _enabled, uint16 _feeBp) public virtual onlyOwner {\n require(_feeBp <= BP_DENOMINATOR, \"Fee: fee bp must be <= BP_DENOMINATOR\");\n chainIdToFeeBps[_dstChainId] = FeeConfig(_feeBp, _enabled);\n emit SetFeeBp(_dstChainId, _enabled, _feeBp);\n }\n\n function setFeeOwner(address _feeOwner) public virtual onlyOwner {\n require(_feeOwner != address(0x0), \"Fee: feeOwner cannot be 0x\");\n feeOwner = _feeOwner;\n emit SetFeeOwner(_feeOwner);\n }\n\n function quoteOFTFee(uint16 _dstChainId, uint _amount) public view virtual returns (uint fee) {\n FeeConfig memory config = chainIdToFeeBps[_dstChainId];\n if (config.enabled) {\n fee = (_amount * config.feeBP) / BP_DENOMINATOR;\n } else if (defaultFeeBp > 0) {\n fee = (_amount * defaultFeeBp) / BP_DENOMINATOR;\n } else {\n fee = 0;\n }\n }\n\n function _payOFTFee(address _from, uint16 _dstChainId, uint _amount) internal virtual returns (uint amount, uint fee) {\n fee = quoteOFTFee(_dstChainId, _amount);\n amount = _amount - fee;\n if (fee > 0) {\n _transferFrom(_from, feeOwner, fee);\n }\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint);\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 uint[45] private __gap;\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" + }, + "contracts/contracts-upgradable/lzApp/NonblockingLzAppUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"./LzAppUpgradeable.sol\";\nimport \"../../libraries/ExcessivelySafeCall.sol\";\n\n/*\n * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel\n * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking\n * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress)\n */\nabstract contract NonblockingLzAppUpgradeable is Initializable, LzAppUpgradeable {\n using ExcessivelySafeCall for address;\n\n function __NonblockingLzAppUpgradeable_init(address _endpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_endpoint);\n }\n\n function __NonblockingLzAppUpgradeable_init_unchained(address _endpoint) internal onlyInitializing {}\n\n mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages;\n\n event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason);\n event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash);\n\n // overriding the virtual function in LzReceiver\n function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\n gasleft(),\n 150,\n abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)\n );\n // try-catch all errors/exceptions\n if (!success) {\n _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason);\n }\n }\n\n function _storeFailedMessage(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload,\n bytes memory _reason\n ) internal virtual {\n failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload);\n emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason);\n }\n\n function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual {\n // only internal transaction\n require(_msgSender() == address(this), \"NonblockingLzApp: caller must be LzApp\");\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n }\n\n //@notice override this function\n function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\n\n function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual {\n // assert there is message to retry\n bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce];\n require(payloadHash != bytes32(0), \"NonblockingLzApp: no stored message\");\n require(keccak256(_payload) == payloadHash, \"NonblockingLzApp: invalid payload\");\n // clear the stored message\n failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0);\n // execute the message. revert if it fails again\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash);\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 uint[49] private __gap;\n}\n" + }, + "contracts/libraries/ExcessivelySafeCall.sol": { + "content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity >=0.7.6;\n\nlibrary ExcessivelySafeCall {\n uint constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\n\n /// @notice Use when you _really_ really _really_ don't trust the called\n /// contract. This prevents the called contract from causing reversion of\n /// the caller in as many ways as we can.\n /// @dev The main difference between this and a solidity low-level call is\n /// that we limit the number of bytes that the callee can cause to be\n /// copied to caller memory. This prevents stupid things like malicious\n /// contracts returning 10,000,000 bytes causing a local OOG when copying\n /// to memory.\n /// @param _target The address to call\n /// @param _gas The amount of gas to forward to the remote contract\n /// @param _maxCopy The maximum number of bytes of returndata to copy\n /// to memory.\n /// @param _calldata The data to send to the remote contract\n /// @return success and returndata, as `.call()`. Returndata is capped to\n /// `_maxCopy` bytes.\n function excessivelySafeCall(\n address _target,\n uint _gas,\n uint16 _maxCopy,\n bytes memory _calldata\n ) internal returns (bool, bytes memory) {\n // set up for assembly call\n uint _toCopy;\n bool _success;\n bytes memory _returnData = new bytes(_maxCopy);\n // dispatch message to recipient\n // by assembly calling \"handle\" function\n // we call via assembly to avoid memcopying a very large returndata\n // returned by a malicious contract\n assembly {\n _success := call(\n _gas, // gas\n _target, // recipient\n 0, // ether value\n add(_calldata, 0x20), // inloc\n mload(_calldata), // inlen\n 0, // outloc\n 0 // outlen\n )\n // limit our copy to 256 bytes\n _toCopy := returndatasize()\n if gt(_toCopy, _maxCopy) {\n _toCopy := _maxCopy\n }\n // Store the length of the copied bytes\n mstore(_returnData, _toCopy)\n // copy the bytes from returndata[0:_toCopy]\n returndatacopy(add(_returnData, 0x20), 0, _toCopy)\n }\n return (_success, _returnData);\n }\n\n /// @notice Use when you _really_ really _really_ don't trust the called\n /// contract. This prevents the called contract from causing reversion of\n /// the caller in as many ways as we can.\n /// @dev The main difference between this and a solidity low-level call is\n /// that we limit the number of bytes that the callee can cause to be\n /// copied to caller memory. This prevents stupid things like malicious\n /// contracts returning 10,000,000 bytes causing a local OOG when copying\n /// to memory.\n /// @param _target The address to call\n /// @param _gas The amount of gas to forward to the remote contract\n /// @param _maxCopy The maximum number of bytes of returndata to copy\n /// to memory.\n /// @param _calldata The data to send to the remote contract\n /// @return success and returndata, as `.call()`. Returndata is capped to\n /// `_maxCopy` bytes.\n function excessivelySafeStaticCall(\n address _target,\n uint _gas,\n uint16 _maxCopy,\n bytes memory _calldata\n ) internal view returns (bool, bytes memory) {\n // set up for assembly call\n uint _toCopy;\n bool _success;\n bytes memory _returnData = new bytes(_maxCopy);\n // dispatch message to recipient\n // by assembly calling \"handle\" function\n // we call via assembly to avoid memcopying a very large returndata\n // returned by a malicious contract\n assembly {\n _success := staticcall(\n _gas, // gas\n _target, // recipient\n add(_calldata, 0x20), // inloc\n mload(_calldata), // inlen\n 0, // outloc\n 0 // outlen\n )\n // limit our copy to 256 bytes\n _toCopy := returndatasize()\n if gt(_toCopy, _maxCopy) {\n _toCopy := _maxCopy\n }\n // Store the length of the copied bytes\n mstore(_returnData, _toCopy)\n // copy the bytes from returndata[0:_toCopy]\n returndatacopy(add(_returnData, 0x20), 0, _toCopy)\n }\n return (_success, _returnData);\n }\n\n /**\n * @notice Swaps function selectors in encoded contract calls\n * @dev Allows reuse of encoded calldata for functions with identical\n * argument types but different names. It simply swaps out the first 4 bytes\n * for the new selector. This function modifies memory in place, and should\n * only be used with caution.\n * @param _newSelector The new 4-byte selector\n * @param _buf The encoded contract args\n */\n function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure {\n require(_buf.length >= 4);\n uint _mask = LOW_28_MASK;\n assembly {\n // load the first word of\n let _word := mload(add(_buf, 0x20))\n // mask out the top 4 bytes\n // /x\n _word := and(_word, _mask)\n _word := or(_newSelector, _word)\n mstore(add(_buf, 0x20), _word)\n }\n }\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/interfaces/ICommonOFTUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface ICommonOFTUpgradeable is IERC165Upgradeable {\n struct LzCallParams {\n address payable refundAddress;\n address zroPaymentAddress;\n bytes adapterParams;\n }\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _amount - amount of the tokens to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParam - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n function estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n /**\n * @dev returns the circulating amount of tokens on current chain\n */\n function circulatingSupply() external view returns (uint);\n\n /**\n * @dev returns the address of the ERC20 token\n */\n function token() external view returns (address);\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/interfaces/IOFTReceiverV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.5.0;\n\ninterface IOFTReceiverV2Upgradeable {\n /**\n * @dev Called by the OFT contract when tokens are received from source chain.\n * @param _srcChainId The chain id of the source chain.\n * @param _srcAddress The address of the OFT token contract on the source chain.\n * @param _nonce The nonce of the transaction on the source chain.\n * @param _from The address of the account who calls the sendAndCall() on the source chain.\n * @param _amount The amount of tokens to transfer.\n * @param _payload Additional data with no specified format.\n */\n function onOFTReceived(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes32 _from,\n uint _amount,\n bytes calldata _payload\n ) external;\n}\n" + }, + "contracts/contracts-upgradable/lzApp/LzAppUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"./interfaces/ILayerZeroReceiverUpgradeable.sol\";\nimport \"./interfaces/ILayerZeroUserApplicationConfigUpgradeable.sol\";\nimport \"./interfaces/ILayerZeroEndpointUpgradeable.sol\";\nimport \"../../libraries/BytesLib.sol\";\n\n/*\n * a generic LzReceiver implementation\n */\nabstract contract LzAppUpgradeable is\n Initializable,\n OwnableUpgradeable,\n ILayerZeroReceiverUpgradeable,\n ILayerZeroUserApplicationConfigUpgradeable\n{\n using BytesLib for bytes;\n\n // ua can not send payload larger than this by default, but it can be changed by the ua owner\n uint public constant DEFAULT_PAYLOAD_SIZE_LIMIT = 10000;\n\n ILayerZeroEndpointUpgradeable public lzEndpoint;\n mapping(uint16 => bytes) public trustedRemoteLookup;\n mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup;\n mapping(uint16 => uint) public payloadSizeLimitLookup;\n address public precrime;\n\n event SetPrecrime(address precrime);\n event SetTrustedRemote(uint16 _remoteChainId, bytes _path);\n event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress);\n event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas);\n\n function __LzAppUpgradeable_init(address _endpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_endpoint);\n }\n\n function __LzAppUpgradeable_init_unchained(address _endpoint) internal onlyInitializing {\n lzEndpoint = ILayerZeroEndpointUpgradeable(_endpoint);\n }\n\n function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override {\n // lzReceive must be called by the endpoint for security\n require(_msgSender() == address(lzEndpoint), \"LzApp: invalid endpoint caller\");\n\n bytes memory trustedRemote = trustedRemoteLookup[_srcChainId];\n // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.\n require(\n _srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote),\n \"LzApp: invalid source sending contract\"\n );\n\n _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n }\n\n // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging\n function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\n\n function _lzSend(\n uint16 _dstChainId,\n bytes memory _payload,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams,\n uint _nativeFee\n ) internal virtual {\n bytes memory trustedRemote = trustedRemoteLookup[_dstChainId];\n require(trustedRemote.length != 0, \"LzApp: destination chain is not a trusted source\");\n _checkPayloadSize(_dstChainId, _payload.length);\n lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual {\n uint providedGasLimit = _getGasLimit(_adapterParams);\n uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas;\n require(minGasLimit > 0, \"LzApp: minGasLimit not set\");\n require(providedGasLimit >= minGasLimit, \"LzApp: gas limit is too low\");\n }\n\n function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) {\n require(_adapterParams.length >= 34, \"LzApp: invalid adapterParams\");\n assembly {\n gasLimit := mload(add(_adapterParams, 34))\n }\n }\n\n function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual {\n uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId];\n if (payloadSizeLimit == 0) {\n // use default if not set\n payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT;\n }\n require(_payloadSize <= payloadSizeLimit, \"LzApp: payload size is too large\");\n }\n\n //---------------------------UserApplication config----------------------------------------\n function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) {\n return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);\n }\n\n // generic config for LayerZero user Application\n function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner {\n lzEndpoint.setConfig(_version, _chainId, _configType, _config);\n }\n\n function setSendVersion(uint16 _version) external override onlyOwner {\n lzEndpoint.setSendVersion(_version);\n }\n\n function setReceiveVersion(uint16 _version) external override onlyOwner {\n lzEndpoint.setReceiveVersion(_version);\n }\n\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner {\n lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress);\n }\n\n // _path = abi.encodePacked(remoteAddress, localAddress)\n // this function set the trusted path for the cross-chain communication\n function setTrustedRemote(uint16 _srcChainId, bytes calldata _path) external onlyOwner {\n trustedRemoteLookup[_srcChainId] = _path;\n emit SetTrustedRemote(_srcChainId, _path);\n }\n\n function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner {\n trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this));\n emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress);\n }\n\n function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) {\n bytes memory path = trustedRemoteLookup[_remoteChainId];\n require(path.length != 0, \"LzApp: no trusted path record\");\n return path.slice(0, path.length - 20); // the last 20 bytes should be address(this)\n }\n\n function setPrecrime(address _precrime) external onlyOwner {\n precrime = _precrime;\n emit SetPrecrime(_precrime);\n }\n\n function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner {\n require(_minGas > 0, \"LzApp: invalid minGas\");\n minDstGasLookup[_dstChainId][_packetType] = _minGas;\n emit SetMinDstGas(_dstChainId, _packetType, _minGas);\n }\n\n // if the size is 0, it means default size limit\n function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner {\n payloadSizeLimitLookup[_dstChainId] = _size;\n }\n\n //--------------------------- VIEW FUNCTION ----------------------------------------\n function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) {\n bytes memory trustedSource = trustedRemoteLookup[_srcChainId];\n return keccak256(trustedSource) == keccak256(_srcAddress);\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 uint[45] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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" + }, + "contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\ninterface ILayerZeroReceiverUpgradeable {\n // @notice LayerZero endpoint will invoke this function to deliver the message on the destination\n // @param _srcChainId - the source endpoint identifier\n // @param _srcAddress - the source sending contract address from the source chain\n // @param _nonce - the ordered message nonce\n // @param _payload - the signed payload is the UA bytes has encoded to be sent\n function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;\n}\n" + }, + "contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroUserApplicationConfigUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\ninterface ILayerZeroUserApplicationConfigUpgradeable {\n // @notice set the configuration of the LayerZero messaging library of the specified version\n // @param _version - messaging library version\n // @param _chainId - the chainId for the pending config change\n // @param _configType - type of configuration. every messaging library has its own convention.\n // @param _config - configuration in the bytes. can encode arbitrary content.\n function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;\n\n // @notice set the send() LayerZero messaging library version to _version\n // @param _version - new messaging library version\n function setSendVersion(uint16 _version) external;\n\n // @notice set the lzReceive() LayerZero messaging library version to _version\n // @param _version - new messaging library version\n function setReceiveVersion(uint16 _version) external;\n\n // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload\n // @param _srcChainId - the chainId of the source chain\n // @param _srcAddress - the contract address of the source contract at the source chain\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;\n}\n" + }, + "contracts/contracts-upgradable/lzApp/interfaces/ILayerZeroEndpointUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"./ILayerZeroUserApplicationConfigUpgradeable.sol\";\n\ninterface ILayerZeroEndpointUpgradeable is ILayerZeroUserApplicationConfigUpgradeable {\n // @notice send a LayerZero message to the specified address at a LayerZero endpoint.\n // @param _dstChainId - the destination chain identifier\n // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains\n // @param _payload - a custom bytes payload to send to the destination contract\n // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address\n // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction\n // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination\n function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;\n\n // @notice used by the messaging library to publish verified payload\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source contract (as bytes) at the source chain\n // @param _dstAddress - the address on destination chain\n // @param _nonce - the unbound message ordering nonce\n // @param _gasLimit - the gas limit for external contract execution\n // @param _payload - verified payload to send to the destination contract\n function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external;\n\n // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);\n\n // @notice get the outboundNonce from this source chain which, consequently, is always an EVM\n // @param _srcAddress - the source chain contract address\n function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);\n\n // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery\n // @param _dstChainId - the destination chain identifier\n // @param _userApplication - the user app address on this EVM chain\n // @param _payload - the custom message to send over LayerZero\n // @param _payInZRO - if false, user app pays the protocol fee in native token\n // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain\n function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee);\n\n // @notice get this Endpoint's immutable source identifier\n function getChainId() external view returns (uint16);\n\n // @notice the interface to retry failed message on this Endpoint destination\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n // @param _payload - the payload to be retried\n function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external;\n\n // @notice query if any STORED payload (message blocking) at the endpoint.\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);\n\n // @notice query if the _libraryAddress is valid for sending msgs.\n // @param _userApplication - the user app address on this EVM chain\n function getSendLibraryAddress(address _userApplication) external view returns (address);\n\n // @notice query if the _libraryAddress is valid for receiving msgs.\n // @param _userApplication - the user app address on this EVM chain\n function getReceiveLibraryAddress(address _userApplication) external view returns (address);\n\n // @notice query if the non-reentrancy guard for send() is on\n // @return true if the guard is on. false otherwise\n function isSendingPayload() external view returns (bool);\n\n // @notice query if the non-reentrancy guard for receive() is on\n // @return true if the guard is on. false otherwise\n function isReceivingPayload() external view returns (bool);\n\n // @notice get the configuration of the LayerZero messaging library of the specified version\n // @param _version - messaging library version\n // @param _chainId - the chainId for the pending config change\n // @param _userApplication - the contract address of the user application\n // @param _configType - type of configuration. every messaging library has its own convention.\n function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory);\n\n // @notice get the send() LayerZero messaging library version\n // @param _userApplication - the contract address of the user application\n function getSendVersion(address _userApplication) external view returns (uint16);\n\n // @notice get the lzReceive() LayerZero messaging library version\n // @param _userApplication - the contract address of the user application\n function getReceiveVersion(address _userApplication) external view returns (uint16);\n}\n" + }, + "contracts/libraries/BytesLib.sol": { + "content": "// SPDX-License-Identifier: Unlicense\n/*\n * @title Solidity Bytes Arrays Utils\n * @author Gonçalo Sá \n *\n * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.\n * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.\n */\npragma solidity >=0.8.0 <0.9.0;\n\nlibrary BytesLib {\n function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory) {\n bytes memory tempBytes;\n\n assembly {\n // Get a location of some free memory and store it in tempBytes as\n // Solidity does for memory variables.\n tempBytes := mload(0x40)\n\n // Store the length of the first bytes array at the beginning of\n // the memory for tempBytes.\n let length := mload(_preBytes)\n mstore(tempBytes, length)\n\n // Maintain a memory counter for the current write location in the\n // temp bytes array by adding the 32 bytes for the array length to\n // the starting location.\n let mc := add(tempBytes, 0x20)\n // Stop copying when the memory counter reaches the length of the\n // first bytes array.\n let end := add(mc, length)\n\n for {\n // Initialize a copy counter to the start of the _preBytes data,\n // 32 bytes into its memory.\n let cc := add(_preBytes, 0x20)\n } lt(mc, end) {\n // Increase both counters by 32 bytes each iteration.\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n // Write the _preBytes data into the tempBytes memory 32 bytes\n // at a time.\n mstore(mc, mload(cc))\n }\n\n // Add the length of _postBytes to the current length of tempBytes\n // and store it as the new length in the first 32 bytes of the\n // tempBytes memory.\n length := mload(_postBytes)\n mstore(tempBytes, add(length, mload(tempBytes)))\n\n // Move the memory counter back from a multiple of 0x20 to the\n // actual end of the _preBytes data.\n mc := end\n // Stop copying when the memory counter reaches the new combined\n // length of the arrays.\n end := add(mc, length)\n\n for {\n let cc := add(_postBytes, 0x20)\n } lt(mc, end) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n // Update the free-memory pointer by padding our last write location\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\n // next 32 byte block, then round down to the nearest multiple of\n // 32. If the sum of the length of the two arrays is zero then add\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\n mstore(\n 0x40,\n and(\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\n not(31) // Round down to the nearest 32 bytes.\n )\n )\n }\n\n return tempBytes;\n }\n\n function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {\n assembly {\n // Read the first 32 bytes of _preBytes storage, which is the length\n // of the array. (We don't need to use the offset into the slot\n // because arrays use the entire slot.)\n let fslot := sload(_preBytes.slot)\n // Arrays of 31 bytes or less have an even value in their slot,\n // while longer arrays have an odd value. The actual length is\n // the slot divided by two for odd values, and the lowest order\n // byte divided by two for even values.\n // If the slot is even, bitwise and the slot with 255 and divide by\n // two to get the length. If the slot is odd, bitwise and the slot\n // with -1 and divide by two.\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\n let mlength := mload(_postBytes)\n let newlength := add(slength, mlength)\n // slength can contain both the length and contents of the array\n // if length < 32 bytes so let's prepare for that\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\n switch add(lt(slength, 32), lt(newlength, 32))\n case 2 {\n // Since the new array still fits in the slot, we just need to\n // update the contents of the slot.\n // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length\n sstore(\n _preBytes.slot,\n // all the modifications to the slot are inside this\n // next block\n add(\n // we can just add to the slot contents because the\n // bytes we want to change are the LSBs\n fslot,\n add(\n mul(\n div(\n // load the bytes from memory\n mload(add(_postBytes, 0x20)),\n // zero all bytes to the right\n exp(0x100, sub(32, mlength))\n ),\n // and now shift left the number of bytes to\n // leave space for the length in the slot\n exp(0x100, sub(32, newlength))\n ),\n // increase length by the double of the memory\n // bytes length\n mul(mlength, 2)\n )\n )\n )\n }\n case 1 {\n // The stored value fits in the slot, but the combined value\n // will exceed it.\n // get the keccak hash to get the contents of the array\n mstore(0x0, _preBytes.slot)\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\n\n // save new length\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\n\n // The contents of the _postBytes array start 32 bytes into\n // the structure. Our first read should obtain the `submod`\n // bytes that can fit into the unused space in the last word\n // of the stored array. To get this, we read 32 bytes starting\n // from `submod`, so the data we read overlaps with the array\n // contents by `submod` bytes. Masking the lowest-order\n // `submod` bytes allows us to add that value directly to the\n // stored value.\n\n let submod := sub(32, slength)\n let mc := add(_postBytes, submod)\n let end := add(_postBytes, mlength)\n let mask := sub(exp(0x100, submod), 1)\n\n sstore(sc, add(and(fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00), and(mload(mc), mask)))\n\n for {\n mc := add(mc, 0x20)\n sc := add(sc, 1)\n } lt(mc, end) {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } {\n sstore(sc, mload(mc))\n }\n\n mask := exp(0x100, sub(mc, end))\n\n sstore(sc, mul(div(mload(mc), mask), mask))\n }\n default {\n // get the keccak hash to get the contents of the array\n mstore(0x0, _preBytes.slot)\n // Start copying to the last used word of the stored array.\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\n\n // save new length\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\n\n // Copy over the first `submod` bytes of the new data as in\n // case 1 above.\n let slengthmod := mod(slength, 32)\n let mlengthmod := mod(mlength, 32)\n let submod := sub(32, slengthmod)\n let mc := add(_postBytes, submod)\n let end := add(_postBytes, mlength)\n let mask := sub(exp(0x100, submod), 1)\n\n sstore(sc, add(sload(sc), and(mload(mc), mask)))\n\n for {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } lt(mc, end) {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } {\n sstore(sc, mload(mc))\n }\n\n mask := exp(0x100, sub(mc, end))\n\n sstore(sc, mul(div(mload(mc), mask), mask))\n }\n }\n }\n\n function slice(\n bytes memory _bytes,\n uint _start,\n uint _length\n ) internal pure returns (bytes memory) {\n require(_length + 31 >= _length, \"slice_overflow\");\n require(_bytes.length >= _start + _length, \"slice_outOfBounds\");\n\n bytes memory tempBytes;\n\n assembly {\n switch iszero(_length)\n case 0 {\n // Get a location of some free memory and store it in tempBytes as\n // Solidity does for memory variables.\n tempBytes := mload(0x40)\n\n // The first word of the slice result is potentially a partial\n // word read from the original array. To read it, we calculate\n // the length of that partial word and start copying that many\n // bytes into the array. The first word we copy will start with\n // data we don't care about, but the last `lengthmod` bytes will\n // land at the beginning of the contents of the new array. When\n // we're done copying, we overwrite the full first word with\n // the actual length of the slice.\n let lengthmod := and(_length, 31)\n\n // The multiplication in the next line is necessary\n // because when slicing multiples of 32 bytes (lengthmod == 0)\n // the following copy loop was copying the origin's length\n // and then ending prematurely not copying everything it should.\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\n let end := add(mc, _length)\n\n for {\n // The multiplication in the next line has the same exact purpose\n // as the one above.\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\n } lt(mc, end) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n mstore(tempBytes, _length)\n\n //update free-memory pointer\n //allocating the array padded to 32 bytes like the compiler does now\n mstore(0x40, and(add(mc, 31), not(31)))\n }\n //if we want a zero-length slice let's just return a zero-length array\n default {\n tempBytes := mload(0x40)\n //zero out the 32 bytes slice we are about to return\n //we need to do it because Solidity does not garbage collect\n mstore(tempBytes, 0)\n\n mstore(0x40, add(tempBytes, 0x20))\n }\n }\n\n return tempBytes;\n }\n\n function toAddress(bytes memory _bytes, uint _start) internal pure returns (address) {\n require(_bytes.length >= _start + 20, \"toAddress_outOfBounds\");\n address tempAddress;\n\n assembly {\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\n }\n\n return tempAddress;\n }\n\n function toUint8(bytes memory _bytes, uint _start) internal pure returns (uint8) {\n require(_bytes.length >= _start + 1, \"toUint8_outOfBounds\");\n uint8 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x1), _start))\n }\n\n return tempUint;\n }\n\n function toUint16(bytes memory _bytes, uint _start) internal pure returns (uint16) {\n require(_bytes.length >= _start + 2, \"toUint16_outOfBounds\");\n uint16 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x2), _start))\n }\n\n return tempUint;\n }\n\n function toUint32(bytes memory _bytes, uint _start) internal pure returns (uint32) {\n require(_bytes.length >= _start + 4, \"toUint32_outOfBounds\");\n uint32 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x4), _start))\n }\n\n return tempUint;\n }\n\n function toUint64(bytes memory _bytes, uint _start) internal pure returns (uint64) {\n require(_bytes.length >= _start + 8, \"toUint64_outOfBounds\");\n uint64 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x8), _start))\n }\n\n return tempUint;\n }\n\n function toUint96(bytes memory _bytes, uint _start) internal pure returns (uint96) {\n require(_bytes.length >= _start + 12, \"toUint96_outOfBounds\");\n uint96 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0xc), _start))\n }\n\n return tempUint;\n }\n\n function toUint128(bytes memory _bytes, uint _start) internal pure returns (uint128) {\n require(_bytes.length >= _start + 16, \"toUint128_outOfBounds\");\n uint128 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x10), _start))\n }\n\n return tempUint;\n }\n\n function toUint256(bytes memory _bytes, uint _start) internal pure returns (uint) {\n require(_bytes.length >= _start + 32, \"toUint256_outOfBounds\");\n uint tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x20), _start))\n }\n\n return tempUint;\n }\n\n function toBytes32(bytes memory _bytes, uint _start) internal pure returns (bytes32) {\n require(_bytes.length >= _start + 32, \"toBytes32_outOfBounds\");\n bytes32 tempBytes32;\n\n assembly {\n tempBytes32 := mload(add(add(_bytes, 0x20), _start))\n }\n\n return tempBytes32;\n }\n\n function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {\n bool success = true;\n\n assembly {\n let length := mload(_preBytes)\n\n // if lengths don't match the arrays are not equal\n switch eq(length, mload(_postBytes))\n case 1 {\n // cb is a circuit breaker in the for loop since there's\n // no said feature for inline assembly loops\n // cb = 1 - don't breaker\n // cb = 0 - break\n let cb := 1\n\n let mc := add(_preBytes, 0x20)\n let end := add(mc, length)\n\n for {\n let cc := add(_postBytes, 0x20)\n // the next line is the loop condition:\n // while(uint256(mc < end) + cb == 2)\n } eq(add(lt(mc, end), cb), 2) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n // if any of these checks fails then arrays are not equal\n if iszero(eq(mload(mc), mload(cc))) {\n // unsuccess:\n success := 0\n cb := 0\n }\n }\n }\n default {\n // unsuccess:\n success := 0\n }\n }\n\n return success;\n }\n\n function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool) {\n bool success = true;\n\n assembly {\n // we know _preBytes_offset is 0\n let fslot := sload(_preBytes.slot)\n // Decode the length of the stored array like in concatStorage().\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\n let mlength := mload(_postBytes)\n\n // if lengths don't match the arrays are not equal\n switch eq(slength, mlength)\n case 1 {\n // slength can contain both the length and contents of the array\n // if length < 32 bytes so let's prepare for that\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\n if iszero(iszero(slength)) {\n switch lt(slength, 32)\n case 1 {\n // blank the last byte which is the length\n fslot := mul(div(fslot, 0x100), 0x100)\n\n if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {\n // unsuccess:\n success := 0\n }\n }\n default {\n // cb is a circuit breaker in the for loop since there's\n // no said feature for inline assembly loops\n // cb = 1 - don't breaker\n // cb = 0 - break\n let cb := 1\n\n // get the keccak hash to get the contents of the array\n mstore(0x0, _preBytes.slot)\n let sc := keccak256(0x0, 0x20)\n\n let mc := add(_postBytes, 0x20)\n let end := add(mc, mlength)\n\n // the next line is the loop condition:\n // while(uint256(mc < end) + cb == 2)\n for {\n\n } eq(add(lt(mc, end), cb), 2) {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } {\n if iszero(eq(sload(sc), mload(mc))) {\n // unsuccess:\n success := 0\n cb := 0\n }\n }\n }\n }\n }\n default {\n // unsuccess:\n success := 0\n }\n }\n\n return success;\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/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\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 ReentrancyGuardUpgradeable is Initializable {\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 function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\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 /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\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" + }, + "contracts/contracts-upgradable/examples/BeamBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/NativeOFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\n\ncontract BeamProxyOFT is ProxyOFTWithFeeUpgradeable {}\n\ncontract BeamNativeOFT is NativeOFTWithFeeUpgradeable {}\n\ncontract BeamOFT is OFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"./BaseOFTWithFeeUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\ncontract ProxyOFTWithFeeUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, Proxied {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n IERC20Upgradeable internal innerToken;\n uint internal ld2sdRate;\n\n // total amount is transferred from this chain to other chains, ensuring the total is less than uint64.max in sd\n uint public outboundAmount;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address _token, uint8 _sharedDecimals, address _lzEndpoint) public initializer {\n __BaseOFTWithFeeUpgradeable_init(_sharedDecimals, _lzEndpoint);\n\n innerToken = IERC20Upgradeable(_token);\n\n (bool success, bytes memory data) = _token.staticcall(abi.encodeWithSignature(\"decimals()\"));\n require(success, \"ProxyOFTWithFee: failed to get token decimals\");\n uint8 decimals = abi.decode(data, (uint8));\n\n require(_sharedDecimals <= decimals, \"ProxyOFTWithFee: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return innerToken.totalSupply() - outboundAmount;\n }\n\n function token() public view virtual override returns (address) {\n return address(innerToken);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n require(_from == _msgSender(), \"ProxyOFTWithFee: owner is not send caller\");\n\n _amount = _transferFrom(_from, address(this), _amount);\n\n // _amount still may have dust if the token has transfer fee, then give the dust back to the sender\n (uint amount, uint dust) = _removeDust(_amount);\n if (dust > 0) innerToken.safeTransfer(_from, dust);\n\n // check total outbound amount\n outboundAmount += amount;\n uint cap = _sd2ld(type(uint64).max);\n require(cap >= outboundAmount, \"ProxyOFTWithFee: outboundAmount overflow\");\n\n return amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n outboundAmount -= _amount;\n\n // tokens are already in this contract, so no need to transfer\n if (_toAddress == address(this)) {\n return _amount;\n }\n\n return _transferFrom(address(this), _toAddress, _amount);\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n uint before = innerToken.balanceOf(_to);\n if (_from == address(this)) {\n innerToken.safeTransfer(_to, _amount);\n } else {\n innerToken.safeTransferFrom(_from, _to, _amount);\n }\n return innerToken.balanceOf(_to) - before;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) 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(IERC20Upgradeable token, address spender, uint256 value) 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 /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable 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(IERC20Upgradeable 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 require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation 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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\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 cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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 IERC20PermitUpgradeable {\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" + }, + "contracts/contracts-upgradable/examples/UsdtOFT.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\n\ncontract UsdtOFT is OFTWithFeeUpgradeable {\n function decimals() public view virtual override returns (uint8) {\n return 6;\n }\n}\n\ncontract UsdtProxyOFT is ProxyOFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/examples/UsdcOFT.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\n\ncontract UsdcOFT is OFTWithFeeUpgradeable {\n function decimals() public view virtual override returns (uint8) {\n return 6;\n }\n}\n\ncontract UsdcProxyOFT is ProxyOFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/examples/GOB.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\n\ncontract GobOFT is OFTWithFeeUpgradeable {}\n\ncontract GobProxyOFT is ProxyOFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/examples/FP.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\n\ncontract ForgottenPlaylandOFT is OFTWithFeePermitUpgradeable {}\n\ncontract ForgottenPlaylandProxyOFT is ProxyOFTWithFeeUpgradeable {}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/fee/OFTWithFeePermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol\";\nimport \"./BaseOFTWithFeeUpgradeable.sol\";\n\ncontract OFTWithFeePermitUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, ERC20Upgradeable, Proxied, ERC20PermitUpgradeable {\n uint internal ld2sdRate;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) public virtual initializer {\n __OFTWithFeePermitUpgradeable_init(_name, _symbol, _sharedDecimals, _lzEndpoint);\n }\n\n function __OFTWithFeePermitUpgradeable_init(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n\n __ERC20_init_unchained(_name, _symbol);\n __ERC20Permit_init_unchained(_name);\n\n __OFTWithFeePermitUpgradeable_init_unchained(_sharedDecimals);\n }\n\n function __OFTWithFeePermitUpgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\n uint8 decimals = decimals();\n require(_sharedDecimals <= decimals, \"OFTWithFee: sharedDecimals must be <= decimals\");\n ld2sdRate = 10**(decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return totalSupply();\n }\n\n function token() public view virtual override returns (address) {\n return address(this);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(\n address _from,\n uint16,\n bytes32,\n uint _amount\n ) internal virtual override returns (uint) {\n address spender = _msgSender();\n if (_from != spender) _spendAllowance(_from, spender, _amount);\n _burn(_from, _amount);\n return _amount;\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _amount\n ) internal virtual override returns (uint) {\n _mint(_toAddress, _amount);\n return _amount;\n }\n\n function _transferFrom(\n address _from,\n address _to,\n uint _amount\n ) internal virtual override returns (uint) {\n address spender = _msgSender();\n // if transfer from this contract, no need to check allowance\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\n _transfer(_from, _to, _amount);\n return _amount;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/cryptography/EIP712Upgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation 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 *\n * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n /**\n * @dev See {IERC20Permit-permit}.\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 ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\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/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.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 ECDSAUpgradeable {\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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\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\", StringsUpgradeable.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 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../interfaces/IERC5267Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\n bytes32 private constant _TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /// @custom:oz-renamed-from _HASHED_NAME\n bytes32 private _hashedName;\n /// @custom:oz-renamed-from _HASHED_VERSION\n bytes32 private _hashedVersion;\n\n string private _name;\n string private _version;\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 function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n _name = name;\n _version = version;\n\n // Reset prior values in storage if upgrading\n _hashedName = 0;\n _hashedVersion = 0;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator();\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), 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 ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev See {EIP-5267}.\n *\n * _Available since v4.9._\n */\n function eip712Domain()\n public\n view\n virtual\n override\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\n // and the EIP712 domain is not reliable, as it will be missing name and version.\n require(_hashedName == 0 && _hashedVersion == 0, \"EIP712: Uninitialized\");\n\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n /**\n * @dev The name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Name() internal virtual view returns (string memory) {\n return _name;\n }\n\n /**\n * @dev The version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Version() internal virtual view returns (string memory) {\n return _version;\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\n */\n function _EIP712NameHash() internal view returns (bytes32) {\n string memory name = _EIP712Name();\n if (bytes(name).length > 0) {\n return keccak256(bytes(name));\n } else {\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\n bytes32 hashedName = _hashedName;\n if (hashedName != 0) {\n return hashedName;\n } else {\n return keccak256(\"\");\n }\n }\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\n */\n function _EIP712VersionHash() internal view returns (bytes32) {\n string memory version = _EIP712Version();\n if (bytes(version).length > 0) {\n return keccak256(bytes(version));\n } else {\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\n bytes32 hashedVersion = _hashedVersion;\n if (hashedVersion != 0) {\n return hashedVersion;\n } else {\n return keccak256(\"\");\n }\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[48] 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/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.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 `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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 256, 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 << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267Upgradeable {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/experimental/NativeProxyOFTWithFeeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"../fee/BaseOFTWithFeeUpgradeable.sol\";\n\n/**\n * \"NativeMinter\" Avalanche Subnet precompile interface\n * https://docs.avax.network/build/subnet/upgrade/customize-a-subnet#minting-native-coins\n */\n\ninterface INativeMinter {\n // Mint [amount] number of native coins and send to [addr]\n function mintNativeCoin(address addr, uint256 amount) external;\n}\n\n/**\n * This contract is based on \"NativeOFTV2\" and \"ProxyOFTV2\", and takes advantage of\n * the \"NativeMinter\" Avalanche Subnet precompile to mint and burn native currency\n * on-the-fly instead of locking it up.\n */\n\ncontract NativeProxyOFTWithFeeUpgradeable is Initializable, BaseOFTWithFeeUpgradeable, PausableUpgradeable, Proxied {\n uint internal ld2sdRate;\n uint internal supply;\n INativeMinter internal constant nativeMinter = INativeMinter(address(0x0200000000000000000000000000000000000001));\n address public constant BURN_ADDRESS = 0x0100000000000000000000000000000000000000;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(uint8 _nativeDecimals, uint8 _sharedDecimals, address _lzEndpoint) public initializer {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n __Pausable_init_unchained();\n\n require(_sharedDecimals <= _nativeDecimals, \"NativeProxyOFTWithFee: sharedDecimals must be <= nativeDecimals\");\n ld2sdRate = 10 ** (_nativeDecimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n // allow 0x0 to burn fee instead\n function setFeeOwner(address _feeOwner) public virtual override onlyOwner {\n feeOwner = _feeOwner;\n emit SetFeeOwner(_feeOwner);\n }\n\n // pausable\n function pause(bool _enable) public virtual onlyOwner {\n if (_enable) {\n _pause();\n } else {\n _unpause();\n }\n }\n\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n LzCallParams calldata _callParams\n ) public payable virtual override whenNotPaused {\n return super.sendFrom(_from, _dstChainId, _toAddress, _amount, _minAmount, _callParams);\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n uint _minAmount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override whenNotPaused {\n return super.sendAndCall(_from, _dstChainId, _toAddress, _amount, _minAmount, _payload, _dstGasForCall, _callParams);\n }\n\n function token() public view virtual override returns (address) {\n return address(0);\n }\n\n function circulatingSupply() public view virtual override returns (uint) {\n return supply;\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeProxyOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(amount);\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeProxyOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(amount);\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _debitFromNative(uint _amount) internal virtual whenNotPaused returns (uint messageFee) {\n require(msg.value >= _amount, \"NativeProxyOFTWithFee: Insufficient msg.value\");\n // update the messageFee to take out the token amount\n messageFee = msg.value - _amount;\n\n // burn native tokens\n _burnNative(_amount);\n\n return messageFee;\n }\n\n function _debitFrom(address, uint16, bytes32, uint _amount) internal virtual override whenNotPaused returns (uint) {\n return _debitFromNative(_amount);\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override whenNotPaused returns (uint) {\n // mint native tokens\n _mintNative(_toAddress, _amount);\n\n return _amount;\n }\n\n // native currency transfer\n function _transferFrom(address, address _to, uint _amount) internal virtual override whenNotPaused returns (uint) {\n require(msg.value >= _amount, \"NativeProxyOFTWithFee: Insufficient msg.value\");\n\n (bool success, ) = address(_to).call{value: _amount}(\"\");\n\n require(success, \"NativeProxyOFTWithFee: Transferring native tokens failed\");\n\n return _amount;\n }\n\n // mints native currency (gas tokens) by calling Avalanche's NativeMinter precompile\n function _mintNative(address _toAddress, uint _amount) internal virtual whenNotPaused {\n uint newBalance = msg.sender.balance + _amount;\n nativeMinter.mintNativeCoin(_toAddress, _amount);\n\n require(msg.sender.balance == newBalance, \"NativeProxyOFTWithFee: Minting native tokens failed\");\n\n // update tracker\n supply = supply + _amount;\n }\n\n // burn native tokens sent with tx\n function _burnNative(uint _amount) internal virtual {\n _transferFrom(address(0), BURN_ADDRESS, _amount);\n\n // update tracker\n supply = supply > _amount ? supply - _amount : 0;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\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" + }, + "contracts/contracts-upgradable/token/onft721/ProxyONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol\";\nimport \"./ONFT721CoreUpgradeable.sol\";\n\ncontract ProxyONFT721Upgradeable is Initializable, ONFT721CoreUpgradeable, IERC721ReceiverUpgradeable, Proxied {\n using ERC165CheckerUpgradeable for address;\n\n IERC721Upgradeable public token;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(uint256 _minGasToTransfer, address _lzEndpoint, address _proxyToken) public virtual initializer {\n __ProxyONFT721Upgradeable_init(_minGasToTransfer, _lzEndpoint, _proxyToken);\n }\n\n function __ProxyONFT721Upgradeable_init(uint256 _minGasToTransfer, address _lzEndpoint, address _proxyToken) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __ONFT721CoreUpgradeable_init_unchained(_minGasToTransfer);\n\n __ProxyONFT721Upgradeable_init_unchained(_proxyToken);\n }\n\n function __ProxyONFT721Upgradeable_init_unchained(address _proxyToken) internal onlyInitializing {\n require(_proxyToken.supportsInterface(type(IERC721Upgradeable).interfaceId), \"ProxyONFT721Upgradeable: invalid ERC721 token\");\n token = IERC721Upgradeable(_proxyToken);\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC721ReceiverUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(address _from, uint16, bytes memory, uint _tokenId) internal virtual override {\n require(_from == _msgSender(), \"ProxyONFT721Upgradeable: owner is not send caller\");\n token.safeTransferFrom(_from, address(this), _tokenId);\n }\n\n function _creditTo(uint16, address _toAddress, uint _tokenId) internal virtual override {\n token.safeTransferFrom(address(this), _toAddress, _tokenId);\n }\n\n function onERC721Received(address _operator, address, uint, bytes memory) public virtual override returns (bytes4) {\n // only allow `this` to transfer token from others\n if (_operator != address(this)) return bytes4(0);\n return IERC721ReceiverUpgradeable.onERC721Received.selector;\n }\n\n uint[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165CheckerUpgradeable {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface.\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return\n supportsERC165InterfaceUnchecked(account, type(IERC165Upgradeable).interfaceId) &&\n !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(\n address account,\n bytes4[] memory interfaceIds\n ) internal view returns (bool[] memory) {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n *\n * Some precompiled contracts will falsely indicate support for a given interface, so caution\n * should be exercised when using this function.\n *\n * Interface identification is specified in ERC-165.\n */\n function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {\n // prepare call\n bytes memory encodedParams = abi.encodeWithSelector(IERC165Upgradeable.supportsInterface.selector, interfaceId);\n\n // perform static call\n bool success;\n uint256 returnSize;\n uint256 returnValue;\n assembly {\n success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n returnSize := returndatasize()\n returnValue := mload(0x00)\n }\n\n return success && returnSize >= 0x20 && returnValue > 0;\n }\n}\n" + }, + "contracts/contracts-upgradable/token/onft721/ONFT721CoreUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"./interfaces/IONFT721CoreUpgradeable.sol\";\nimport \"../../lzApp/NonblockingLzAppUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nabstract contract ONFT721CoreUpgradeable is\n Initializable,\n NonblockingLzAppUpgradeable,\n ERC165Upgradeable,\n ReentrancyGuardUpgradeable,\n IONFT721CoreUpgradeable\n{\n uint16 public constant FUNCTION_TYPE_SEND = 1;\n\n struct StoredCredit {\n uint16 srcChainId;\n address toAddress;\n uint256 index; // which index of the tokenIds remain\n bool creditsRemain;\n }\n\n uint256 public minGasToTransferAndStore; // min amount of gas required to transfer, and also store the payload\n mapping(uint16 => uint256) public dstChainIdToBatchLimit;\n mapping(uint16 => uint256) public dstChainIdToTransferGas; // per transfer amount of gas required to mint/transfer on the dst\n mapping(bytes32 => StoredCredit) public storedCredits;\n\n function __ONFT721CoreUpgradeable_init(uint256 _minGasToTransferAndStore, address _lzEndpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __ONFT721CoreUpgradeable_init_unchained(_minGasToTransferAndStore);\n }\n\n function __ONFT721CoreUpgradeable_init_unchained(uint256 _minGasToTransferAndStore) internal onlyInitializing {\n require(_minGasToTransferAndStore > 0, \"ONFT721: minGasToTransferAndStore must be > 0\");\n minGasToTransferAndStore = _minGasToTransferAndStore;\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IONFT721CoreUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _useZro, _adapterParams);\n }\n\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n bytes memory payload = abi.encode(_toAddress, _tokenIds);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _tokenIds, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual {\n // allow 1 by default\n require(_tokenIds.length > 0, \"LzApp: tokenIds[] is empty\");\n require(_tokenIds.length == 1 || _tokenIds.length <= dstChainIdToBatchLimit[_dstChainId], \"ONFT721: batch size exceeds dst batch limit\");\n\n for (uint i = 0; i < _tokenIds.length; i++) {\n _debitFrom(_from, _dstChainId, _toAddress, _tokenIds[i]);\n }\n\n bytes memory payload = abi.encode(_toAddress, _tokenIds);\n\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, dstChainIdToTransferGas[_dstChainId] * _tokenIds.length);\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds);\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 /*_nonce*/,\n bytes memory _payload\n ) internal virtual override {\n // decode and load the toAddress\n (bytes memory toAddressBytes, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[]));\n\n address toAddress;\n assembly {\n toAddress := mload(add(toAddressBytes, 20))\n }\n\n uint nextIndex = _creditTill(_srcChainId, toAddress, 0, tokenIds);\n if (nextIndex < tokenIds.length) {\n // not enough gas to complete transfers, store to be cleared in another tx\n bytes32 hashedPayload = keccak256(_payload);\n storedCredits[hashedPayload] = StoredCredit(_srcChainId, toAddress, nextIndex, true);\n emit CreditStored(hashedPayload, _payload);\n }\n\n emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds);\n }\n\n // Public function for anyone to clear and deliver the remaining batch sent tokenIds\n function clearCredits(bytes memory _payload) external virtual nonReentrant {\n bytes32 hashedPayload = keccak256(_payload);\n require(storedCredits[hashedPayload].creditsRemain, \"ONFT721: no credits stored\");\n\n (, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[]));\n\n uint nextIndex = _creditTill(\n storedCredits[hashedPayload].srcChainId,\n storedCredits[hashedPayload].toAddress,\n storedCredits[hashedPayload].index,\n tokenIds\n );\n require(nextIndex > storedCredits[hashedPayload].index, \"ONFT721: not enough gas to process credit transfer\");\n\n if (nextIndex == tokenIds.length) {\n // cleared the credits, delete the element\n delete storedCredits[hashedPayload];\n emit CreditCleared(hashedPayload);\n } else {\n // store the next index to mint\n storedCredits[hashedPayload] = StoredCredit(\n storedCredits[hashedPayload].srcChainId,\n storedCredits[hashedPayload].toAddress,\n nextIndex,\n true\n );\n }\n }\n\n // When a srcChain has the ability to transfer more chainIds in a single tx than the dst can do.\n // Needs the ability to iterate and stop if the minGasToTransferAndStore is not met\n function _creditTill(uint16 _srcChainId, address _toAddress, uint _startIndex, uint[] memory _tokenIds) internal returns (uint256) {\n uint i = _startIndex;\n while (i < _tokenIds.length) {\n // if not enough gas to process, store this index for next loop\n if (gasleft() < minGasToTransferAndStore) break;\n\n _creditTo(_srcChainId, _toAddress, _tokenIds[i]);\n i++;\n }\n\n // indicates the next index to send of tokenIds,\n // if i == tokenIds.length, we are finished\n return i;\n }\n\n function setMinGasToTransferAndStore(uint256 _minGasToTransferAndStore) external onlyOwner {\n require(_minGasToTransferAndStore > 0, \"ONFT721: minGasToTransferAndStore must be > 0\");\n minGasToTransferAndStore = _minGasToTransferAndStore;\n }\n\n // ensures enough gas in adapter params to handle batch transfer gas amounts on the dst\n function setDstChainIdToTransferGas(uint16 _dstChainId, uint256 _dstChainIdToTransferGas) external onlyOwner {\n require(_dstChainIdToTransferGas > 0, \"ONFT721: dstChainIdToTransferGas must be > 0\");\n dstChainIdToTransferGas[_dstChainId] = _dstChainIdToTransferGas;\n }\n\n // limit on src the amount of tokens to batch send\n function setDstChainIdToBatchLimit(uint16 _dstChainId, uint256 _dstChainIdToBatchLimit) external onlyOwner {\n require(_dstChainIdToBatchLimit > 0, \"ONFT721: dstChainIdToBatchLimit must be > 0\");\n dstChainIdToBatchLimit[_dstChainId] = _dstChainIdToBatchLimit;\n }\n\n function _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId) internal virtual;\n\n function _creditTo(uint16 _srcChainId, address _toAddress, uint _tokenId) internal virtual;\n\n function _toSingletonArray(uint element) internal pure returns (uint[] memory) {\n uint[] memory array = new uint[](1);\n array[0] = element;\n return array;\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 uint[46] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/onft721/interfaces/IONFT721CoreUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\n/**\n * @dev Interface of the ONFT Core Upgradeable standard\n */\ninterface IONFT721CoreUpgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `_tokenIds[]` are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\n * `_nonce` is the outbound nonce from\n */\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds);\n event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint[] _tokenIds);\n\n /**\n * @dev Emitted when `_payload` was received from lz, but not enough gas to deliver all tokenIds\n */\n event CreditStored(bytes32 _hashedPayload, bytes _payload);\n /**\n * @dev Emitted when `_hashedPayload` has been completely delivered\n */\n event CreditCleared(bytes32 _hashedPayload);\n\n /**\n * @dev send token `_tokenId` to (`_dstChainId`, `_toAddress`) from `_from`\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n /**\n * @dev send tokens `_tokenIds[]` to (`_dstChainId`, `_toAddress`) from `_from`\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _tokenId - token Id to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _tokenIds[] - token Ids to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/NativeOFTV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"./OFTV2Upgradeable.sol\";\n\ncontract NativeOFTV2Upgradeable is OFTV2Upgradeable, ReentrancyGuardUpgradeable {\n event Deposit(address indexed _dst, uint _amount);\n event Withdrawal(address indexed _src, uint _amount);\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _sendAndCall(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _payload,\n _dstGasForCall,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n }\n\n function deposit() public payable {\n _mint(msg.sender, msg.value);\n emit Deposit(msg.sender, msg.value);\n }\n\n function withdraw(uint _amount) external nonReentrant {\n require(balanceOf(msg.sender) >= _amount, \"NativeOFTV2: Insufficient balance.\");\n _burn(msg.sender, _amount);\n (bool success, ) = msg.sender.call{value: _amount}(\"\");\n require(success, \"NativeOFTV2: failed to unwrap\");\n emit Withdrawal(msg.sender, _amount);\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTV2: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkAdapterParams(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTV2: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _debitFromNative(address _from, uint _amount) internal returns (uint messageFee) {\n messageFee = msg.sender == _from ? _debitMsgSender(_amount) : _debitMsgFrom(_from, _amount);\n }\n\n function _debitMsgSender(uint _amount) internal returns (uint messageFee) {\n uint msgSenderBalance = balanceOf(msg.sender);\n\n if (msgSenderBalance < _amount) {\n require(msgSenderBalance + msg.value >= _amount, \"NativeOFTV2: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgSenderBalance;\n _mint(address(msg.sender), mintAmount);\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _transfer(msg.sender, address(this), _amount);\n return messageFee;\n }\n\n function _debitMsgFrom(address _from, uint _amount) internal returns (uint messageFee) {\n uint msgFromBalance = balanceOf(_from);\n\n if (msgFromBalance < _amount) {\n require(msgFromBalance + msg.value >= _amount, \"NativeOFTV2: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgFromBalance;\n _mint(address(msg.sender), mintAmount);\n\n // transfer the differential amount to the contract\n _transfer(msg.sender, address(this), mintAmount);\n\n // overwrite the _amount to take the rest of the balance from the _from address\n _amount = msgFromBalance;\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _spendAllowance(_from, msg.sender, _amount);\n _transfer(_from, address(this), _amount);\n return messageFee;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal override returns (uint) {\n _burn(address(this), _amount);\n (bool success, ) = _toAddress.call{value: _amount}(\"\");\n require(success, \"NativeOFTV2: failed to _creditTo\");\n return _amount;\n }\n\n receive() external payable {\n deposit();\n }\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/OFTV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\nimport \"./BaseOFTV2Upgradeable.sol\";\n\ncontract OFTV2Upgradeable is Initializable, BaseOFTV2Upgradeable, ERC20Upgradeable, Proxied {\n uint internal ld2sdRate;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(string memory _name, string memory _symbol, uint8 _sharedDecimals, address _lzEndpoint) public virtual initializer {\n __OFTV2Upgradeable_init(_name, _symbol, _sharedDecimals, _lzEndpoint);\n }\n\n function __OFTV2Upgradeable_init(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n\n __ERC20_init_unchained(_name, _symbol);\n\n __OFTV2Upgradeable_init_unchained(_sharedDecimals);\n }\n\n function __OFTV2Upgradeable_init_unchained(uint8 _sharedDecimals) internal onlyInitializing {\n uint8 decimals = decimals();\n require(_sharedDecimals <= decimals, \"OFT: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return totalSupply();\n }\n\n function token() public view virtual override returns (address) {\n return address(this);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n if (_from != spender) _spendAllowance(_from, spender, _amount);\n _burn(_from, _amount);\n return _amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n _mint(_toAddress, _amount);\n return _amount;\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n // if transfer from this contract, no need to check allowance\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\n _transfer(_from, _to, _amount);\n return _amount;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\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 uint[49] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/BaseOFTV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./OFTCoreV2Upgradeable.sol\";\nimport \"./interfaces/IOFTV2Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\nabstract contract BaseOFTV2Upgradeable is OFTCoreV2Upgradeable, ERC165Upgradeable, IOFTV2Upgradeable {\n function __BaseOFTV2Upgradeable_init(uint8 _sharedDecimals, address _lzEndpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __OFTCoreV2Upgradeable_init_unchained(_sharedDecimals);\n }\n\n function __BaseOFTV2Upgradeable_init_unchained() internal onlyInitializing {}\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _sendAndCall(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _payload,\n _dstGasForCall,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n }\n\n /************************************************************************\n * public view functions\n ************************************************************************/\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IOFTV2Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams);\n }\n\n function estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams);\n }\n\n function circulatingSupply() public view virtual override returns (uint);\n\n function token() public view virtual override returns (address);\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 uint[50] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/interfaces/IOFTV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./ICommonOFTUpgradeable.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface IOFTV2Upgradeable is ICommonOFTUpgradeable {\n /**\n * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\n * `_from` the owner of token\n * `_dstChainId` the destination chain identifier\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_amount` the quantity of tokens in wei\n * `_refundAddress` the address LayerZero refunds if too much message fee is sent\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, LzCallParams calldata _callParams) external payable;\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) external payable;\n}\n" + }, + "contracts/contracts-upgradable/token/oft/v2/ProxyOFTV2Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"./BaseOFTV2Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\ncontract ProxyOFTV2Upgradeable is Initializable, BaseOFTV2Upgradeable, Proxied {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n IERC20Upgradeable internal innerToken;\n uint internal ld2sdRate;\n\n // total amount is transferred from this chain to other chains, ensuring the total is less than uint64.max in sd\n uint public outboundAmount;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address _token, uint8 _sharedDecimals, address _lzEndpoint) public initializer {\n __BaseOFTV2Upgradeable_init(_sharedDecimals, _lzEndpoint);\n\n innerToken = IERC20Upgradeable(_token);\n\n (bool success, bytes memory data) = _token.staticcall(abi.encodeWithSignature(\"decimals()\"));\n require(success, \"ProxyOFT: failed to get token decimals\");\n uint8 decimals = abi.decode(data, (uint8));\n\n require(_sharedDecimals <= decimals, \"ProxyOFT: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return innerToken.totalSupply() - outboundAmount;\n }\n\n function token() public view virtual override returns (address) {\n return address(innerToken);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n require(_from == _msgSender(), \"ProxyOFT: owner is not send caller\");\n\n _amount = _transferFrom(_from, address(this), _amount);\n\n // _amount still may have dust if the token has transfer fee, then give the dust back to the sender\n (uint amount, uint dust) = _removeDust(_amount);\n if (dust > 0) innerToken.safeTransfer(_from, dust);\n\n // check total outbound amount\n outboundAmount += amount;\n uint cap = _sd2ld(type(uint64).max);\n require(cap >= outboundAmount, \"ProxyOFT: outboundAmount overflow\");\n\n return amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n outboundAmount -= _amount;\n\n // tokens are already in this contract, so no need to transfer\n if (_toAddress == address(this)) {\n return _amount;\n }\n\n return _transferFrom(address(this), _toAddress, _amount);\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n uint before = innerToken.balanceOf(_to);\n if (_from == address(this)) {\n innerToken.safeTransfer(_to, _amount);\n } else {\n innerToken.safeTransferFrom(_from, _to, _amount);\n }\n return innerToken.balanceOf(_to) - before;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\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 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 /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\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[44] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\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 */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"./IERC721EnumerableUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\n function __ERC721Enumerable_init() internal onlyInitializing {\n }\n\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\n }\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Upgradeable.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721Upgradeable.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's 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 = ERC721Upgradeable.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\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 uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = 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 /**\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[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\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 */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721RoyaltyUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Royalty.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../common/ERC2981Upgradeable.sol\";\nimport \"../../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC721 with the ERC2981 NFT Royalty Standard, a standardized way to retrieve royalty payment\n * information.\n *\n * Royalty information can be specified globally for all token ids via {ERC2981-_setDefaultRoyalty}, and/or individually for\n * specific token ids via {ERC2981-_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC721RoyaltyUpgradeable is Initializable, ERC2981Upgradeable, ERC721Upgradeable {\n function __ERC721Royalty_init() internal onlyInitializing {\n }\n\n function __ERC721Royalty_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, ERC2981Upgradeable) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {ERC721-_burn}. This override additionally clears the royalty information for the token.\n */\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n _resetTokenRoyalty(tokenId);\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/token/common/ERC2981Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/IERC2981Upgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.\n *\n * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for\n * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the\n * fee is specified in basis points by default.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {\n function __ERC2981_init() internal onlyInitializing {\n }\n\n function __ERC2981_init_unchained() internal onlyInitializing {\n }\n struct RoyaltyInfo {\n address receiver;\n uint96 royaltyFraction;\n }\n\n RoyaltyInfo private _defaultRoyaltyInfo;\n mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) {\n return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @inheritdoc IERC2981Upgradeable\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) {\n RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];\n\n if (royalty.receiver == address(0)) {\n royalty = _defaultRoyaltyInfo;\n }\n\n uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();\n\n return (royalty.receiver, royaltyAmount);\n }\n\n /**\n * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a\n * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an\n * override.\n */\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: invalid receiver\");\n\n _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Removes default royalty information.\n */\n function _deleteDefaultRoyalty() internal virtual {\n delete _defaultRoyaltyInfo;\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: Invalid parameters\");\n\n _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Resets royalty information for the token id back to the global default.\n */\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n delete _tokenRoyaltyInfo[tokenId];\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[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981Upgradeable is IERC165Upgradeable {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount);\n}\n" + }, + "contracts/contracts-upgradable/token/onft1155/ProxyONFT1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol\";\nimport \"./ONFT1155CoreUpgradeable.sol\";\n\ncontract ProxyONFT1155Upgradeable is Initializable, ONFT1155CoreUpgradeable, IERC1155ReceiverUpgradeable, Proxied {\n using ERC165CheckerUpgradeable for address;\n\n IERC1155Upgradeable public token;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(address _lzEndpoint, address _proxyToken) public virtual initializer {\n __ProxyONFT1155Upgradeable_init(_lzEndpoint, _proxyToken);\n }\n\n function __ProxyONFT1155Upgradeable_init(address _lzEndpoint, address _proxyToken) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n\n __ProxyONFT1155Upgradeable_init_unchained(_proxyToken);\n }\n\n function __ProxyONFT1155Upgradeable_init_unchained(address _proxyToken) internal onlyInitializing {\n require(_proxyToken.supportsInterface(type(IERC1155Upgradeable).interfaceId), \"ProxyONFT1155Upgradeable: invalid ERC1155 token\");\n token = IERC1155Upgradeable(_proxyToken);\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT1155CoreUpgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IERC1155ReceiverUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(address _from, uint16, bytes memory, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override {\n require(_from == _msgSender(), \"ProxyONFT1155: owner is not send caller\");\n token.safeBatchTransferFrom(_from, address(this), _tokenIds, _amounts, \"\");\n }\n\n function _creditTo(uint16, address _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override {\n token.safeBatchTransferFrom(address(this), _toAddress, _tokenIds, _amounts, \"\");\n }\n\n function onERC1155Received(address _operator, address, uint, uint, bytes memory) public virtual override returns (bytes4) {\n // only allow `this` to tranfser token from others\n if (_operator != address(this)) return bytes4(0);\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address _operator,\n address,\n uint[] memory,\n uint[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n // only allow `this` to tranfser token from others\n if (_operator != address(this)) return bytes4(0);\n return this.onERC1155BatchReceived.selector;\n }\n\n uint[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "contracts/contracts-upgradable/token/onft1155/ONFT1155CoreUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT1155CoreUpgradeable.sol\";\nimport \"../../lzApp/NonblockingLzAppUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\n\nabstract contract ONFT1155CoreUpgradeable is Initializable, NonblockingLzAppUpgradeable, ERC165Upgradeable, IONFT1155CoreUpgradeable {\n uint public constant NO_EXTRA_GAS = 0;\n uint16 public constant FUNCTION_TYPE_SEND = 1;\n uint16 public constant FUNCTION_TYPE_SEND_BATCH = 2;\n bool public useCustomAdapterParams;\n\n event SetUseCustomAdapterParams(bool _useCustomAdapterParams);\n\n function __ONFT1155CoreUpgradeable_init(address _lzEndpoint) internal onlyInitializing {\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n }\n\n function __ONFT1155CoreUpgradeable_init_unchained() internal onlyInitializing {}\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IONFT1155CoreUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n uint _amount,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _useZro, _adapterParams);\n }\n\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _sendBatch(\n _from,\n _dstChainId,\n _toAddress,\n _toSingletonArray(_tokenId),\n _toSingletonArray(_amount),\n _refundAddress,\n _zroPaymentAddress,\n _adapterParams\n );\n }\n\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _sendBatch(_from, _dstChainId, _toAddress, _tokenIds, _amounts, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _sendBatch(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual {\n _debitFrom(_from, _dstChainId, _toAddress, _tokenIds, _amounts);\n bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts);\n if (_tokenIds.length == 1) {\n if (useCustomAdapterParams) {\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, NO_EXTRA_GAS);\n } else {\n require(_adapterParams.length == 0, \"LzApp: _adapterParams must be empty.\");\n }\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds[0], _amounts[0]);\n } else if (_tokenIds.length > 1) {\n if (useCustomAdapterParams) {\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND_BATCH, _adapterParams, NO_EXTRA_GAS);\n } else {\n require(_adapterParams.length == 0, \"LzApp: _adapterParams must be empty.\");\n }\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendBatchToChain(_dstChainId, _from, _toAddress, _tokenIds, _amounts);\n }\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 /*_nonce*/,\n bytes memory _payload\n ) internal virtual override {\n // decode and load the toAddress\n (bytes memory toAddressBytes, uint[] memory tokenIds, uint[] memory amounts) = abi.decode(_payload, (bytes, uint[], uint[]));\n address toAddress;\n assembly {\n toAddress := mload(add(toAddressBytes, 20))\n }\n\n _creditTo(_srcChainId, toAddress, tokenIds, amounts);\n\n if (tokenIds.length == 1) {\n emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds[0], amounts[0]);\n } else if (tokenIds.length > 1) {\n emit ReceiveBatchFromChain(_srcChainId, _srcAddress, toAddress, tokenIds, amounts);\n }\n }\n\n function setUseCustomAdapterParams(bool _useCustomAdapterParams) external onlyOwner {\n useCustomAdapterParams = _useCustomAdapterParams;\n emit SetUseCustomAdapterParams(_useCustomAdapterParams);\n }\n\n function _debitFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual;\n\n function _creditTo(uint16 _srcChainId, address _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual;\n\n function _toSingletonArray(uint element) internal pure returns (uint[] memory) {\n uint[] memory array = new uint[](1);\n array[0] = element;\n return array;\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 uint[49] private __gap;\n}\n" + }, + "contracts/contracts-upgradable/token/onft1155/interfaces/IONFT1155CoreUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Interface of the ONFT Core standard\n */\ninterface IONFT1155CoreUpgradeable is IERC165Upgradeable {\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint _tokenId, uint _amount);\n event SendBatchToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds, uint[] _amounts);\n event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint _tokenId, uint _amount);\n event ReceiveBatchFromChain(\n uint16 indexed _srcChainId,\n bytes indexed _srcAddress,\n address indexed _toAddress,\n uint[] _tokenIds,\n uint[] _amounts\n );\n\n // _from - address where tokens should be deducted from on behalf of\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenId - token Id to transfer\n // _amount - amount of the tokens to transfer\n // _refundAddress - address on src that will receive refund for any overpayment of L0 fees\n // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n // _from - address where tokens should be deducted from on behalf of\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenIds - token Ids to transfer\n // _amounts - amounts of the tokens to transfer\n // _refundAddress - address on src that will receive refund for any overpayment of L0 fees\n // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n uint[] calldata _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenId - token Id to transfer\n // _amount - amount of the tokens to transfer\n // _useZro - indicates to use zro to pay L0 fees\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function estimateSendFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenIds - tokens Id to transfer\n // _amounts - amounts of the tokens to transfer\n // _useZro - indicates to use zro to pay L0 fees\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n uint[] calldata _amounts,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n}\n" + }, + "contracts/lzApp/NonblockingLzApp.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./LzApp.sol\";\nimport \"../libraries/ExcessivelySafeCall.sol\";\n\n/*\n * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel\n * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking\n * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress)\n */\nabstract contract NonblockingLzApp is LzApp {\n using ExcessivelySafeCall for address;\n\n constructor(address _endpoint) LzApp(_endpoint) {}\n\n mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages;\n\n event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason);\n event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash);\n\n // overriding the virtual function in LzReceiver\n function _blockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual override {\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\n gasleft(),\n 150,\n abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)\n );\n if (!success) {\n _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason);\n }\n }\n\n function _storeFailedMessage(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload,\n bytes memory _reason\n ) internal virtual {\n failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload);\n emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason);\n }\n\n function nonblockingLzReceive(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes calldata _payload\n ) public virtual {\n // only internal transaction\n require(_msgSender() == address(this), \"NonblockingLzApp: caller must be LzApp\");\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n }\n\n //@notice override this function\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual;\n\n function retryMessage(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes calldata _payload\n ) public payable virtual {\n // assert there is message to retry\n bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce];\n require(payloadHash != bytes32(0), \"NonblockingLzApp: no stored message\");\n require(keccak256(_payload) == payloadHash, \"NonblockingLzApp: invalid payload\");\n // clear the stored message\n failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0);\n // execute the message. revert if it fails again\n _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash);\n }\n}\n" + }, + "contracts/lzApp/LzApp.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./interfaces/ILayerZeroReceiver.sol\";\nimport \"./interfaces/ILayerZeroUserApplicationConfig.sol\";\nimport \"./interfaces/ILayerZeroEndpoint.sol\";\nimport \"../libraries/BytesLib.sol\";\n\n/*\n * a generic LzReceiver implementation\n */\nabstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig {\n using BytesLib for bytes;\n\n // ua can not send payload larger than this by default, but it can be changed by the ua owner\n uint public constant DEFAULT_PAYLOAD_SIZE_LIMIT = 10000;\n\n ILayerZeroEndpoint public immutable lzEndpoint;\n mapping(uint16 => bytes) public trustedRemoteLookup;\n mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup;\n mapping(uint16 => uint) public payloadSizeLimitLookup;\n address public precrime;\n\n event SetPrecrime(address precrime);\n event SetTrustedRemote(uint16 _remoteChainId, bytes _path);\n event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress);\n event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas);\n\n constructor(address _endpoint) {\n lzEndpoint = ILayerZeroEndpoint(_endpoint);\n }\n\n function lzReceive(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes calldata _payload\n ) public virtual override {\n // lzReceive must be called by the endpoint for security\n require(_msgSender() == address(lzEndpoint), \"LzApp: invalid endpoint caller\");\n\n bytes memory trustedRemote = trustedRemoteLookup[_srcChainId];\n // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.\n require(\n _srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote),\n \"LzApp: invalid source sending contract\"\n );\n\n _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n }\n\n // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging\n function _blockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual;\n\n function _lzSend(\n uint16 _dstChainId,\n bytes memory _payload,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams,\n uint _nativeFee\n ) internal virtual {\n bytes memory trustedRemote = trustedRemoteLookup[_dstChainId];\n require(trustedRemote.length != 0, \"LzApp: destination chain is not a trusted source\");\n _checkPayloadSize(_dstChainId, _payload.length);\n lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _checkGasLimit(\n uint16 _dstChainId,\n uint16 _type,\n bytes memory _adapterParams,\n uint _extraGas\n ) internal view virtual {\n uint providedGasLimit = _getGasLimit(_adapterParams);\n uint minGasLimit = minDstGasLookup[_dstChainId][_type];\n require(minGasLimit > 0, \"LzApp: minGasLimit not set\");\n require(providedGasLimit >= minGasLimit + _extraGas, \"LzApp: gas limit is too low\");\n }\n\n function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) {\n require(_adapterParams.length >= 34, \"LzApp: invalid adapterParams\");\n assembly {\n gasLimit := mload(add(_adapterParams, 34))\n }\n }\n\n function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual {\n uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId];\n if (payloadSizeLimit == 0) {\n // use default if not set\n payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT;\n }\n require(_payloadSize <= payloadSizeLimit, \"LzApp: payload size is too large\");\n }\n\n //---------------------------UserApplication config----------------------------------------\n function getConfig(\n uint16 _version,\n uint16 _chainId,\n address,\n uint _configType\n ) external view returns (bytes memory) {\n return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);\n }\n\n // generic config for LayerZero user Application\n function setConfig(\n uint16 _version,\n uint16 _chainId,\n uint _configType,\n bytes calldata _config\n ) external override onlyOwner {\n lzEndpoint.setConfig(_version, _chainId, _configType, _config);\n }\n\n function setSendVersion(uint16 _version) external override onlyOwner {\n lzEndpoint.setSendVersion(_version);\n }\n\n function setReceiveVersion(uint16 _version) external override onlyOwner {\n lzEndpoint.setReceiveVersion(_version);\n }\n\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner {\n lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress);\n }\n\n // _path = abi.encodePacked(remoteAddress, localAddress)\n // this function set the trusted path for the cross-chain communication\n function setTrustedRemote(uint16 _remoteChainId, bytes calldata _path) external onlyOwner {\n trustedRemoteLookup[_remoteChainId] = _path;\n emit SetTrustedRemote(_remoteChainId, _path);\n }\n\n function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner {\n trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this));\n emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress);\n }\n\n function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) {\n bytes memory path = trustedRemoteLookup[_remoteChainId];\n require(path.length != 0, \"LzApp: no trusted path record\");\n return path.slice(0, path.length - 20); // the last 20 bytes should be address(this)\n }\n\n function setPrecrime(address _precrime) external onlyOwner {\n precrime = _precrime;\n emit SetPrecrime(_precrime);\n }\n\n function setMinDstGas(\n uint16 _dstChainId,\n uint16 _packetType,\n uint _minGas\n ) external onlyOwner {\n minDstGasLookup[_dstChainId][_packetType] = _minGas;\n emit SetMinDstGas(_dstChainId, _packetType, _minGas);\n }\n\n // if the size is 0, it means default size limit\n function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner {\n payloadSizeLimitLookup[_dstChainId] = _size;\n }\n\n //--------------------------- VIEW FUNCTION ----------------------------------------\n function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) {\n bytes memory trustedSource = trustedRemoteLookup[_srcChainId];\n return keccak256(trustedSource) == keccak256(_srcAddress);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.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 Ownable is Context {\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 constructor() {\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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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" + }, + "contracts/lzApp/interfaces/ILayerZeroReceiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface ILayerZeroReceiver {\n // @notice LayerZero endpoint will invoke this function to deliver the message on the destination\n // @param _srcChainId - the source endpoint identifier\n // @param _srcAddress - the source sending contract address from the source chain\n // @param _nonce - the ordered message nonce\n // @param _payload - the signed payload is the UA bytes has encoded to be sent\n function lzReceive(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes calldata _payload\n ) external;\n}\n" + }, + "contracts/lzApp/interfaces/ILayerZeroUserApplicationConfig.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface ILayerZeroUserApplicationConfig {\n // @notice set the configuration of the LayerZero messaging library of the specified version\n // @param _version - messaging library version\n // @param _chainId - the chainId for the pending config change\n // @param _configType - type of configuration. every messaging library has its own convention.\n // @param _config - configuration in the bytes. can encode arbitrary content.\n function setConfig(\n uint16 _version,\n uint16 _chainId,\n uint _configType,\n bytes calldata _config\n ) external;\n\n // @notice set the send() LayerZero messaging library version to _version\n // @param _version - new messaging library version\n function setSendVersion(uint16 _version) external;\n\n // @notice set the lzReceive() LayerZero messaging library version to _version\n // @param _version - new messaging library version\n function setReceiveVersion(uint16 _version) external;\n\n // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload\n // @param _srcChainId - the chainId of the source chain\n // @param _srcAddress - the contract address of the source contract at the source chain\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;\n}\n" + }, + "contracts/lzApp/interfaces/ILayerZeroEndpoint.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./ILayerZeroUserApplicationConfig.sol\";\n\ninterface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig {\n // @notice send a LayerZero message to the specified address at a LayerZero endpoint.\n // @param _dstChainId - the destination chain identifier\n // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains\n // @param _payload - a custom bytes payload to send to the destination contract\n // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address\n // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction\n // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination\n function send(\n uint16 _dstChainId,\n bytes calldata _destination,\n bytes calldata _payload,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n // @notice used by the messaging library to publish verified payload\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source contract (as bytes) at the source chain\n // @param _dstAddress - the address on destination chain\n // @param _nonce - the unbound message ordering nonce\n // @param _gasLimit - the gas limit for external contract execution\n // @param _payload - verified payload to send to the destination contract\n function receivePayload(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n address _dstAddress,\n uint64 _nonce,\n uint _gasLimit,\n bytes calldata _payload\n ) external;\n\n // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);\n\n // @notice get the outboundNonce from this source chain which, consequently, is always an EVM\n // @param _srcAddress - the source chain contract address\n function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);\n\n // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery\n // @param _dstChainId - the destination chain identifier\n // @param _userApplication - the user app address on this EVM chain\n // @param _payload - the custom message to send over LayerZero\n // @param _payInZRO - if false, user app pays the protocol fee in native token\n // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain\n function estimateFees(\n uint16 _dstChainId,\n address _userApplication,\n bytes calldata _payload,\n bool _payInZRO,\n bytes calldata _adapterParam\n ) external view returns (uint nativeFee, uint zroFee);\n\n // @notice get this Endpoint's immutable source identifier\n function getChainId() external view returns (uint16);\n\n // @notice the interface to retry failed message on this Endpoint destination\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n // @param _payload - the payload to be retried\n function retryPayload(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n bytes calldata _payload\n ) external;\n\n // @notice query if any STORED payload (message blocking) at the endpoint.\n // @param _srcChainId - the source chain identifier\n // @param _srcAddress - the source chain contract address\n function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);\n\n // @notice query if the _libraryAddress is valid for sending msgs.\n // @param _userApplication - the user app address on this EVM chain\n function getSendLibraryAddress(address _userApplication) external view returns (address);\n\n // @notice query if the _libraryAddress is valid for receiving msgs.\n // @param _userApplication - the user app address on this EVM chain\n function getReceiveLibraryAddress(address _userApplication) external view returns (address);\n\n // @notice query if the non-reentrancy guard for send() is on\n // @return true if the guard is on. false otherwise\n function isSendingPayload() external view returns (bool);\n\n // @notice query if the non-reentrancy guard for receive() is on\n // @return true if the guard is on. false otherwise\n function isReceivingPayload() external view returns (bool);\n\n // @notice get the configuration of the LayerZero messaging library of the specified version\n // @param _version - messaging library version\n // @param _chainId - the chainId for the pending config change\n // @param _userApplication - the contract address of the user application\n // @param _configType - type of configuration. every messaging library has its own convention.\n function getConfig(\n uint16 _version,\n uint16 _chainId,\n address _userApplication,\n uint _configType\n ) external view returns (bytes memory);\n\n // @notice get the send() LayerZero messaging library version\n // @param _userApplication - the contract address of the user application\n function getSendVersion(address _userApplication) external view returns (uint16);\n\n // @notice get the lzReceive() LayerZero messaging library version\n // @param _userApplication - the contract address of the user application\n function getReceiveVersion(address _userApplication) external view returns (uint16);\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" + }, + "contracts/token/onft721/ONFT721Core.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT721Core.sol\";\nimport \"../../lzApp/NonblockingLzApp.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\nabstract contract ONFT721Core is NonblockingLzApp, ERC165, ReentrancyGuard, IONFT721Core {\n uint16 public constant FUNCTION_TYPE_SEND = 1;\n\n struct StoredCredit {\n uint16 srcChainId;\n address toAddress;\n uint index; // which index of the tokenIds remain\n bool creditsRemain;\n }\n\n uint public minGasToTransferAndStore; // min amount of gas required to transfer, and also store the payload\n mapping(uint16 => uint) public dstChainIdToBatchLimit;\n mapping(uint16 => uint) public dstChainIdToTransferGas; // per transfer amount of gas required to mint/transfer on the dst\n mapping(bytes32 => StoredCredit) public storedCredits;\n\n constructor(uint _minGasToTransferAndStore, address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {\n require(_minGasToTransferAndStore > 0, \"minGasToTransferAndStore must be > 0\");\n minGasToTransferAndStore = _minGasToTransferAndStore;\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IONFT721Core).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _useZro, _adapterParams);\n }\n\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n bytes memory payload = abi.encode(_toAddress, _tokenIds);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _tokenIds, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual {\n // allow 1 by default\n require(_tokenIds.length > 0, \"tokenIds[] is empty\");\n require(_tokenIds.length == 1 || _tokenIds.length <= dstChainIdToBatchLimit[_dstChainId], \"batch size exceeds dst batch limit\");\n\n for (uint i = 0; i < _tokenIds.length; i++) {\n _debitFrom(_from, _dstChainId, _toAddress, _tokenIds[i]);\n }\n\n bytes memory payload = abi.encode(_toAddress, _tokenIds);\n\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, dstChainIdToTransferGas[_dstChainId] * _tokenIds.length);\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds);\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64, /*_nonce*/\n bytes memory _payload\n ) internal virtual override {\n // decode and load the toAddress\n (bytes memory toAddressBytes, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[]));\n\n address toAddress;\n assembly {\n toAddress := mload(add(toAddressBytes, 20))\n }\n\n uint nextIndex = _creditTill(_srcChainId, toAddress, 0, tokenIds);\n if (nextIndex < tokenIds.length) {\n // not enough gas to complete transfers, store to be cleared in another tx\n bytes32 hashedPayload = keccak256(_payload);\n storedCredits[hashedPayload] = StoredCredit(_srcChainId, toAddress, nextIndex, true);\n emit CreditStored(hashedPayload, _payload);\n }\n\n emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds);\n }\n\n // Public function for anyone to clear and deliver the remaining batch sent tokenIds\n function clearCredits(bytes memory _payload) external virtual nonReentrant {\n bytes32 hashedPayload = keccak256(_payload);\n require(storedCredits[hashedPayload].creditsRemain, \"no credits stored\");\n\n (, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[]));\n\n uint nextIndex = _creditTill(\n storedCredits[hashedPayload].srcChainId,\n storedCredits[hashedPayload].toAddress,\n storedCredits[hashedPayload].index,\n tokenIds\n );\n require(nextIndex > storedCredits[hashedPayload].index, \"not enough gas to process credit transfer\");\n\n if (nextIndex == tokenIds.length) {\n // cleared the credits, delete the element\n delete storedCredits[hashedPayload];\n emit CreditCleared(hashedPayload);\n } else {\n // store the next index to mint\n storedCredits[hashedPayload] = StoredCredit(\n storedCredits[hashedPayload].srcChainId,\n storedCredits[hashedPayload].toAddress,\n nextIndex,\n true\n );\n }\n }\n\n // When a srcChain has the ability to transfer more chainIds in a single tx than the dst can do.\n // Needs the ability to iterate and stop if the minGasToTransferAndStore is not met\n function _creditTill(\n uint16 _srcChainId,\n address _toAddress,\n uint _startIndex,\n uint[] memory _tokenIds\n ) internal returns (uint) {\n uint i = _startIndex;\n while (i < _tokenIds.length) {\n // if not enough gas to process, store this index for next loop\n if (gasleft() < minGasToTransferAndStore) break;\n\n _creditTo(_srcChainId, _toAddress, _tokenIds[i]);\n i++;\n }\n\n // indicates the next index to send of tokenIds,\n // if i == tokenIds.length, we are finished\n return i;\n }\n\n function setMinGasToTransferAndStore(uint _minGasToTransferAndStore) external onlyOwner {\n require(_minGasToTransferAndStore > 0, \"minGasToTransferAndStore must be > 0\");\n minGasToTransferAndStore = _minGasToTransferAndStore;\n emit SetMinGasToTransferAndStore(_minGasToTransferAndStore);\n }\n\n // ensures enough gas in adapter params to handle batch transfer gas amounts on the dst\n function setDstChainIdToTransferGas(uint16 _dstChainId, uint _dstChainIdToTransferGas) external onlyOwner {\n require(_dstChainIdToTransferGas > 0, \"dstChainIdToTransferGas must be > 0\");\n dstChainIdToTransferGas[_dstChainId] = _dstChainIdToTransferGas;\n emit SetDstChainIdToTransferGas(_dstChainId, _dstChainIdToTransferGas);\n }\n\n // limit on src the amount of tokens to batch send\n function setDstChainIdToBatchLimit(uint16 _dstChainId, uint _dstChainIdToBatchLimit) external onlyOwner {\n require(_dstChainIdToBatchLimit > 0, \"dstChainIdToBatchLimit must be > 0\");\n dstChainIdToBatchLimit[_dstChainId] = _dstChainIdToBatchLimit;\n emit SetDstChainIdToBatchLimit(_dstChainId, _dstChainIdToBatchLimit);\n }\n\n function _debitFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId\n ) internal virtual;\n\n function _creditTo(\n uint16 _srcChainId,\n address _toAddress,\n uint _tokenId\n ) internal virtual;\n\n function _toSingletonArray(uint element) internal pure returns (uint[] memory) {\n uint[] memory array = new uint[](1);\n array[0] = element;\n return array;\n }\n}\n" + }, + "contracts/token/onft721/interfaces/IONFT721Core.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface of the ONFT Core standard\n */\ninterface IONFT721Core is IERC165 {\n /**\n * @dev Emitted when `_tokenIds[]` are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\n * `_nonce` is the outbound nonce from\n */\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds);\n event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint[] _tokenIds);\n event SetMinGasToTransferAndStore(uint _minGasToTransferAndStore);\n event SetDstChainIdToTransferGas(uint16 _dstChainId, uint _dstChainIdToTransferGas);\n event SetDstChainIdToBatchLimit(uint16 _dstChainId, uint _dstChainIdToBatchLimit);\n\n /**\n * @dev Emitted when `_payload` was received from lz, but not enough gas to deliver all tokenIds\n */\n event CreditStored(bytes32 _hashedPayload, bytes _payload);\n /**\n * @dev Emitted when `_hashedPayload` has been completely delivered\n */\n event CreditCleared(bytes32 _hashedPayload);\n\n /**\n * @dev send token `_tokenId` to (`_dstChainId`, `_toAddress`) from `_from`\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n /**\n * @dev send tokens `_tokenIds[]` to (`_dstChainId`, `_toAddress`) from `_from`\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _tokenId - token Id to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _tokenIds[] - token Ids to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\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/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\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" + }, + "contracts/token/onft721/ProxyONFT721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\nimport \"./ONFT721Core.sol\";\n\ncontract ProxyONFT721 is ONFT721Core, IERC721Receiver {\n using ERC165Checker for address;\n\n IERC721 public immutable token;\n\n constructor(\n uint _minGasToTransfer,\n address _lzEndpoint,\n address _proxyToken\n ) ONFT721Core(_minGasToTransfer, _lzEndpoint) {\n require(_proxyToken.supportsInterface(type(IERC721).interfaceId), \"ProxyONFT721: invalid ERC721 token\");\n token = IERC721(_proxyToken);\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC721Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(\n address _from,\n uint16,\n bytes memory,\n uint _tokenId\n ) internal virtual override {\n require(_from == _msgSender(), \"ProxyONFT721: owner is not send caller\");\n token.safeTransferFrom(_from, address(this), _tokenId);\n }\n\n // TODO apply same changes from regular ONFT721\n function _creditTo(\n uint16,\n address _toAddress,\n uint _tokenId\n ) internal virtual override {\n token.safeTransferFrom(address(this), _toAddress, _tokenId);\n }\n\n function onERC721Received(\n address _operator,\n address,\n uint,\n bytes memory\n ) public virtual override returns (bytes4) {\n // only allow `this` to transfer token from others\n if (_operator != address(this)) return bytes4(0);\n return IERC721Receiver.onERC721Received.selector;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface.\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return\n supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&\n !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(\n address account,\n bytes4[] memory interfaceIds\n ) internal view returns (bool[] memory) {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n *\n * Some precompiled contracts will falsely indicate support for a given interface, so caution\n * should be exercised when using this function.\n *\n * Interface identification is specified in ERC-165.\n */\n function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {\n // prepare call\n bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);\n\n // perform static call\n bool success;\n uint256 returnSize;\n uint256 returnValue;\n assembly {\n success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n returnSize := returndatasize()\n returnValue := mload(0x00)\n }\n\n return success && returnSize >= 0x20 && returnValue > 0;\n }\n}\n" + }, + "contracts/token/onft721/ONFT721A.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"erc721a/contracts/ERC721A.sol\";\nimport \"erc721a/contracts/IERC721A.sol\";\nimport \"./interfaces/IONFT721.sol\";\nimport \"./ONFT721Core.sol\";\n\n// DISCLAIMER:\n// This contract can only be deployed on one chain and must be the first minter of each token id!\n// This is because ERC721A does not have the ability to mint a specific token id.\n// Other chains must have ONFT721 deployed.\n\n// NOTE: this ONFT contract has no public minting logic.\n// must implement your own minting logic in child contract\ncontract ONFT721A is ONFT721Core, ERC721A, ERC721A__IERC721Receiver {\n constructor(\n string memory _name,\n string memory _symbol,\n uint _minGasToTransferAndStore,\n address _lzEndpoint\n ) ERC721A(_name, _symbol) ONFT721Core(_minGasToTransferAndStore, _lzEndpoint) {}\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT721Core, ERC721A) returns (bool) {\n return interfaceId == type(IONFT721Core).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(\n address _from,\n uint16,\n bytes memory,\n uint _tokenId\n ) internal virtual override(ONFT721Core) {\n safeTransferFrom(_from, address(this), _tokenId);\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _tokenId\n ) internal virtual override(ONFT721Core) {\n require(_exists(_tokenId) && ERC721A.ownerOf(_tokenId) == address(this));\n safeTransferFrom(address(this), _toAddress, _tokenId);\n }\n\n function onERC721Received(\n address,\n address,\n uint,\n bytes memory\n ) public virtual override returns (bytes4) {\n return ERC721A__IERC721Receiver.onERC721Received.selector;\n }\n}\n" + }, + "erc721a/contracts/ERC721A.sol": { + "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport './IERC721A.sol';\n\n/**\n * @dev Interface of ERC721 token receiver.\n */\ninterface ERC721A__IERC721Receiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\n/**\n * @title ERC721A\n *\n * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)\n * Non-Fungible Token Standard, including the Metadata extension.\n * Optimized for lower gas during batch mints.\n *\n * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)\n * starting from `_startTokenId()`.\n *\n * Assumptions:\n *\n * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.\n * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).\n */\ncontract ERC721A is IERC721A {\n // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).\n struct TokenApprovalRef {\n address value;\n }\n\n // =============================================================\n // CONSTANTS\n // =============================================================\n\n // Mask of an entry in packed address data.\n uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;\n\n // The bit position of `numberMinted` in packed address data.\n uint256 private constant _BITPOS_NUMBER_MINTED = 64;\n\n // The bit position of `numberBurned` in packed address data.\n uint256 private constant _BITPOS_NUMBER_BURNED = 128;\n\n // The bit position of `aux` in packed address data.\n uint256 private constant _BITPOS_AUX = 192;\n\n // Mask of all 256 bits in packed address data except the 64 bits for `aux`.\n uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;\n\n // The bit position of `startTimestamp` in packed ownership.\n uint256 private constant _BITPOS_START_TIMESTAMP = 160;\n\n // The bit mask of the `burned` bit in packed ownership.\n uint256 private constant _BITMASK_BURNED = 1 << 224;\n\n // The bit position of the `nextInitialized` bit in packed ownership.\n uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;\n\n // The bit mask of the `nextInitialized` bit in packed ownership.\n uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;\n\n // The bit position of `extraData` in packed ownership.\n uint256 private constant _BITPOS_EXTRA_DATA = 232;\n\n // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.\n uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;\n\n // The mask of the lower 160 bits for addresses.\n uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;\n\n // The maximum `quantity` that can be minted with {_mintERC2309}.\n // This limit is to prevent overflows on the address data entries.\n // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}\n // is required to cause an overflow, which is unrealistic.\n uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;\n\n // The `Transfer` event signature is given by:\n // `keccak256(bytes(\"Transfer(address,address,uint256)\"))`.\n bytes32 private constant _TRANSFER_EVENT_SIGNATURE =\n 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;\n\n // =============================================================\n // STORAGE\n // =============================================================\n\n // The next token ID to be minted.\n uint256 private _currentIndex;\n\n // The number of tokens burned.\n uint256 private _burnCounter;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to ownership details\n // An empty struct value does not necessarily mean the token is unowned.\n // See {_packedOwnershipOf} implementation for details.\n //\n // Bits Layout:\n // - [0..159] `addr`\n // - [160..223] `startTimestamp`\n // - [224] `burned`\n // - [225] `nextInitialized`\n // - [232..255] `extraData`\n mapping(uint256 => uint256) private _packedOwnerships;\n\n // Mapping owner address to address data.\n //\n // Bits Layout:\n // - [0..63] `balance`\n // - [64..127] `numberMinted`\n // - [128..191] `numberBurned`\n // - [192..255] `aux`\n mapping(address => uint256) private _packedAddressData;\n\n // Mapping from token ID to approved address.\n mapping(uint256 => TokenApprovalRef) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // =============================================================\n // CONSTRUCTOR\n // =============================================================\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n _currentIndex = _startTokenId();\n }\n\n // =============================================================\n // TOKEN COUNTING OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the starting token ID.\n * To change the starting token ID, please override this function.\n */\n function _startTokenId() internal view virtual returns (uint256) {\n return 0;\n }\n\n /**\n * @dev Returns the next token ID to be minted.\n */\n function _nextTokenId() internal view virtual returns (uint256) {\n return _currentIndex;\n }\n\n /**\n * @dev Returns the total number of tokens in existence.\n * Burned tokens will reduce the count.\n * To get the total number of tokens minted, please see {_totalMinted}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n // Counter underflow is impossible as _burnCounter cannot be incremented\n // more than `_currentIndex - _startTokenId()` times.\n unchecked {\n return _currentIndex - _burnCounter - _startTokenId();\n }\n }\n\n /**\n * @dev Returns the total amount of tokens minted in the contract.\n */\n function _totalMinted() internal view virtual returns (uint256) {\n // Counter underflow is impossible as `_currentIndex` does not decrement,\n // and it is initialized to `_startTokenId()`.\n unchecked {\n return _currentIndex - _startTokenId();\n }\n }\n\n /**\n * @dev Returns the total number of tokens burned.\n */\n function _totalBurned() internal view virtual returns (uint256) {\n return _burnCounter;\n }\n\n // =============================================================\n // ADDRESS DATA OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the number of tokens in `owner`'s account.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n if (owner == address(0)) revert BalanceQueryForZeroAddress();\n return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the number of tokens minted by `owner`.\n */\n function _numberMinted(address owner) internal view returns (uint256) {\n return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the number of tokens burned by or on behalf of `owner`.\n */\n function _numberBurned(address owner) internal view returns (uint256) {\n return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n */\n function _getAux(address owner) internal view returns (uint64) {\n return uint64(_packedAddressData[owner] >> _BITPOS_AUX);\n }\n\n /**\n * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n * If there are multiple variables, please pack them into a uint64.\n */\n function _setAux(address owner, uint64 aux) internal virtual {\n uint256 packed = _packedAddressData[owner];\n uint256 auxCasted;\n // Cast `aux` with assembly to avoid redundant masking.\n assembly {\n auxCasted := aux\n }\n packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);\n _packedAddressData[owner] = packed;\n }\n\n // =============================================================\n // IERC165\n // =============================================================\n\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30000 gas.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n // The interface IDs are constants representing the first 4 bytes\n // of the XOR of all function selectors in the interface.\n // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)\n // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)\n return\n interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.\n interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.\n interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.\n }\n\n // =============================================================\n // IERC721Metadata\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 Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n if (!_exists(tokenId)) revert URIQueryForNonexistentToken();\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, it can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return '';\n }\n\n // =============================================================\n // OWNERSHIPS OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n return address(uint160(_packedOwnershipOf(tokenId)));\n }\n\n /**\n * @dev Gas spent here starts off proportional to the maximum mint batch size.\n * It gradually moves to O(1) as tokens get transferred around over time.\n */\n function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnershipOf(tokenId));\n }\n\n /**\n * @dev Returns the unpacked `TokenOwnership` struct at `index`.\n */\n function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnerships[index]);\n }\n\n /**\n * @dev Initializes the ownership slot minted at `index` for efficiency purposes.\n */\n function _initializeOwnershipAt(uint256 index) internal virtual {\n if (_packedOwnerships[index] == 0) {\n _packedOwnerships[index] = _packedOwnershipOf(index);\n }\n }\n\n /**\n * Returns the packed ownership data of `tokenId`.\n */\n function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {\n uint256 curr = tokenId;\n\n unchecked {\n if (_startTokenId() <= curr)\n if (curr < _currentIndex) {\n uint256 packed = _packedOwnerships[curr];\n // If not burned.\n if (packed & _BITMASK_BURNED == 0) {\n // Invariant:\n // There will always be an initialized ownership slot\n // (i.e. `ownership.addr != address(0) && ownership.burned == false`)\n // before an unintialized ownership slot\n // (i.e. `ownership.addr == address(0) && ownership.burned == false`)\n // Hence, `curr` will not underflow.\n //\n // We can directly compare the packed value.\n // If the address is zero, packed will be zero.\n while (packed == 0) {\n packed = _packedOwnerships[--curr];\n }\n return packed;\n }\n }\n }\n revert OwnerQueryForNonexistentToken();\n }\n\n /**\n * @dev Returns the unpacked `TokenOwnership` struct from `packed`.\n */\n function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {\n ownership.addr = address(uint160(packed));\n ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);\n ownership.burned = packed & _BITMASK_BURNED != 0;\n ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);\n }\n\n /**\n * @dev Packs ownership data into a single uint256.\n */\n function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {\n assembly {\n // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n owner := and(owner, _BITMASK_ADDRESS)\n // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.\n result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))\n }\n }\n\n /**\n * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.\n */\n function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {\n // For branchless setting of the `nextInitialized` flag.\n assembly {\n // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.\n result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))\n }\n }\n\n // =============================================================\n // APPROVAL OPERATIONS\n // =============================================================\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the\n * zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) public payable virtual override {\n address owner = ownerOf(tokenId);\n\n if (_msgSenderERC721A() != owner)\n if (!isApprovedForAll(owner, _msgSenderERC721A())) {\n revert ApprovalCallerNotOwnerNorApproved();\n }\n\n _tokenApprovals[tokenId].value = to;\n emit Approval(owner, to, tokenId);\n }\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();\n\n return _tokenApprovals[tokenId].value;\n }\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom}\n * for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _operatorApprovals[_msgSenderERC721A()][operator] = approved;\n emit ApprovalForAll(_msgSenderERC721A(), operator, approved);\n }\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted. See {_mint}.\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return\n _startTokenId() <= tokenId &&\n tokenId < _currentIndex && // If within bounds,\n _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.\n }\n\n /**\n * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.\n */\n function _isSenderApprovedOrOwner(\n address approvedAddress,\n address owner,\n address msgSender\n ) private pure returns (bool result) {\n assembly {\n // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n owner := and(owner, _BITMASK_ADDRESS)\n // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.\n msgSender := and(msgSender, _BITMASK_ADDRESS)\n // `msgSender == owner || msgSender == approvedAddress`.\n result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))\n }\n }\n\n /**\n * @dev Returns the storage slot and value for the approved address of `tokenId`.\n */\n function _getApprovedSlotAndAddress(uint256 tokenId)\n private\n view\n returns (uint256 approvedAddressSlot, address approvedAddress)\n {\n TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];\n // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.\n assembly {\n approvedAddressSlot := tokenApproval.slot\n approvedAddress := sload(approvedAddressSlot)\n }\n }\n\n // =============================================================\n // TRANSFER OPERATIONS\n // =============================================================\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token\n * by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public payable virtual override {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();\n\n (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);\n\n // The nested ifs save around 20+ gas over a compound boolean condition.\n if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))\n if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();\n\n if (to == address(0)) revert TransferToZeroAddress();\n\n _beforeTokenTransfers(from, to, tokenId, 1);\n\n // Clear approvals from the previous owner.\n assembly {\n if approvedAddress {\n // This is equivalent to `delete _tokenApprovals[tokenId]`.\n sstore(approvedAddressSlot, 0)\n }\n }\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n unchecked {\n // We can directly increment and decrement the balances.\n --_packedAddressData[from]; // Updates: `balance -= 1`.\n ++_packedAddressData[to]; // Updates: `balance += 1`.\n\n // Updates:\n // - `address` to the next owner.\n // - `startTimestamp` to the timestamp of transfering.\n // - `burned` to `false`.\n // - `nextInitialized` to `true`.\n _packedOwnerships[tokenId] = _packOwnershipData(\n to,\n _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)\n );\n\n // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n // If the next slot's address is zero and not burned (i.e. packed value is zero).\n if (_packedOwnerships[nextTokenId] == 0) {\n // If the next slot is within bounds.\n if (nextTokenId != _currentIndex) {\n // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, to, tokenId);\n _afterTokenTransfers(from, to, tokenId, 1);\n }\n\n /**\n * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\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 /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token\n * by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public payable virtual override {\n transferFrom(from, to, tokenId);\n if (to.code.length != 0)\n if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n }\n\n /**\n * @dev Hook that is called before a set of serially-ordered token IDs\n * are about to be transferred. This includes minting.\n * And also called before burning one token.\n *\n * `startTokenId` - the first token ID to be transferred.\n * `quantity` - the amount to be transferred.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, `tokenId` will be burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _beforeTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after a set of serially-ordered token IDs\n * have been transferred. This includes minting.\n * And also called after one token has been burned.\n *\n * `startTokenId` - the first token ID to be transferred.\n * `quantity` - the amount to be transferred.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been\n * transferred to `to`.\n * - When `from` is zero, `tokenId` has been minted for `to`.\n * - When `to` is zero, `tokenId` has been burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _afterTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n /**\n * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.\n *\n * `from` - Previous owner of the given token ID.\n * `to` - Target address that will receive the token.\n * `tokenId` - Token ID to be transferred.\n * `_data` - Optional data to send along with the call.\n *\n * Returns whether the call correctly returned the expected magic value.\n */\n function _checkContractOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (\n bytes4 retval\n ) {\n return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert TransferToNonERC721ReceiverImplementer();\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n\n // =============================================================\n // MINT OPERATIONS\n // =============================================================\n\n /**\n * @dev Mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `quantity` must be greater than 0.\n *\n * Emits a {Transfer} event for each mint.\n */\n function _mint(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n if (quantity == 0) revert MintZeroQuantity();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are incredibly unrealistic.\n // `balance` and `numberMinted` have a maximum limit of 2**64.\n // `tokenId` has a maximum limit of 2**256.\n unchecked {\n // Updates:\n // - `balance += quantity`.\n // - `numberMinted += quantity`.\n //\n // We can directly add to the `balance` and `numberMinted`.\n _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n // Updates:\n // - `address` to the owner.\n // - `startTimestamp` to the timestamp of minting.\n // - `burned` to `false`.\n // - `nextInitialized` to `quantity == 1`.\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)\n );\n\n uint256 toMasked;\n uint256 end = startTokenId + quantity;\n\n // Use assembly to loop and emit the `Transfer` event for gas savings.\n // The duplicated `log4` removes an extra check and reduces stack juggling.\n // The assembly, together with the surrounding Solidity code, have been\n // delicately arranged to nudge the compiler into producing optimized opcodes.\n assembly {\n // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.\n toMasked := and(to, _BITMASK_ADDRESS)\n // Emit the `Transfer` event.\n log4(\n 0, // Start of data (0, since no data).\n 0, // End of data (0, since no data).\n _TRANSFER_EVENT_SIGNATURE, // Signature.\n 0, // `address(0)`.\n toMasked, // `to`.\n startTokenId // `tokenId`.\n )\n\n // The `iszero(eq(,))` check ensures that large values of `quantity`\n // that overflows uint256 will make the loop run out of gas.\n // The compiler will optimize the `iszero` away for performance.\n for {\n let tokenId := add(startTokenId, 1)\n } iszero(eq(tokenId, end)) {\n tokenId := add(tokenId, 1)\n } {\n // Emit the `Transfer` event. Similar to above.\n log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)\n }\n }\n if (toMasked == 0) revert MintToZeroAddress();\n\n _currentIndex = end;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Mints `quantity` tokens and transfers them to `to`.\n *\n * This function is intended for efficient minting only during contract creation.\n *\n * It emits only one {ConsecutiveTransfer} as defined in\n * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),\n * instead of a sequence of {Transfer} event(s).\n *\n * Calling this function outside of contract creation WILL make your contract\n * non-compliant with the ERC721 standard.\n * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309\n * {ConsecutiveTransfer} event is only permissible during contract creation.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `quantity` must be greater than 0.\n *\n * Emits a {ConsecutiveTransfer} event.\n */\n function _mintERC2309(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n if (to == address(0)) revert MintToZeroAddress();\n if (quantity == 0) revert MintZeroQuantity();\n if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are unrealistic due to the above check for `quantity` to be below the limit.\n unchecked {\n // Updates:\n // - `balance += quantity`.\n // - `numberMinted += quantity`.\n //\n // We can directly add to the `balance` and `numberMinted`.\n _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n // Updates:\n // - `address` to the owner.\n // - `startTimestamp` to the timestamp of minting.\n // - `burned` to `false`.\n // - `nextInitialized` to `quantity == 1`.\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)\n );\n\n emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);\n\n _currentIndex = startTokenId + quantity;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Safely mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.\n * - `quantity` must be greater than 0.\n *\n * See {_mint}.\n *\n * Emits a {Transfer} event for each mint.\n */\n function _safeMint(\n address to,\n uint256 quantity,\n bytes memory _data\n ) internal virtual {\n _mint(to, quantity);\n\n unchecked {\n if (to.code.length != 0) {\n uint256 end = _currentIndex;\n uint256 index = end - quantity;\n do {\n if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n } while (index < end);\n // Reentrancy protection.\n if (_currentIndex != end) revert();\n }\n }\n }\n\n /**\n * @dev Equivalent to `_safeMint(to, quantity, '')`.\n */\n function _safeMint(address to, uint256 quantity) internal virtual {\n _safeMint(to, quantity, '');\n }\n\n // =============================================================\n // BURN OPERATIONS\n // =============================================================\n\n /**\n * @dev Equivalent to `_burn(tokenId, false)`.\n */\n function _burn(uint256 tokenId) internal virtual {\n _burn(tokenId, false);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId, bool approvalCheck) internal virtual {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n address from = address(uint160(prevOwnershipPacked));\n\n (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);\n\n if (approvalCheck) {\n // The nested ifs save around 20+ gas over a compound boolean condition.\n if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))\n if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();\n }\n\n _beforeTokenTransfers(from, address(0), tokenId, 1);\n\n // Clear approvals from the previous owner.\n assembly {\n if approvedAddress {\n // This is equivalent to `delete _tokenApprovals[tokenId]`.\n sstore(approvedAddressSlot, 0)\n }\n }\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n unchecked {\n // Updates:\n // - `balance -= 1`.\n // - `numberBurned += 1`.\n //\n // We can directly decrement the balance, and increment the number burned.\n // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.\n _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;\n\n // Updates:\n // - `address` to the last owner.\n // - `startTimestamp` to the timestamp of burning.\n // - `burned` to `true`.\n // - `nextInitialized` to `true`.\n _packedOwnerships[tokenId] = _packOwnershipData(\n from,\n (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)\n );\n\n // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n // If the next slot's address is zero and not burned (i.e. packed value is zero).\n if (_packedOwnerships[nextTokenId] == 0) {\n // If the next slot is within bounds.\n if (nextTokenId != _currentIndex) {\n // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, address(0), tokenId);\n _afterTokenTransfers(from, address(0), tokenId, 1);\n\n // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.\n unchecked {\n _burnCounter++;\n }\n }\n\n // =============================================================\n // EXTRA DATA OPERATIONS\n // =============================================================\n\n /**\n * @dev Directly sets the extra data for the ownership data `index`.\n */\n function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {\n uint256 packed = _packedOwnerships[index];\n if (packed == 0) revert OwnershipNotInitializedForExtraData();\n uint256 extraDataCasted;\n // Cast `extraData` with assembly to avoid redundant masking.\n assembly {\n extraDataCasted := extraData\n }\n packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);\n _packedOwnerships[index] = packed;\n }\n\n /**\n * @dev Called during each token transfer to set the 24bit `extraData` field.\n * Intended to be overridden by the cosumer contract.\n *\n * `previousExtraData` - the value of `extraData` before transfer.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, `tokenId` will be burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _extraData(\n address from,\n address to,\n uint24 previousExtraData\n ) internal view virtual returns (uint24) {}\n\n /**\n * @dev Returns the next extra data for the packed ownership data.\n * The returned result is shifted into position.\n */\n function _nextExtraData(\n address from,\n address to,\n uint256 prevOwnershipPacked\n ) private view returns (uint256) {\n uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);\n return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;\n }\n\n // =============================================================\n // OTHER OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the message sender (defaults to `msg.sender`).\n *\n * If you are writing GSN compatible contracts, you need to override this function.\n */\n function _msgSenderERC721A() internal view virtual returns (address) {\n return msg.sender;\n }\n\n /**\n * @dev Converts a uint256 to its ASCII string decimal representation.\n */\n function _toString(uint256 value) internal pure virtual returns (string memory str) {\n assembly {\n // The maximum value of a uint256 contains 78 digits (1 byte per digit), but\n // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.\n // We will need 1 word for the trailing zeros padding, 1 word for the length,\n // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.\n let m := add(mload(0x40), 0xa0)\n // Update the free memory pointer to allocate.\n mstore(0x40, m)\n // Assign the `str` to the end.\n str := sub(m, 0x20)\n // Zeroize the slot after the string.\n mstore(str, 0)\n\n // Cache the end of the memory to calculate the length later.\n let end := str\n\n // We write the string from rightmost digit to leftmost digit.\n // The following is essentially a do-while loop that also handles the zero case.\n // prettier-ignore\n for { let temp := value } 1 {} {\n str := sub(str, 1)\n // Write the character to the pointer.\n // The ASCII index of the '0' character is 48.\n mstore8(str, add(48, mod(temp, 10)))\n // Keep dividing `temp` until zero.\n temp := div(temp, 10)\n // prettier-ignore\n if iszero(temp) { break }\n }\n\n let length := sub(end, str)\n // Move the pointer 32 bytes leftwards to make room for the length.\n str := sub(str, 0x20)\n // Store the length.\n mstore(str, length)\n }\n }\n}\n" + }, + "erc721a/contracts/IERC721A.sol": { + "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\n/**\n * @dev Interface of ERC721A.\n */\ninterface IERC721A {\n /**\n * The caller must own the token or be an approved operator.\n */\n error ApprovalCallerNotOwnerNorApproved();\n\n /**\n * The token does not exist.\n */\n error ApprovalQueryForNonexistentToken();\n\n /**\n * Cannot query the balance for the zero address.\n */\n error BalanceQueryForZeroAddress();\n\n /**\n * Cannot mint to the zero address.\n */\n error MintToZeroAddress();\n\n /**\n * The quantity of tokens minted must be more than zero.\n */\n error MintZeroQuantity();\n\n /**\n * The token does not exist.\n */\n error OwnerQueryForNonexistentToken();\n\n /**\n * The caller must own the token or be an approved operator.\n */\n error TransferCallerNotOwnerNorApproved();\n\n /**\n * The token must be owned by `from`.\n */\n error TransferFromIncorrectOwner();\n\n /**\n * Cannot safely transfer to a contract that does not implement the\n * ERC721Receiver interface.\n */\n error TransferToNonERC721ReceiverImplementer();\n\n /**\n * Cannot transfer to the zero address.\n */\n error TransferToZeroAddress();\n\n /**\n * The token does not exist.\n */\n error URIQueryForNonexistentToken();\n\n /**\n * The `quantity` minted with ERC2309 exceeds the safety limit.\n */\n error MintERC2309QuantityExceedsLimit();\n\n /**\n * The `extraData` cannot be set on an unintialized ownership slot.\n */\n error OwnershipNotInitializedForExtraData();\n\n // =============================================================\n // STRUCTS\n // =============================================================\n\n struct TokenOwnership {\n // The address of the owner.\n address addr;\n // Stores the start time of ownership with minimal overhead for tokenomics.\n uint64 startTimestamp;\n // Whether the token has been burned.\n bool burned;\n // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.\n uint24 extraData;\n }\n\n // =============================================================\n // TOKEN COUNTERS\n // =============================================================\n\n /**\n * @dev Returns the total number of tokens in existence.\n * Burned tokens will reduce the count.\n * To get the total number of tokens minted, please see {_totalMinted}.\n */\n function totalSupply() external view returns (uint256);\n\n // =============================================================\n // IERC165\n // =============================================================\n\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n\n // =============================================================\n // IERC721\n // =============================================================\n\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables\n * (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in `owner`'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`,\n * checking first that contract recipients are aware of the ERC721 protocol\n * to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move\n * this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external payable;\n\n /**\n * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external payable;\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom}\n * whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token\n * by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external payable;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the\n * zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external payable;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom}\n * for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n // =============================================================\n // IERC721Metadata\n // =============================================================\n\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n\n // =============================================================\n // IERC2309\n // =============================================================\n\n /**\n * @dev Emitted when tokens in `fromTokenId` to `toTokenId`\n * (inclusive) is transferred from `from` to `to`, as defined in the\n * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.\n *\n * See {_mintERC2309} for more details.\n */\n event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);\n}\n" + }, + "contracts/token/onft721/interfaces/IONFT721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./IONFT721Core.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/**\n * @dev Interface of the ONFT standard\n */\ninterface IONFT721 is IONFT721Core, IERC721 {\n\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.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 */\ninterface IERC721Enumerable is IERC721 {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"./IERC721Enumerable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721Enumerable is ERC721, IERC721Enumerable {\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {\n return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Enumerable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's 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 = ERC721.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\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 uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = 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" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\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 IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.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 /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.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 */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) 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/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.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 `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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 256, 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 << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "contracts/token/onft721/mocks/ERC721Mock.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\n\n// for mock purposes only, no limit on minting functionality\ncontract ERC721Mock is ERC721 {\n constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {}\n\n string public baseTokenURI;\n\n function mint(address to, uint tokenId) public {\n _safeMint(to, tokenId, \"\");\n }\n\n function transfer(address to, uint tokenId) public {\n _safeTransfer(msg.sender, to, tokenId, \"\");\n }\n\n function isApprovedOrOwner(address spender, uint tokenId) public view virtual returns (bool) {\n return _isApprovedOrOwner(spender, tokenId);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Royalty.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"../../common/ERC2981.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Extension of ERC721 with the ERC2981 NFT Royalty Standard, a standardized way to retrieve royalty payment\n * information.\n *\n * Royalty information can be specified globally for all token ids via {ERC2981-_setDefaultRoyalty}, and/or individually for\n * specific token ids via {ERC2981-_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC721Royalty is ERC2981, ERC721 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {ERC721-_burn}. This override additionally clears the royalty information for the token.\n */\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n _resetTokenRoyalty(tokenId);\n }\n}\n" + }, + "@openzeppelin/contracts/token/common/ERC2981.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/IERC2981.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.\n *\n * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for\n * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the\n * fee is specified in basis points by default.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n *\n * _Available since v4.5._\n */\nabstract contract ERC2981 is IERC2981, ERC165 {\n struct RoyaltyInfo {\n address receiver;\n uint96 royaltyFraction;\n }\n\n RoyaltyInfo private _defaultRoyaltyInfo;\n mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {\n return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @inheritdoc IERC2981\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) {\n RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];\n\n if (royalty.receiver == address(0)) {\n royalty = _defaultRoyaltyInfo;\n }\n\n uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();\n\n return (royalty.receiver, royaltyAmount);\n }\n\n /**\n * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a\n * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an\n * override.\n */\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: invalid receiver\");\n\n _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Removes default royalty information.\n */\n function _deleteDefaultRoyalty() internal virtual {\n delete _defaultRoyaltyInfo;\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator.\n */\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {\n require(feeNumerator <= _feeDenominator(), \"ERC2981: royalty fee will exceed salePrice\");\n require(receiver != address(0), \"ERC2981: Invalid parameters\");\n\n _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);\n }\n\n /**\n * @dev Resets royalty information for the token id back to the global default.\n */\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n delete _tokenRoyaltyInfo[tokenId];\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC2981.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981 is IERC165 {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount);\n}\n" + }, + "contracts/token/onft1155/ONFT1155Core.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT1155Core.sol\";\nimport \"../../lzApp/NonblockingLzApp.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract ONFT1155Core is NonblockingLzApp, ERC165, IONFT1155Core {\n uint public constant NO_EXTRA_GAS = 0;\n uint16 public constant FUNCTION_TYPE_SEND = 1;\n uint16 public constant FUNCTION_TYPE_SEND_BATCH = 2;\n bool public useCustomAdapterParams;\n\n event SetUseCustomAdapterParams(bool _useCustomAdapterParams);\n\n constructor(address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {}\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IONFT1155Core).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n uint _amount,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _useZro, _adapterParams);\n }\n\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n bool _useZro,\n bytes memory _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint _tokenId,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _sendBatch(\n _from,\n _dstChainId,\n _toAddress,\n _toSingletonArray(_tokenId),\n _toSingletonArray(_amount),\n _refundAddress,\n _zroPaymentAddress,\n _adapterParams\n );\n }\n\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) public payable virtual override {\n _sendBatch(_from, _dstChainId, _toAddress, _tokenIds, _amounts, _refundAddress, _zroPaymentAddress, _adapterParams);\n }\n\n function _sendBatch(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual {\n _debitFrom(_from, _dstChainId, _toAddress, _tokenIds, _amounts);\n bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts);\n if (_tokenIds.length == 1) {\n if (useCustomAdapterParams) {\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, NO_EXTRA_GAS);\n } else {\n require(_adapterParams.length == 0, \"LzApp: _adapterParams must be empty.\");\n }\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds[0], _amounts[0]);\n } else if (_tokenIds.length > 1) {\n if (useCustomAdapterParams) {\n _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND_BATCH, _adapterParams, NO_EXTRA_GAS);\n } else {\n require(_adapterParams.length == 0, \"LzApp: _adapterParams must be empty.\");\n }\n _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n emit SendBatchToChain(_dstChainId, _from, _toAddress, _tokenIds, _amounts);\n }\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64, /*_nonce*/\n bytes memory _payload\n ) internal virtual override {\n // decode and load the toAddress\n (bytes memory toAddressBytes, uint[] memory tokenIds, uint[] memory amounts) = abi.decode(_payload, (bytes, uint[], uint[]));\n address toAddress;\n assembly {\n toAddress := mload(add(toAddressBytes, 20))\n }\n\n _creditTo(_srcChainId, toAddress, tokenIds, amounts);\n\n if (tokenIds.length == 1) {\n emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds[0], amounts[0]);\n } else if (tokenIds.length > 1) {\n emit ReceiveBatchFromChain(_srcChainId, _srcAddress, toAddress, tokenIds, amounts);\n }\n }\n\n function setUseCustomAdapterParams(bool _useCustomAdapterParams) external onlyOwner {\n useCustomAdapterParams = _useCustomAdapterParams;\n emit SetUseCustomAdapterParams(_useCustomAdapterParams);\n }\n\n function _debitFrom(\n address _from,\n uint16 _dstChainId,\n bytes memory _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual;\n\n function _creditTo(\n uint16 _srcChainId,\n address _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual;\n\n function _toSingletonArray(uint element) internal pure returns (uint[] memory) {\n uint[] memory array = new uint[](1);\n array[0] = element;\n return array;\n }\n}\n" + }, + "contracts/token/onft1155/interfaces/IONFT1155Core.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface of the ONFT Core standard\n */\ninterface IONFT1155Core is IERC165 {\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint _tokenId, uint _amount);\n event SendBatchToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds, uint[] _amounts);\n event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint _tokenId, uint _amount);\n event ReceiveBatchFromChain(\n uint16 indexed _srcChainId,\n bytes indexed _srcAddress,\n address indexed _toAddress,\n uint[] _tokenIds,\n uint[] _amounts\n );\n\n // _from - address where tokens should be deducted from on behalf of\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenId - token Id to transfer\n // _amount - amount of the tokens to transfer\n // _refundAddress - address on src that will receive refund for any overpayment of L0 fees\n // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n // _from - address where tokens should be deducted from on behalf of\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenIds - token Ids to transfer\n // _amounts - amounts of the tokens to transfer\n // _refundAddress - address on src that will receive refund for any overpayment of L0 fees\n // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function sendBatchFrom(\n address _from,\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n uint[] calldata _amounts,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes calldata _adapterParams\n ) external payable;\n\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenId - token Id to transfer\n // _amount - amount of the tokens to transfer\n // _useZro - indicates to use zro to pay L0 fees\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function estimateSendFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint _tokenId,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n\n // _dstChainId - L0 defined chain id to send tokens too\n // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n // _tokenIds - tokens Id to transfer\n // _amounts - amounts of the tokens to transfer\n // _useZro - indicates to use zro to pay L0 fees\n // _adapterParams - flexible bytes array to indicate messaging adapter services in L0\n function estimateSendBatchFee(\n uint16 _dstChainId,\n bytes calldata _toAddress,\n uint[] calldata _tokenIds,\n uint[] calldata _amounts,\n bool _useZro,\n bytes calldata _adapterParams\n ) external view returns (uint nativeFee, uint zroFee);\n}\n" + }, + "contracts/token/onft1155/ProxyONFT1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ONFT1155Core.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\n\ncontract ProxyONFT1155 is ONFT1155Core, IERC1155Receiver {\n using ERC165Checker for address;\n\n IERC1155 public immutable token;\n\n constructor(address _lzEndpoint, address _proxyToken) ONFT1155Core(_lzEndpoint) {\n require(_proxyToken.supportsInterface(type(IERC1155).interfaceId), \"ProxyONFT1155: invalid ERC1155 token\");\n token = IERC1155(_proxyToken);\n }\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT1155Core, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(\n address _from,\n uint16,\n bytes memory,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual override {\n require(_from == _msgSender(), \"ProxyONFT1155: owner is not send caller\");\n token.safeBatchTransferFrom(_from, address(this), _tokenIds, _amounts, \"\");\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual override {\n token.safeBatchTransferFrom(address(this), _toAddress, _tokenIds, _amounts, \"\");\n }\n\n function onERC1155Received(\n address _operator,\n address,\n uint,\n uint,\n bytes memory\n ) public virtual override returns (bytes4) {\n // only allow `this` to tranfser token from others\n if (_operator != address(this)) return bytes4(0);\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address _operator,\n address,\n uint[] memory,\n uint[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n // only allow `this` to tranfser token from others\n if (_operator != address(this)) return bytes4(0);\n return this.onERC1155BatchReceived.selector;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/ERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155.sol\";\nimport \"./IERC1155Receiver.sol\";\nimport \"./extensions/IERC1155MetadataURI.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n constructor(string memory uri_) {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: address zero is not a valid owner\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155Receiver.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "contracts/token/onft1155/mocks/ERC1155Mock.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/ERC1155.sol\";\n\n// for mock purposes only, no limit on minting functionality\ncontract ERC1155Mock is ERC1155 {\n constructor(string memory uri_) ERC1155(uri_) {}\n\n function mint(\n address _to,\n uint _tokenId,\n uint _amount\n ) public {\n _mint(_to, _tokenId, _amount, \"\");\n }\n\n function mintBatch(\n address _to,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) public {\n _mintBatch(_to, _tokenIds, _amounts, \"\");\n }\n\n function transfer(\n address _to,\n uint _tokenId,\n uint _amount\n ) public {\n _safeTransferFrom(msg.sender, _to, _tokenId, _amount, \"\");\n }\n}\n" + }, + "contracts/token/onft1155/ONFT1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT1155.sol\";\nimport \"./ONFT1155Core.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/ERC1155.sol\";\n\n// NOTE: this ONFT contract has no public minting logic.\n// must implement your own minting logic in child classes\ncontract ONFT1155 is ONFT1155Core, ERC1155, IONFT1155 {\n constructor(string memory _uri, address _lzEndpoint) ERC1155(_uri) ONFT1155Core(_lzEndpoint) {}\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT1155Core, ERC1155, IERC165) returns (bool) {\n return interfaceId == type(IONFT1155).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(\n address _from,\n uint16,\n bytes memory,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual override {\n address spender = _msgSender();\n require(spender == _from || isApprovedForAll(_from, spender), \"ONFT1155: send caller is not owner nor approved\");\n _burnBatch(_from, _tokenIds, _amounts);\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint[] memory _tokenIds,\n uint[] memory _amounts\n ) internal virtual override {\n _mintBatch(_toAddress, _tokenIds, _amounts, \"\");\n }\n}\n" + }, + "contracts/token/onft1155/interfaces/IONFT1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./IONFT1155Core.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\n\n/**\n * @dev Interface of the ONFT standard\n */\ninterface IONFT1155 is IONFT1155Core, IERC1155 {\n\n}\n" + }, + "contracts/token/onft1155/extensions/ExtendedONFT1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/common/ERC2981.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol\";\nimport \"../ONFT1155.sol\";\n\ncontract ExtendedONFT1155 is Ownable, AccessControl, ERC1155, ERC1155Supply, ERC1155Burnable, ERC2981, ONFT1155 {\n string public name;\n string public symbol;\n\n /********************************************\n *** Constructor\n ********************************************/\n\n constructor(\n string memory _name,\n string memory _symbol,\n string memory _uri,\n uint96 _royaltyBasePoints,\n address _lzEndpoint\n ) ONFT1155(_uri, _lzEndpoint) {\n name = _name;\n symbol = _symbol;\n\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n _setDefaultRoyalty(_msgSender(), _royaltyBasePoints);\n }\n\n /********************************************\n *** Public functions\n ********************************************/\n /**\n * @dev Sets a new token metadata URI.\n */\n function setURI(string memory _uri) external virtual onlyOwner {\n _setURI(_uri);\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external virtual onlyOwner {\n _setDefaultRoyalty(receiver, feeNumerator);\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n */\n function setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) external virtual onlyOwner {\n _setTokenRoyalty(tokenId, receiver, feeNumerator);\n }\n\n /**\n * @dev Transfer to multiple recipients.\n */\n function multiTransferFrom(address from, address[] memory tos, uint256 id, uint256 amount, bytes memory data) public virtual {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"ExtendedONFT1155: caller is not token owner or approved\");\n\n for (uint256 i = 0; i < tos.length; ++i) {\n _safeTransferFrom(from, tos[i], id, amount, data);\n }\n }\n\n /**\n * @dev Batch transfer to multiple recipients.\n */\n function multiBatchTransferFrom(\n address from,\n address[] memory tos,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"ExtendedONFT1155: caller is not token owner or approved\");\n\n for (uint256 i = 0; i < tos.length; ++i) {\n _safeBatchTransferFrom(from, tos[i], ids, amounts, data);\n }\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}. Includes check for token existence.\n */\n function uri(uint256 id) public view virtual override returns (string memory) {\n require(exists(id), \"ExtendedONFT1155: Token ID doesn't exist\");\n\n return super.uri(id);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, ERC2981, ONFT1155, AccessControl) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n /********************************************\n *** Internal functions\n ********************************************/\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override(ERC1155, ERC1155Supply) {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, 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 uint[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.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 * ```solidity\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 * ```solidity\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. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\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(IAccessControl).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 Strings.toHexString(account),\n \" is missing role \",\n Strings.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" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155.sol\";\n\n/**\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\n * own tokens and those that they have been approved to use.\n *\n * _Available since v3.1._\n */\nabstract contract ERC1155Burnable is ERC1155 {\n function burn(address account, uint256 id, uint256 value) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burn(account, id, value);\n }\n\n function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burnBatch(account, ids, values);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155.sol\";\n\n/**\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\n *\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\n * clearly identified. Note: While a totalSupply of 1 might mean the\n * corresponding is an NFT, there is no guarantees that no other token with the\n * same id are not going to be minted.\n */\nabstract contract ERC1155Supply is ERC1155 {\n mapping(uint256 => uint256) private _totalSupply;\n\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) public view virtual returns (uint256) {\n return _totalSupply[id];\n }\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) public view virtual returns (bool) {\n return ERC1155Supply.totalSupply(id) > 0;\n }\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n if (from == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n _totalSupply[ids[i]] += amounts[i];\n }\n }\n\n if (to == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n uint256 supply = _totalSupply[id];\n require(supply >= amount, \"ERC1155: burn amount exceeds totalSupply\");\n unchecked {\n _totalSupply[id] = supply - amount;\n }\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.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 IAccessControl {\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" + }, + "contracts/token/onft721/extensions/ExtendedONFT721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../ONFT721.sol\";\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol\";\n\ncontract ExtendedONFT721 is Ownable, AccessControl, ERC721, ERC721Royalty, ERC721Enumerable, ERC721Burnable, ONFT721 {\n using Strings for uint256;\n\n string internal baseTokenURI;\n\n constructor(\n string memory _name,\n string memory _symbol,\n string memory _baseUri,\n uint96 _royaltyBasePoints,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) ONFT721(_name, _symbol, _minGasToTransfer, _lzEndpoint) {\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n _setDefaultRoyalty(_msgSender(), _royaltyBasePoints);\n baseTokenURI = _baseUri;\n }\n\n /********************************************\n *** Public functions\n ********************************************/\n\n /**\n * @dev Multi-recipient transfer.\n */\n function transferMulti(address from, address[] memory recipients, uint256[] memory tokenIds) public virtual {\n require(recipients.length > 0 && recipients.length == tokenIds.length, \"ERC721: input length mismatch\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n safeTransferFrom(from, recipients[i], tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Batch-Transfer (same recipient).\n */\n function transferBatch(address from, address to, uint256[] memory tokenIds) public virtual {\n require(tokenIds.length > 0, \"ERC721: tokenIds can't be empty\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n safeTransferFrom(from, to, tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Set new token metadata base URI.\n */\n function setBaseURI(string memory _baseUri) public virtual onlyRole(DEFAULT_ADMIN_ROLE) {\n baseTokenURI = _baseUri;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}. Override attaches \".json\" extension to URI.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), \".json\")) : \"\";\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ONFT721, ERC721Royalty, ERC721Enumerable, ERC721, AccessControl) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n /********************************************\n *** Internal functions\n ********************************************/\n\n /**\n * @dev Updateable base token URI override.\n */\n function _baseURI() internal view virtual override returns (string memory) {\n return baseTokenURI;\n }\n\n /**\n * @dev See {ERC721-_burn}.\n */\n function _burn(uint256 tokenId) internal virtual override(ERC721Royalty, ERC721) {\n super._burn(tokenId);\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override(ERC721Enumerable, ERC721) {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n }\n}\n" + }, + "contracts/token/onft721/ONFT721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT721.sol\";\nimport \"./ONFT721Core.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\n\n// NOTE: this ONFT contract has no public minting logic.\n// must implement your own minting logic in child classes\ncontract ONFT721 is ONFT721Core, ERC721, IONFT721 {\n constructor(\n string memory _name,\n string memory _symbol,\n uint _minGasToTransfer,\n address _lzEndpoint\n ) ERC721(_name, _symbol) ONFT721Core(_minGasToTransfer, _lzEndpoint) {}\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT721Core, ERC721, IERC165) returns (bool) {\n return interfaceId == type(IONFT721).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(\n address _from,\n uint16,\n bytes memory,\n uint _tokenId\n ) internal virtual override {\n require(_isApprovedOrOwner(_msgSender(), _tokenId), \"ONFT721: send caller is not owner nor approved\");\n require(ERC721.ownerOf(_tokenId) == _from, \"ONFT721: send from incorrect owner\");\n _transfer(_from, address(this), _tokenId);\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _tokenId\n ) internal virtual override {\n require(!_exists(_tokenId) || (_exists(_tokenId) && ERC721.ownerOf(_tokenId) == address(this)));\n if (!_exists(_tokenId)) {\n _safeMint(_toAddress, _tokenId);\n } else {\n _transfer(address(this), _toAddress, _tokenId);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @title ERC721 Burnable Token\n * @dev ERC721 Token that can be burned (destroyed).\n */\nabstract contract ERC721Burnable is Context, ERC721 {\n /**\n * @dev Burns `tokenId`. See {ERC721-_burn}.\n *\n * Requirements:\n *\n * - The caller must own `tokenId` or be an approved operator.\n */\n function burn(uint256 tokenId) public virtual {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _burn(tokenId);\n }\n}\n" + }, + "contracts/token/onft721/extensions/MinterONFT721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"./ExtendedONFT721.sol\";\n\ncontract MinterONFT721 is ExtendedONFT721 {\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n\n constructor(string memory _name, string memory _symbol, string memory _baseUri, uint96 _royaltyBasePoints, uint256 _minGasToTransfer, address _lzEndpoint) ExtendedONFT721(_name, _symbol, _baseUri, _royaltyBasePoints, _minGasToTransfer, _lzEndpoint) {\n _setupRole(MINTER_ROLE, _msgSender());\n }\n\n /********************************************\n *** Public functions\n ********************************************/\n\n /**\n * @dev Public minting method, Minter-role only.\n */\n function mint(address to, uint256 tokenId) public virtual onlyRole(MINTER_ROLE) {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Multi-recipient minting.\n */\n function mintMulti(address[] memory recipients, uint256[] memory tokenIds) public virtual onlyRole(MINTER_ROLE) {\n require(recipients.length > 0 && recipients.length == tokenIds.length, \"ERC721: input length mismatch\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n _safeMint(recipients[i], tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Batch-Mint (same recipient).\n */\n function mintBatch(address to, uint256[] memory tokenIds) public virtual onlyRole(MINTER_ROLE) {\n require(tokenIds.length > 0, \"ERC721: tokenIds can't be empty\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n _safeMint(to, tokenIds[i], \"\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "contracts/token/oft/v2/fee/OFTWithFee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./BaseOFTWithFee.sol\";\n\ncontract OFTWithFee is BaseOFTWithFee, ERC20 {\n\n uint internal immutable ld2sdRate;\n\n constructor(string memory _name, string memory _symbol, uint8 _sharedDecimals, address _lzEndpoint) ERC20(_name, _symbol) BaseOFTWithFee(_sharedDecimals, _lzEndpoint) {\n uint8 decimals = decimals();\n require(_sharedDecimals <= decimals, \"OFTWithFee: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return totalSupply();\n }\n\n function token() public view virtual override returns (address) {\n return address(this);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n if (_from != spender) _spendAllowance(_from, spender, _amount);\n _burn(_from, _amount);\n return _amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n _mint(_toAddress, _amount);\n return _amount;\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n address spender = _msgSender();\n // if transfer from this contract, no need to check allowance\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\n _transfer(_from, _to, _amount);\n return _amount;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "contracts/token/oft/v2/fee/BaseOFTWithFee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../OFTCoreV2.sol\";\nimport \"./IOFTWithFee.sol\";\nimport \"./Fee.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract BaseOFTWithFee is OFTCoreV2, Fee, ERC165, IOFTWithFee {\n\n constructor(uint8 _sharedDecimals, address _lzEndpoint) OFTCoreV2(_sharedDecimals, _lzEndpoint) {\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, LzCallParams calldata _callParams) public payable virtual override {\n (_amount,) = _payOFTFee(_from, _dstChainId, _amount);\n _amount = _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n require(_amount >= _minAmount, \"BaseOFTWithFee: amount is less than minAmount\");\n }\n\n function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) public payable virtual override {\n (_amount,) = _payOFTFee(_from, _dstChainId, _amount);\n _amount = _sendAndCall(_from, _dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n require(_amount >= _minAmount, \"BaseOFTWithFee: amount is less than minAmount\");\n }\n\n /************************************************************************\n * public view functions\n ************************************************************************/\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IOFTWithFee).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams);\n }\n\n function estimateSendAndCallFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, bool _useZro, bytes calldata _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams);\n }\n\n function circulatingSupply() public view virtual override returns (uint);\n\n function token() public view virtual override returns (address);\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override (Fee, OFTCoreV2) returns (uint);\n}\n" + }, + "contracts/token/oft/v2/OFTCoreV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../../lzApp/NonblockingLzApp.sol\";\nimport \"../../../libraries/ExcessivelySafeCall.sol\";\nimport \"./interfaces/ICommonOFT.sol\";\nimport \"./interfaces/IOFTReceiverV2.sol\";\n\nabstract contract OFTCoreV2 is NonblockingLzApp {\n using BytesLib for bytes;\n using ExcessivelySafeCall for address;\n\n uint public constant NO_EXTRA_GAS = 0;\n\n // packet type\n uint8 public constant PT_SEND = 0;\n uint8 public constant PT_SEND_AND_CALL = 1;\n\n uint8 public immutable sharedDecimals;\n\n mapping(uint16 => mapping(bytes => mapping(uint64 => bool))) public creditedPackets;\n\n /**\n * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\n * `_nonce` is the outbound nonce\n */\n event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes32 indexed _toAddress, uint _amount);\n\n /**\n * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain.\n * `_nonce` is the inbound nonce.\n */\n event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount);\n\n event CallOFTReceivedSuccess(uint16 indexed _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _hash);\n\n event NonContractAddress(address _address);\n\n // _sharedDecimals should be the minimum decimals on all chains\n constructor(uint8 _sharedDecimals, address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {\n sharedDecimals = _sharedDecimals;\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function callOnOFTReceived(\n uint16 _srcChainId,\n bytes calldata _srcAddress,\n uint64 _nonce,\n bytes32 _from,\n address _to,\n uint _amount,\n bytes calldata _payload,\n uint _gasForCall\n ) public virtual {\n require(_msgSender() == address(this), \"OFTCore: caller must be OFTCore\");\n\n // send\n _amount = _transferFrom(address(this), _to, _amount);\n emit ReceiveFromChain(_srcChainId, _to, _amount);\n\n // call\n IOFTReceiverV2(_to).onOFTReceived{gas: _gasForCall}(_srcChainId, _srcAddress, _nonce, _from, _amount, _payload);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes memory _adapterParams\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\n // mock the payload for sendFrom()\n bytes memory payload = _encodeSendPayload(_toAddress, _ld2sd(_amount));\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function _estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes memory _adapterParams\n ) internal view virtual returns (uint nativeFee, uint zroFee) {\n // mock the payload for sendAndCall()\n bytes memory payload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(_amount), _payload, _dstGasForCall);\n return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n }\n\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual override {\n uint8 packetType = _payload.toUint8(0);\n\n if (packetType == PT_SEND) {\n _sendAck(_srcChainId, _srcAddress, _nonce, _payload);\n } else if (packetType == PT_SEND_AND_CALL) {\n _sendAndCallAck(_srcChainId, _srcAddress, _nonce, _payload);\n } else {\n revert(\"OFTCore: unknown packet type\");\n }\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount); // amount returned should not have dust\n require(amount > 0, \"OFTCore: amount too small\");\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAck(\n uint16 _srcChainId,\n bytes memory,\n uint64,\n bytes memory _payload\n ) internal virtual {\n (address to, uint64 amountSD) = _decodeSendPayload(_payload);\n if (to == address(0)) {\n to = address(0xdead);\n }\n\n uint amount = _sd2ld(amountSD);\n amount = _creditTo(_srcChainId, to, amount);\n\n emit ReceiveFromChain(_srcChainId, to, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n amount = _debitFrom(_from, _dstChainId, _toAddress, amount);\n require(amount > 0, \"OFTCore: amount too small\");\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCallAck(\n uint16 _srcChainId,\n bytes memory _srcAddress,\n uint64 _nonce,\n bytes memory _payload\n ) internal virtual {\n (bytes32 from, address to, uint64 amountSD, bytes memory payloadForCall, uint64 gasForCall) = _decodeSendAndCallPayload(_payload);\n\n bool credited = creditedPackets[_srcChainId][_srcAddress][_nonce];\n uint amount = _sd2ld(amountSD);\n\n // credit to this contract first, and then transfer to receiver only if callOnOFTReceived() succeeds\n if (!credited) {\n amount = _creditTo(_srcChainId, address(this), amount);\n creditedPackets[_srcChainId][_srcAddress][_nonce] = true;\n }\n\n if (!_isContract(to)) {\n emit NonContractAddress(to);\n return;\n }\n\n // workaround for stack too deep\n uint16 srcChainId = _srcChainId;\n bytes memory srcAddress = _srcAddress;\n uint64 nonce = _nonce;\n bytes memory payload = _payload;\n bytes32 from_ = from;\n address to_ = to;\n uint amount_ = amount;\n bytes memory payloadForCall_ = payloadForCall;\n\n // no gas limit for the call if retry\n uint gas = credited ? gasleft() : gasForCall;\n (bool success, bytes memory reason) = address(this).excessivelySafeCall(\n gasleft(),\n 150,\n abi.encodeWithSelector(this.callOnOFTReceived.selector, srcChainId, srcAddress, nonce, from_, to_, amount_, payloadForCall_, gas)\n );\n\n if (success) {\n bytes32 hash = keccak256(payload);\n emit CallOFTReceivedSuccess(srcChainId, srcAddress, nonce, hash);\n } else {\n // store the failed message into the nonblockingLzApp\n _storeFailedMessage(srcChainId, srcAddress, nonce, payload, reason);\n }\n }\n\n function _isContract(address _account) internal view returns (bool) {\n return _account.code.length > 0;\n }\n\n function _ld2sd(uint _amount) internal view virtual returns (uint64) {\n uint amountSD = _amount / _ld2sdRate();\n require(amountSD <= type(uint64).max, \"OFTCore: amountSD overflow\");\n return uint64(amountSD);\n }\n\n function _sd2ld(uint64 _amountSD) internal view virtual returns (uint) {\n return _amountSD * _ld2sdRate();\n }\n\n function _removeDust(uint _amount) internal view virtual returns (uint amountAfter, uint dust) {\n dust = _amount % _ld2sdRate();\n amountAfter = _amount - dust;\n }\n\n function _encodeSendPayload(bytes32 _toAddress, uint64 _amountSD) internal view virtual returns (bytes memory) {\n return abi.encodePacked(PT_SEND, _toAddress, _amountSD);\n }\n\n function _decodeSendPayload(bytes memory _payload) internal view virtual returns (address to, uint64 amountSD) {\n require(_payload.toUint8(0) == PT_SEND && _payload.length == 41, \"OFTCore: invalid payload\");\n\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\n amountSD = _payload.toUint64(33);\n }\n\n function _encodeSendAndCallPayload(\n address _from,\n bytes32 _toAddress,\n uint64 _amountSD,\n bytes memory _payload,\n uint64 _dstGasForCall\n ) internal view virtual returns (bytes memory) {\n return abi.encodePacked(PT_SEND_AND_CALL, _toAddress, _amountSD, _addressToBytes32(_from), _dstGasForCall, _payload);\n }\n\n function _decodeSendAndCallPayload(bytes memory _payload)\n internal\n view\n virtual\n returns (\n bytes32 from,\n address to,\n uint64 amountSD,\n bytes memory payload,\n uint64 dstGasForCall\n )\n {\n require(_payload.toUint8(0) == PT_SEND_AND_CALL, \"OFTCore: invalid payload\");\n\n to = _payload.toAddress(13); // drop the first 12 bytes of bytes32\n amountSD = _payload.toUint64(33);\n from = _payload.toBytes32(41);\n dstGasForCall = _payload.toUint64(73);\n payload = _payload.slice(81, _payload.length - 81);\n }\n\n function _addressToBytes32(address _address) internal pure virtual returns (bytes32) {\n return bytes32(uint(uint160(_address)));\n }\n\n function _debitFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount\n ) internal virtual returns (uint);\n\n function _creditTo(\n uint16 _srcChainId,\n address _toAddress,\n uint _amount\n ) internal virtual returns (uint);\n\n function _transferFrom(\n address _from,\n address _to,\n uint _amount\n ) internal virtual returns (uint);\n\n function _ld2sdRate() internal view virtual returns (uint);\n}\n" + }, + "contracts/token/oft/v2/fee/IOFTWithFee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"../interfaces/ICommonOFT.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface IOFTWithFee is ICommonOFT {\n\n /**\n * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\n * `_from` the owner of token\n * `_dstChainId` the destination chain identifier\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_amount` the quantity of tokens in wei\n * `_minAmount` the minimum amount of tokens to receive on dstChain\n * `_refundAddress` the address LayerZero refunds if too much message fee is sent\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, LzCallParams calldata _callParams) external payable;\n\n function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) external payable;\n}\n" + }, + "contracts/token/oft/v2/fee/Fee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\nabstract contract Fee is Ownable {\n uint public constant BP_DENOMINATOR = 10000;\n\n mapping(uint16 => FeeConfig) public chainIdToFeeBps;\n uint16 public defaultFeeBp;\n address public feeOwner; // defaults to owner\n\n struct FeeConfig {\n uint16 feeBP;\n bool enabled;\n }\n\n event SetFeeBp(uint16 dstchainId, bool enabled, uint16 feeBp);\n event SetDefaultFeeBp(uint16 feeBp);\n event SetFeeOwner(address feeOwner);\n\n constructor(){\n feeOwner = owner();\n }\n\n function setDefaultFeeBp(uint16 _feeBp) public virtual onlyOwner {\n require(_feeBp <= BP_DENOMINATOR, \"Fee: fee bp must be <= BP_DENOMINATOR\");\n defaultFeeBp = _feeBp;\n emit SetDefaultFeeBp(defaultFeeBp);\n }\n\n function setFeeBp(uint16 _dstChainId, bool _enabled, uint16 _feeBp) public virtual onlyOwner {\n require(_feeBp <= BP_DENOMINATOR, \"Fee: fee bp must be <= BP_DENOMINATOR\");\n chainIdToFeeBps[_dstChainId] = FeeConfig(_feeBp, _enabled);\n emit SetFeeBp(_dstChainId, _enabled, _feeBp);\n }\n\n function setFeeOwner(address _feeOwner) public virtual onlyOwner {\n require(_feeOwner != address(0x0), \"Fee: feeOwner cannot be 0x\");\n feeOwner = _feeOwner;\n emit SetFeeOwner(_feeOwner);\n }\n\n function quoteOFTFee(uint16 _dstChainId, uint _amount) public virtual view returns (uint fee) {\n FeeConfig memory config = chainIdToFeeBps[_dstChainId];\n if (config.enabled) {\n fee = _amount * config.feeBP / BP_DENOMINATOR;\n } else if (defaultFeeBp > 0) {\n fee = _amount * defaultFeeBp / BP_DENOMINATOR;\n } else {\n fee = 0;\n }\n }\n\n function _payOFTFee(address _from, uint16 _dstChainId, uint _amount) internal virtual returns (uint amount, uint fee) {\n fee = quoteOFTFee(_dstChainId, _amount);\n amount = _amount - fee;\n if (fee > 0) {\n _transferFrom(_from, feeOwner, fee);\n }\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual returns (uint);\n}\n" + }, + "contracts/token/oft/v2/interfaces/ICommonOFT.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface ICommonOFT is IERC165 {\n\n struct LzCallParams {\n address payable refundAddress;\n address zroPaymentAddress;\n bytes adapterParams;\n }\n\n /**\n * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n * _dstChainId - L0 defined chain id to send tokens too\n * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n * _amount - amount of the tokens to transfer\n * _useZro - indicates to use zro to pay L0 fees\n * _adapterParam - flexible bytes array to indicate messaging adapter services in L0\n */\n function estimateSendFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee);\n\n function estimateSendAndCallFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee);\n\n /**\n * @dev returns the circulating amount of tokens on current chain\n */\n function circulatingSupply() external view returns (uint);\n\n /**\n * @dev returns the address of the ERC20 token\n */\n function token() external view returns (address);\n}\n" + }, + "contracts/token/oft/v2/interfaces/IOFTReceiverV2.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.5.0;\n\ninterface IOFTReceiverV2 {\n /**\n * @dev Called by the OFT contract when tokens are received from source chain.\n * @param _srcChainId The chain id of the source chain.\n * @param _srcAddress The address of the OFT token contract on the source chain.\n * @param _nonce The nonce of the transaction on the source chain.\n * @param _from The address of the account who calls the sendAndCall() on the source chain.\n * @param _amount The amount of tokens to transfer.\n * @param _payload Additional data with no specified format.\n */\n function onOFTReceived(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes32 _from, uint _amount, bytes calldata _payload) external;\n}\n" + }, + "contracts/token/oft/v2/fee/ProxyOFTWithFee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./BaseOFTWithFee.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract ProxyOFTWithFee is BaseOFTWithFee {\n using SafeERC20 for IERC20;\n\n IERC20 internal immutable innerToken;\n uint internal immutable ld2sdRate;\n\n // total amount is transferred from this chain to other chains, ensuring the total is less than uint64.max in sd\n uint public outboundAmount;\n\n constructor(address _token, uint8 _sharedDecimals, address _lzEndpoint) BaseOFTWithFee(_sharedDecimals, _lzEndpoint) {\n innerToken = IERC20(_token);\n\n (bool success, bytes memory data) = _token.staticcall(\n abi.encodeWithSignature(\"decimals()\")\n );\n require(success, \"ProxyOFTWithFee: failed to get token decimals\");\n uint8 decimals = abi.decode(data, (uint8));\n\n require(_sharedDecimals <= decimals, \"ProxyOFTWithFee: sharedDecimals must be <= decimals\");\n ld2sdRate = 10 ** (decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return innerToken.totalSupply() - outboundAmount;\n }\n\n function token() public view virtual override returns (address) {\n return address(innerToken);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(address _from, uint16, bytes32, uint _amount) internal virtual override returns (uint) {\n require(_from == _msgSender(), \"ProxyOFTWithFee: owner is not send caller\");\n\n _amount = _transferFrom(_from, address(this), _amount);\n\n // _amount still may have dust if the token has transfer fee, then give the dust back to the sender\n (uint amount, uint dust) = _removeDust(_amount);\n if (dust > 0) innerToken.safeTransfer(_from, dust);\n\n // check total outbound amount\n outboundAmount += amount;\n uint cap = _sd2ld(type(uint64).max);\n require(cap >= outboundAmount, \"ProxyOFTWithFee: outboundAmount overflow\");\n\n return amount;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns (uint) {\n outboundAmount -= _amount;\n\n // tokens are already in this contract, so no need to transfer\n if (_toAddress == address(this)) {\n return _amount;\n }\n\n return _transferFrom(address(this), _toAddress, _amount);\n }\n\n function _transferFrom(address _from, address _to, uint _amount) internal virtual override returns (uint) {\n uint before = innerToken.balanceOf(_to);\n if (_from == address(this)) {\n innerToken.safeTransfer(_to, _amount);\n } else {\n innerToken.safeTransferFrom(_from, _to, _amount);\n }\n return innerToken.balanceOf(_to) - before;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/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 /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) 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(IERC20 token, address spender, uint256 value) 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 /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\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 require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation 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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\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 cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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" + }, + "contracts/token/oft/v2/ProxyOFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./BaseOFTV2.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract ProxyOFTV2 is BaseOFTV2 {\n using SafeERC20 for IERC20;\n\n IERC20 internal immutable innerToken;\n uint internal immutable ld2sdRate;\n\n // total amount is transferred from this chain to other chains, ensuring the total is less than uint64.max in sd\n uint public outboundAmount;\n\n constructor(\n address _token,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) BaseOFTV2(_sharedDecimals, _lzEndpoint) {\n innerToken = IERC20(_token);\n\n (bool success, bytes memory data) = _token.staticcall(abi.encodeWithSignature(\"decimals()\"));\n require(success, \"ProxyOFT: failed to get token decimals\");\n uint8 decimals = abi.decode(data, (uint8));\n\n require(_sharedDecimals <= decimals, \"ProxyOFT: sharedDecimals must be <= decimals\");\n ld2sdRate = 10**(decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return innerToken.totalSupply() - outboundAmount;\n }\n\n function token() public view virtual override returns (address) {\n return address(innerToken);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(\n address _from,\n uint16,\n bytes32,\n uint _amount\n ) internal virtual override returns (uint) {\n require(_from == _msgSender(), \"ProxyOFT: owner is not send caller\");\n\n _amount = _transferFrom(_from, address(this), _amount);\n\n // _amount still may have dust if the token has transfer fee, then give the dust back to the sender\n (uint amount, uint dust) = _removeDust(_amount);\n if (dust > 0) innerToken.safeTransfer(_from, dust);\n\n // check total outbound amount\n outboundAmount += amount;\n uint cap = _sd2ld(type(uint64).max);\n require(cap >= outboundAmount, \"ProxyOFT: outboundAmount overflow\");\n\n return amount;\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _amount\n ) internal virtual override returns (uint) {\n outboundAmount -= _amount;\n\n // tokens are already in this contract, so no need to transfer\n if (_toAddress == address(this)) {\n return _amount;\n }\n\n return _transferFrom(address(this), _toAddress, _amount);\n }\n\n function _transferFrom(\n address _from,\n address _to,\n uint _amount\n ) internal virtual override returns (uint) {\n uint before = innerToken.balanceOf(_to);\n if (_from == address(this)) {\n innerToken.safeTransfer(_to, _amount);\n } else {\n innerToken.safeTransferFrom(_from, _to, _amount);\n }\n return innerToken.balanceOf(_to) - before;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "contracts/token/oft/v2/BaseOFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./OFTCoreV2.sol\";\nimport \"./interfaces/IOFTV2.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract BaseOFTV2 is OFTCoreV2, ERC165, IOFTV2 {\n constructor(uint8 _sharedDecimals, address _lzEndpoint) OFTCoreV2(_sharedDecimals, _lzEndpoint) {}\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _sendAndCall(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _payload,\n _dstGasForCall,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n }\n\n /************************************************************************\n * public view functions\n ************************************************************************/\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IOFTV2).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function estimateSendFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendFee(_dstChainId, _toAddress, _amount, _useZro, _adapterParams);\n }\n\n function estimateSendAndCallFee(\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view virtual override returns (uint nativeFee, uint zroFee) {\n return _estimateSendAndCallFee(_dstChainId, _toAddress, _amount, _payload, _dstGasForCall, _useZro, _adapterParams);\n }\n\n function circulatingSupply() public view virtual override returns (uint);\n\n function token() public view virtual override returns (address);\n}\n" + }, + "contracts/token/oft/v2/interfaces/IOFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./ICommonOFT.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface IOFTV2 is ICommonOFT {\n\n /**\n * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\n * `_from` the owner of token\n * `_dstChainId` the destination chain identifier\n * `_toAddress` can be any size depending on the `dstChainId`.\n * `_amount` the quantity of tokens in wei\n * `_refundAddress` the address LayerZero refunds if too much message fee is sent\n * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n */\n function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, LzCallParams calldata _callParams) external payable;\n\n function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) external payable;\n}\n" + }, + "contracts/token/oft/v2/mocks/OFTStakingMockV2.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"../interfaces/IOFTV2.sol\";\nimport \"../interfaces/IOFTReceiverV2.sol\";\nimport \"../../../../libraries/BytesLib.sol\";\n\n// OFTStakingMock is an example to integrate with OFT. It shows how to send OFT cross chain with a custom payload and\n// call a receiver contract on the destination chain when oft is received.\ncontract OFTStakingMockV2 is IOFTReceiverV2 {\n using SafeERC20 for IERC20;\n using BytesLib for bytes;\n\n uint64 public constant DST_GAS_FOR_CALL = 300000; // estimate gas usage of onOFTReceived()\n\n // packet type\n uint8 public constant PT_DEPOSIT_TO_REMOTE_CHAIN = 1;\n // ... other types\n\n // variables\n IOFTV2 public oft;\n mapping(uint16 => bytes32) public remoteStakingContracts;\n mapping(address => uint) public balances;\n bool public paused; // for testing try/catch\n\n event Deposit(address from, uint amount);\n event Withdrawal(address to, uint amount);\n event DepositToDstChain(address from, uint16 dstChainId, bytes to, uint amountOut);\n\n // _oft can be any composable OFT contract, e.g. ComposableOFT, ComposableBasedOFT and ComposableProxyOFT.\n constructor(address _oft) {\n oft = IOFTV2(_oft);\n IERC20(oft.token()).safeApprove(_oft, type(uint).max);\n }\n\n function setRemoteStakingContract(uint16 _chainId, bytes32 _stakingContract) external {\n remoteStakingContracts[_chainId] = _stakingContract;\n }\n\n function deposit(uint _amount) external payable {\n IERC20(oft.token()).safeTransferFrom(msg.sender, address(this), _amount);\n balances[msg.sender] += _amount;\n emit Deposit(msg.sender, _amount);\n }\n\n function withdraw(uint _amount) external {\n withdrawTo(_amount, msg.sender);\n }\n\n function withdrawTo(uint _amount, address _to) public {\n require(balances[msg.sender] >= _amount);\n balances[msg.sender] -= _amount;\n IERC20(oft.token()).safeTransfer(_to, _amount);\n emit Withdrawal(msg.sender, _amount);\n }\n\n function depositToDstChain(\n uint16 _dstChainId,\n bytes calldata _to, // address of the owner of token on the destination chain\n uint _amount, // amount of token to deposit\n bytes calldata _adapterParams\n ) external payable {\n bytes32 dstStakingContract = remoteStakingContracts[_dstChainId];\n require(dstStakingContract != bytes32(0), \"invalid _dstChainId\");\n\n // transfer token from sender to this contract\n // if the oft is not the proxy oft, dont need to transfer token to this contract\n // and call sendAndCall() with the msg.sender (_from) instead of address(this)\n // here we use a common pattern to be compatible with all kinds of composable OFT\n IERC20(oft.token()).safeTransferFrom(msg.sender, address(this), _amount);\n\n bytes memory payload = abi.encode(PT_DEPOSIT_TO_REMOTE_CHAIN, _to);\n ICommonOFT.LzCallParams memory callParams = ICommonOFT.LzCallParams(payable(msg.sender), address(0), _adapterParams);\n oft.sendAndCall{value: msg.value}(address(this), _dstChainId, dstStakingContract, _amount, payload, DST_GAS_FOR_CALL, callParams);\n\n emit DepositToDstChain(msg.sender, _dstChainId, _to, _amount);\n }\n\n function quoteForDeposit(\n uint16 _dstChainId,\n bytes calldata _to, // address of the owner of token on the destination chain\n uint _amount, // amount of token to deposit\n bytes calldata _adapterParams\n ) public view returns (uint nativeFee, uint zroFee) {\n bytes32 dstStakingContract = remoteStakingContracts[_dstChainId];\n require(dstStakingContract != bytes32(0), \"invalid _dstChainId\");\n\n bytes memory payload = abi.encode(PT_DEPOSIT_TO_REMOTE_CHAIN, _to);\n return oft.estimateSendAndCallFee(_dstChainId, dstStakingContract, _amount, payload, DST_GAS_FOR_CALL, false, _adapterParams);\n }\n\n //-----------------------------------------------------------------------------------------------------------------------\n function onOFTReceived(uint16 _srcChainId, bytes calldata, uint64, bytes32 _from, uint _amount, bytes memory _payload) external override {\n require(!paused, \"paused\"); // for testing safe call\n require(msg.sender == address(oft), \"only oft can call onOFTReceived()\");\n require(_from == remoteStakingContracts[_srcChainId], \"invalid from\");\n\n uint8 pkType;\n assembly {\n pkType := mload(add(_payload, 32))\n }\n\n if (pkType == PT_DEPOSIT_TO_REMOTE_CHAIN) {\n (, bytes memory toAddrBytes) = abi.decode(_payload, (uint8, bytes));\n\n address to = toAddrBytes.toAddress(0);\n balances[to] += _amount;\n } else {\n revert(\"invalid deposit type\");\n }\n }\n\n function setPaused(bool _paused) external {\n paused = _paused;\n }\n}\n" + }, + "contracts/lzApp/mocks/LZEndpointMock.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.0;\npragma abicoder v2;\n\nimport \"../interfaces/ILayerZeroReceiver.sol\";\nimport \"../interfaces/ILayerZeroEndpoint.sol\";\nimport \"../libs/LzLib.sol\";\n\n/*\nlike a real LayerZero endpoint but can be mocked, which handle message transmission, verification, and receipt.\n- blocking: LayerZero provides ordered delivery of messages from a given sender to a destination chain.\n- non-reentrancy: endpoint has a non-reentrancy guard for both the send() and receive(), respectively.\n- adapter parameters: allows UAs to add arbitrary transaction params in the send() function, like airdrop on destination chain.\nunlike a real LayerZero endpoint, it is\n- no messaging library versioning\n- send() will short circuit to lzReceive()\n- no user application configuration\n*/\ncontract LZEndpointMock is ILayerZeroEndpoint {\n uint8 internal constant _NOT_ENTERED = 1;\n uint8 internal constant _ENTERED = 2;\n\n mapping(address => address) public lzEndpointLookup;\n\n uint16 public mockChainId;\n bool public nextMsgBlocked;\n\n // fee config\n RelayerFeeConfig public relayerFeeConfig;\n ProtocolFeeConfig public protocolFeeConfig;\n uint public oracleFee;\n bytes public defaultAdapterParams;\n\n // path = remote addrss + local address\n // inboundNonce = [srcChainId][path].\n mapping(uint16 => mapping(bytes => uint64)) public inboundNonce;\n //todo: this is a hack\n // outboundNonce = [dstChainId][srcAddress]\n mapping(uint16 => mapping(address => uint64)) public outboundNonce;\n // // outboundNonce = [dstChainId][path].\n // mapping(uint16 => mapping(bytes => uint64)) public outboundNonce;\n // storedPayload = [srcChainId][path]\n mapping(uint16 => mapping(bytes => StoredPayload)) public storedPayload;\n // msgToDeliver = [srcChainId][path]\n mapping(uint16 => mapping(bytes => QueuedPayload[])) public msgsToDeliver;\n\n // reentrancy guard\n uint8 internal _send_entered_state = 1;\n uint8 internal _receive_entered_state = 1;\n\n struct ProtocolFeeConfig {\n uint zroFee;\n uint nativeBP;\n }\n\n struct RelayerFeeConfig {\n uint128 dstPriceRatio; // 10^10\n uint128 dstGasPriceInWei;\n uint128 dstNativeAmtCap;\n uint64 baseGas;\n uint64 gasPerByte;\n }\n\n struct StoredPayload {\n uint64 payloadLength;\n address dstAddress;\n bytes32 payloadHash;\n }\n\n struct QueuedPayload {\n address dstAddress;\n uint64 nonce;\n bytes payload;\n }\n\n modifier sendNonReentrant() {\n require(_send_entered_state == _NOT_ENTERED, \"LayerZeroMock: no send reentrancy\");\n _send_entered_state = _ENTERED;\n _;\n _send_entered_state = _NOT_ENTERED;\n }\n\n modifier receiveNonReentrant() {\n require(_receive_entered_state == _NOT_ENTERED, \"LayerZeroMock: no receive reentrancy\");\n _receive_entered_state = _ENTERED;\n _;\n _receive_entered_state = _NOT_ENTERED;\n }\n\n event UaForceResumeReceive(uint16 chainId, bytes srcAddress);\n event PayloadCleared(uint16 srcChainId, bytes srcAddress, uint64 nonce, address dstAddress);\n event PayloadStored(uint16 srcChainId, bytes srcAddress, address dstAddress, uint64 nonce, bytes payload, bytes reason);\n event ValueTransferFailed(address indexed to, uint indexed quantity);\n\n constructor(uint16 _chainId) {\n mockChainId = _chainId;\n\n // init config\n relayerFeeConfig = RelayerFeeConfig({\n dstPriceRatio: 1e10, // 1:1, same chain, same native coin\n dstGasPriceInWei: 1e10,\n dstNativeAmtCap: 1e19,\n baseGas: 100,\n gasPerByte: 1\n });\n protocolFeeConfig = ProtocolFeeConfig({zroFee: 1e18, nativeBP: 1000}); // BP 0.1\n oracleFee = 1e16;\n defaultAdapterParams = LzLib.buildDefaultAdapterParams(200000);\n }\n\n // ------------------------------ ILayerZeroEndpoint Functions ------------------------------\n function send(\n uint16 _chainId,\n bytes memory _path,\n bytes calldata _payload,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) external payable override sendNonReentrant {\n require(_path.length == 40, \"LayerZeroMock: incorrect remote address size\"); // only support evm chains\n\n address dstAddr;\n assembly {\n dstAddr := mload(add(_path, 20))\n }\n\n address lzEndpoint = lzEndpointLookup[dstAddr];\n require(lzEndpoint != address(0), \"LayerZeroMock: destination LayerZero Endpoint not found\");\n\n // not handle zro token\n bytes memory adapterParams = _adapterParams.length > 0 ? _adapterParams : defaultAdapterParams;\n (uint nativeFee, ) = estimateFees(_chainId, msg.sender, _payload, _zroPaymentAddress != address(0x0), adapterParams);\n require(msg.value >= nativeFee, \"LayerZeroMock: not enough native for fees\");\n\n uint64 nonce = ++outboundNonce[_chainId][msg.sender];\n\n // refund if they send too much\n uint amount = msg.value - nativeFee;\n if (amount > 0) {\n (bool success, ) = _refundAddress.call{value: amount}(\"\");\n require(success, \"LayerZeroMock: failed to refund\");\n }\n\n // Mock the process of receiving msg on dst chain\n // Mock the relayer paying the dstNativeAddr the amount of extra native token\n (, uint extraGas, uint dstNativeAmt, address payable dstNativeAddr) = LzLib.decodeAdapterParams(adapterParams);\n if (dstNativeAmt > 0) {\n (bool success, ) = dstNativeAddr.call{value: dstNativeAmt}(\"\");\n if (!success) {\n emit ValueTransferFailed(dstNativeAddr, dstNativeAmt);\n }\n }\n\n bytes memory srcUaAddress = abi.encodePacked(msg.sender, dstAddr); // cast this address to bytes\n bytes memory payload = _payload;\n LZEndpointMock(lzEndpoint).receivePayload(mockChainId, srcUaAddress, dstAddr, nonce, extraGas, payload);\n }\n\n function receivePayload(\n uint16 _srcChainId,\n bytes calldata _path,\n address _dstAddress,\n uint64 _nonce,\n uint _gasLimit,\n bytes calldata _payload\n ) external override receiveNonReentrant {\n StoredPayload storage sp = storedPayload[_srcChainId][_path];\n\n // assert and increment the nonce. no message shuffling\n require(_nonce == ++inboundNonce[_srcChainId][_path], \"LayerZeroMock: wrong nonce\");\n\n // queue the following msgs inside of a stack to simulate a successful send on src, but not fully delivered on dst\n if (sp.payloadHash != bytes32(0)) {\n QueuedPayload[] storage msgs = msgsToDeliver[_srcChainId][_path];\n QueuedPayload memory newMsg = QueuedPayload(_dstAddress, _nonce, _payload);\n\n // warning, might run into gas issues trying to forward through a bunch of queued msgs\n // shift all the msgs over so we can treat this like a fifo via array.pop()\n if (msgs.length > 0) {\n // extend the array\n msgs.push(newMsg);\n\n // shift all the indexes up for pop()\n for (uint i = 0; i < msgs.length - 1; i++) {\n msgs[i + 1] = msgs[i];\n }\n\n // put the newMsg at the bottom of the stack\n msgs[0] = newMsg;\n } else {\n msgs.push(newMsg);\n }\n } else if (nextMsgBlocked) {\n storedPayload[_srcChainId][_path] = StoredPayload(uint64(_payload.length), _dstAddress, keccak256(_payload));\n emit PayloadStored(_srcChainId, _path, _dstAddress, _nonce, _payload, bytes(\"\"));\n // ensure the next msgs that go through are no longer blocked\n nextMsgBlocked = false;\n } else {\n try ILayerZeroReceiver(_dstAddress).lzReceive{gas: _gasLimit}(_srcChainId, _path, _nonce, _payload) {} catch (bytes memory reason) {\n storedPayload[_srcChainId][_path] = StoredPayload(uint64(_payload.length), _dstAddress, keccak256(_payload));\n emit PayloadStored(_srcChainId, _path, _dstAddress, _nonce, _payload, reason);\n // ensure the next msgs that go through are no longer blocked\n nextMsgBlocked = false;\n }\n }\n }\n\n function getInboundNonce(uint16 _chainID, bytes calldata _path) external view override returns (uint64) {\n return inboundNonce[_chainID][_path];\n }\n\n function getOutboundNonce(uint16 _chainID, address _srcAddress) external view override returns (uint64) {\n return outboundNonce[_chainID][_srcAddress];\n }\n\n function estimateFees(\n uint16 _dstChainId,\n address _userApplication,\n bytes memory _payload,\n bool _payInZRO,\n bytes memory _adapterParams\n ) public view override returns (uint nativeFee, uint zroFee) {\n bytes memory adapterParams = _adapterParams.length > 0 ? _adapterParams : defaultAdapterParams;\n\n // Relayer Fee\n uint relayerFee = _getRelayerFee(_dstChainId, 1, _userApplication, _payload.length, adapterParams);\n\n // LayerZero Fee\n uint protocolFee = _getProtocolFees(_payInZRO, relayerFee, oracleFee);\n _payInZRO ? zroFee = protocolFee : nativeFee = protocolFee;\n\n // return the sum of fees\n nativeFee = nativeFee + relayerFee + oracleFee;\n }\n\n function getChainId() external view override returns (uint16) {\n return mockChainId;\n }\n\n function retryPayload(\n uint16 _srcChainId,\n bytes calldata _path,\n bytes calldata _payload\n ) external override {\n StoredPayload storage sp = storedPayload[_srcChainId][_path];\n require(sp.payloadHash != bytes32(0), \"LayerZeroMock: no stored payload\");\n require(_payload.length == sp.payloadLength && keccak256(_payload) == sp.payloadHash, \"LayerZeroMock: invalid payload\");\n\n address dstAddress = sp.dstAddress;\n // empty the storedPayload\n sp.payloadLength = 0;\n sp.dstAddress = address(0);\n sp.payloadHash = bytes32(0);\n\n uint64 nonce = inboundNonce[_srcChainId][_path];\n\n ILayerZeroReceiver(dstAddress).lzReceive(_srcChainId, _path, nonce, _payload);\n emit PayloadCleared(_srcChainId, _path, nonce, dstAddress);\n }\n\n function hasStoredPayload(uint16 _srcChainId, bytes calldata _path) external view override returns (bool) {\n StoredPayload storage sp = storedPayload[_srcChainId][_path];\n return sp.payloadHash != bytes32(0);\n }\n\n function getSendLibraryAddress(address) external view override returns (address) {\n return address(this);\n }\n\n function getReceiveLibraryAddress(address) external view override returns (address) {\n return address(this);\n }\n\n function isSendingPayload() external view override returns (bool) {\n return _send_entered_state == _ENTERED;\n }\n\n function isReceivingPayload() external view override returns (bool) {\n return _receive_entered_state == _ENTERED;\n }\n\n function getConfig(\n uint16, /*_version*/\n uint16, /*_chainId*/\n address, /*_ua*/\n uint /*_configType*/\n ) external pure override returns (bytes memory) {\n return \"\";\n }\n\n function getSendVersion(\n address /*_userApplication*/\n ) external pure override returns (uint16) {\n return 1;\n }\n\n function getReceiveVersion(\n address /*_userApplication*/\n ) external pure override returns (uint16) {\n return 1;\n }\n\n function setConfig(\n uint16, /*_version*/\n uint16, /*_chainId*/\n uint, /*_configType*/\n bytes memory /*_config*/\n ) external override {}\n\n function setSendVersion(\n uint16 /*version*/\n ) external override {}\n\n function setReceiveVersion(\n uint16 /*version*/\n ) external override {}\n\n function forceResumeReceive(uint16 _srcChainId, bytes calldata _path) external override {\n StoredPayload storage sp = storedPayload[_srcChainId][_path];\n // revert if no messages are cached. safeguard malicious UA behaviour\n require(sp.payloadHash != bytes32(0), \"LayerZeroMock: no stored payload\");\n require(sp.dstAddress == msg.sender, \"LayerZeroMock: invalid caller\");\n\n // empty the storedPayload\n sp.payloadLength = 0;\n sp.dstAddress = address(0);\n sp.payloadHash = bytes32(0);\n\n emit UaForceResumeReceive(_srcChainId, _path);\n\n // resume the receiving of msgs after we force clear the \"stuck\" msg\n _clearMsgQue(_srcChainId, _path);\n }\n\n // ------------------------------ Other Public/External Functions --------------------------------------------------\n\n function getLengthOfQueue(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint) {\n return msgsToDeliver[_srcChainId][_srcAddress].length;\n }\n\n // used to simulate messages received get stored as a payload\n function blockNextMsg() external {\n nextMsgBlocked = true;\n }\n\n function setDestLzEndpoint(address destAddr, address lzEndpointAddr) external {\n lzEndpointLookup[destAddr] = lzEndpointAddr;\n }\n\n function setRelayerPrice(\n uint128 _dstPriceRatio,\n uint128 _dstGasPriceInWei,\n uint128 _dstNativeAmtCap,\n uint64 _baseGas,\n uint64 _gasPerByte\n ) external {\n relayerFeeConfig.dstPriceRatio = _dstPriceRatio;\n relayerFeeConfig.dstGasPriceInWei = _dstGasPriceInWei;\n relayerFeeConfig.dstNativeAmtCap = _dstNativeAmtCap;\n relayerFeeConfig.baseGas = _baseGas;\n relayerFeeConfig.gasPerByte = _gasPerByte;\n }\n\n function setProtocolFee(uint _zroFee, uint _nativeBP) external {\n protocolFeeConfig.zroFee = _zroFee;\n protocolFeeConfig.nativeBP = _nativeBP;\n }\n\n function setOracleFee(uint _oracleFee) external {\n oracleFee = _oracleFee;\n }\n\n function setDefaultAdapterParams(bytes memory _adapterParams) external {\n defaultAdapterParams = _adapterParams;\n }\n\n // --------------------- Internal Functions ---------------------\n // simulates the relayer pushing through the rest of the msgs that got delayed due to the stored payload\n function _clearMsgQue(uint16 _srcChainId, bytes calldata _path) internal {\n QueuedPayload[] storage msgs = msgsToDeliver[_srcChainId][_path];\n\n // warning, might run into gas issues trying to forward through a bunch of queued msgs\n while (msgs.length > 0) {\n QueuedPayload memory payload = msgs[msgs.length - 1];\n ILayerZeroReceiver(payload.dstAddress).lzReceive(_srcChainId, _path, payload.nonce, payload.payload);\n msgs.pop();\n }\n }\n\n function _getProtocolFees(\n bool _payInZro,\n uint _relayerFee,\n uint _oracleFee\n ) internal view returns (uint) {\n if (_payInZro) {\n return protocolFeeConfig.zroFee;\n } else {\n return ((_relayerFee + _oracleFee) * protocolFeeConfig.nativeBP) / 10000;\n }\n }\n\n function _getRelayerFee(\n uint16, /* _dstChainId */\n uint16, /* _outboundProofType */\n address, /* _userApplication */\n uint _payloadSize,\n bytes memory _adapterParams\n ) internal view returns (uint) {\n (uint16 txType, uint extraGas, uint dstNativeAmt, ) = LzLib.decodeAdapterParams(_adapterParams);\n uint totalRemoteToken; // = baseGas + extraGas + requiredNativeAmount\n if (txType == 2) {\n require(relayerFeeConfig.dstNativeAmtCap >= dstNativeAmt, \"LayerZeroMock: dstNativeAmt too large \");\n totalRemoteToken += dstNativeAmt;\n }\n // remoteGasTotal = dstGasPriceInWei * (baseGas + extraGas)\n uint remoteGasTotal = relayerFeeConfig.dstGasPriceInWei * (relayerFeeConfig.baseGas + extraGas);\n totalRemoteToken += remoteGasTotal;\n\n // tokenConversionRate = dstPrice / localPrice\n // basePrice = totalRemoteToken * tokenConversionRate\n uint basePrice = (totalRemoteToken * relayerFeeConfig.dstPriceRatio) / 10**10;\n\n // pricePerByte = (dstGasPriceInWei * gasPerBytes) * tokenConversionRate\n uint pricePerByte = (relayerFeeConfig.dstGasPriceInWei * relayerFeeConfig.gasPerByte * relayerFeeConfig.dstPriceRatio) / 10**10;\n\n return basePrice + _payloadSize * pricePerByte;\n }\n}\n" + }, + "contracts/lzApp/libs/LzLib.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity >=0.6.0;\npragma experimental ABIEncoderV2;\n\nlibrary LzLib {\n // LayerZero communication\n struct CallParams {\n address payable refundAddress;\n address zroPaymentAddress;\n }\n\n //---------------------------------------------------------------------------\n // Address type handling\n\n struct AirdropParams {\n uint airdropAmount;\n bytes32 airdropAddress;\n }\n\n function buildAdapterParams(LzLib.AirdropParams memory _airdropParams, uint _uaGasLimit) internal pure returns (bytes memory adapterParams) {\n if (_airdropParams.airdropAmount == 0 && _airdropParams.airdropAddress == bytes32(0x0)) {\n adapterParams = buildDefaultAdapterParams(_uaGasLimit);\n } else {\n adapterParams = buildAirdropAdapterParams(_uaGasLimit, _airdropParams);\n }\n }\n\n // Build Adapter Params\n function buildDefaultAdapterParams(uint _uaGas) internal pure returns (bytes memory) {\n // txType 1\n // bytes [2 32 ]\n // fields [txType extraGas]\n return abi.encodePacked(uint16(1), _uaGas);\n }\n\n function buildAirdropAdapterParams(uint _uaGas, AirdropParams memory _params) internal pure returns (bytes memory) {\n require(_params.airdropAmount > 0, \"Airdrop amount must be greater than 0\");\n require(_params.airdropAddress != bytes32(0x0), \"Airdrop address must be set\");\n\n // txType 2\n // bytes [2 32 32 bytes[] ]\n // fields [txType extraGas dstNativeAmt dstNativeAddress]\n return abi.encodePacked(uint16(2), _uaGas, _params.airdropAmount, _params.airdropAddress);\n }\n\n function getGasLimit(bytes memory _adapterParams) internal pure returns (uint gasLimit) {\n require(_adapterParams.length == 34 || _adapterParams.length > 66, \"Invalid adapterParams\");\n assembly {\n gasLimit := mload(add(_adapterParams, 34))\n }\n }\n\n // Decode Adapter Params\n function decodeAdapterParams(bytes memory _adapterParams)\n internal\n pure\n returns (\n uint16 txType,\n uint uaGas,\n uint airdropAmount,\n address payable airdropAddress\n )\n {\n require(_adapterParams.length == 34 || _adapterParams.length > 66, \"Invalid adapterParams\");\n assembly {\n txType := mload(add(_adapterParams, 2))\n uaGas := mload(add(_adapterParams, 34))\n }\n require(txType == 1 || txType == 2, \"Unsupported txType\");\n require(uaGas > 0, \"Gas too low\");\n\n if (txType == 2) {\n assembly {\n airdropAmount := mload(add(_adapterParams, 66))\n airdropAddress := mload(add(_adapterParams, 86))\n }\n }\n }\n\n //---------------------------------------------------------------------------\n // Address type handling\n function bytes32ToAddress(bytes32 _bytes32Address) internal pure returns (address _address) {\n return address(uint160(uint(_bytes32Address)));\n }\n\n function addressToBytes32(address _address) internal pure returns (bytes32 _bytes32Address) {\n return bytes32(uint(uint160(_address)));\n }\n}\n" + }, + "contracts/contracts-upgradable/token/onft721/extensions/ExtendedONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721RoyaltyUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\";\nimport \"../ONFT721Upgradeable.sol\";\n\ncontract ExtendedONFT721Upgradeable is\n OwnableUpgradeable,\n AccessControlUpgradeable,\n ERC721Upgradeable,\n ERC721RoyaltyUpgradeable,\n ERC721EnumerableUpgradeable,\n ERC721BurnableUpgradeable,\n ONFT721Upgradeable,\n Proxied\n{\n using StringsUpgradeable for uint256;\n\n string internal baseTokenURI;\n\n /********************************************\n *** Initializers\n ********************************************/\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(\n string memory _name,\n string memory _symbol,\n string memory _baseUri,\n uint96 _royaltyBasePoints,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) public virtual initializer {\n __ExtendedONFT721Upgradeable_init(_name, _symbol, _baseUri, _royaltyBasePoints, _minGasToTransfer, _lzEndpoint);\n }\n\n function __ExtendedONFT721Upgradeable_init(\n string memory _name,\n string memory _symbol,\n string memory _baseUri,\n uint96 _royaltyBasePoints,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) internal onlyInitializing {\n __ERC721_init_unchained(_name, _symbol);\n\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __ONFT721CoreUpgradeable_init_unchained(_minGasToTransfer);\n\n __ExtendedONFT721Upgradeable_init_unchained(_baseUri, _royaltyBasePoints);\n }\n\n function __ExtendedONFT721Upgradeable_init_unchained(string memory _baseUri, uint96 _royaltyBasePoints) internal onlyInitializing {\n baseTokenURI = _baseUri;\n\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n _setDefaultRoyalty(_msgSender(), _royaltyBasePoints);\n }\n\n /********************************************\n *** Public functions\n ********************************************/\n\n /**\n * @dev Multi-recipient transfer.\n */\n function transferMulti(address from, address[] memory recipients, uint256[] memory tokenIds) public virtual {\n require(recipients.length > 0 && recipients.length == tokenIds.length, \"ERC721: input length mismatch\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n safeTransferFrom(from, recipients[i], tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Batch-Transfer (same recipient).\n */\n function transferBatch(address from, address to, uint256[] memory tokenIds) public virtual {\n require(tokenIds.length > 0, \"ERC721: tokenIds can't be empty\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n safeTransferFrom(from, to, tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Set new token metadata base URI.\n */\n function setBaseURI(string memory _baseUri) public virtual onlyOwner {\n baseTokenURI = _baseUri;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}. Override attaches \".json\" extension to URI.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), \".json\")) : \"\";\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ONFT721Upgradeable, ERC721RoyaltyUpgradeable, ERC721EnumerableUpgradeable, ERC721Upgradeable, AccessControlUpgradeable)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n /********************************************\n *** Internal functions\n ********************************************/\n\n /**\n * @dev Updateable base token URI override.\n */\n function _baseURI() internal view virtual override returns (string memory) {\n return baseTokenURI;\n }\n\n /**\n * @dev See {ERC721-_burn}.\n */\n function _burn(uint256 tokenId) internal virtual override(ERC721RoyaltyUpgradeable, ERC721Upgradeable) {\n super._burn(tokenId);\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override(ERC721EnumerableUpgradeable, ERC721Upgradeable) {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\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 uint[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * ```solidity\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 * ```solidity\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. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\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/token/ERC721/extensions/ERC721BurnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../utils/ContextUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC721 Burnable Token\n * @dev ERC721 Token that can be burned (destroyed).\n */\nabstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {\n function __ERC721Burnable_init() internal onlyInitializing {\n }\n\n function __ERC721Burnable_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev Burns `tokenId`. See {ERC721-_burn}.\n *\n * Requirements:\n *\n * - The caller must own `tokenId` or be an approved operator.\n */\n function burn(uint256 tokenId) public virtual {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _burn(tokenId);\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" + }, + "contracts/contracts-upgradable/token/onft721/ONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"./interfaces/IONFT721Upgradeable.sol\";\nimport \"./ONFT721CoreUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\n\n// NOTE: this ONFT contract has no public minting logic.\n// must implement your own minting logic in child classes\ncontract ONFT721Upgradeable is Initializable, ONFT721CoreUpgradeable, ERC721Upgradeable, IONFT721Upgradeable {\n function __ONFT721Upgradeable_init(\n string memory _name,\n string memory _symbol,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) internal onlyInitializing {\n __ERC721_init_unchained(_name, _symbol);\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __ONFT721CoreUpgradeable_init_unchained(_minGasToTransfer);\n }\n\n function __ONFT721Upgradeable_init_unchained() internal onlyInitializing {}\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ONFT721CoreUpgradeable, ERC721Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IONFT721Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(address _from, uint16, bytes memory, uint _tokenId) internal virtual override {\n require(_isApprovedOrOwner(_msgSender(), _tokenId), \"ONFT721: send caller is not owner nor approved\");\n require(ERC721Upgradeable.ownerOf(_tokenId) == _from, \"ONFT721: send from incorrect owner\");\n _transfer(_from, address(this), _tokenId);\n }\n\n function _creditTo(uint16, address _toAddress, uint _tokenId) internal virtual override {\n require(!_exists(_tokenId) || (_exists(_tokenId) && ERC721Upgradeable.ownerOf(_tokenId) == address(this)));\n if (!_exists(_tokenId)) {\n _safeMint(_toAddress, _tokenId);\n } else {\n _transfer(address(this), _toAddress, _tokenId);\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 uint[50] 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" + }, + "contracts/contracts-upgradable/token/onft721/interfaces/IONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"./IONFT721CoreUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\n\n/**\n * @dev Interface of the ONFT Upgradeable standard\n */\ninterface IONFT721Upgradeable is IONFT721CoreUpgradeable, IERC721Upgradeable {\n\n}\n" + }, + "contracts/contracts-upgradable/token/onft721/extensions/MinterONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"./ExtendedONFT721Upgradeable.sol\";\n\ncontract MinterONFT721Upgradeable is ExtendedONFT721Upgradeable {\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n\n /********************************************\n *** Public functions\n ********************************************/\n\n function initialize(\n string memory _name,\n string memory _symbol,\n string memory _baseUri,\n uint96 _royaltyBasePoints,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) public virtual override initializer {\n __MinterONFT721Upgradeable_init(_name, _symbol, _baseUri, _royaltyBasePoints, _minGasToTransfer, _lzEndpoint);\n }\n\n function __MinterONFT721Upgradeable_init(\n string memory _name,\n string memory _symbol,\n string memory _baseUri,\n uint96 _royaltyBasePoints,\n uint256 _minGasToTransfer,\n address _lzEndpoint\n ) internal onlyInitializing {\n __ERC721_init_unchained(_name, _symbol);\n\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n __ONFT721CoreUpgradeable_init_unchained(_minGasToTransfer);\n\n __ExtendedONFT721Upgradeable_init_unchained(_baseUri, _royaltyBasePoints);\n\n __MinterONFT721Upgradeable_init_unchained();\n }\n\n function __MinterONFT721Upgradeable_init_unchained() internal onlyInitializing {\n _setupRole(MINTER_ROLE, _msgSender());\n }\n\n /**\n * @dev Public minting method, Minter-role only.\n */\n function mint(address to, uint256 tokenId) public virtual onlyRole(MINTER_ROLE) {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Multi-recipient minting.\n */\n function mintMulti(address[] memory recipients, uint256[] memory tokenIds) public virtual onlyRole(MINTER_ROLE) {\n require(recipients.length > 0 && recipients.length == tokenIds.length, \"ERC721: input length mismatch\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n _safeMint(recipients[i], tokenIds[i], \"\");\n }\n }\n\n /**\n * @dev Batch-Mint (same recipient).\n */\n function mintBatch(address to, uint256[] memory tokenIds) public virtual onlyRole(MINTER_ROLE) {\n require(tokenIds.length > 0, \"ERC721: tokenIds can't be empty\");\n\n for (uint16 i = 0; i < tokenIds.length; i++) {\n _safeMint(to, tokenIds[i], \"\");\n }\n }\n}\n" + }, + "contracts/contracts-upgradable/examples/ExampleONFT721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.2;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"../token/onft721/ONFT721Upgradeable.sol\";\n\ncontract ExampleONFT721Upgradeable is Initializable, ONFT721Upgradeable, Proxied {\n function initialize(string memory _name, string memory _symbol, uint256 _minGasToTransfer, address _lzEndpoint) public initializer {\n __ONFT721Upgradeable_init(_name, _symbol, _minGasToTransfer, _lzEndpoint);\n }\n\n function mint(address _tokenOwner, uint _newId) external {\n _safeMint(_tokenOwner, _newId);\n }\n}\n" + }, + "contracts/contracts-upgradable/token/onft1155/extensions/ExtendedONFT1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\";\nimport \"../ONFT1155Upgradeable.sol\";\n\ncontract ExtendedONFT1155Upgradeable is\n Initializable,\n OwnableUpgradeable,\n AccessControlUpgradeable,\n ERC1155Upgradeable,\n ERC1155SupplyUpgradeable,\n ERC1155BurnableUpgradeable,\n ERC2981Upgradeable,\n ONFT1155Upgradeable,\n Proxied\n{\n string public name;\n string public symbol;\n\n /********************************************\n *** Initializers\n ********************************************/\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function initialize(\n string memory _name,\n string memory _symbol,\n string memory _uri,\n uint96 _royaltyBasePoints,\n address _lzEndpoint\n ) public virtual initializer {\n __ExtendedONFT1155Upgradeable_init(_name, _symbol, _uri, _royaltyBasePoints, _lzEndpoint);\n }\n\n function __ExtendedONFT1155Upgradeable_init(\n string memory _name,\n string memory _symbol,\n string memory _uri,\n uint96 _royaltyBasePoints,\n address _lzEndpoint\n ) internal onlyInitializing {\n __ERC1155_init_unchained(_uri);\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n\n __ExtendedONFT721Upgradeable_init_unchained(_name, _symbol, _royaltyBasePoints);\n }\n\n function __ExtendedONFT721Upgradeable_init_unchained(\n string memory _name,\n string memory _symbol,\n uint96 _royaltyBasePoints\n ) internal onlyInitializing {\n name = _name;\n symbol = _symbol;\n\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n _setDefaultRoyalty(_msgSender(), _royaltyBasePoints);\n }\n\n /********************************************\n *** Public functions\n ********************************************/\n /**\n * @dev Sets a new token metadata URI.\n */\n function setURI(string memory _uri) external virtual onlyOwner {\n _setURI(_uri);\n }\n\n /**\n * @dev Sets the royalty information that all ids in this contract will default to.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external virtual onlyOwner {\n _setDefaultRoyalty(receiver, feeNumerator);\n }\n\n /**\n * @dev Sets the royalty information for a specific token id, overriding the global default.\n */\n function setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) external virtual onlyOwner {\n _setTokenRoyalty(tokenId, receiver, feeNumerator);\n }\n\n /**\n * @dev Transfer to multiple recipients.\n */\n function multiTransferFrom(address from, address[] memory tos, uint256 id, uint256 amount, bytes memory data) public virtual {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"ExtendedONFT1155: caller is not token owner or approved\");\n\n for (uint256 i = 0; i < tos.length; ++i) {\n _safeTransferFrom(from, tos[i], id, amount, data);\n }\n }\n\n /**\n * @dev Batch transfer to multiple recipients.\n */\n function multiBatchTransferFrom(\n address from,\n address[] memory tos,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual {\n require(from == _msgSender() || isApprovedForAll(from, _msgSender()), \"ExtendedONFT1155: caller is not token owner or approved\");\n\n for (uint256 i = 0; i < tos.length; ++i) {\n _safeBatchTransferFrom(from, tos[i], ids, amounts, data);\n }\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}. Includes check for token existence.\n */\n function uri(uint256 id) public view virtual override returns (string memory) {\n require(exists(id), \"ExtendedONFT1155: Token ID doesn't exist\");\n\n return super.uri(id);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Upgradeable, ERC2981Upgradeable, ONFT1155Upgradeable, AccessControlUpgradeable) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n /********************************************\n *** Internal functions\n ********************************************/\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, 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 uint[48] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of {ERC1155} that allows token holders to destroy both their\n * own tokens and those that they have been approved to use.\n *\n * _Available since v3.1._\n */\nabstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Burnable_init() internal onlyInitializing {\n }\n\n function __ERC1155Burnable_init_unchained() internal onlyInitializing {\n }\n function burn(address account, uint256 id, uint256 value) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burn(account, id, value);\n }\n\n function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n\n _burnBatch(account, ids, values);\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/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\n *\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\n * clearly identified. Note: While a totalSupply of 1 might mean the\n * corresponding is an NFT, there is no guarantees that no other token with the\n * same id are not going to be minted.\n */\nabstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Supply_init() internal onlyInitializing {\n }\n\n function __ERC1155Supply_init_unchained() internal onlyInitializing {\n }\n mapping(uint256 => uint256) private _totalSupply;\n\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) public view virtual returns (uint256) {\n return _totalSupply[id];\n }\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) public view virtual returns (bool) {\n return ERC1155SupplyUpgradeable.totalSupply(id) > 0;\n }\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n if (from == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n _totalSupply[ids[i]] += amounts[i];\n }\n }\n\n if (to == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n uint256 supply = _totalSupply[id];\n require(supply >= amount, \"ERC1155: burn amount exceeds totalSupply\");\n unchecked {\n _totalSupply[id] = supply - amount;\n }\n }\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" + }, + "contracts/contracts-upgradable/token/onft1155/ONFT1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./interfaces/IONFT1155Upgradeable.sol\";\nimport \"./ONFT1155CoreUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\";\n\n// NOTE: this ONFT contract has no public minting logic.\n// must implement your own minting logic in child classes\ncontract ONFT1155Upgradeable is Initializable, ONFT1155CoreUpgradeable, ERC1155Upgradeable, IONFT1155Upgradeable {\n function __ONFT1155Upgradeable_init(string memory _uri, address _lzEndpoint) internal onlyInitializing {\n __ERC1155_init_unchained(_uri);\n __Ownable_init_unchained();\n __LzAppUpgradeable_init_unchained(_lzEndpoint);\n }\n\n function __ONFT1155Upgradeable_init_unchained() internal onlyInitializing {}\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ONFT1155CoreUpgradeable, ERC1155Upgradeable, IERC165Upgradeable) returns (bool) {\n return interfaceId == type(IONFT1155Upgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n function _debitFrom(address _from, uint16, bytes memory, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override {\n address spender = _msgSender();\n require(spender == _from || isApprovedForAll(_from, spender), \"ONFT1155: send caller is not owner nor approved\");\n _burnBatch(_from, _tokenIds, _amounts);\n }\n\n function _creditTo(uint16, address _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override {\n _mintBatch(_toAddress, _tokenIds, _amounts, \"\");\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 uint[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155Upgradeable.sol\";\nimport \"./IERC1155ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC1155MetadataURIUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\n using AddressUpgradeable for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\n __ERC1155_init_unchained(uri_);\n }\n\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: address zero is not a valid owner\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\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[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Upgradeable.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "contracts/contracts-upgradable/token/onft1155/interfaces/IONFT1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./IONFT1155CoreUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\";\n\n/**\n * @dev Interface of the ONFT standard\n */\ninterface IONFT1155Upgradeable is IONFT1155CoreUpgradeable, IERC1155Upgradeable {\n\n}\n" + }, + "contracts/contracts-upgradable/examples/ExampleONFT1155Upgradeable.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.2;\n\nimport \"hardhat-deploy/solc_0.8/proxy/Proxied.sol\";\nimport \"../token/onft1155/ONFT1155Upgradeable.sol\";\n\ncontract ExampleONFT1155Upgradeable is Initializable, ONFT1155Upgradeable, Proxied {\n function initialize(string memory _uri, address _lzEndpoint, uint _amount) public initializer {\n __ONFT1155Upgradeable_init(_uri, _lzEndpoint);\n if (_amount > 0) {\n _mint(_msgSender(), 1, _amount, \"\");\n }\n }\n\n function mintBatch(address _to, uint256[] memory _ids, uint256[] memory _amounts) external {\n _mintBatch(_to, _ids, _amounts, \"\");\n }\n\n function mint(address _to, uint256 _id, uint256 _amount) external {\n _mint(_to, _id, _amount, \"\");\n }\n}\n" + }, + "contracts/token/oft/v2/OFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./BaseOFTV2.sol\";\n\ncontract OFTV2 is BaseOFTV2, ERC20 {\n uint internal immutable ld2sdRate;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) ERC20(_name, _symbol) BaseOFTV2(_sharedDecimals, _lzEndpoint) {\n uint8 decimals = decimals();\n require(_sharedDecimals <= decimals, \"OFT: sharedDecimals must be <= decimals\");\n ld2sdRate = 10**(decimals - _sharedDecimals);\n }\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function circulatingSupply() public view virtual override returns (uint) {\n return totalSupply();\n }\n\n function token() public view virtual override returns (address) {\n return address(this);\n }\n\n /************************************************************************\n * internal functions\n ************************************************************************/\n function _debitFrom(\n address _from,\n uint16,\n bytes32,\n uint _amount\n ) internal virtual override returns (uint) {\n address spender = _msgSender();\n if (_from != spender) _spendAllowance(_from, spender, _amount);\n _burn(_from, _amount);\n return _amount;\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _amount\n ) internal virtual override returns (uint) {\n _mint(_toAddress, _amount);\n return _amount;\n }\n\n function _transferFrom(\n address _from,\n address _to,\n uint _amount\n ) internal virtual override returns (uint) {\n address spender = _msgSender();\n // if transfer from this contract, no need to check allowance\n if (_from != address(this) && _from != spender) _spendAllowance(_from, spender, _amount);\n _transfer(_from, _to, _amount);\n return _amount;\n }\n\n function _ld2sdRate() internal view virtual override returns (uint) {\n return ld2sdRate;\n }\n}\n" + }, + "contracts/token/oft/v2/NativeOFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"./OFTV2.sol\";\n\ncontract NativeOFTV2 is OFTV2, ReentrancyGuard {\n event Deposit(address indexed _dst, uint _amount);\n event Withdrawal(address indexed _src, uint _amount);\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _sharedDecimals,\n address _lzEndpoint\n ) OFTV2(_name, _symbol, _sharedDecimals, _lzEndpoint) {}\n\n /************************************************************************\n * public functions\n ************************************************************************/\n function sendFrom(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _send(_from, _dstChainId, _toAddress, _amount, _callParams.refundAddress, _callParams.zroPaymentAddress, _callParams.adapterParams);\n }\n\n function sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes calldata _payload,\n uint64 _dstGasForCall,\n LzCallParams calldata _callParams\n ) public payable virtual override {\n _sendAndCall(\n _from,\n _dstChainId,\n _toAddress,\n _amount,\n _payload,\n _dstGasForCall,\n _callParams.refundAddress,\n _callParams.zroPaymentAddress,\n _callParams.adapterParams\n );\n }\n\n function deposit() public payable {\n _mint(msg.sender, msg.value);\n emit Deposit(msg.sender, msg.value);\n }\n\n function withdraw(uint _amount) external nonReentrant {\n require(balanceOf(msg.sender) >= _amount, \"NativeOFTV2: Insufficient balance.\");\n _burn(msg.sender, _amount);\n (bool success, ) = msg.sender.call{value: _amount}(\"\");\n require(success, \"NativeOFTV2: failed to unwrap\");\n emit Withdrawal(msg.sender, _amount);\n }\n\n function _send(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTV2: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCall(\n address _from,\n uint16 _dstChainId,\n bytes32 _toAddress,\n uint _amount,\n bytes memory _payload,\n uint64 _dstGasForCall,\n address payable _refundAddress,\n address _zroPaymentAddress,\n bytes memory _adapterParams\n ) internal virtual override returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount, ) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTV2: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _debitFromNative(address _from, uint _amount) internal returns (uint messageFee) {\n messageFee = msg.sender == _from ? _debitMsgSender(_amount) : _debitMsgFrom(_from, _amount);\n }\n\n function _debitMsgSender(uint _amount) internal returns (uint messageFee) {\n uint msgSenderBalance = balanceOf(msg.sender);\n\n if (msgSenderBalance < _amount) {\n require(msgSenderBalance + msg.value >= _amount, \"NativeOFTV2: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgSenderBalance;\n _mint(address(msg.sender), mintAmount);\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _transfer(msg.sender, address(this), _amount);\n return messageFee;\n }\n\n function _debitMsgFrom(address _from, uint _amount) internal returns (uint messageFee) {\n uint msgFromBalance = balanceOf(_from);\n\n if (msgFromBalance < _amount) {\n require(msgFromBalance + msg.value >= _amount, \"NativeOFTV2: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgFromBalance;\n _mint(address(msg.sender), mintAmount);\n\n // transfer the differential amount to the contract\n _transfer(msg.sender, address(this), mintAmount);\n\n // overwrite the _amount to take the rest of the balance from the _from address\n _amount = msgFromBalance;\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _spendAllowance(_from, msg.sender, _amount);\n _transfer(_from, address(this), _amount);\n return messageFee;\n }\n\n function _creditTo(\n uint16,\n address _toAddress,\n uint _amount\n ) internal override returns (uint) {\n _burn(address(this), _amount);\n (bool success, ) = _toAddress.call{value: _amount}(\"\");\n require(success, \"NativeOFTV2: failed to _creditTo\");\n return _amount;\n }\n\n receive() external payable {\n deposit();\n }\n}\n" + }, + "contracts/token/oft/v2/fee/NativeOFTWithFee.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"./OFTWithFee.sol\";\n\ncontract NativeOFTWithFee is OFTWithFee, ReentrancyGuard {\n\n event Deposit(address indexed _dst, uint _amount);\n event Withdrawal(address indexed _src, uint _amount);\n\n constructor(string memory _name, string memory _symbol, uint8 _sharedDecimals, address _lzEndpoint) OFTWithFee(_name, _symbol, _sharedDecimals, _lzEndpoint) {}\n\n function deposit() public payable {\n _mint(msg.sender, msg.value);\n emit Deposit(msg.sender, msg.value);\n }\n\n function withdraw(uint _amount) external nonReentrant {\n require(balanceOf(msg.sender) >= _amount, \"NativeOFTWithFee: Insufficient balance.\");\n _burn(msg.sender, _amount);\n (bool success, ) = msg.sender.call{value: _amount}(\"\");\n require(success, \"NativeOFTWithFee: failed to unwrap\");\n emit Withdrawal(msg.sender, _amount);\n }\n\n function _send(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual override returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n (amount,) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n bytes memory lzPayload = _encodeSendPayload(_toAddress, _ld2sd(amount));\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes memory _payload, uint64 _dstGasForCall, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual override returns (uint amount) {\n _checkGasLimit(_dstChainId, PT_SEND_AND_CALL, _adapterParams, _dstGasForCall);\n\n (amount,) = _removeDust(_amount);\n require(amount > 0, \"NativeOFTWithFee: amount too small\");\n uint messageFee = _debitFromNative(_from, amount);\n\n // encode the msg.sender into the payload instead of _from\n bytes memory lzPayload = _encodeSendAndCallPayload(msg.sender, _toAddress, _ld2sd(amount), _payload, _dstGasForCall);\n _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, messageFee);\n\n emit SendToChain(_dstChainId, _from, _toAddress, amount);\n }\n\n function _debitFromNative(address _from, uint _amount) internal returns (uint messageFee) {\n messageFee = msg.sender == _from ? _debitMsgSender(_amount) : _debitMsgFrom(_from, _amount);\n }\n\n function _debitMsgSender(uint _amount) internal returns (uint messageFee) {\n uint msgSenderBalance = balanceOf(msg.sender);\n\n if (msgSenderBalance < _amount) {\n require(msgSenderBalance + msg.value >= _amount, \"NativeOFTWithFee: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgSenderBalance;\n _mint(address(msg.sender), mintAmount);\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _transfer(msg.sender, address(this), _amount);\n return messageFee;\n }\n\n function _debitMsgFrom(address _from, uint _amount) internal returns (uint messageFee) {\n uint msgFromBalance = balanceOf(_from);\n\n if (msgFromBalance < _amount) {\n require(msgFromBalance + msg.value >= _amount, \"NativeOFTWithFee: Insufficient msg.value\");\n\n // user can cover difference with additional msg.value ie. wrapping\n uint mintAmount = _amount - msgFromBalance;\n _mint(address(msg.sender), mintAmount);\n\n // transfer the differential amount to the contract\n _transfer(msg.sender, address(this), mintAmount);\n\n // overwrite the _amount to take the rest of the balance from the _from address\n _amount = msgFromBalance;\n\n // update the messageFee to take out mintAmount\n messageFee = msg.value - mintAmount;\n } else {\n messageFee = msg.value;\n }\n\n _spendAllowance(_from, msg.sender, _amount);\n _transfer(_from, address(this), _amount);\n return messageFee;\n }\n\n function _creditTo(uint16, address _toAddress, uint _amount) internal override returns(uint) {\n _burn(address(this), _amount);\n (bool success, ) = _toAddress.call{value: _amount}(\"\");\n require(success, \"NativeOFTWithFee: failed to _creditTo\");\n return _amount;\n }\n\n receive() external payable {\n deposit();\n }\n}" + }, + "contracts/token/oft/v2/mocks/OFTV2Mock.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../OFTV2.sol\";\n\n// @dev mock OFTV2 demonstrating how to inherit OFTV2\ncontract OFTV2Mock is OFTV2 {\n constructor(address _layerZeroEndpoint, uint _initialSupply, uint8 _sharedDecimals) OFTV2(\"ExampleOFT\", \"OFT\", _sharedDecimals, _layerZeroEndpoint) {\n _mint(_msgSender(), _initialSupply);\n }\n}\n" + }, + "contracts/examples/ExampleOFTV2.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../token/oft/v2/OFTV2.sol\";\n\n/// @title A LayerZero OmnichainFungibleToken example of BasedOFT\n/// @notice Use this contract only on the BASE CHAIN. It locks tokens on source, on outgoing send(), and unlocks tokens when receiving from other chains.\ncontract ExampleOFTV2 is OFTV2 {\n constructor(address _layerZeroEndpoint, uint _initialSupply, uint8 _sharedDecimals) OFTV2(\"ExampleOFT\", \"OFT\", _sharedDecimals, _layerZeroEndpoint) {\n _mint(_msgSender(), _initialSupply);\n }\n}\n" + }, + "contracts/mocks/USDMock.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\n// this is a MOCK\nabstract contract Faucet is ERC20 {\n mapping(address => uint256) public lastClaimedAt;\n uint256 public constant FAUCET_DRIP = 100; // eth\n uint256 public constant COOLDOWN = 3600; // sec\n uint256 internal pow;\n\n constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) {\n pow = 10 ** decimals();\n _mint(msg.sender, 100000000 * pow);\n }\n\n function canClaim(address account) public view returns (bool) {\n return lastClaimedAt[account] + COOLDOWN < block.timestamp;\n }\n\n function claim() external {\n require(canClaim(msg.sender), \"wallet claimed recently\");\n\n lastClaimedAt[msg.sender] = block.timestamp;\n _mint(msg.sender, FAUCET_DRIP * pow);\n }\n}\n\nabstract contract USDFaucet is Faucet {\n function decimals() public view virtual override returns (uint8) {\n return 6;\n }\n}\n\ncontract USDCMock is USDFaucet {\n constructor() Faucet(\"USD Coin\", \"USDC\") {}\n}\n\ncontract USDTMock is USDFaucet {\n constructor() Faucet(\"Tether USD\", \"USDT\") {}\n}\n\ncontract BeamMock is Faucet {\n constructor() Faucet(\"Beam\", \"BEAM\") {}\n}\n" + }, + "contracts/mocks/ERC20Mock.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\n// this is a MOCK\ncontract ERC20Mock is ERC20 {\n constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) {}\n\n function mint(address _to, uint _amount) public {\n _mint(_to, _amount);\n }\n}\n" + }, + "contracts/token/onft721/mocks/ONFT721Mock.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.0;\n\nimport \"../ONFT721.sol\";\n\ncontract ONFT721Mock is ONFT721 {\n constructor(\n string memory _name,\n string memory _symbol,\n uint _minGasToStore,\n address _layerZeroEndpoint\n ) ONFT721(_name, _symbol, _minGasToStore, _layerZeroEndpoint) {}\n\n function mint(address _tokenOwner, uint _newId) external payable {\n _safeMint(_tokenOwner, _newId);\n }\n\n function rawOwnerOf(uint tokenId) public view returns (address) {\n if (_exists(tokenId)) {\n return ownerOf(tokenId);\n }\n return address(0);\n }\n}\n" + }, + "contracts/token/onft721/mocks/ONFT721AMock.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.4;\n\nimport \"../ONFT721A.sol\";\n\n// DISCLAIMER: This contract can only be deployed on one chain when deployed and calling\n// setTrustedRemotes with remote contracts. This is due to the sequential way 721A mints tokenIds.\n// This contract must be the first minter of each token id\ncontract ONFT721AMock is ONFT721A {\n constructor(\n string memory _name,\n string memory _symbol,\n uint _minGasToTransferAndStore,\n address _layerZeroEndpoint\n ) ONFT721A(_name, _symbol, _minGasToTransferAndStore, _layerZeroEndpoint) {}\n\n function mint(uint _amount) external payable {\n _safeMint(msg.sender, _amount, \"\");\n }\n}\n" + }, + "contracts/examples/PingPong.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n//\n// Note: You will need to fund each deployed contract with gas.\n//\n// PingPong sends a LayerZero message back and forth between chains\n// a predetermined number of times (or until it runs out of gas).\n//\n// Demonstrates:\n// 1. a recursive feature of calling send() from inside lzReceive()\n// 2. how to `estimateFees` for a send()'ing a LayerZero message\n// 3. the contract pays the message fee\n\npragma solidity ^0.8.0;\npragma abicoder v2;\n\nimport \"../lzApp/NonblockingLzApp.sol\";\n\n/// @title PingPong\n/// @notice Sends a LayerZero message back and forth between chains a predetermined number of times.\ncontract PingPong is NonblockingLzApp {\n\n /// @dev event emitted every ping() to keep track of consecutive pings count\n event Ping(uint256 pingCount);\n\n /// @param _endpoint The LayerZero endpoint address.\n constructor(address _endpoint) NonblockingLzApp(_endpoint) {}\n\n /// @notice Pings the destination chain, along with the current number of pings sent.\n /// @param _dstChainId The destination chain ID.\n /// @param _totalPings The total number of pings to send.\n function ping(\n uint16 _dstChainId,\n uint256 _totalPings\n ) public {\n _ping(_dstChainId, 0, _totalPings);\n }\n\n /// @dev Internal function to ping the destination chain, along with the current number of pings sent.\n /// @param _dstChainId The destination chain ID.\n /// @param _pings The current ping count.\n /// @param _totalPings The total number of pings to send.\n function _ping(\n uint16 _dstChainId,\n uint256 _pings,\n uint256 _totalPings\n ) internal {\n require(address(this).balance > 0, \"This contract ran out of money.\");\n\n // encode the payload with the number of pings\n bytes memory payload = abi.encode(_pings, _totalPings);\n\n // encode the adapter parameters\n uint16 version = 1;\n uint256 gasForDestinationLzReceive = 350000;\n bytes memory adapterParams = abi.encodePacked(version, gasForDestinationLzReceive);\n\n // send LayerZero message\n _lzSend( // {value: messageFee} will be paid out of this contract!\n _dstChainId, // destination chainId\n payload, // abi.encode()'ed bytes\n payable(this), // (msg.sender will be this contract) refund address (LayerZero will refund any extra gas back to caller of send())\n address(0x0), // future param, unused for this example\n adapterParams, // v1 adapterParams, specify custom destination gas qty\n address(this).balance\n );\n }\n\n /// @dev Internal function to handle incoming Ping messages.\n /// @param _srcChainId The source chain ID from which the message originated.\n /// @param _payload The payload of the incoming message.\n function _nonblockingLzReceive(\n uint16 _srcChainId,\n bytes memory, /*_srcAddress*/\n uint64, /*_nonce*/\n bytes memory _payload\n ) internal override {\n // decode the number of pings sent thus far\n (uint256 pingCount, uint256 totalPings) = abi.decode(_payload, (uint256, uint256));\n ++pingCount;\n emit Ping(pingCount);\n\n // *pong* back to the other side\n if (pingCount < totalPings) {\n _ping(_srcChainId, pingCount, totalPings);\n }\n }\n\n // allow this contract to receive ether\n receive() external payable {}\n}\n" + }, + "contracts/examples/OmniCounter.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\npragma abicoder v2;\n\nimport \"../lzApp/NonblockingLzApp.sol\";\n\n/// @title A LayerZero example sending a cross chain message from a source chain to a destination chain to increment a counter\ncontract OmniCounter is NonblockingLzApp {\n bytes public constant PAYLOAD = \"\\x01\\x02\\x03\\x04\";\n uint public counter;\n\n constructor(address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {}\n\n function _nonblockingLzReceive(\n uint16,\n bytes memory,\n uint64,\n bytes memory\n ) internal override {\n counter += 1;\n }\n\n function estimateFee(\n uint16 _dstChainId,\n bool _useZro,\n bytes calldata _adapterParams\n ) public view returns (uint nativeFee, uint zroFee) {\n return lzEndpoint.estimateFees(_dstChainId, address(this), PAYLOAD, _useZro, _adapterParams);\n }\n\n function incrementCounter(uint16 _dstChainId) public payable {\n _lzSend(_dstChainId, PAYLOAD, payable(msg.sender), address(0x0), bytes(\"\"), msg.value);\n }\n\n function setOracle(uint16 dstChainId, address oracle) external onlyOwner {\n uint TYPE_ORACLE = 6;\n // set the Oracle\n lzEndpoint.setConfig(lzEndpoint.getSendVersion(address(this)), dstChainId, TYPE_ORACLE, abi.encode(oracle));\n }\n\n function getOracle(uint16 remoteChainId) external view returns (address _oracle) {\n bytes memory bytesOracle = lzEndpoint.getConfig(lzEndpoint.getSendVersion(address(this)), remoteChainId, address(this), 6);\n assembly {\n _oracle := mload(add(bytesOracle, 32))\n }\n }\n}\n" + }, + "contracts/examples/GasDrop.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../lzApp/NonblockingLzApp.sol\";\n\n/// @title GasDrop\n/// @notice A contract for sending and receiving gas across chains using LayerZero's NonblockingLzApp.\ncontract GasDrop is NonblockingLzApp {\n\n /// @notice The version of the adapterParams.\n uint16 public constant VERSION = 2;\n \n /// @notice The default amount of gas to be used on the destination chain.\n uint public dstGas = 25000;\n\n /// @dev Emitted when the destination gas is updated.\n event SetDstGas(uint dstGas);\n \n /// @dev Emitted when a gas drop is sent.\n event SendGasDrop(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint _amount);\n \n /// @dev Emitted when a gas drop is received on this chain.\n event ReceiveGasDrop(uint16 indexed _srcChainId, address indexed _from, bytes indexed _toAddress, uint _amount);\n\n /// @param _endpoint The LayerZero endpoint address.\n constructor(address _endpoint) NonblockingLzApp(_endpoint) {}\n\n /// @dev Internal function to handle incoming LayerZero messages and emit a ReceiveGasDrop event.\n /// @param _srcChainId The source chain ID from where the message originated.\n /// @param _payload The payload of the incoming message.\n function _nonblockingLzReceive(uint16 _srcChainId, bytes memory, uint64, bytes memory _payload) internal virtual override {\n (uint amount, address fromAddress, bytes memory toAddress) = abi.decode(_payload, (uint, address, bytes));\n emit ReceiveGasDrop(_srcChainId, fromAddress, toAddress, amount);\n }\n\n /// @notice Estimate the fee for sending a gas drop to other chains.\n /// @param _dstChainId Array of destination chain IDs.\n /// @param _toAddress Array of destination addresses.\n /// @param _amount Array of amounts to send.\n /// @param _useZro Whether to use ZRO for payment or not.\n /// @return nativeFee The total native fee for all destinations.\n /// @return zroFee The total ZRO fee for all destinations.\n function estimateSendFee(uint16[] calldata _dstChainId, bytes[] calldata _toAddress, uint[] calldata _amount, bool _useZro) external view virtual returns (uint nativeFee, uint zroFee) {\n require(_dstChainId.length == _toAddress.length, \"_dstChainId and _toAddress must be same size\");\n require(_toAddress.length == _amount.length, \"_toAddress and _amount must be same size\");\n for(uint i = 0; i < _dstChainId.length; i++) {\n bytes memory adapterParams = abi.encodePacked(VERSION, dstGas, _amount[i], _toAddress[i]);\n bytes memory payload = abi.encode(_amount[i], msg.sender, _toAddress[i]);\n (uint native, uint zro) = lzEndpoint.estimateFees(_dstChainId[i], address(this), payload, _useZro, adapterParams);\n nativeFee += native;\n zroFee += zro;\n }\n }\n\n /// @notice Send gas drops to other chains.\n /// @param _dstChainId Array of destination chain IDs.\n /// @param _toAddress Array of destination addresses.\n /// @param _amount Array of amounts to send.\n /// @param _refundAddress Address for refunds.\n /// @param _zroPaymentAddress Address for ZRO payments.\n function gasDrop(uint16[] calldata _dstChainId, bytes[] calldata _toAddress, uint[] calldata _amount, address payable _refundAddress, address _zroPaymentAddress) external payable virtual {\n require(_dstChainId.length == _toAddress.length, \"_dstChainId and _toAddress must be same size\");\n require(_toAddress.length == _amount.length, \"_toAddress and _amount must be same size\");\n uint _dstGas = dstGas;\n for(uint i = 0; i < _dstChainId.length; i++) {\n bytes memory adapterParams = abi.encodePacked(VERSION, _dstGas, _amount[i], _toAddress[i]);\n bytes memory payload = abi.encode(_amount[i], msg.sender, _toAddress[i]);\n address payable refundAddress = (i == _dstChainId.length - 1) ? _refundAddress : payable(address(this));\n _lzSend(_dstChainId[i], payload, refundAddress, _zroPaymentAddress, adapterParams, address(this).balance);\n emit SendGasDrop(_dstChainId[i], msg.sender, _toAddress[i], _amount[i]);\n }\n }\n\n /// @notice Update the destination gas amount.\n /// @param _dstGas The new destination gas amount.\n function setDstGas(uint _dstGas) external onlyOwner {\n dstGas = _dstGas;\n emit SetDstGas(dstGas);\n }\n\n /// @dev Fallback function to receive Ether.\n receive() external payable {}\n}\n" + }, + "contracts/contracts-upgradable/examples/Domi.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.18;\n\nimport \"../token/oft/v2/fee/OFTWithFeeUpgradeable.sol\";\nimport \"../token/oft/v2/fee/ProxyOFTWithFeeUpgradeable.sol\";\n\ncontract DomiOFT is OFTWithFeeUpgradeable {}\n\ncontract DomiProxyOFT is ProxyOFTWithFeeUpgradeable {}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "storageLayout", + "devdoc", + "userdoc", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index be3070f1..e7802ed4 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "scripts": { "test": "npx hardhat test --parallel", "prettier": "prettier --write test/**/*.js && prettier --write test/*/*/*.js && prettier --write deploy/*.js && prettier --write tasks/*.js && prettier --write contracts/**/*.sol && prettier --write contracts/**/**/*.sol && prettier --write contracts/**/**/**/*.sol", - "lint": "yarn prettier && solhint 'contracts/*.sol' && solhint 'contracts/**/*.sol' && solhint 'contracts/**/**/*.sol' && solhint 'contracts/**/**/**/*.sol'" + "lint": "yarn prettier && solhint 'contracts/*.sol' && solhint 'contracts/**/*.sol' && solhint 'contracts/**/**/*.sol' && solhint 'contracts/**/**/**/*.sol'", + "compile": "npx hardhat compile" }, "engines": { "node": "==18" diff --git a/tasks/sendOFT.js b/tasks/sendOFT.js index 2b3e55b7..8e989408 100644 --- a/tasks/sendOFT.js +++ b/tasks/sendOFT.js @@ -50,7 +50,7 @@ module.exports = async function (taskArgs, hre) { let qty = ethers.utils.parseUnits(taskArgs.qty, decimals) // quote LZ fee with default adapterParams - let adapterParams = ethers.utils.solidityPack(["uint16", "uint256"], [1, 200000]) // default adapterParams example + let adapterParams = ethers.utils.solidityPack(["uint16", "uint256"], [1, 10000000]) // default beam adapterParams example let lzFees = await localContractInstance.estimateSendFee(remoteChainId, toAddressBytes, qty, false, adapterParams) console.log(`lzFees[0] (wei): ${lzFees[0]} / (eth): ${ethers.utils.formatEther(lzFees[0])}`)