UNPKG

@cartesi/staking-pool

Version:
346 lines 19.9 kB
{ "contractName": "StakingPoolStakingImpl", "sourceName": "contracts/StakingPoolStakingImpl.sol", "abi": [ { "inputs": [ { "internalType": "address", "name": "_ctsi", "type": "address" }, { "internalType": "address", "name": "_staking", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Paused", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Unpaused", "type": "event" }, { "inputs": [], "name": "amount", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_amount", "type": "uint256" } ], "name": "amountToShares", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "amounts", "outputs": [ { "internalType": "uint256", "name": "stake", "type": "uint256" }, { "internalType": "uint256", "name": "unstake", "type": "uint256" }, { "internalType": "uint256", "name": "withdraw", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "paused", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pos", "outputs": [ { "internalType": "contract IPoS", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "rebalance", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "requiredLiquidity", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "shares", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_shares", "type": "uint256" } ], "name": "sharesToAmount", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "userBalance", "outputs": [ { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "shares", "type": "uint256" }, { "internalType": "uint256", "name": "depositTimestamp", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ], "bytecode": "0x60c060405234801561001057600080fd5b50604051610b6f380380610b6f83398101604081905261002f91610069565b6001600160601b0319606092831b8116608052911b1660a05261009c565b80516001600160a01b038116811461006457600080fd5b919050565b6000806040838503121561007c57600080fd5b6100858361004d565b91506100936020840161004d565b90509250929050565b60805160601c60a05160601c610a856100ea600039600081816102ee015281816103ca01528181610464015281816105a20152818161062301526106a4015260006102500152610a856000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80637d7c2a1c1161008c578063b811540e11610066578063b811540e146101ab578063c56551b6146101be578063e366b7bb146101d1578063f2fde38b146101da57600080fd5b80637d7c2a1c146101755780638da5cb5b1461017d578063aa8c217c146101a257600080fd5b80630103c92b146100d457806303314efa14610123578063555d8ebb1461013a5780635c975abb1461014d5780636beaeeae14610163578063715018a61461016b575b600080fd5b6101036100e236600461096e565b609b6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060015b60405180910390f35b61012c60975481565b60405190815260200161011a565b61012c610148366004610997565b6101ed565b60335460ff16604051901515815260200161011a565b61010361022a565b610173610507565b005b610173610572565b6065546001600160a01b03165b6040516001600160a01b03909116815260200161011a565b61012c60985481565b61012c6101b9366004610997565b61070e565b609a5461018a906001600160a01b031681565b61012c60995481565b6101736101e836600461096e565b610745565b6000609754600014156102095761020382610810565b92915050565b6102036097546102246098548561084490919063ffffffff16565b9061087e565b6040516370a0823160e01b81523060048201526000908190819081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319060240160206040518083038186803b15801561029257600080fd5b505afa1580156102a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ca91906109b0565b905060995481111561038d57604051631066f98960e21b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063419be6249060240160206040518083038186803b15801561033857600080fd5b505afa15801561034c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037091906109b0565b905080610387576099546103849083610a22565b94505b50610501565b806099541115610501576000816099546103a79190610a22565b604051638e9f04b560e01b81523060048201529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690638e9f04b59060240160206040518083038186803b15801561040c57600080fd5b505afa158015610420573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044491906109b0565b905080156104fa576040516367ba9b9160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906367ba9b919060240160206040518083038186803b1580156104ae57600080fd5b505afa1580156104c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e691906109b0565b9050428110156104f4578194505b506104fe565b8194505b50505b50909192565b6065546001600160a01b031633146105665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61057060006108c1565b565b600080600061057f61022a565b9194509250905082156106075760405163534a7e1d60e11b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a694fc3a90602401600060405180830381600087803b1580156105ee57600080fd5b505af1158015610602573d6000803e3d6000fd5b505050505b8115610688576040516305c2fbcf60e31b8152600481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e17de7890602401600060405180830381600087803b15801561066f57600080fd5b505af1158015610683573d6000803e3d6000fd5b505050505b801561070957604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156106f057600080fd5b505af1158015610704573d6000803e3d6000fd5b505050505b505050565b6000609854600014156107245761020382610913565b61020360985461073f6097548561092390919063ffffffff16565b9061094b565b6065546001600160a01b0316331461079f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161055d565b6001600160a01b0381166108045760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161055d565b61080d816108c1565b50565b6000806108226002633b9aca006109e1565b9050633b9aca0061083384836109c9565b61083d91906109e1565b9392505050565b60006b033b2e3c9fd0803ce800000061085d8385610a03565b61087460026b033b2e3c9fd0803ce80000006109e1565b61083391906109c9565b60008061088c6002846109e1565b9050826108a56b033b2e3c9fd0803ce800000086610a03565b6108af90836109c9565b6108b991906109e1565b949350505050565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610203633b9aca0083610a03565b6000670de0b6b3a76400006109388385610a03565b6108746002670de0b6b3a76400006109e1565b6000806109596002846109e1565b9050826108a5670de0b6b3a764000086610a03565b60006020828403121561098057600080fd5b81356001600160a01b038116811461083d57600080fd5b6000602082840312156109a957600080fd5b5035919050565b6000602082840312156109c257600080fd5b5051919050565b600082198211156109dc576109dc610a39565b500190565b6000826109fe57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610a1d57610a1d610a39565b500290565b600082821015610a3457610a34610a39565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220fac7935b2060e0bd88662c36360ce71f7460ff1f470694cb60c854a231f8279864736f6c63430008070033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80637d7c2a1c1161008c578063b811540e11610066578063b811540e146101ab578063c56551b6146101be578063e366b7bb146101d1578063f2fde38b146101da57600080fd5b80637d7c2a1c146101755780638da5cb5b1461017d578063aa8c217c146101a257600080fd5b80630103c92b146100d457806303314efa14610123578063555d8ebb1461013a5780635c975abb1461014d5780636beaeeae14610163578063715018a61461016b575b600080fd5b6101036100e236600461096e565b609b6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060015b60405180910390f35b61012c60975481565b60405190815260200161011a565b61012c610148366004610997565b6101ed565b60335460ff16604051901515815260200161011a565b61010361022a565b610173610507565b005b610173610572565b6065546001600160a01b03165b6040516001600160a01b03909116815260200161011a565b61012c60985481565b61012c6101b9366004610997565b61070e565b609a5461018a906001600160a01b031681565b61012c60995481565b6101736101e836600461096e565b610745565b6000609754600014156102095761020382610810565b92915050565b6102036097546102246098548561084490919063ffffffff16565b9061087e565b6040516370a0823160e01b81523060048201526000908190819081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319060240160206040518083038186803b15801561029257600080fd5b505afa1580156102a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ca91906109b0565b905060995481111561038d57604051631066f98960e21b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063419be6249060240160206040518083038186803b15801561033857600080fd5b505afa15801561034c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037091906109b0565b905080610387576099546103849083610a22565b94505b50610501565b806099541115610501576000816099546103a79190610a22565b604051638e9f04b560e01b81523060048201529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690638e9f04b59060240160206040518083038186803b15801561040c57600080fd5b505afa158015610420573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044491906109b0565b905080156104fa576040516367ba9b9160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906367ba9b919060240160206040518083038186803b1580156104ae57600080fd5b505afa1580156104c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e691906109b0565b9050428110156104f4578194505b506104fe565b8194505b50505b50909192565b6065546001600160a01b031633146105665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61057060006108c1565b565b600080600061057f61022a565b9194509250905082156106075760405163534a7e1d60e11b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a694fc3a90602401600060405180830381600087803b1580156105ee57600080fd5b505af1158015610602573d6000803e3d6000fd5b505050505b8115610688576040516305c2fbcf60e31b8152600481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e17de7890602401600060405180830381600087803b15801561066f57600080fd5b505af1158015610683573d6000803e3d6000fd5b505050505b801561070957604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156106f057600080fd5b505af1158015610704573d6000803e3d6000fd5b505050505b505050565b6000609854600014156107245761020382610913565b61020360985461073f6097548561092390919063ffffffff16565b9061094b565b6065546001600160a01b0316331461079f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161055d565b6001600160a01b0381166108045760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161055d565b61080d816108c1565b50565b6000806108226002633b9aca006109e1565b9050633b9aca0061083384836109c9565b61083d91906109e1565b9392505050565b60006b033b2e3c9fd0803ce800000061085d8385610a03565b61087460026b033b2e3c9fd0803ce80000006109e1565b61083391906109c9565b60008061088c6002846109e1565b9050826108a56b033b2e3c9fd0803ce800000086610a03565b6108af90836109c9565b6108b991906109e1565b949350505050565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610203633b9aca0083610a03565b6000670de0b6b3a76400006109388385610a03565b6108746002670de0b6b3a76400006109e1565b6000806109596002846109e1565b9050826108a5670de0b6b3a764000086610a03565b60006020828403121561098057600080fd5b81356001600160a01b038116811461083d57600080fd5b6000602082840312156109a957600080fd5b5035919050565b6000602082840312156109c257600080fd5b5051919050565b600082198211156109dc576109dc610a39565b500190565b6000826109fe57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610a1d57610a1d610a39565b500290565b600082821015610a3457610a34610a39565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220fac7935b2060e0bd88662c36360ce71f7460ff1f470694cb60c854a231f8279864736f6c63430008070033", "linkReferences": {}, "deployedLinkReferences": {}, "devdoc": { "kind": "dev", "methods": { "amounts()": { "returns": { "stake": "amount of tokens that can be staked", "unstake": "amount of tokens that must be unstaked to add liquidity", "withdraw": "amount of tokens that can be withdrawn to add liquidity" } }, "owner()": { "details": "Returns the address of the current owner." }, "paused()": { "details": "Returns true if the contract is paused, and false otherwise." }, "renounceOwnership()": { "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." }, "transferOwnership(address)": { "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." } }, "version": 1 }, "userdoc": { "kind": "user", "methods": { "amounts()": { "notice": "provide information for offchain about the amount for each staking operation on the main Staking contract" }, "rebalance()": { "notice": "Move tokens from pool to staking or vice-versa, according to required liquidity. If the pool has more liquidity then necessary, it stakes tokens. If the pool has less liquidity then necessary, and has not started an unstake, it unstakes. If the pool has less liquity than necessary, and has started an unstake, it withdraws if possible." } }, "notice": "This contract takes care of the interaction between the pool and the staking contract It makes sure that there is enough liquidity in the pool to fullfil all unstake request from users, by requesting to withdraw or unstake from Staking contract. The remaining balance is staked.", "version": 1 }, "evm": { "gasEstimates": { "creation": { "codeDepositCost": "538600", "executionCost": "infinite", "totalCost": "infinite" }, "external": { "amount()": "2362", "amountToShares(uint256)": "infinite", "amounts()": "infinite", "owner()": "2365", "paused()": "2359", "pos()": "2381", "rebalance()": "infinite", "renounceOwnership()": "28228", "requiredLiquidity()": "2361", "shares()": "2318", "sharesToAmount(uint256)": "infinite", "transferOwnership(address)": "28365", "userBalance(address)": "6749" }, "internal": { "__StakingPoolStaking_init()": "infinite" } }, "methodIdentifiers": { "amount()": "aa8c217c", "amountToShares(uint256)": "b811540e", "amounts()": "6beaeeae", "owner()": "8da5cb5b", "paused()": "5c975abb", "pos()": "c56551b6", "rebalance()": "7d7c2a1c", "renounceOwnership()": "715018a6", "requiredLiquidity()": "e366b7bb", "shares()": "03314efa", "sharesToAmount(uint256)": "555d8ebb", "transferOwnership(address)": "f2fde38b", "userBalance(address)": "0103c92b" } } }