UNPKG

@gooddollar/goodcontracts

Version:
1,148 lines 109 kB
{ "contractName": "AbstractGoodStaking", "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "address", "name": "token", "type": "address" }, { "indexed": false, "internalType": "address", "name": "intrestToken", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "intrestTokenValue", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "tokenValue", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "tokenPrecisionLoss", "type": "uint256" } ], "name": "InterestCollected", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "staker", "type": "address" }, { "indexed": false, "internalType": "address", "name": "token", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "remainingBalance", "type": "uint256" } ], "name": "StakeWithdraw", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "staker", "type": "address" }, { "indexed": false, "internalType": "address", "name": "token", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Staked", "type": "event" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "stakers", "outputs": [ { "internalType": "uint256", "name": "stakedToken", "type": "uint256" }, { "internalType": "uint256", "name": "lastStake", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "stake", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "withdrawStake", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "currentTokenWorth", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "currentUBIInterest", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "address", "name": "recipient", "type": "address" } ], "name": "collectUBIInterest", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint32", "name": "", "type": "uint32" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"intrestToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"intrestTokenValue\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenValue\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenPrecisionLoss\",\"type\":\"uint256\"}],\"name\":\"InterestCollected\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remainingBalance\",\"type\":\"uint256\"}],\"name\":\"StakeWithdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"collectUBIInterest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"currentTokenWorth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"currentUBIInterest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"stake\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"stakers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"stakedToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastStake\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"withdrawStake\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{\"collectUBIInterest(address)\":{\"details\":\"collect gained interest by fundmanager\",\"params\":{\"recipient\":\"of intrestToken gains\"},\"return\":\"Intrest gained on lending the tokens.Intrest gained on lending the tokens in terms of token rate.Token's precision loss due to decimal difference.average intrest donation ratio.\"},\"currentTokenWorth()\":{\"details\":\"calculates the holding of intrestToken by staking contract in terms of token value.\",\"return\":\"It will return the token worth of intrest token that contract is holding.\"},\"currentUBIInterest()\":{\"details\":\"calculates the tokenGain, intrestTokenGain and precisionLossToken\",\"return\":\"Intrest gained on lending the tokens.Intrest gained on lending the tokens in terms of token rate.Token's precision loss due to decimal difference.\"},\"stake(uint256)\":{\"details\":\"stake some tokens\",\"params\":{\"amount\":\"of Tokens to stake\"}},\"withdrawStake()\":{\"details\":\"withdraw staked tokens\"}},\"title\":\"Abstract contract that holds all the data, events and functions for staking contract. The staking contract will inherit this interface\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/stakingModel/contracts/AbstractGoodStaking.sol\":\"AbstractGoodStaking\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/stakingModel/contracts/AbstractGoodStaking.sol\":{\"keccak256\":\"0xc643ae3414da5106369e6ccef59e2d48cddf24a84a4c1d19aeba40f40e3e04c6\",\"urls\":[\"bzz-raw://c60810ba3a3a92532ddd129c99ad727dc23d6f8fe94050796bde02f5f54cc21a\",\"dweb:/ipfs/QmQ92c7u8vi5Dc56MqeVx6hJsEjx3GFgBC47hKMHzbVwij\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b506101ce806100206000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806317e49ca114610067578063374559901461008d5780639168ae72146100df578063a694fc3a1461011e578063bed9d8611461013d578063e0b3f30514610145575b600080fd5b61006f61015f565b60408051938452602084019290925282820152519081900360600190f35b6100b3600480360360208110156100a357600080fd5b50356001600160a01b0316610169565b6040805194855260208501939093528383019190915263ffffffff166060830152519081900360800190f35b610105600480360360208110156100f557600080fd5b50356001600160a01b0316610176565b6040805192835260208301919091528051918290030190f35b61013b6004803603602081101561013457600080fd5b503561018f565b005b61013b610192565b61014d610194565b60408051918252519081900360200190f35b6000806000909192565b6000806000809193509193565b6000602081905290815260409020805460019091015482565b50565b565b60009056fea265627a7a723158207b1b07cbf211ba7d5e4209100e6084c0328c2dfbe8fcb11b01529ba35925488b64736f6c63430005100032", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c806317e49ca114610067578063374559901461008d5780639168ae72146100df578063a694fc3a1461011e578063bed9d8611461013d578063e0b3f30514610145575b600080fd5b61006f61015f565b60408051938452602084019290925282820152519081900360600190f35b6100b3600480360360208110156100a357600080fd5b50356001600160a01b0316610169565b6040805194855260208501939093528383019190915263ffffffff166060830152519081900360800190f35b610105600480360360208110156100f557600080fd5b50356001600160a01b0316610176565b6040805192835260208301919091528051918290030190f35b61013b6004803603602081101561013457600080fd5b503561018f565b005b61013b610192565b61014d610194565b60408051918252519081900360200190f35b6000806000909192565b6000806000809193509193565b6000602081905290815260409020805460019091015482565b50565b565b60009056fea265627a7a723158207b1b07cbf211ba7d5e4209100e6084c0328c2dfbe8fcb11b01529ba35925488b64736f6c63430005100032", "sourceMap": "184:3472:20:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;184:3472:20;;;;;;;", "deployedSourceMap": "184:3472:20:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;184:3472:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2190:156;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;2706:180;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2706:180:20;-1:-1:-1;;;;;2706:180:20;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;523:41;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;523:41:20;-1:-1:-1;;;;;523:41:20;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1491:42;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1491:42:20;;:::i;:::-;;1590:36;;;:::i;1833:63::-;;;:::i;:::-;;;;;;;;;;;;;;;;2190:156;2280:7;2301;2322;2190:156;;;:::o;2706:180::-;2800:7;2821;2842;2863:6;2706:180;;;;;:::o;523:41::-;;;;;;;;;;;;;;;;;;;;:::o;1491:42::-;;:::o;1590:36::-;:::o;1833:63::-;1885:7;1833:63;:::o", "source": "pragma solidity >0.5.4;\n\n/**\n * @title Abstract contract that holds all the data,\n * events and functions for staking contract.\n * The staking contract will inherit this interface\n */\ncontract AbstractGoodStaking {\n /**\n * @dev Structure to store staking details.\n * It contains amount of tokens staked and blocknumber at which last staked.\n */\n struct Staker {\n uint256 stakedToken;\n uint256 lastStake;\n }\n\n /**\n * @dev Mapping to store staking details for each user.\n */\n mapping(address => Staker) public stakers;\n\n /**\n * @dev Emitted when `staker` stake `value` tokens of `token`\n */\n event Staked(address indexed staker, address token, uint256 value);\n\n /**\n * @dev Emitted when `staker` withdraws their stake `value` tokens and contracts balance will\n * be reduced to`remainingBalance`.\n */\n event StakeWithdraw(\n address indexed staker,\n address token,\n uint256 value,\n uint256 remainingBalance\n );\n\n /**\n * @dev Emitted when fundmanager transfers intrest collected from defi protrocol.\n * `recipient` will receive `intrestTokenValue` as intrest.\n */\n event InterestCollected(\n address recipient,\n address token,\n address intrestToken,\n uint256 intrestTokenValue,\n uint256 tokenValue,\n uint256 tokenPrecisionLoss\n );\n\n /**\n * @dev stake some tokens\n * @param amount of Tokens to stake\n */\n function stake(uint256 amount) external {}\n\n /**\n * @dev withdraw staked tokens\n */\n function withdrawStake() external {}\n\n /**\n * @dev calculates the holding of intrestToken by staking contract in terms of token value.\n * @return It will return the token worth of intrest token that contract is holding.\n */\n function currentTokenWorth() external view returns (uint256) {}\n\n /**\n * @dev calculates the tokenGain, intrestTokenGain and precisionLossToken\n * @return Intrest gained on lending the tokens.\n * @return Intrest gained on lending the tokens in terms of token rate.\n * @return Token's precision loss due to decimal difference.\n */\n function currentUBIInterest()\n external\n view\n returns (\n uint256,\n uint256,\n uint256\n )\n {}\n\n /**\n * @dev collect gained interest by fundmanager\n * @param recipient of intrestToken gains\n * @return Intrest gained on lending the tokens.\n * @return Intrest gained on lending the tokens in terms of token rate.\n * @return Token's precision loss due to decimal difference.\n * @return average intrest donation ratio.\n */\n function collectUBIInterest(address recipient)\n external\n returns (\n uint256,\n uint256,\n uint256,\n uint32\n )\n {}\n\n /**\n * @dev Invests staked tokens to defi protocol.\n * @param amount tokens staked.\n */\n function mint(uint256 amount) internal {}\n\n /**\n * @dev Redeem invested tokens from defi protocol.\n * @param amount tokens to be redeemed.\n */\n function redeem(uint256 amount) internal {}\n\n /**\n * @dev Calculates exchange rate for token to intrest token from defi protocol.\n * @return exchange rate.\n */\n function exchangeRate() internal view returns (uint256) {}\n\n /**\n * @dev Returns decimal value for token.\n */\n function tokenDecimal() internal view returns (uint256) {}\n\n /**\n * @dev Returns decimal value for intrest token.\n */\n function iTokenDecimal() internal view returns (uint256) {}\n}\n", "sourcePath": "/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/stakingModel/contracts/AbstractGoodStaking.sol", "ast": { "absolutePath": "/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/stakingModel/contracts/AbstractGoodStaking.sol", "exportedSymbols": { "AbstractGoodStaking": [ 3881 ] }, "id": 3882, "nodeType": "SourceUnit", "nodes": [ { "id": 3769, "literals": [ "solidity", ">", "0.5", ".4" ], "nodeType": "PragmaDirective", "src": "0:23:20" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": "@title Abstract contract that holds all the data,\nevents and functions for staking contract.\nThe staking contract will inherit this interface", "fullyImplemented": true, "id": 3881, "linearizedBaseContracts": [ 3881 ], "name": "AbstractGoodStaking", "nodeType": "ContractDefinition", "nodes": [ { "canonicalName": "AbstractGoodStaking.Staker", "id": 3774, "members": [ { "constant": false, "id": 3771, "name": "stakedToken", "nodeType": "VariableDeclaration", "scope": 3774, "src": "388:19:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3770, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "388:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3773, "name": "lastStake", "nodeType": "VariableDeclaration", "scope": 3774, "src": "417:17:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3772, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "417:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "name": "Staker", "nodeType": "StructDefinition", "scope": 3881, "src": "364:77:20", "visibility": "public" }, { "constant": false, "id": 3778, "name": "stakers", "nodeType": "VariableDeclaration", "scope": 3881, "src": "523:41:20", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Staker_$3774_storage_$", "typeString": "mapping(address => struct AbstractGoodStaking.Staker)" }, "typeName": { "id": 3777, "keyType": { "id": 3775, "name": "address", "nodeType": "ElementaryTypeName", "src": "531:7:20", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "523:26:20", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Staker_$3774_storage_$", "typeString": "mapping(address => struct AbstractGoodStaking.Staker)" }, "valueType": { "contractScope": null, "id": 3776, "name": "Staker", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 3774, "src": "542:6:20", "typeDescriptions": { "typeIdentifier": "t_struct$_Staker_$3774_storage_ptr", "typeString": "struct AbstractGoodStaking.Staker" } } }, "value": null, "visibility": "public" }, { "anonymous": false, "documentation": "@dev Emitted when `staker` stake `value` tokens of `token`", "id": 3786, "name": "Staked", "nodeType": "EventDefinition", "parameters": { "id": 3785, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3780, "indexed": true, "name": "staker", "nodeType": "VariableDeclaration", "scope": 3786, "src": "666:22:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3779, "name": "address", "nodeType": "ElementaryTypeName", "src": "666:7:20", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3782, "indexed": false, "name": "token", "nodeType": "VariableDeclaration", "scope": 3786, "src": "690:13:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3781, "name": "address", "nodeType": "ElementaryTypeName", "src": "690:7:20", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3784, "indexed": false, "name": "value", "nodeType": "VariableDeclaration", "scope": 3786, "src": "705:13:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3783, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "705:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "665:54:20" }, "src": "653:67:20" }, { "anonymous": false, "documentation": "@dev Emitted when `staker` withdraws their stake `value` tokens and contracts balance will\nbe reduced to`remainingBalance`.", "id": 3796, "name": "StakeWithdraw", "nodeType": "EventDefinition", "parameters": { "id": 3795, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3788, "indexed": true, "name": "staker", "nodeType": "VariableDeclaration", "scope": 3796, "src": "909:22:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3787, "name": "address", "nodeType": "ElementaryTypeName", "src": "909:7:20", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3790, "indexed": false, "name": "token", "nodeType": "VariableDeclaration", "scope": 3796, "src": "941:13:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3789, "name": "address", "nodeType": "ElementaryTypeName", "src": "941:7:20", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3792, "indexed": false, "name": "value", "nodeType": "VariableDeclaration", "scope": 3796, "src": "964:13:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3791, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "964:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3794, "indexed": false, "name": "remainingBalance", "nodeType": "VariableDeclaration", "scope": 3796, "src": "987:24:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3793, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "987:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "899:118:20" }, "src": "880:138:20" }, { "anonymous": false, "documentation": "@dev Emitted when fundmanager transfers intrest collected from defi protrocol.\n`recipient` will receive `intrestTokenValue` as intrest.", "id": 3810, "name": "InterestCollected", "nodeType": "EventDefinition", "parameters": { "id": 3809, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3798, "indexed": false, "name": "recipient", "nodeType": "VariableDeclaration", "scope": 3810, "src": "1223:17:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3797, "name": "address", "nodeType": "ElementaryTypeName", "src": "1223:7:20", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3800, "indexed": false, "name": "token", "nodeType": "VariableDeclaration", "scope": 3810, "src": "1250:13:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3799, "name": "address", "nodeType": "ElementaryTypeName", "src": "1250:7:20", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3802, "indexed": false, "name": "intrestToken", "nodeType": "VariableDeclaration", "scope": 3810, "src": "1273:20:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3801, "name": "address", "nodeType": "ElementaryTypeName", "src": "1273:7:20", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3804, "indexed": false, "name": "intrestTokenValue", "nodeType": "VariableDeclaration", "scope": 3810, "src": "1303:25:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3803, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1303:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3806, "indexed": false, "name": "tokenValue", "nodeType": "VariableDeclaration", "scope": 3810, "src": "1338:18:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3805, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1338:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3808, "indexed": false, "name": "tokenPrecisionLoss", "nodeType": "VariableDeclaration", "scope": 3810, "src": "1366:26:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3807, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1366:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1213:185:20" }, "src": "1190:209:20" }, { "body": { "id": 3815, "nodeType": "Block", "src": "1531:2:20", "statements": [] }, "documentation": "@dev stake some tokens\n@param amount of Tokens to stake", "id": 3816, "implemented": true, "kind": "function", "modifiers": [], "name": "stake", "nodeType": "FunctionDefinition", "parameters": { "id": 3813, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3812, "name": "amount", "nodeType": "VariableDeclaration", "scope": 3816, "src": "1506:14:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3811, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1506:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1505:16:20" }, "returnParameters": { "id": 3814, "nodeType": "ParameterList", "parameters": [], "src": "1531:0:20" }, "scope": 3881, "src": "1491:42:20", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" }, { "body": { "id": 3819, "nodeType": "Block", "src": "1624:2:20", "statements": [] }, "documentation": "@dev withdraw staked tokens", "id": 3820, "implemented": true, "kind": "function", "modifiers": [], "name": "withdrawStake", "nodeType": "FunctionDefinition", "parameters": { "id": 3817, "nodeType": "ParameterList", "parameters": [], "src": "1612:2:20" }, "returnParameters": { "id": 3818, "nodeType": "ParameterList", "parameters": [], "src": "1624:0:20" }, "scope": 3881, "src": "1590:36:20", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" }, { "body": { "id": 3825, "nodeType": "Block", "src": "1894:2:20", "statements": [] }, "documentation": "@dev calculates the holding of intrestToken by staking contract in terms of token value.\n@return It will return the token worth of intrest token that contract is holding.", "id": 3826, "implemented": true, "kind": "function", "modifiers": [], "name": "currentTokenWorth", "nodeType": "FunctionDefinition", "parameters": { "id": 3821, "nodeType": "ParameterList", "parameters": [], "src": "1859:2:20" }, "returnParameters": { "id": 3824, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3823, "name": "", "nodeType": "VariableDeclaration", "scope": 3826, "src": "1885:7:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3822, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1885:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1884:9:20" }, "scope": 3881, "src": "1833:63:20", "stateMutability": "view", "superFunction": null, "visibility": "external" }, { "body": { "id": 3835, "nodeType": "Block", "src": "2344:2:20", "statements": [] }, "documentation": "@dev calculates the tokenGain, intrestTokenGain and precisionLossToken\n@return Intrest gained on lending the tokens.\n@return Intrest gained on lending the tokens in terms of token rate.\n@return Token's precision loss due to decimal difference.", "id": 3836, "implemented": true, "kind": "function", "modifiers": [], "name": "currentUBIInterest", "nodeType": "FunctionDefinition", "parameters": { "id": 3827, "nodeType": "ParameterList", "parameters": [], "src": "2217:2:20" }, "returnParameters": { "id": 3834, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3829, "name": "", "nodeType": "VariableDeclaration", "scope": 3836, "src": "2280:7:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3828, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2280:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3831, "name": "", "nodeType": "VariableDeclaration", "scope": 3836, "src": "2301:7:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3830, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2301:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3833, "name": "", "nodeType": "VariableDeclaration", "scope": 3836, "src": "2322:7:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3832, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2322:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "2266:73:20" }, "scope": 3881, "src": "2190:156:20", "stateMutability": "view", "superFunction": null, "visibility": "external" }, { "body": { "id": 3849, "nodeType": "Block", "src": "2884:2:20", "statements": [] }, "documentation": "@dev collect gained interest by fundmanager\n@param recipient of intrestToken gains\n@return Intrest gained on lending the tokens.\n@return Intrest gained on lending the tokens in terms of token rate.\n@return Token's precision loss due to decimal difference.\n@return average intrest donation ratio.", "id": 3850, "implemented": true, "kind": "function", "modifiers": [], "name": "collectUBIInterest", "nodeType": "FunctionDefinition", "parameters": { "id": 3839, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3838, "name": "recipient", "nodeType": "VariableDeclaration", "scope": 3850, "src": "2734:17:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3837, "name": "address", "nodeType": "ElementaryTypeName", "src": "2734:7:20", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2733:19:20" }, "returnParameters": { "id": 3848, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3841, "name": "", "nodeType": "VariableDeclaration", "scope": 3850, "src": "2800:7:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3840, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2800:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 3843, "name": "", "nodeType": "VariableDeclaration", "scope": 3850, "src": "2821:7:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3842, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2821:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" },