UNPKG

@cartesi/staking-pool

Version:
274 lines 7.23 kB
{ "contractName": "StakingPoolUser", "sourceName": "contracts/interfaces/StakingPoolUser.sol", "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "stakeTimestamp", "type": "uint256" } ], "name": "Deposit", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "shares", "type": "uint256" } ], "name": "Stake", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "shares", "type": "uint256" } ], "name": "Unstake", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "Withdraw", "type": "event" }, { "inputs": [ { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "deposit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "getWithdrawBalance", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "stake", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "shares", "type": "uint256" } ], "name": "unstake", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "bytecode": "0x", "deployedBytecode": "0x", "linkReferences": {}, "deployedLinkReferences": {}, "devdoc": { "author": "Danilo Tuler", "events": { "Deposit(address,uint256,uint256)": { "params": { "amount": "amount of tokens deposited by the user", "stakeTimestamp": "instant when the amount can be staked", "user": "address of msg.sender" } }, "Stake(address,uint256,uint256)": { "params": { "amount": "amount deposited by the user", "shares": "number of shares emitted for user", "user": "address of msg.sender" } }, "Unstake(address,uint256,uint256)": { "params": { "amount": "amount of tokens to be released", "shares": "number of shares being liquidated", "user": "address of msg.sender" } }, "Withdraw(address,uint256)": { "params": { "amount": "amount of tokens withdrawn", "user": "address of msg.sender" } } }, "kind": "dev", "methods": { "deposit(uint256)": { "params": { "amount": "amount of token deposited in the pool" } }, "getWithdrawBalance()": { "details": "there is no way to know the exact time in the future the requested tokens will be available", "returns": { "_0": "the amount of tokens that can be immediately withdrawn by the calling user" } }, "stake(uint256)": { "params": { "amount": "amount of tokens to convert to shares" } }, "unstake(uint256)": { "details": "Shares are immediately converted to tokens, and added to the pool liquidity requirement" }, "withdraw(uint256)": { "details": "this will transfer tokens from user pool account to user's wallet" } }, "title": "Interaction between a pool user and a pool", "version": 1 }, "userdoc": { "events": { "Deposit(address,uint256,uint256)": { "notice": "Tokens were deposited, available for staking or withdrawal" }, "Stake(address,uint256,uint256)": { "notice": "Tokens were deposited, they count as shares immediatly" }, "Unstake(address,uint256,uint256)": { "notice": "Request to unstake tokens. Additional liquidity requested for the pool" }, "Withdraw(address,uint256)": { "notice": "Withdraw performed by a user" } }, "kind": "user", "methods": { "deposit(uint256)": { "notice": "Deposit tokens to user pool balance" }, "getWithdrawBalance()": { "notice": "Returns the amount of tokens that can be immediately withdrawn by the calling user" }, "stake(uint256)": { "notice": "Stake an amount of tokens, immediately earning pool shares in returns" }, "unstake(uint256)": { "notice": "Unstake an specified amount of shares of the calling user" }, "withdraw(uint256)": { "notice": "Transfer tokens back to calling user wallet" } }, "notice": "This interface models all interactions between a pool user and a pool, including staking, unstaking and withdrawing. A pool user always holds pool shares. When a user stakes tokens, he immediately receive shares. When he unstakes shares he is asking to release tokens. Those tokens need to be withdrawn by an additional call to withdraw()", "version": 1 }, "evm": { "gasEstimates": null, "methodIdentifiers": { "deposit(uint256)": "b6b55f25", "getWithdrawBalance()": "710fe6f8", "stake(uint256)": "a694fc3a", "unstake(uint256)": "2e17de78", "withdraw(uint256)": "2e1a7d4d" } } }