@cartesi/staking-pool
Version:
PoS Staking Pools
376 lines • 20.4 kB
JSON
{
"contractName": "StakingPoolProducerImpl",
"sourceName": "contracts/StakingPoolProducerImpl.sol",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_ctsi",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "reward",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "commission",
"type": "uint256"
}
],
"name": "BlockProduced",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": 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": "ctsi",
"outputs": [
{
"internalType": "contract IERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "fee",
"outputs": [
{
"internalType": "contract Fee",
"name": "",
"type": "address"
}
],
"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": [
{
"internalType": "uint256",
"name": "_index",
"type": "uint256"
}
],
"name": "produceBlock",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"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": "0x60a060405234801561001057600080fd5b50604051610bbe380380610bbe83398101604081905261002f91610044565b60601b6001600160601b031916608052610074565b60006020828403121561005657600080fd5b81516001600160a01b038116811461006d57600080fd5b9392505050565b60805160601c610b256100996000396000818161018401526105f70152610b256000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063a5a6cd0b1161008c578063c56551b611610066578063c56551b614610208578063ddca3f431461021b578063e366b7bb1461022e578063f2fde38b1461023757600080fd5b8063a5a6cd0b146101d9578063aa8c217c146101ec578063b811540e146101f557600080fd5b80635c975abb116100c85780635c975abb1461016857806364ffc3f41461017f578063715018a6146101be5780638da5cb5b146101c857600080fd5b80630103c92b146100ef57806303314efa1461013e578063555d8ebb14610155575b600080fd5b61011e6100fd3660046109c6565b609b6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060015b60405180910390f35b61014760975481565b604051908152602001610135565b610147610163366004610a22565b61024a565b60335460ff165b6040519015158152602001610135565b6101a67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610135565b6101c6610287565b005b6065546001600160a01b03166101a6565b61016f6101e7366004610a22565b6102f2565b61014760985481565b610147610203366004610a22565b610766565b609a546101a6906001600160a01b031681565b609c546101a6906001600160a01b031681565b61014760995481565b6101c66102453660046109c6565b61079d565b6000609754600014156102665761026082610868565b92915050565b6102606097546102816098548561089c90919063ffffffff16565b906108d6565b6065546001600160a01b031633146102e65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6102f06000610919565b565b609a546040516385425f4f60e01b81526004810183905260009182916001600160a01b03909116906385425f4f9060240160206040518083038186803b15801561033b57600080fd5b505afa15801561034f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037391906109e3565b90506000816001600160a01b0316638aec85426040518163ffffffff1660e01b815260040160206040518083038186803b1580156103b057600080fd5b505afa1580156103c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e89190610a3b565b609a5460405163a5a6cd0b60e01b8152600481018790529192506001600160a01b03169063a5a6cd0b90602401602060405180830381600087803b15801561042f57600080fd5b505af1158015610443573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104679190610a00565b6104cc5760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c50726f6475636572496d706c3a206661696c65642060448201526f746f2070726f6475636520626c6f636b60801b60648201526084016102dd565b609c54604051632c7f22b560e21b815260048101869052602481018390526000916001600160a01b03169063b1fc8ad49060440160206040518083038186803b15801561051857600080fd5b505afa15801561052c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105509190610a3b565b9050818111156105ca576040805162461bcd60e51b81526020600482015260248101919091527f5374616b696e67506f6f6c50726f6475636572496d706c3a20636f6d6d69737360448201527f696f6e2069732067726561746572207468616e20626c6f636b2072657761726460648201526084016102dd565b60006105d68284610aad565b905080609860008282546105ea9190610a54565b90915550508115610721577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb6106366065546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401602060405180830381600087803b15801561067e57600080fd5b505af1158015610692573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b69190610a00565b6107215760405162461bcd60e51b815260206004820152603660248201527f5374616b696e67506f6f6c50726f6475636572496d706c3a206661696c6564206044820152753a37903a3930b739b332b91031b7b6b6b4b9b9b4b7b760511b60648201526084016102dd565b60408051848152602081018490527fbb9ac692e0e3001a628f86a894f03da4ced5df81886fec577036664ed70a59cb910160405180910390a150600195945050505050565b60006098546000141561077c576102608261096b565b6102606098546107976097548561097b90919063ffffffff16565b906109a3565b6065546001600160a01b031633146107f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102dd565b6001600160a01b03811661085c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102dd565b61086581610919565b50565b60008061087a6002633b9aca00610a6c565b9050633b9aca0061088b8483610a54565b6108959190610a6c565b9392505050565b60006b033b2e3c9fd0803ce80000006108b58385610a8e565b6108cc60026b033b2e3c9fd0803ce8000000610a6c565b61088b9190610a54565b6000806108e4600284610a6c565b9050826108fd6b033b2e3c9fd0803ce800000086610a8e565b6109079083610a54565b6109119190610a6c565b949350505050565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610260633b9aca0083610a8e565b6000670de0b6b3a76400006109908385610a8e565b6108cc6002670de0b6b3a7640000610a6c565b6000806109b1600284610a6c565b9050826108fd670de0b6b3a764000086610a8e565b6000602082840312156109d857600080fd5b813561089581610ada565b6000602082840312156109f557600080fd5b815161089581610ada565b600060208284031215610a1257600080fd5b8151801515811461089557600080fd5b600060208284031215610a3457600080fd5b5035919050565b600060208284031215610a4d57600080fd5b5051919050565b60008219821115610a6757610a67610ac4565b500190565b600082610a8957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610aa857610aa8610ac4565b500290565b600082821015610abf57610abf610ac4565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461086557600080fdfea2646970667358221220e19c59be3afe4efeba81f82206e414d004717247d1e941648fcf122d5e475be164736f6c63430008070033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063a5a6cd0b1161008c578063c56551b611610066578063c56551b614610208578063ddca3f431461021b578063e366b7bb1461022e578063f2fde38b1461023757600080fd5b8063a5a6cd0b146101d9578063aa8c217c146101ec578063b811540e146101f557600080fd5b80635c975abb116100c85780635c975abb1461016857806364ffc3f41461017f578063715018a6146101be5780638da5cb5b146101c857600080fd5b80630103c92b146100ef57806303314efa1461013e578063555d8ebb14610155575b600080fd5b61011e6100fd3660046109c6565b609b6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060015b60405180910390f35b61014760975481565b604051908152602001610135565b610147610163366004610a22565b61024a565b60335460ff165b6040519015158152602001610135565b6101a67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610135565b6101c6610287565b005b6065546001600160a01b03166101a6565b61016f6101e7366004610a22565b6102f2565b61014760985481565b610147610203366004610a22565b610766565b609a546101a6906001600160a01b031681565b609c546101a6906001600160a01b031681565b61014760995481565b6101c66102453660046109c6565b61079d565b6000609754600014156102665761026082610868565b92915050565b6102606097546102816098548561089c90919063ffffffff16565b906108d6565b6065546001600160a01b031633146102e65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6102f06000610919565b565b609a546040516385425f4f60e01b81526004810183905260009182916001600160a01b03909116906385425f4f9060240160206040518083038186803b15801561033b57600080fd5b505afa15801561034f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037391906109e3565b90506000816001600160a01b0316638aec85426040518163ffffffff1660e01b815260040160206040518083038186803b1580156103b057600080fd5b505afa1580156103c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e89190610a3b565b609a5460405163a5a6cd0b60e01b8152600481018790529192506001600160a01b03169063a5a6cd0b90602401602060405180830381600087803b15801561042f57600080fd5b505af1158015610443573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104679190610a00565b6104cc5760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c50726f6475636572496d706c3a206661696c65642060448201526f746f2070726f6475636520626c6f636b60801b60648201526084016102dd565b609c54604051632c7f22b560e21b815260048101869052602481018390526000916001600160a01b03169063b1fc8ad49060440160206040518083038186803b15801561051857600080fd5b505afa15801561052c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105509190610a3b565b9050818111156105ca576040805162461bcd60e51b81526020600482015260248101919091527f5374616b696e67506f6f6c50726f6475636572496d706c3a20636f6d6d69737360448201527f696f6e2069732067726561746572207468616e20626c6f636b2072657761726460648201526084016102dd565b60006105d68284610aad565b905080609860008282546105ea9190610a54565b90915550508115610721577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb6106366065546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401602060405180830381600087803b15801561067e57600080fd5b505af1158015610692573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b69190610a00565b6107215760405162461bcd60e51b815260206004820152603660248201527f5374616b696e67506f6f6c50726f6475636572496d706c3a206661696c6564206044820152753a37903a3930b739b332b91031b7b6b6b4b9b9b4b7b760511b60648201526084016102dd565b60408051848152602081018490527fbb9ac692e0e3001a628f86a894f03da4ced5df81886fec577036664ed70a59cb910160405180910390a150600195945050505050565b60006098546000141561077c576102608261096b565b6102606098546107976097548561097b90919063ffffffff16565b906109a3565b6065546001600160a01b031633146107f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102dd565b6001600160a01b03811661085c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102dd565b61086581610919565b50565b60008061087a6002633b9aca00610a6c565b9050633b9aca0061088b8483610a54565b6108959190610a6c565b9392505050565b60006b033b2e3c9fd0803ce80000006108b58385610a8e565b6108cc60026b033b2e3c9fd0803ce8000000610a6c565b61088b9190610a54565b6000806108e4600284610a6c565b9050826108fd6b033b2e3c9fd0803ce800000086610a8e565b6109079083610a54565b6109119190610a6c565b949350505050565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610260633b9aca0083610a8e565b6000670de0b6b3a76400006109908385610a8e565b6108cc6002670de0b6b3a7640000610a6c565b6000806109b1600284610a6c565b9050826108fd670de0b6b3a764000086610a8e565b6000602082840312156109d857600080fd5b813561089581610ada565b6000602082840312156109f557600080fd5b815161089581610ada565b600060208284031215610a1257600080fd5b8151801515811461089557600080fd5b600060208284031215610a3457600080fd5b5035919050565b600060208284031215610a4d57600080fd5b5051919050565b60008219821115610a6757610a67610ac4565b500190565b600082610a8957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610aa857610aa8610ac4565b500290565b600082821015610abf57610abf610ac4565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461086557600080fdfea2646970667358221220e19c59be3afe4efeba81f82206e414d004717247d1e941648fcf122d5e475be164736f6c63430008070033",
"linkReferences": {},
"deployedLinkReferences": {},
"devdoc": {
"kind": "dev",
"methods": {
"owner()": {
"details": "Returns the address of the current owner."
},
"paused()": {
"details": "Returns true if the contract is paused, and false otherwise."
},
"produceBlock(uint256)": {
"returns": {
"_0": "true when everything went fine"
}
},
"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": {
"events": {
"BlockProduced(uint256,uint256)": {
"notice": "this event is emitted at every produceBlock call reward is the block reward commission is how much CTSI is directed to the pool owner"
}
},
"kind": "user",
"methods": {
"produceBlock(uint256)": {
"notice": "routes produceBlock to POS contract and updates internal states of the pool"
}
},
"version": 1
},
"evm": {
"gasEstimates": {
"creation": {
"codeDepositCost": "570600",
"executionCost": "infinite",
"totalCost": "infinite"
},
"external": {
"amount()": "2340",
"amountToShares(uint256)": "infinite",
"ctsi()": "infinite",
"fee()": "2381",
"owner()": "2420",
"paused()": "2316",
"pos()": "2359",
"produceBlock(uint256)": "infinite",
"renounceOwnership()": "28184",
"requiredLiquidity()": "2361",
"shares()": "2341",
"sharesToAmount(uint256)": "infinite",
"transferOwnership(address)": "infinite",
"userBalance(address)": "6801"
},
"internal": {
"__StakingPoolProducer_init(address,address)": "infinite"
}
},
"methodIdentifiers": {
"amount()": "aa8c217c",
"amountToShares(uint256)": "b811540e",
"ctsi()": "64ffc3f4",
"fee()": "ddca3f43",
"owner()": "8da5cb5b",
"paused()": "5c975abb",
"pos()": "c56551b6",
"produceBlock(uint256)": "a5a6cd0b",
"renounceOwnership()": "715018a6",
"requiredLiquidity()": "e366b7bb",
"shares()": "03314efa",
"sharesToAmount(uint256)": "555d8ebb",
"transferOwnership(address)": "f2fde38b",
"userBalance(address)": "0103c92b"
}
}
}