Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x1B2B0FA9283595F5036C007dD99Ed0aA6de8362E
Balance 0 ETH
Nonce 1
Code Size 23120 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

23120 bytes
0x608060405234801561001057600080fd5b50600436106103a45760003560e01c806377338642116101e9578063a9059cbb1161010f578063c5b29e57116100ad578063dd62ed3e1161007c578063dd62ed3e14610870578063e8db4e68146108a9578063f23a6e61146108b7578063f2fde38b146108ef57600080fd5b8063c5b29e5714610824578063cf34cda214610837578063d505accf1461084a578063dd60752d1461085d57600080fd5b8063b449c24d116100e9578063b449c24d14610777578063bc197c8114610797578063c1444067146107e8578063c317c377146107f157600080fd5b8063a9059cbb14610731578063a9bb242414610744578063b3872dc71461075757600080fd5b80638fdb8d0711610187578063a2e41ecf11610156578063a2e41ecf146106ea578063a457c2d7146106f8578063a59021741461070b578063a694fc3a1461071e57600080fd5b80638fdb8d07146106a957806391382dbf146106bc57806395d89b41146106cf57806399af4ba8146106d757600080fd5b806384b0196e116101c357806384b0196e1461064a5780638b775c4a146106655780638c3f164c146106855780638da5cb5b1461069857600080fd5b806377338642146105e857806379cc6790146106245780637ecebe001461063757600080fd5b8063313ce567116102ce57806350dd85e51161026c578063715018a61161023b578063715018a6146105a7578063735de9f7146105af5780637683a720146105c257806376b70f5e146105d557600080fd5b806350dd85e51461055b57806351689ecf14610563578063535d95d61461056b57806370a082311461057e57600080fd5b80633e413bee116102a85780633e413bee146105255780633fb239d01461053857806342966c68146105405780634e71d92d1461055357600080fd5b8063313ce567146104fb5780633644e5151461050a578063395093511461051257600080fd5b80631208aa181161034657806323b872dd1161031557806323b872dd146104b857806329451729146104cb578063297ce614146104d35780632e17de78146104e857600080fd5b80631208aa1814610461578063145bc9671461047457806318160ddd14610487578063207ce2fe1461048f57600080fd5b80630b3a6efb116103825780630b3a6efb146103f95780630ccb91ff146104245780630da451881461043757806311c850311461045857600080fd5b806301ffc9a7146103a957806306fdde03146103d1578063095ea7b3146103e6575b600080fd5b6103bc6103b7366004614fcb565b610902565b60405190151581526020015b60405180910390f35b6103d961096b565b6040516103c89190615045565b6103bc6103f436600461506d565b6109fd565b600f5461040c906001600160a01b031681565b6040516001600160a01b0390911681526020016103c8565b600e5461040c906001600160a01b031681565b61044a610445366004615099565b610a15565b6040519081526020016103c8565b61044a601c5481565b60145461040c906001600160a01b031681565b60105461040c906001600160a01b031681565b60025461044a565b61040c61049d3660046150b6565b6015602052600090815260409020546001600160a01b031681565b6103bc6104c63660046150cf565b610a59565b61044a610a7d565b6104e66104e1366004615099565b610a99565b005b6104e66104f63660046150b6565b610b2b565b604051600681526020016103c8565b61044a610bdd565b6103bc61052036600461506d565b610be7565b600d5461040c906001600160a01b031681565b6103d9610c26565b6104e661054e3660046150b6565b610cb4565b6104e6610cc1565b61044a610ed5565b61044a610f1e565b61044a6105793660046150b6565b610f90565b61044a61058c366004615099565b6001600160a01b031660009081526020819052604090205490565b6104e6611096565b60135461040c906001600160a01b031681565b6104e66105d03660046150b6565b6110e6565b60115461040c906001600160a01b031681565b61060f6105f6366004615099565b6017602052600090815260409020805460019091015482565b604080519283526020830191909152016103c8565b6104e661063236600461506d565b6120fc565b61044a610645366004615099565b612115565b610652612133565b6040516103c89796959493929190615110565b61044a6106733660046150b6565b60196020526000908152604090205481565b6104e66106933660046150b6565b6121d8565b6009546001600160a01b031661040c565b600b5461040c906001600160a01b031681565b61044a6106ca3660046150b6565b612647565b6103d96126ec565b60125461040c906001600160a01b031681565b601d54601e5461060f919082565b6103bc61070636600461506d565b6126fb565b6104e661071936600461506d565b6127a5565b6104e661072c3660046150b6565b612817565b6103bc61073f36600461506d565b612913565b61044a6107523660046150b6565b612921565b61044a610765366004615099565b60186020526000908152604090205481565b61044a610785366004615099565b60166020526000908152604090205481565b6107cf6107a53660046152fc565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b6040516001600160e01b031990911681526020016103c8565b61044a601f5481565b6108046107ff3660046150b6565b612c5e565b6040805194855260208501939093529183015260608201526080016103c8565b6104e66108323660046153aa565b6133db565b600c5461040c906001600160a01b031681565b6104e66108583660046153f2565b61341e565b6104e661086b366004615099565b613582565b61044a61087e3660046153aa565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b601a54601b5461060f919082565b6107cf6108c5366004615463565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b6104e66108fd366004615099565b61360f565b60006001600160e01b031982167f4e2312e000000000000000000000000000000000000000000000000000000000148061096557507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b60606003805461097a906154cc565b80601f01602080910402602001604051908101604052809291908181526020018280546109a6906154cc565b80156109f35780601f106109c8576101008083540402835291602001916109f3565b820191906000526020600020905b8154815290600101906020018083116109d657829003601f168201915b5050505050905090565b600033610a0b8185856136d0565b5060019392505050565b6001600160a01b0381166000908152601760205260408120610a3690613829565b6001600160a01b0383166000908152601860205260409020546109659190615516565b600033610a67858285613854565b610a728585856138e6565b506001949350505050565b6000610a87613ad3565b601c54610a949190615516565b905090565b610aa1613b08565b6001600160a01b038116610afc5760405162461bcd60e51b815260206004820152601b60248201527f7a65726f2061646472657373206973206e6f7420616c6c6f776564000000000060448201526064015b60405180910390fd5b600b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b33600090815260176020526040902054811115610b4757600080fd5b610b523033836138e6565b610b5a610cc1565b3360009081526017602052604081208054839290610b79908490615529565b9091555050601a8054829190600090610b93908490615529565b90915550610ba19050613b64565b60408051338152602081018390527f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75910160405180910390a150565b6000610a94613bc8565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190610a0b9082908690610c21908790615516565b6136d0565b600a8054610c33906154cc565b80601f0160208091040260200160405190810160405280929190818152602001828054610c5f906154cc565b8015610cac5780601f10610c8157610100808354040283529160200191610cac565b820191906000526020600020905b815481529060010190602001808311610c8f57829003601f168201915b505050505081565b610cbe3382613cf3565b50565b600f546040517f392ac3cd0000000000000000000000000000000000000000000000000000000081526000916001600160a01b03169063392ac3cd90610d0c90600a9060040161553c565b602060405180830381865afa158015610d29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4d91906155c7565b33600090815260176020526040812091925090610d6990613829565b33600090815260186020526040902054909150610d87908290615516565b610d8f613ad3565b601c54610d9c9190615516565b610da69190615529565b601c55336000818152601860205260409020546001600160a01b038416916340c10f1991610dd5908590615516565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015610e1b57600080fd5b505af1158015610e2f573d6000803e3d6000fd5b505033600090815260186020526040902054610e4e9250839150615516565b3360009081526016602052604081208054909190610e6d908490615516565b9091555050336000818152601760209081526040808320426001909101819055601b556018825280832092909255815192835282018390527fc04825ba3f383b602255d2a13065a68e325c65c9e0ed5d031ea2b06f641873af91015b60405180910390a15050565b601e546000908190610ee79042615529565b601d549091506301e13380908190610f009084906155e4565b610f0a9190615603565b601f54610f179190615516565b9250505090565b6010546000906001600160a01b03163314610f7b5760405162461bcd60e51b815260206004820152601f60248201527f6f6e6c792072656e74466f756e646174696f6e2063616e2074616b65206974006044820152606401610af3565b610f83613b64565b50601f8054600090915590565b600e5460405163d92521d160e01b81526004810183905260009182916001600160a01b039091169063d92521d190602401602060405180830381865afa158015610fde573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110029190615625565b600e546040516360ba48fd60e01b8152600481018690529192506000916001600160a01b03909116906360ba48fd90602401602060405180830381865afa158015611051573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110759190615625565b905061271061108482846155e4565b61108e9190615603565b949350505050565b61109e613b08565b60405162461bcd60e51b815260206004820152601d60248201527f63616e2027742072656e6f756e63654f776e65727368697020686572650000006044820152606401610af3565b600e546040516360ba48fd60e01b8152600481018390526000916001600160a01b0316906360ba48fd90602401602060405180830381865afa158015611130573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111549190615625565b116111a15760405162461bcd60e51b815260206004820152601d60248201527f74686973204e465420686173206e6f206c616e642061726561207365740000006044820152606401610af3565b600e5460405163d92521d160e01b8152600481018390526000916001600160a01b03169063d92521d190602401602060405180830381865afa1580156111eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061120f9190615625565b1161125c5760405162461bcd60e51b815260206004820152601e60248201527f74686973204e465420686173206e6f2063726f702073686172652073657400006044820152606401610af3565b600e546040517f207ce2fe0000000000000000000000000000000000000000000000000000000081526004810183905233916001600160a01b03169063207ce2fe90602401602060405180830381865afa1580156112be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e291906155c7565b6001600160a01b0316146113385760405162461bcd60e51b815260206004820152601c60248201527f6f6e6c7920696e697469616c206f776e65722063616e207368617264000000006044820152606401610af3565b600a60405160200161134a919061563e565b60408051808303601f19018152908290528051602090910120600e54630cd3ca6760e41b83526004830184905290916001600160a01b039091169063cd3ca67090602401600060405180830381865afa1580156113ab573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113d391908101906156b4565b6040516020016113e3919061572b565b60405160208183030381529060405280519060200120146114465760405162461bcd60e51b815260206004820152600a60248201527f77726f6e672063726f70000000000000000000000000000000000000000000006044820152606401610af3565b600f546040517f15eb439100000000000000000000000000000000000000000000000000000000815230916001600160a01b0316906315eb43919061149090600a9060040161553c565b602060405180830381865afa1580156114ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d191906155c7565b6001600160a01b0316146115275760405162461bcd60e51b815260206004820181905260248201527f746f6b656e7320617265206e6f742073657420666f7220746869732063726f706044820152606401610af3565b600e546040517efdd58e000000000000000000000000000000000000000000000000000000008152336004820152602481018390526000916001600160a01b03169062fdd58e90604401602060405180830381865afa15801561158e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115b29190615625565b116115ff5760405162461bcd60e51b815260206004820152601560248201527f796f75206d757374206f776e2074686973204e465400000000000000000000006044820152606401610af3565b6010546040517fefa20bf8000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b039091169063efa20bf890602401602060405180830381865afa158015611661573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611685919061575c565b156116d25760405162461bcd60e51b815260206004820152601860248201527f72656e742077617320616c7265616479206170706c69656400000000000000006044820152606401610af3565b600081815260156020526040808220805473ffffffffffffffffffffffffffffffffffffffff191633908117909155600e5491517ff242432a0000000000000000000000000000000000000000000000000000000081526004810191909152306024820152604481018490526001606482015260a0608482015260a48101929092526001600160a01b03169063f242432a9060c401600060405180830381600087803b15801561178157600080fd5b505af1158015611795573d6000803e3d6000fd5b5050600e5460405163d92521d160e01b8152600481018590526000935061271092506001600160a01b039091169063d92521d190602401602060405180830381865afa1580156117e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180d9190615625565b600e546040516360ba48fd60e01b8152600481018690526001600160a01b03909116906360ba48fd90602401602060405180830381865afa158015611856573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061187a9190615625565b61188491906155e4565b61189190620f42406155e4565b61189b9190615603565b90506118a73082613e59565b60006118b282613f18565b905060006118c08484613fb2565b905060006118cd85610f90565b6011546040517fdb87347c0000000000000000000000000000000000000000000000000000000081523060048201529192506000916001600160a01b039091169063db87347c90602401602060405180830381865afa158015611934573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119589190615625565b6011546040517fc3825f4b0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063c3825f4b906119a290600a9060040161553c565b602060405180830381865afa1580156119bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e39190615625565b6119ed90846155e4565b6119f79190615603565b611a03906103e86155e4565b90506000601260009054906101000a90046001600160a01b03166001600160a01b031663388335076040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7e9190615777565b60ff16611a8c600c84615603565b611a9691906155e4565b9050601260009054906101000a90046001600160a01b03166001600160a01b031663ec12e9f86040518163ffffffff1660e01b8152600401602060405180830381865afa158015611aeb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b0f919061575c565b15611c1b57611b9530601260009054906101000a90046001600160a01b03166001600160a01b0316635215fc8c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8f91906155c7565b846138e6565b611c1630601260009054906101000a90046001600160a01b03166001600160a01b0316635215fc8c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c1091906155c7565b876138e6565b611e6e565b6000611c26866140e2565b90506000611c33846140e2565b90506000612710601260009054906101000a90046001600160a01b03166001600160a01b0316630c05388c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb19190615625565b611cbb90846155e4565b611cc59190615603565b600d54601254604080517fde181f0100000000000000000000000000000000000000000000000000000000815290519394506001600160a01b039283169363a9059cbb939092169163de181f01916004808201926020929091908290030181865afa158015611d38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5c91906155c7565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015611da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dcd919061575c565b50600d546010546001600160a01b039182169163a9059cbb9116611df18486615529565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611e3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e60919061575c565b50611e6a836142ec565b5050505b611eef30601260009054906101000a90046001600160a01b03166001600160a01b031663db3225136040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ec5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee991906155c7565b836138e6565b600e5460405163fa28686560e01b8152600481018990526000916001600160a01b03169063fa28686590602401602060405180830381865afa158015611f39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5d91906155c7565b6001600160a01b031614611fe457600e5460405163fa28686560e01b815260048101899052611fe49130916001600160a01b039091169063fa28686590602401602060405180830381865afa158015611fba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fde91906155c7565b866138e6565b6120193033868486611ff68b8d615529565b6120009190615529565b61200a9190615529565b6120149190615529565b6138e6565b6000878152601960205260409081902082905560105490517fde6d71a900000000000000000000000000000000000000000000000000000000815260048101899052602481018590526001600160a01b039091169063de6d71a990604401600060405180830381600087803b15801561209157600080fd5b505af11580156120a5573d6000803e3d6000fd5b505050506120b1613b64565b7f28ad10ba238d640e689633817baa158a3c1b259951a32326c288949d32e2743587876120dc6126ec565b6040516120eb93929190615794565b60405180910390a150505050505050565b612107823383613854565b6121118282613cf3565b5050565b6001600160a01b038116600090815260076020526040812054610965565b6000606080828080836121677f78574845415400000000000000000000000000000000000000000000000000066005614735565b6121927f31000000000000000000000000000000000000000000000000000000000000016006614735565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b6000818152601560205260409020546001600160a01b031633146122645760405162461bcd60e51b815260206004820152602560248201527f6f6e6c7920696e697469616c206f776e65722063616e2072656465656d20746860448201527f65204e46540000000000000000000000000000000000000000000000000000006064820152608401610af3565b6010546040517fec7a81d0000000000000000000000000000000000000000000000000000000008152600481018390526000916001600160a01b03169063ec7a81d0906024016020604051808303816000875af11580156122c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ed9190615625565b600083815260196020526040908190205460105491517ff779dcff00000000000000000000000000000000000000000000000000000000815260048101869052929350916001600160a01b039091169063f779dcff90602401602060405180830381865afa158015612363573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612387919061575c565b15612390575060005b600082156123a4576123a1836147d9565b90505b600e5460405163d92521d160e01b815260048101869052600091612710916001600160a01b039091169063d92521d190602401602060405180830381865afa1580156123f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124189190615625565b600e546040516360ba48fd60e01b8152600481018990526001600160a01b03909116906360ba48fd90602401602060405180830381865afa158015612461573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124859190615625565b61248f91906155e4565b61249c90620f42406155e4565b6124a69190615603565b9050821561253c57601254604080517fdb322513000000000000000000000000000000000000000000000000000000008152905161253c926001600160a01b03169163db3225139160048083019260209291908290030181865afa158015612512573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253691906155c7565b84613cf3565b6125463083613cf3565b61255e826125548584615529565b61054e9190615529565b612566613b64565b600e546040517ff242432a000000000000000000000000000000000000000000000000000000008152306004820152336024820152604481018790526001606482015260a06084820152600060a48201526001600160a01b039091169063f242432a9060c401600060405180830381600087803b1580156125e657600080fd5b505af11580156125fa573d6000803e3d6000fd5b505050507fc36f179fd58a9f604bd6b314b73441f208835bbfa999e88167ea1f813e9333fa85826126296126ec565b60405161263893929190615794565b60405180910390a15050505050565b601454600d546040517fac41865a0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0391821660248201526000928392169063ac41865a90604401602060405180830381865afa1580156126b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126da9190615625565b90506000620f424061108483866155e4565b60606004805461097a906154cc565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156127985760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610af3565b610a7282868684036136d0565b600b546001600160a01b031633146127ff5760405162461bcd60e51b815260206004820152600e60248201527f6e6f7420617574686f72697a65640000000000000000000000000000000000006044820152606401610af3565b600b546121119083906001600160a01b0316836138e6565b6128223330836138e6565b33600090815260176020526040812061283a90613829565b9050612844613ad3565b601c60008282546128559190615516565b90915550503360009081526018602052604081208054839290612879908490615516565b9091555050336000908152601760205260408120426001909101819055601b55601a80548492906128ab908490615516565b909155505033600090815260176020526040812080548492906128cf908490615516565b909155506128dd9050613b64565b60408051338152602081018490527f1fdab8a8457aaf782e4b6217d6ffa6f5006eda7e50922dd092b2e1524275d7749101610ec9565b600033610a0b8185856138e6565b6010546040517fa3f05ba600000000000000000000000000000000000000000000000000000000815260048101839052600091829182916001600160a01b03169063a3f05ba6906024016040805180830381865afa158015612987573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ab91906157b3565b9092509050816129fd5760405162461bcd60e51b815260206004820152600f60248201527f74686572652069732061206465627400000000000000000000000000000000006044820152606401610af3565b600084815260196020526040908190205460105491517ff779dcff0000000000000000000000000000000000000000000000000000000081526004810187905290916001600160a01b03169063f779dcff90602401602060405180830381865afa158015612a6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a93919061575c565b15612a9c575060005b6011546040517fdb87347c0000000000000000000000000000000000000000000000000000000081523060048201526000916001600160a01b03169063db87347c90602401602060405180830381865afa158015612afe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b229190615625565b612b2f84620f42406155e4565b612b399190615603565b600e5460405163d92521d160e01b815260048101899052919250600091612710916001600160a01b03169063d92521d190602401602060405180830381865afa158015612b8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bae9190615625565b600e546040516360ba48fd60e01b8152600481018b90526001600160a01b03909116906360ba48fd90602401602060405180830381865afa158015612bf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1b9190615625565b612c2591906155e4565b612c3290620f42406155e4565b612c3c9190615603565b905081612c498483615529565b612c539190615529565b979650505050505050565b600e546040516360ba48fd60e01b81526004810183905260009182918291829182916001600160a01b0316906360ba48fd90602401602060405180830381865afa158015612cb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd49190615625565b11612d215760405162461bcd60e51b815260206004820152601d60248201527f74686973204e465420686173206e6f206c616e642061726561207365740000006044820152606401610af3565b600e5460405163d92521d160e01b8152600481018790526000916001600160a01b03169063d92521d190602401602060405180830381865afa158015612d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d8f9190615625565b11612ddc5760405162461bcd60e51b815260206004820152601e60248201527f74686973204e465420686173206e6f2063726f702073686172652073657400006044820152606401610af3565b600a604051602001612dee919061563e565b60408051808303601f19018152908290528051602090910120600e54630cd3ca6760e41b83526004830188905290916001600160a01b039091169063cd3ca67090602401600060405180830381865afa158015612e4f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612e7791908101906156b4565b604051602001612e87919061572b565b6040516020818303038152906040528051906020012014612eea5760405162461bcd60e51b815260206004820152600a60248201527f77726f6e672063726f70000000000000000000000000000000000000000000006044820152606401610af3565b600f54600e54604051630cd3ca6760e41b81526004810188905230926001600160a01b03908116926315eb43919291169063cd3ca67090602401600060405180830381865afa158015612f41573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612f6991908101906156b4565b6040518263ffffffff1660e01b8152600401612f859190615045565b602060405180830381865afa158015612fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fc691906155c7565b6001600160a01b03161461301c5760405162461bcd60e51b815260206004820152601860248201527f556e61626c6520746f2073686172642074686973204e465400000000000000006044820152606401610af3565b600e5460405163d92521d160e01b815260048101879052600091612710916001600160a01b039091169063d92521d190602401602060405180830381865afa15801561306c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130909190615625565b600e546040516360ba48fd60e01b8152600481018a90526001600160a01b03909116906360ba48fd90602401602060405180830381865afa1580156130d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130fd9190615625565b61310791906155e4565b61311490620f42406155e4565b61311e9190615603565b9050600061312b87610f90565b601154600f546040517f15eb43910000000000000000000000000000000000000000000000000000000081529293506000926001600160a01b039283169263db87347c9216906315eb43919061318690600a9060040161553c565b602060405180830381865afa1580156131a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131c791906155c7565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561320b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061322f9190615625565b6011546040517fc3825f4b0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063c3825f4b9061327990600a9060040161553c565b602060405180830381865afa158015613296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132ba9190615625565b6132c490846155e4565b6132ce9190615603565b6132da906103e86155e4565b90506000601260009054906101000a90046001600160a01b03166001600160a01b031663388335076040518163ffffffff1660e01b8152600401602060405180830381865afa158015613331573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133559190615777565b60ff16613363600c84615603565b61336d91906155e4565b9050600061337a85613f18565b905060006133888b87613fb2565b90506000818486613399868b615529565b6133a39190615529565b6133ad9190615529565b6133b79190615529565b905086836133c58688615516565b919c509a50985096505050505050509193509193565b6133e3613b08565b601480546001600160a01b0393841673ffffffffffffffffffffffffffffffffffffffff199182161790915560138054929093169116179055565b8342111561346e5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610af3565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c988888861349d8c614a8b565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006134f882614ab3565b9050600061350882878787614afb565b9050896001600160a01b0316816001600160a01b03161461356b5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610af3565b6135768a8a8a6136d0565b50505050505050505050565b61358a613b08565b6001600160a01b0381166135e05760405162461bcd60e51b815260206004820152601b60248201527f7a65726f2061646472657373206973206e6f7420616c6c6f77656400000000006044820152606401610af3565b600f805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b613617613b08565b6001600160a01b0381166136935760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610af3565b610cbe81614b23565b60006020835110156136b8576136b183614b82565b9050610965565b816136c3848261582d565b5060ff9050610965565b90565b6001600160a01b03831661374b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610af3565b6001600160a01b0382166137c75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610af3565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60008082600101544261383c9190615529565b83549091506301e133809081906110849084906155e4565b6001600160a01b0383811660009081526001602090815260408083209386168352929052205460001981146138e057818110156138d35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610af3565b6138e084848484036136d0565b50505050565b6001600160a01b0383166139625760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610af3565b6001600160a01b0382166139de5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610af3565b6001600160a01b03831660009081526020819052604090205481811015613a6d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610af3565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36138e0565b601b546000908190613ae59042615529565b601a549091506301e13380908190613afe9084906155e4565b610f179190615603565b6009546001600160a01b03163314613b625760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af3565b565b601e54600090613b749042615529565b601d549091506301e13380908190613b8d9084906155e4565b613b979190615603565b601f6000828254613ba89190615516565b9091555050601a54600254613bbd9190615529565b601d55505042601e55565b6000306001600160a01b037f0000000000000000000000001b2b0fa9283595f5036c007dd99ed0aa6de8362e16148015613c2157507f000000000000000000000000000000000000000000000000000000000000000146145b15613c4b57507f9b4699dfb7f58c71941584eee71bb7ff21ffeecc2cb10c5fc7c52cf0a04b502490565b610a94604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f601569196ec7f4f70da8d523e5c40b7a9907c280b6a9c7f4350b2b8cf79dd870918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6001600160a01b038216613d6f5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610af3565b6001600160a01b03821660009081526020819052604090205481811015613dfe5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610af3565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910161381c565b505050565b6001600160a01b038216613eaf5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610af3565b8060026000828254613ec19190615516565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600080601260009054906101000a90046001600160a01b03166001600160a01b031663dcc6fe4e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613f6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f929190615625565b9050612710613fa182856155e4565b613fab9190615603565b9392505050565b600e5460405163fa28686560e01b81526004810184905260009182916001600160a01b039091169063fa28686590602401602060405180830381865afa158015614000573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061402491906155c7565b6001600160a01b03160361403a57506000610965565b600e546040517f8e4d2927000000000000000000000000000000000000000000000000000000008152600481018590526000916001600160a01b031690638e4d292790602401602060405180830381865afa15801561409d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140c19190615625565b9050806000036140d5576000915050610965565b61271061108482856155e4565b600080601260009054906101000a90046001600160a01b03166001600160a01b031663eb266ec46040518163ffffffff1660e01b8152600401602060405180830381865afa158015614138573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061415c9190615625565b9050600061416984612647565b9050600061417983612710615516565b614185836127106155e4565b61418f9190615603565b6013549091506141aa9030906001600160a01b031687614bd9565b604080516101008101825230808252600d546001600160a01b03166020830152610bb8928201929092526060810191909152600090608081016141ee42600f615516565b815260208082018990526040808301869052600060609384015260135481517f414bf38900000000000000000000000000000000000000000000000000000000815285516001600160a01b03908116600483015293860151841660248201529185015162ffffff16604483015292840151821660648201526080840151608482015260a084015160a482015260c084015160c482015260e0840151821660e4820152929350169063414bf38990610104016020604051808303816000875af11580156142be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142e29190615625565b9695505050505050565b6000612710601260009054906101000a90046001600160a01b03166001600160a01b031663aa8eccc06040518163ffffffff1660e01b8152600401602060405180830381865afa158015614344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143689190615625565b61437290846155e4565b61437c9190615603565b90506000612710601260009054906101000a90046001600160a01b03166001600160a01b031663870f79b26040518163ffffffff1660e01b8152600401602060405180830381865afa1580156143d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143fa9190615625565b61440490856155e4565b61440e9190615603565b600d54600c546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015260248101869052929350169063a9059cbb906044016020604051808303816000875af115801561447e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144a2919061575c565b50600c546040517f23f9cc0c000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906323f9cc0c90602401600060405180830381600087803b15801561450257600080fd5b505af1158015614516573d6000803e3d6000fd5b5050600d54601254604080517f5215fc8c00000000000000000000000000000000000000000000000000000000815290516001600160a01b03938416955063a9059cbb94509190921691635215fc8c9160048083019260209291908290030181865afa15801561458a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145ae91906155c7565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af11580156145fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061461f919061575c565b50600d54601254604080517fa085107b00000000000000000000000000000000000000000000000000000000815290516001600160a01b039384169363a9059cbb93169163a085107b9160048083019260209291908290030181865afa15801561468d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146b191906155c7565b836146bc8688615529565b6146c69190615529565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015614711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138e0919061575c565b606060ff8314614748576136b183614d22565b818054614754906154cc565b80601f0160208091040260200160405190810160405280929190818152602001828054614780906154cc565b80156147cd5780601f106147a2576101008083540402835291602001916147cd565b820191906000526020600020905b8154815290600101906020018083116147b057829003601f168201915b50505050509050610965565b600080601260009054906101000a90046001600160a01b03166001600160a01b0316636dba41e46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561482f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148539190615625565b601454600d546040517fac41865a0000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015230602482015292935060009291169063ac41865a90604401602060405180830381865afa1580156148c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148e89190615625565b905060006148f86006600a6159d1565b61490283876155e4565b61490c9190615603565b9050600061491c84612710615516565b614928836127106155e4565b6149329190615603565b600d54601354919250614952916001600160a01b03918216911688614bd9565b6040805161010081018252600d546001600160a01b031681523060208201819052610bb89282019290925260608101919091526000906080810161499742600f615516565b815260208082018a90526040808301869052600060609384015260135481517f414bf38900000000000000000000000000000000000000000000000000000000815285516001600160a01b03908116600483015293860151841660248201529185015162ffffff16604483015292840151821660648201526080840151608482015260a084015160a482015260c084015160c482015260e0840151821660e4820152929350169063414bf38990610104016020604051808303816000875af1158015614a67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c539190615625565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b6000610965614ac0613bc8565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b6000806000614b0c87878787614d61565b91509150614b1981614e25565b5095945050505050565b600980546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080829050601f81511115614bc657826040517f305a27a9000000000000000000000000000000000000000000000000000000008152600401610af39190615045565b8051614bd1826159e0565b179392505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790529151600092839290871691614c63919061572b565b6000604051808303816000865af19150503d8060008114614ca0576040519150601f19603f3d011682016040523d82523d6000602084013e614ca5565b606091505b5091509150818015614ccf575080511580614ccf575080806020019051810190614ccf919061575c565b614d1b5760405162461bcd60e51b815260206004820152600260248201527f53410000000000000000000000000000000000000000000000000000000000006044820152606401610af3565b5050505050565b60606000614d2f83614f8a565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115614d985750600090506003614e1c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614dec573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116614e1557600060019250925050614e1c565b9150600090505b94509492505050565b6000816004811115614e3957614e39615a04565b03614e415750565b6001816004811115614e5557614e55615a04565b03614ea25760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610af3565b6002816004811115614eb657614eb6615a04565b03614f035760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610af3565b6003816004811115614f1757614f17615a04565b03610cbe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610af3565b600060ff8216601f811115610965576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215614fdd57600080fd5b81356001600160e01b031981168114613fab57600080fd5b60005b83811015615010578181015183820152602001614ff8565b50506000910152565b60008151808452615031816020860160208601614ff5565b601f01601f19169290920160200192915050565b602081526000613fab6020830184615019565b6001600160a01b0381168114610cbe57600080fd5b6000806040838503121561508057600080fd5b823561508b81615058565b946020939093013593505050565b6000602082840312156150ab57600080fd5b8135613fab81615058565b6000602082840312156150c857600080fd5b5035919050565b6000806000606084860312156150e457600080fd5b83356150ef81615058565b925060208401356150ff81615058565b929592945050506040919091013590565b7fff00000000000000000000000000000000000000000000000000000000000000881681526000602060e08184015261514c60e084018a615019565b838103604085015261515e818a615019565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b818110156151b057835183529284019291840191600101615194565b50909c9b505050505050505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715615201576152016151c2565b604052919050565b600082601f83011261521a57600080fd5b8135602067ffffffffffffffff821115615236576152366151c2565b8160051b6152458282016151d8565b928352848101820192828101908785111561525f57600080fd5b83870192505b84831015612c5357823582529183019190830190615265565b600067ffffffffffffffff821115615298576152986151c2565b50601f01601f191660200190565b600082601f8301126152b757600080fd5b81356152ca6152c58261527e565b6151d8565b8181528460208386010111156152df57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a0868803121561531457600080fd5b853561531f81615058565b9450602086013561532f81615058565b9350604086013567ffffffffffffffff8082111561534c57600080fd5b61535889838a01615209565b9450606088013591508082111561536e57600080fd5b61537a89838a01615209565b9350608088013591508082111561539057600080fd5b5061539d888289016152a6565b9150509295509295909350565b600080604083850312156153bd57600080fd5b82356153c881615058565b915060208301356153d881615058565b809150509250929050565b60ff81168114610cbe57600080fd5b600080600080600080600060e0888a03121561540d57600080fd5b873561541881615058565b9650602088013561542881615058565b955060408801359450606088013593506080880135615446816153e3565b9699959850939692959460a0840135945060c09093013592915050565b600080600080600060a0868803121561547b57600080fd5b853561548681615058565b9450602086013561549681615058565b93506040860135925060608601359150608086013567ffffffffffffffff8111156154c057600080fd5b61539d888289016152a6565b600181811c908216806154e057607f821691505b602082108103614aad57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561096557610965615500565b8181038181111561096557610965615500565b6000602080835260008454615550816154cc565b80848701526040600180841660008114615571576001811461558b576155b9565b60ff198516838a01528284151560051b8a010195506155b9565b896000528660002060005b858110156155b15781548b8201860152908301908801615596565b8a0184019650505b509398975050505050505050565b6000602082840312156155d957600080fd5b8151613fab81615058565b60008160001904831182151516156155fe576155fe615500565b500290565b60008261562057634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561563757600080fd5b5051919050565b600080835461564c816154cc565b600182811680156156645760018114615679576156a8565b60ff19841687528215158302870194506156a8565b8760005260208060002060005b8581101561569f5781548a820152908401908201615686565b50505082870194505b50929695505050505050565b6000602082840312156156c657600080fd5b815167ffffffffffffffff8111156156dd57600080fd5b8201601f810184136156ee57600080fd5b80516156fc6152c58261527e565b81815285602083850101111561571157600080fd5b615722826020830160208601614ff5565b95945050505050565b6000825161573d818460208701614ff5565b9190910192915050565b8051801515811461575757600080fd5b919050565b60006020828403121561576e57600080fd5b613fab82615747565b60006020828403121561578957600080fd5b8151613fab816153e3565b8381528260208201526060604082015260006157226060830184615019565b600080604083850312156157c657600080fd5b6157cf83615747565b9150602083015190509250929050565b601f821115613e5457600081815260208120601f850160051c810160208610156158065750805b601f850160051c820191505b8181101561582557828155600101615812565b505050505050565b815167ffffffffffffffff811115615847576158476151c2565b61585b8161585584546154cc565b846157df565b602080601f83116001811461589057600084156158785750858301515b600019600386901b1c1916600185901b178555615825565b600085815260208120601f198616915b828110156158bf578886015182559484019460019091019084016158a0565b50858210156158dd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600181815b8085111561592857816000190482111561590e5761590e615500565b8085161561591b57918102915b93841c93908002906158f2565b509250929050565b60008261593f57506001610965565b8161594c57506000610965565b8160018114615962576002811461596c57615988565b6001915050610965565b60ff84111561597d5761597d615500565b50506001821b610965565b5060208310610133831016604e8410600b84101617156159ab575081810a610965565b6159b583836158ed565b80600019048211156159c9576159c9615500565b029392505050565b6000613fab60ff841683615930565b80516020808301519190811015614aad5760001960209190910360031b1b16919050565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220f2daa078e0872d50e7b94db2388dbe2ad2b0535c27e330f463d4c5e2a527f59f64736f6c63430008100033

Verified Source Code Full Match

Compiler: v0.8.16+commit.07a7930e EVM: london Optimization: Yes (2000 runs)
xToken.sol 502 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "./interfaces/IKeyProtocolVariables.sol";
import "./interfaces/ILandXNFT.sol";
import "./interfaces/IxTokenRouter.sol";
import "./interfaces/IOraclePrices.sol";
import "./interfaces/IRentFoundation.sol";
import "./interfaces/IcToken.sol";
import "./interfaces/IxToken.sol";
import "./interfaces/ILNDX.sol";
import "./interfaces/ITWAP.sol";

//xToken NFT in = shards. xToken in = NFT
//1 xToken = (tillableArea * cropShare) /  10000
contract XToken is Context, ERC20Permit, ERC20Burnable, Ownable, ERC1155Holder, IxToken {
     struct Stake {
        uint256 amount;
        uint256 startTime;
    }

    string public crop;
    address public xBasketContract;
    address public lndx;
    address public usdc;

    ILandXNFT public landXNFT; //address of landXNFT
    IxTokenRouter public xTokenRouter; // address of xTokenRouter
    IRentFoundation public rentFoundation;
    IOraclePrices public oraclePrices;
    IKeyProtocolVariables public keyProtocolValues;

    ISwapRouter public uniswapRouter;
    ITWAP public twap;

    //only the initial owner of the NFT can redeem it
    mapping(uint256 => address) public initialOwner;

    mapping(address => uint256) public Claimed;

    mapping(address => Stake) public Staked;
    mapping(address => uint256) public Yield;

    mapping(uint256 => uint256) public SecurityDepositedAmount;

    Stake public TotalStaked;
    uint256 public TotalYield;

    Stake public NonStakedTokens;
    uint256 public NonDistributedYield;

    event Sharded(uint256 nftID, uint256 amount, string name);
    event BuyOut(uint256 nftID, uint256 amount, string name);
    event TokenStaked(address staker, uint256 amount);
    event Unstaked(address staker, uint256 amount);
    event YieldClaimed(address staker, uint256 amount);

    constructor(
        address _landXNFT,
        address _lndx,
        address _usdc,
        address _rentFoundation,
        address _xTokenRouter,
        address _keyProtocolValues,
        address _oraclePrices,
        string memory _crop// "SOY, CORN etc",
    ) ERC20Permit(string(abi.encodePacked("x", _crop))) ERC20("LandX xToken", string(abi.encodePacked("x", _crop))) {
        require(_landXNFT != address(0), "zero address is not allowed");
        require(_lndx != address(0), "zero address is not allowed");
        require(_usdc != address(0), "zero address is not allowed");
        require(_rentFoundation != address(0), "zero address is not allowed");
        require(_xTokenRouter != address(0), "zero address is not allowed");
        require(_keyProtocolValues != address(0), "zero address is not allowed");
        landXNFT = ILandXNFT(_landXNFT);
        crop = _crop;
        lndx = _lndx;
        usdc = _usdc;
        rentFoundation = IRentFoundation(_rentFoundation);
        xTokenRouter = IxTokenRouter(_xTokenRouter);
        keyProtocolValues = IKeyProtocolVariables(_keyProtocolValues);
        oraclePrices = IOraclePrices(_oraclePrices);
        twap = ITWAP(0x5eb612F924dAD205eAb02911b198520eFfE96e5C);
        uniswapRouter = ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564);
    }

    //deposits an NFT to get shards equivalence
    function getShards(uint256 _id) external {
        require(
            landXNFT.tillableArea(_id) > 0,
            "this NFT has no land area set"
        );
        require(landXNFT.cropShare(_id) > 0, "this NFT has no crop share set");
        require(
            landXNFT.initialOwner(_id) == msg.sender,
            "only initial owner can shard"
        );
        require(
            keccak256(abi.encodePacked(landXNFT.crop(_id))) ==
                keccak256(abi.encodePacked(crop)),
            "wrong crop"
        );
        require(
            xTokenRouter.getXToken(crop) == address(this),
            "tokens are not set for this crop"
        );
        require(
            landXNFT.balanceOf(msg.sender, _id) > 0,
            "you must own this NFT"
        );

        require(
            rentFoundation.initialRentApplied(_id) == false,
            "rent was already applied"
        );

        initialOwner[_id] = msg.sender; //set the initial owner

        //transfers the nft. must have setApprovalForAll
        landXNFT.safeTransferFrom(msg.sender, address(this), _id, 1, "");

        uint256 shards = landXNFT.tillableArea(_id) *
            (landXNFT.cropShare(_id)) *
            (1e6) / 10000; // xTokens has 6 decimal
        _mint(address(this), shards);

        uint256 fee = _calcFee(shards);
        uint256 validatorFee = _validatorFee(_id, shards);

        uint256 annualRent = getAnnualRentAmount(_id);
        uint256 xTokensAnnualRent = ((annualRent * oraclePrices.prices(crop)) /
            oraclePrices.getXTokenPrice(address(this))) * 1e3; // oraclePrices.prices returns price per megatonne, to to get value per KG we multiply by 10 ** 3
        uint256 toSecurityDepositsAmount = (xTokensAnnualRent / 12) *
            keyProtocolValues.securityDepositMonths();

        if (keyProtocolValues.preLaunch()) {
            _transfer(
                address(this),
                keyProtocolValues.landxOperationalWallet(),
                xTokensAnnualRent
            );
            _transfer(
                address(this),
                keyProtocolValues.landxOperationalWallet(),
                fee
            );
        } else {
            // transfer xTokens to securityDeposit
            uint256 usdcFee = _convertToUsdc(fee);
            uint256 usdcAnnualRent = _convertToUsdc(xTokensAnnualRent);
            uint256 toHedgeFund = (usdcAnnualRent *
                keyProtocolValues.hedgeFundAllocation()) / 10000;
            ERC20(usdc).transfer(
                keyProtocolValues.hedgeFundWallet(),
                toHedgeFund
            );
            ERC20(usdc).transfer(
                address(rentFoundation),
                usdcAnnualRent - toHedgeFund
            );
            _feeDistributor(usdcFee);
        }
        _transfer(
            address(this),
            keyProtocolValues.xTokensSecurityWallet(),
            toSecurityDepositsAmount
        );
        if (landXNFT.validator(_id) != address(0)) {
             _transfer(address(this), landXNFT.validator(_id), validatorFee);
        }
        _transfer(
            address(this),
            msg.sender,
            shards - fee - xTokensAnnualRent - toSecurityDepositsAmount - validatorFee
        );
        SecurityDepositedAmount[_id] = toSecurityDepositsAmount;
        rentFoundation.payInitialRent(_id, annualRent);
        _calculateNonDistributedYield();
        emit Sharded(_id, shards, symbol());
    }

    //returns the NFT after if caller has enough xTokens to burn. requires allowance!
    function getTheNFT(uint256 _id) external {
        require(
            initialOwner[_id] == msg.sender,
            "only initial owner can redeem the NFT"
        );

        uint256 remainingRentUSDC;
        remainingRentUSDC = rentFoundation.buyOut(_id);

        uint256 securityDepositedAmount = SecurityDepositedAmount[_id];
        if (rentFoundation.spentSecurityDeposit(_id)) {
            securityDepositedAmount = 0;
        }

        uint256 xTokens = 0;
        if (remainingRentUSDC > 0) {
            xTokens = _convertToXToken(remainingRentUSDC);
        }

        uint256 shards = landXNFT.tillableArea(_id) *
            landXNFT.cropShare(_id) *
            1e6 / 10000; // xToken has 6 decimals

        //approval required for xTokensSecurityWalle
        if (securityDepositedAmount > 0) {
            _burn(keyProtocolValues.xTokensSecurityWallet(), securityDepositedAmount);
        }
        
        _burn(address(this), xTokens);
        
        //burns shards!
        burn(shards - securityDepositedAmount - xTokens);
        _calculateNonDistributedYield();

        //transfer the NFTs
        landXNFT.safeTransferFrom(address(this), msg.sender, _id, 1, "");
        emit BuyOut(_id, shards, symbol());
    }

    function getTheNFTPreview(uint256 _id) public view returns(uint256) {
        bool allow;
        uint256 remainingRentUSDC;
        (allow, remainingRentUSDC) = rentFoundation.buyOutPreview(_id);
        require(allow, "there is a debt");

        uint256 securityDepositedAmount = SecurityDepositedAmount[_id];
        if (rentFoundation.spentSecurityDeposit(_id)) {
            securityDepositedAmount = 0;
        }

        uint256 xTokens = remainingRentUSDC * 1e6 / oraclePrices.getXTokenPrice(address(this)); //xToken has 6 decimals

        uint256 shards = landXNFT.tillableArea(_id) *
            landXNFT.cropShare(_id) *
            1e6 / 10000; // xToken has 6 decimals

        return (shards - securityDepositedAmount - xTokens);
    }


    function stake(uint256 amount) public {
        _transfer(msg.sender, address(this), amount);
        uint256 yield = _calculateYield(Staked[msg.sender]);
        TotalYield += _calculateTotalYield();
        Yield[msg.sender] += yield;
        Staked[msg.sender].startTime = block.timestamp;
        TotalStaked.startTime = block.timestamp;
        TotalStaked.amount += amount;
        Staked[msg.sender].amount += amount;
        _calculateNonDistributedYield();
        emit TokenStaked(msg.sender, amount);
    }

    function unstake(uint256 amount) public {
        require(Staked[msg.sender].amount >= amount);
        _transfer(address(this), msg.sender, amount);
        claim();
        Staked[msg.sender].amount -= amount;
        TotalStaked.amount -= amount;
        _calculateNonDistributedYield();
        emit Unstaked(msg.sender, amount);
    }

    function claim() public {
        address cToken = xTokenRouter.getCToken(crop);
        uint256 yield = _calculateYield(Staked[msg.sender]);
        TotalYield =
            TotalYield +
            _calculateTotalYield() -
            (Yield[msg.sender] + yield);
        IcToken(cToken).mint(msg.sender, (Yield[msg.sender] + yield));
        Claimed[msg.sender] += (Yield[msg.sender] + yield);
        Staked[msg.sender].startTime = block.timestamp;
        TotalStaked.startTime = block.timestamp;
        Yield[msg.sender] = 0;
        emit YieldClaimed(msg.sender, yield);
    }

    function _feeDistributor(uint256 _fee) internal {
        uint256 lndxFee = (_fee * keyProtocolValues.lndxHoldersPercentage()) /
            10000;
        uint256 operationalFee = (_fee *
            keyProtocolValues.landXOperationsPercentage()) / 10000;
        ERC20(usdc).transfer(lndx, lndxFee);
        ILNDX(lndx).feeToDistribute(lndxFee);
        ERC20(usdc).transfer(
            keyProtocolValues.landxOperationalWallet(),
            operationalFee
        );
        ERC20(usdc).transfer(
            keyProtocolValues.landxChoiceWallet(),
            _fee - lndxFee - operationalFee
        );
    }

    function availableToClaim(address account) public view returns (uint256) {
        return Yield[account] + _calculateYield(Staked[account]);
    }

    function totalAvailableToClaim() public view returns (uint256) {
        return TotalYield + _calculateTotalYield();
    }

    // calculate cTokanes amount generated since amount was staked
    function _calculateYield(Stake storage s) internal view returns (uint256) {
        uint256 elapsedSeconds = block.timestamp - s.startTime;
        uint256 delimeter = 365 * 1 days;
        return (s.amount * elapsedSeconds) / delimeter;
    }

    function _calculateTotalYield() internal view returns (uint256) {
        uint256 elapsedSeconds = block.timestamp - TotalStaked.startTime;
        uint256 delimeter = 365 * 1 days;
        return (TotalStaked.amount * elapsedSeconds) / delimeter;
    }

    function xBasketTransfer(address _from, uint256 amount) external {
        require(msg.sender == xBasketContract, "not authorized");
        _transfer(_from, xBasketContract, amount);
    }

    // change the address of xBasket.
    function changeXBasketAddress(address _newAddress) public onlyOwner {
        require(_newAddress != address(0), "zero address is not allowed");
        xBasketContract = _newAddress;
    }

    function _calcFee(uint256 amount) internal view returns (uint256) {
        uint256 fee = keyProtocolValues.xTokenMintFee();
        return (amount * fee) / 10000;
    }

    function _validatorFee(uint256 tokenID, uint256 amount) internal view returns(uint256) {
        if (landXNFT.validator(tokenID) == address(0)) {
            return 0;
        }
        uint256 validatorFee = landXNFT.validatorFee(tokenID);
        if (validatorFee == 0) {
            return 0;
        }
        return  (amount* validatorFee) / 10000;
    }

    function setXTokenRouter(address _router) public onlyOwner {
        require(_router != address(0), "zero address is not allowed");
        xTokenRouter = IxTokenRouter(_router);
    }

    // return annual rent amount in kg
    function getAnnualRentAmount(uint256 tokenID)
        public
        view
        returns (uint256)
    {
        uint256 rent = landXNFT.cropShare(tokenID);
        uint256 area = landXNFT.tillableArea(tokenID);

        return (rent * area) / 10000;
    }

    function quoteAmountOut(uint _amount) public view returns (uint) {
        uint price = twap.getPrice(address(this), usdc);
        uint256 amountOut = _amount * price / 1e6;
        return amountOut;
    }

    function _convertToXToken(uint256 amount) internal returns (uint256) {
        uint256 slippage =  keyProtocolValues.buyXTokenSlippage();
        uint price = twap.getPrice(usdc, address(this));
        uint256 predictedAmountOut = amount * price / 10 ** decimals();
        uint256 minAmountOut = predictedAmountOut * 10000 / (10000 + slippage);

        TransferHelper.safeApprove(usdc, address(uniswapRouter), amount);

        ISwapRouter.ExactInputSingleParams memory params = ISwapRouter
        .ExactInputSingleParams(
            usdc,
            address(this),
            3000,
            address(this),
            block.timestamp + 15,
            amount,
            minAmountOut,
            0
        );
        return uniswapRouter.exactInputSingle(params);
    }

    function _convertToUsdc(uint256 amount) internal returns (uint256) {
        uint256 slippage =  keyProtocolValues.sellXTokenSlippage();
        uint256 predictedAmountOut = quoteAmountOut(amount);
        uint256 minAmountOut = predictedAmountOut * 10000 / (10000 + slippage);

        TransferHelper.safeApprove(
            address(this),
            address(uniswapRouter),
            amount
        );
        ISwapRouter.ExactInputSingleParams memory params = ISwapRouter
        .ExactInputSingleParams(
            address(this),
            usdc,
            3000,
            address(this),
            block.timestamp + 15,
            amount,
            minAmountOut,
            0
        );
        return uniswapRouter.exactInputSingle(params);
    }

    function preview(uint256 id)
        public
        view
        returns (
            uint256,
            uint256,
            uint256,
            uint256
        )
    {
        require(landXNFT.tillableArea(id) > 0, "this NFT has no land area set");
        require(landXNFT.cropShare(id) > 0, "this NFT has no crop share set");
        require(
            keccak256(abi.encodePacked(landXNFT.crop(id))) ==
                keccak256(abi.encodePacked(crop)),
            "wrong crop"
        );
        require(
            xTokenRouter.getXToken(landXNFT.crop(id)) == address(this),
            "Unable to shard this NFT"
        );
        
        uint256 shards = (landXNFT.tillableArea(id) *
            landXNFT.cropShare(id) *
            1e6) / 10000;
        uint256 annualRent = getAnnualRentAmount(id);
        uint256 xTokensAnnualRent = ((annualRent * oraclePrices.prices(crop)) /
            oraclePrices.getXTokenPrice(xTokenRouter.getXToken(crop))) * 1e3;
        uint256 toSecurityDepositsAmount = (xTokensAnnualRent / 12) *
            keyProtocolValues.securityDepositMonths();
        uint256 fee = _calcFee(shards);
        uint256 validatorFee = _validatorFee(id, shards);
        uint256 toBeReceived = shards -
            fee -
            xTokensAnnualRent -
            toSecurityDepositsAmount - validatorFee;
        return (
            shards,
            fee,
            xTokensAnnualRent + toSecurityDepositsAmount,
            toBeReceived
        );
    }

    function _calculateNonDistributedYield() internal {
        uint256 elapsedSeconds = block.timestamp - NonStakedTokens.startTime;
        uint256 delimeter = 365 * 1 days;
        NonDistributedYield += NonStakedTokens.amount * elapsedSeconds / delimeter;
        NonStakedTokens.amount = totalSupply() - TotalStaked.amount;
        NonStakedTokens.startTime = block.timestamp;
    }

    function previewNonDistributedYield() external view returns(uint256) {
        uint256 elapsedSeconds = block.timestamp - NonStakedTokens.startTime;
        uint256 delimeter = 365 * 1 days;
        return NonDistributedYield + NonStakedTokens.amount * elapsedSeconds / delimeter;
    }

    // returns cTokens amount
    function getNonDistributedYield() external returns(uint256) {
        require(msg.sender == address(rentFoundation), "only rentFoundation can take it");
        _calculateNonDistributedYield();
        uint256 amount = NonDistributedYield;
        NonDistributedYield = 0;
        return amount;
    }

    function renounceOwnership() public view override onlyOwner {
        revert ("can 't renounceOwnership here");
    }

    // for test only purposes
    function updateUniswapContracts(address _twap, address _uniswapRouter) public onlyOwner {
        twap = ITWAP(_twap);
        uniswapRouter = ISwapRouter(_uniswapRouter);
    }

    function decimals() public pure override returns (uint8) {
        return 6;
    }
}
ILNDX.sol 6 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

interface ILNDX {
    function feeToDistribute(uint256 amount) external;
}
ITWAP.sol 7 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.4;


interface ITWAP {
    function getPrice(address tokenIn, address tokenOut) external view returns (uint);
}
IcToken.sol 7 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

interface IcToken {
    function crop() external view returns (string memory);
    function mint(address account, uint256 amount) external;
}
IxToken.sol 25 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IxToken is IERC20 {
    function previewNonDistributedYield() external view returns(uint256);

    function getNonDistributedYield() external returns(uint256);

    function stake(uint256 amount) external;

    function unstake(uint256 amount) external;

    function xBasketTransfer(address _from, uint256 amount) external;

    function Staked(address)
        external
        view
        returns (uint256 amount, uint256 startTime); // Not

    function availableToClaim(address account) external view returns (uint256);

    function claim() external;
}
ILandXNFT.sol 29 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

interface ILandXNFT {
    function tillableArea(uint256 id) external view returns (uint256);

    function cropShare(uint256 id) external view returns (uint256);

    function crop(uint256 id) external view returns (string memory);

    function validatorFee(uint256 id) external view returns (uint256);

    function validator(uint256 id) external view returns (address);

    function initialOwner(uint256 id) external view returns (address);

    function balanceOf(address account, uint256 id)
        external
        view
        returns (uint256);

    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;
}
IOraclePrices.sol 10 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

interface IOraclePrices {
    function prices(string memory grain) external view returns (uint256);
    
    function getXTokenPrice(address xToken) external view returns (uint256);

    function usdc() external view returns (address);
}
IxTokenRouter.sol 7 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

interface IxTokenRouter {
    function getXToken(string memory _name) external view returns (address);
    function getCToken(string memory _name) external view returns (address);
}
IRentFoundation.sol 16 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

interface IRentFoundation {
    function initialRentApplied(uint256 tokenID) external view returns (bool);

    function spentSecurityDeposit(uint256 tokenID) external view returns (bool);

    function payInitialRent(uint256 tokenID, uint256 amount) external;

    function buyOutPreview(uint256 tokenID) external view returns(bool, uint256);

    function buyOut(uint256 tokenID) external returns(uint256);

     function sellCToken(address account, uint256 amount) external;
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev 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.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
Counters.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}
Math.sol 339 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}
ERC20.sol 365 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev 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}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev 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.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev 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`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev 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.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev 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`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}
StorageSlot.sol 138 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
ShortStrings.sol 122 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.8;

import "./StorageSlot.sol";

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(_FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}
IKeyProtocolVariables.sol 41 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;


interface IKeyProtocolVariables {
    function xTokenMintFee() external view returns (uint256);

    function securityDepositMonths() external view returns (uint8);

    function xTokensSecurityWallet() external view returns (address);

    function landxOperationalWallet() external view returns (address);

    function landxChoiceWallet() external view returns (address);

    function landXOperationsPercentage() external view returns (uint256);

    function landXChoicePercentage() external view returns (uint256);

    function lndxHoldersPercentage() external view returns (uint256);

    function hedgeFundAllocation() external view returns (uint256);

    function hedgeFundWallet() external view returns (address);

    function preLaunch() external view returns (bool);

    function sellXTokenSlippage() external view returns (uint256);
   
    function buyXTokenSlippage() external view returns (uint256);  

    function cTokenSellFee() external view returns (uint256);

    function validatorCommission() external view returns (uint256);

    function validatorCommisionWallet() external view returns (address);

    function payRentFee() external view returns (uint256);

    function maxValidatorFee() external view returns (uint256);
}
IERC5267.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.0;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}
SignedMath.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}
ECDSA.sol 217 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}
EIP712.sol 142 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.8;

import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * _Available since v3.4._
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant _TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev See {EIP-5267}.
     *
     * _Available since v4.9._
     */
    function eip712Domain()
        public
        view
        virtual
        override
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _name.toStringWithFallback(_nameFallback),
            _version.toStringWithFallback(_versionFallback),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC1155Receiver.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}
ISwapRouter.sol 67 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';

/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface ISwapRouter is IUniswapV3SwapCallback {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);

    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}
TransferHelper.sol 60 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.0;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';

library TransferHelper {
    /// @notice Transfers tokens from the targeted address to the given destination
    /// @notice Errors with 'STF' if transfer fails
    /// @param token The contract address of the token to be transferred
    /// @param from The originating address from which the tokens will be transferred
    /// @param to The destination address of the transfer
    /// @param value The amount to be transferred
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) =
            token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
    }

    /// @notice Transfers tokens from msg.sender to a recipient
    /// @dev Errors with ST if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
    }

    /// @notice Approves the stipulated contract to spend the given allowance in the given token
    /// @dev Errors with 'SA' if transfer fails
    /// @param token The contract address of the token to be approved
    /// @param to The target of the approval
    /// @param value The amount of the given token the target will be allowed to spend
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');
    }

    /// @notice Transfers ETH to the recipient address
    /// @dev Fails with `STE`
    /// @param to The destination of the transfer
    /// @param value The value to be transferred
    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'STE');
    }
}
ERC1155Holder.sol 36 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)

pragma solidity ^0.8.0;

import "./ERC1155Receiver.sol";

/**
 * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
 *
 * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
 * stuck.
 *
 * @dev _Available since v3.1._
 */
contract ERC1155Holder is ERC1155Receiver {
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
}
ERC20Permit.sol 95 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)

pragma solidity ^0.8.0;

import "./IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/cryptography/EIP712.sol";
import "../../../utils/Counters.sol";

/**
 * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private constant _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    /**
     * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.
     * However, to ensure consistency with the upgradeable transpiler, we will continue
     * to reserve a slot.
     * @custom:oz-renamed-from _PERMIT_TYPEHASH
     */
    // solhint-disable-next-line var-name-mixedcase
    bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}
ERC1155Receiver.sol 19 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
    }
}
IERC20Permit.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}
ERC20Burnable.sol 39 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.0;

import "../ERC20.sol";
import "../../../utils/Context.sol";

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        _spendAllowance(account, _msgSender(), amount);
        _burn(account, amount);
    }
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}
draft-ERC20Permit.sol 8 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/draft-ERC20Permit.sol)

pragma solidity ^0.8.0;

// EIP-2612 is Final as of 2022-11-01. This file is deprecated.

import "./ERC20Permit.sol";
IUniswapV3SwapCallback.sol 21 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback {
    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
    /// @dev In the implementation you must pay the pool tokens owed for the swap.
    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external;
}

Read Contract

Claimed 0xb449c24d → uint256
DOMAIN_SEPARATOR 0x3644e515 → bytes32
NonDistributedYield 0xc1444067 → uint256
NonStakedTokens 0xa2e41ecf → uint256, uint256
SecurityDepositedAmount 0x8b775c4a → uint256
Staked 0x77338642 → uint256, uint256
TotalStaked 0xe8db4e68 → uint256, uint256
TotalYield 0x11c85031 → uint256
Yield 0xb3872dc7 → uint256
allowance 0xdd62ed3e → uint256
availableToClaim 0x0da45188 → uint256
balanceOf 0x70a08231 → uint256
crop 0x3fb239d0 → string
decimals 0x313ce567 → uint8
eip712Domain 0x84b0196e → bytes1, string, string, uint256, address, bytes32, uint256[]
getAnnualRentAmount 0x535d95d6 → uint256
getTheNFTPreview 0xa9bb2424 → uint256
initialOwner 0x207ce2fe → address
keyProtocolValues 0x99af4ba8 → address
landXNFT 0x0ccb91ff → address
lndx 0xcf34cda2 → address
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
oraclePrices 0x76b70f5e → address
owner 0x8da5cb5b → address
preview 0xc317c377 → uint256, uint256, uint256, uint256
previewNonDistributedYield 0x50dd85e5 → uint256
quoteAmountOut 0x91382dbf → uint256
renounceOwnership 0x715018a6
rentFoundation 0x145bc967 → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalAvailableToClaim 0x29451729 → uint256
totalSupply 0x18160ddd → uint256
twap 0x1208aa18 → address
uniswapRouter 0x735de9f7 → address
usdc 0x3e413bee → address
xBasketContract 0x8fdb8d07 → address
xTokenRouter 0x0b3a6efb → address

Write Contract 21 functions

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

approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 amount
burnFrom 0x79cc6790
address account
uint256 amount
changeXBasketAddress 0x297ce614
address _newAddress
claim 0x4e71d92d
No parameters
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
getNonDistributedYield 0x51689ecf
No parameters
returns: uint256
getShards 0x7683a720
uint256 _id
getTheNFT 0x8c3f164c
uint256 _id
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
onERC1155BatchReceived 0xbc197c81
address
address
uint256[]
uint256[]
bytes
returns: bytes4
onERC1155Received 0xf23a6e61
address
address
uint256
uint256
bytes
returns: bytes4
permit 0xd505accf
address owner
address spender
uint256 value
uint256 deadline
uint8 v
bytes32 r
bytes32 s
setXTokenRouter 0xdd60752d
address _router
stake 0xa694fc3a
uint256 amount
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
unstake 0x2e17de78
uint256 amount
updateUniswapContracts 0xc5b29e57
address _twap
address _uniswapRouter
xBasketTransfer 0xa5902174
address _from
uint256 amount

Recent Transactions

No transactions found for this address