@cartesi/staking-pool
Version:
PoS Staking Pools
379 lines • 20.2 kB
JSON
{
"contractName": "StakingPoolWorkerImpl",
"sourceName": "contracts/StakingPoolWorkerImpl.sol",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_workerManager",
"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": [
{
"internalType": "address",
"name": "workerAddress",
"type": "address"
}
],
"name": "cancelHire",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address payable",
"name": "workerAddress",
"type": "address"
}
],
"name": "hire",
"outputs": [],
"stateMutability": "payable",
"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": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "requiredLiquidity",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address payable",
"name": "workerAddress",
"type": "address"
}
],
"name": "retire",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "selfhire",
"outputs": [],
"stateMutability": "payable",
"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"
},
{
"stateMutability": "payable",
"type": "receive"
}
],
"bytecode": "0x60a060405234801561001057600080fd5b50604051610ba2380380610ba283398101604081905261002f916100a8565b6001600160a01b0381166100935760405162461bcd60e51b815260206004820152602160248201527f706172616d657465722063616e206e6f74206265207a65726f206164647265736044820152607360f81b606482015260840160405180910390fd5b60601b6001600160601b0319166080526100d8565b6000602082840312156100ba57600080fd5b81516001600160a01b03811681146100d157600080fd5b9392505050565b60805160601c610a826101206000396000818161033d015281816103c80152818161042c01528181610555015281816105fe015281816106ad01526107320152610a826000f3fe6080604052600436106100ec5760003560e01c80639e6371ba1161008a578063c56551b611610059578063c56551b614610282578063d9d6bd86146102a2578063e366b7bb146102b5578063f2fde38b146102cb57600080fd5b80639e6371ba1461020c578063aa8c217c1461022c578063b64b3bed14610242578063b811540e1461026257600080fd5b80635c975abb116100c65780635c975abb146101985780636ff46a6c146101bb578063715018a6146101c55780638da5cb5b146101da57600080fd5b80630103c92b146100f857806303314efa14610154578063555d8ebb1461017857600080fd5b366100f357005b600080fd5b34801561010457600080fd5b5061013461011336600461095d565b609b6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060015b60405180910390f35b34801561016057600080fd5b5061016a60975481565b60405190815260200161014b565b34801561018457600080fd5b5061016a61019336600461097a565b6102eb565b3480156101a457600080fd5b5060335460ff16604051901515815260200161014b565b6101c3610328565b005b3480156101d157600080fd5b506101c36104cd565b3480156101e657600080fd5b506065546001600160a01b03165b6040516001600160a01b03909116815260200161014b565b34801561021857600080fd5b506101c361022736600461095d565b61050c565b34801561023857600080fd5b5061016a60985481565b34801561024e57600080fd5b506101c361025d36600461095d565b6105b5565b34801561026e57600080fd5b5061016a61027d36600461097a565b61062d565b34801561028e57600080fd5b50609a546101f4906001600160a01b031681565b6101c36102b036600461095d565b610664565b3480156102c157600080fd5b5061016a60995481565b3480156102d757600080fd5b506101c36102e636600461095d565b610767565b60006097546000141561030757610301826107ff565b92915050565b6103016097546103226098548561083390919063ffffffff16565b9061086d565b604051636ceb5ec360e11b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d9d6bd869034906024016000604051808303818588803b15801561038a57600080fd5b505af115801561039e573d6000803e3d6000fd5b5050609a54604051632bef459560e01b81523060048201526001600160a01b0391821660248201527f00000000000000000000000000000000000000000000000000000000000000009091169350632bef459592506044019050600060405180830381600087803b15801561041257600080fd5b505af1158015610426573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639b789b7e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561048557600080fd5b505af1158015610499573d6000803e3d6000fd5b50506040513392503480156108fc029250906000818181858888f193505050501580156104ca573d6000803e3d6000fd5b50565b6065546001600160a01b031633146105005760405162461bcd60e51b81526004016104f790610993565b60405180910390fd5b61050a60006108b0565b565b6065546001600160a01b031633146105365760405162461bcd60e51b81526004016104f790610993565b604051634f31b8dd60e11b81526001600160a01b0382811660048301527f00000000000000000000000000000000000000000000000000000000000000001690639e6371ba906024015b600060405180830381600087803b15801561059a57600080fd5b505af11580156105ae573d6000803e3d6000fd5b5050505050565b6065546001600160a01b031633146105df5760405162461bcd60e51b81526004016104f790610993565b60405163b64b3bed60e01b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063b64b3bed90602401610580565b6000609854600014156106435761030182610902565b61030160985461065e6097548561091290919063ffffffff16565b9061093a565b6065546001600160a01b0316331461068e5760405162461bcd60e51b81526004016104f790610993565b604051636ceb5ec360e11b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063d9d6bd869034906024016000604051808303818588803b1580156106f257600080fd5b505af1158015610706573d6000803e3d6000fd5b5050609a54604051632bef459560e01b81526001600160a01b03868116600483015291821660248201527f00000000000000000000000000000000000000000000000000000000000000009091169350632bef459592506044019050610580565b6065546001600160a01b031633146107915760405162461bcd60e51b81526004016104f790610993565b6001600160a01b0381166107f65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104f7565b6104ca816108b0565b6000806108116002633b9aca006109e0565b9050633b9aca0061082284836109c8565b61082c91906109e0565b9392505050565b60006b033b2e3c9fd0803ce800000061084c8385610a02565b61086360026b033b2e3c9fd0803ce80000006109e0565b61082291906109c8565b60008061087b6002846109e0565b9050826108946b033b2e3c9fd0803ce800000086610a02565b61089e90836109c8565b6108a891906109e0565b949350505050565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610301633b9aca0083610a02565b6000670de0b6b3a76400006109278385610a02565b6108636002670de0b6b3a76400006109e0565b6000806109486002846109e0565b905082610894670de0b6b3a764000086610a02565b60006020828403121561096f57600080fd5b813561082c81610a37565b60006020828403121561098c57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082198211156109db576109db610a21565b500190565b6000826109fd57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610a1c57610a1c610a21565b500290565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146104ca57600080fdfea26469706673582212204d826897b62c22b62f36b32216dafe5cb91d8bd35227c0b8ebfe7b8ed108cd2764736f6c63430008070033",
"deployedBytecode": "0x6080604052600436106100ec5760003560e01c80639e6371ba1161008a578063c56551b611610059578063c56551b614610282578063d9d6bd86146102a2578063e366b7bb146102b5578063f2fde38b146102cb57600080fd5b80639e6371ba1461020c578063aa8c217c1461022c578063b64b3bed14610242578063b811540e1461026257600080fd5b80635c975abb116100c65780635c975abb146101985780636ff46a6c146101bb578063715018a6146101c55780638da5cb5b146101da57600080fd5b80630103c92b146100f857806303314efa14610154578063555d8ebb1461017857600080fd5b366100f357005b600080fd5b34801561010457600080fd5b5061013461011336600461095d565b609b6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060015b60405180910390f35b34801561016057600080fd5b5061016a60975481565b60405190815260200161014b565b34801561018457600080fd5b5061016a61019336600461097a565b6102eb565b3480156101a457600080fd5b5060335460ff16604051901515815260200161014b565b6101c3610328565b005b3480156101d157600080fd5b506101c36104cd565b3480156101e657600080fd5b506065546001600160a01b03165b6040516001600160a01b03909116815260200161014b565b34801561021857600080fd5b506101c361022736600461095d565b61050c565b34801561023857600080fd5b5061016a60985481565b34801561024e57600080fd5b506101c361025d36600461095d565b6105b5565b34801561026e57600080fd5b5061016a61027d36600461097a565b61062d565b34801561028e57600080fd5b50609a546101f4906001600160a01b031681565b6101c36102b036600461095d565b610664565b3480156102c157600080fd5b5061016a60995481565b3480156102d757600080fd5b506101c36102e636600461095d565b610767565b60006097546000141561030757610301826107ff565b92915050565b6103016097546103226098548561083390919063ffffffff16565b9061086d565b604051636ceb5ec360e11b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d9d6bd869034906024016000604051808303818588803b15801561038a57600080fd5b505af115801561039e573d6000803e3d6000fd5b5050609a54604051632bef459560e01b81523060048201526001600160a01b0391821660248201527f00000000000000000000000000000000000000000000000000000000000000009091169350632bef459592506044019050600060405180830381600087803b15801561041257600080fd5b505af1158015610426573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639b789b7e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561048557600080fd5b505af1158015610499573d6000803e3d6000fd5b50506040513392503480156108fc029250906000818181858888f193505050501580156104ca573d6000803e3d6000fd5b50565b6065546001600160a01b031633146105005760405162461bcd60e51b81526004016104f790610993565b60405180910390fd5b61050a60006108b0565b565b6065546001600160a01b031633146105365760405162461bcd60e51b81526004016104f790610993565b604051634f31b8dd60e11b81526001600160a01b0382811660048301527f00000000000000000000000000000000000000000000000000000000000000001690639e6371ba906024015b600060405180830381600087803b15801561059a57600080fd5b505af11580156105ae573d6000803e3d6000fd5b5050505050565b6065546001600160a01b031633146105df5760405162461bcd60e51b81526004016104f790610993565b60405163b64b3bed60e01b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063b64b3bed90602401610580565b6000609854600014156106435761030182610902565b61030160985461065e6097548561091290919063ffffffff16565b9061093a565b6065546001600160a01b0316331461068e5760405162461bcd60e51b81526004016104f790610993565b604051636ceb5ec360e11b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063d9d6bd869034906024016000604051808303818588803b1580156106f257600080fd5b505af1158015610706573d6000803e3d6000fd5b5050609a54604051632bef459560e01b81526001600160a01b03868116600483015291821660248201527f00000000000000000000000000000000000000000000000000000000000000009091169350632bef459592506044019050610580565b6065546001600160a01b031633146107915760405162461bcd60e51b81526004016104f790610993565b6001600160a01b0381166107f65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104f7565b6104ca816108b0565b6000806108116002633b9aca006109e0565b9050633b9aca0061082284836109c8565b61082c91906109e0565b9392505050565b60006b033b2e3c9fd0803ce800000061084c8385610a02565b61086360026b033b2e3c9fd0803ce80000006109e0565b61082291906109c8565b60008061087b6002846109e0565b9050826108946b033b2e3c9fd0803ce800000086610a02565b61089e90836109c8565b6108a891906109e0565b949350505050565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610301633b9aca0083610a02565b6000670de0b6b3a76400006109278385610a02565b6108636002670de0b6b3a76400006109e0565b6000806109486002846109e0565b905082610894670de0b6b3a764000086610a02565b60006020828403121561096f57600080fd5b813561082c81610a37565b60006020828403121561098c57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082198211156109db576109db610a21565b500190565b6000826109fd57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610a1c57610a1c610a21565b500290565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146104ca57600080fdfea26469706673582212204d826897b62c22b62f36b32216dafe5cb91d8bd35227c0b8ebfe7b8ed108cd2764736f6c63430008070033",
"linkReferences": {},
"deployedLinkReferences": {},
"devdoc": {
"kind": "dev",
"methods": {
"cancelHire(address)": {
"params": {
"workerAddress": "address of the worker node"
}
},
"hire(address)": {
"params": {
"workerAddress": "address of the worker"
}
},
"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."
},
"retire(address)": {
"details": "this also removes all authorizations in place",
"params": {
"workerAddress": "address of the worker to be retired"
}
},
"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": {
"cancelHire(address)": {
"notice": "Called by the user to cancel a job offer"
},
"hire(address)": {
"notice": "Asks the worker to work for the sender. Sender needs to pay something."
},
"retire(address)": {
"notice": "Called by the user to retire his worker."
},
"selfhire()": {
"notice": "allows for the pool to act on its own behalf when producing blocks."
}
},
"version": 1
},
"evm": {
"gasEstimates": {
"creation": {
"codeDepositCost": "538000",
"executionCost": "infinite",
"totalCost": "infinite"
},
"external": {
"amount()": "2340",
"amountToShares(uint256)": "infinite",
"cancelHire(address)": "infinite",
"hire(address)": "infinite",
"owner()": "2409",
"paused()": "2315",
"pos()": "2359",
"renounceOwnership()": "28184",
"requiredLiquidity()": "2361",
"retire(address)": "infinite",
"selfhire()": "infinite",
"shares()": "2341",
"sharesToAmount(uint256)": "infinite",
"transferOwnership(address)": "infinite",
"userBalance(address)": "6801"
},
"internal": {
"__StakingPoolWorkerImpl_update(address)": "infinite"
}
},
"methodIdentifiers": {
"amount()": "aa8c217c",
"amountToShares(uint256)": "b811540e",
"cancelHire(address)": "b64b3bed",
"hire(address)": "d9d6bd86",
"owner()": "8da5cb5b",
"paused()": "5c975abb",
"pos()": "c56551b6",
"renounceOwnership()": "715018a6",
"requiredLiquidity()": "e366b7bb",
"retire(address)": "9e6371ba",
"selfhire()": "6ff46a6c",
"shares()": "03314efa",
"sharesToAmount(uint256)": "555d8ebb",
"transferOwnership(address)": "f2fde38b",
"userBalance(address)": "0103c92b"
}
}
}