diff --git a/.gitignore b/.gitignore index 8692cf66d..582a9ca0c 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +/src/built-contracts diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..a9c3bdd9d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,14 @@ +{ + "cSpell.words": [ + "Unstake", + "bignumber", + "borderless", + "browserslist", + "defi", + "identicon", + "noopener", + "noreferrer", + "stakers", + "unstaking" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 000000000..e9bdb2df9 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ + +# DeFi Demo + +DApp developed using the following tech stacks: + +- React.js (CRA) +- Smart Contracts (Solidity) +- Truffle +- Ganache +- Web3.js +- Automated Tests using Mocha and Chai + + +## Quick setup and running + +- Install node in the local (Node version is v12.18.3 and if possible, use the same version for compatibility). +- Download Ganache from https://www.trufflesuite.com/ganache and install it in the local. +- Run Ganache in the local. + +``` bash +$ npm install --g truffle@5.1.39 # If possible, use the same version for compatibility + +$ npm install # Or yarn install +$ npm run truffle-compile # Compile smart contracts +$ npm run truffle-migrate # (Or npm run truffle-migrate-reset) Deploy the compiled smart contracts +$ npm run truffle-test # Run the automated tests to make sure of the behaviors of the smart contracts +$ npm start # Run the UI website + +$ npm run truffle-issue-dapp-tokens # Issue Dapp tokens to the stakers +``` diff --git a/migrations/1_initial_migration.js b/migrations/1_initial_migration.js index ee2135d29..173dc4be5 100644 --- a/migrations/1_initial_migration.js +++ b/migrations/1_initial_migration.js @@ -1,4 +1,5 @@ -const Migrations = artifacts.require("Migrations"); + +const Migrations = artifacts.require('Migrations'); module.exports = function(deployer) { deployer.deploy(Migrations); diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index 6c294db82..4cd9fcb59 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -1,23 +1,24 @@ -const DappToken = artifacts.require('DappToken') -const DaiToken = artifacts.require('DaiToken') -const TokenFarm = artifacts.require('TokenFarm') + +const DappToken = artifacts.require('DappToken'); +const DaiToken = artifacts.require('DaiToken'); +const TokenFarm = artifacts.require('TokenFarm'); module.exports = async function(deployer, network, accounts) { // Deploy Mock DAI Token - await deployer.deploy(DaiToken) - const daiToken = await DaiToken.deployed() + await deployer.deploy(DaiToken); + const daiToken = await DaiToken.deployed(); // Deploy Dapp Token - await deployer.deploy(DappToken) - const dappToken = await DappToken.deployed() + await deployer.deploy(DappToken); + const dappToken = await DappToken.deployed(); // Deploy TokenFarm - await deployer.deploy(TokenFarm, dappToken.address, daiToken.address) - const tokenFarm = await TokenFarm.deployed() + await deployer.deploy(TokenFarm, dappToken.address, daiToken.address); + const tokenFarm = await TokenFarm.deployed(); // Transfer all tokens to TokenFarm (1 million) - await dappToken.transfer(tokenFarm.address, '1000000000000000000000000') + await dappToken.transfer(tokenFarm.address, '1000000000000000000000000'); - // Transfer 100 Mock DAI tokens to investor - await daiToken.transfer(accounts[1], '100000000000000000000') -} + // Transfer 100 Mock DAI tokens to investor (assume that accounts[0] => owner, accounts => investor) + await daiToken.transfer(accounts[1], '100000000000000000000'); +}; diff --git a/package.json b/package.json index a03085e95..d508b81d0 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,10 @@ "version": "0.1.0", "description": "DeFi Token Staking App", "author": "gregory@dappuniversity.com", + "contributors": [ + "gregory@dappuniversity.com", + "Anton K. " + ], "dependencies": { "babel-polyfill": "6.26.0", "babel-preset-env": "1.7.0", @@ -26,7 +30,13 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "truffle-compile": "truffle compile", + "truffle-migrate": "truffle migrate", + "truffle-migrate-reset": "truffle migrate --reset", + "truffle-console": "truffle console", + "truffle-test": "truffle test", + "truffle-issue-dapp-tokens": "truffle exec scripts/issue-dapp-tokens.js" }, "eslintConfig": { "extends": "react-app" diff --git a/scripts/issue-dapp-tokens.js b/scripts/issue-dapp-tokens.js new file mode 100644 index 000000000..a44d5d820 --- /dev/null +++ b/scripts/issue-dapp-tokens.js @@ -0,0 +1,10 @@ + +const TokenFarm = artifacts.require('TokenFarm'); + +module.exports = async function(callback) { + const tokenFarm = await TokenFarm.deployed(); + await tokenFarm.issueDappTokens(); + // Code goes here... + console.log('Tokens issued!'); + callback(); +}; diff --git a/scripts/issue-token.js b/scripts/issue-token.js deleted file mode 100644 index 9addf8906..000000000 --- a/scripts/issue-token.js +++ /dev/null @@ -1,9 +0,0 @@ -const TokenFarm = artifacts.require('TokenFarm') - -module.exports = async function(callback) { - let tokenFarm = await TokenFarm.deployed() - await tokenFarm.issueTokens() - // Code goes here... - console.log("Tokens issued!") - callback() -} diff --git a/src/abis/DaiToken.json b/src/abis/DaiToken.json deleted file mode 100644 index cb6abd3a2..000000000 --- a/src/abis/DaiToken.json +++ /dev/null @@ -1,4978 +0,0 @@ -{ - "contractName": "DaiToken", - "abi": [ - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ], - "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/gregory/code/defi_tutorial/src/contracts/DaiToken.sol\":\"DaiToken\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/gregory/code/defi_tutorial/src/contracts/DaiToken.sol\":{\"keccak256\":\"0xb1705dd761dc6ad152de0cee7c9aeecf3f03193ca314cdd08906efa1829cf6a0\",\"urls\":[\"bzz-raw://8750066fb987b8f721edebf3824a68869d209a36d2606ec99e38c34870557ce2\",\"dweb:/ipfs/QmefYSoK6EnM3m1LKo7vjCeZxrnSV7n89wjQGuCDfhdzHV\"]}},\"version\":1}", - "bytecode": "0x60806040526040518060400160405280600e81526020017f4d6f636b2044414920546f6b656e0000000000000000000000000000000000008152506000908051906020019061004f92919061011e565b506040518060400160405280600481526020017f6d444149000000000000000000000000000000000000000000000000000000008152506001908051906020019061009b92919061011e565b5069d3c21bcecceda10000006002556012600360006101000a81548160ff021916908360ff1602179055503480156100d257600080fd5b50600254600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506101c3565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061015f57805160ff191683800117855561018d565b8280016001018555821561018d579182015b8281111561018c578251825591602001919060010190610171565b5b50905061019a919061019e565b5090565b6101c091905b808211156101bc5760008160009055506001016101a4565b5090565b90565b610a7d806101d26000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461022557806370a082311461024957806395d89b41146102a1578063a9059cbb14610324578063dd62ed3e1461038a57610093565b806306fdde0314610098578063095ea7b31461011b57806318160ddd1461018157806323b872dd1461019f575b600080fd5b6100a0610402565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100e05780820151818401526020810190506100c5565b50505050905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101676004803603604081101561013157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104a0565b604051808215151515815260200191505060405180910390f35b610189610592565b6040518082815260200191505060405180910390f35b61020b600480360360608110156101b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610598565b604051808215151515815260200191505060405180910390f35b61022d610803565b604051808260ff1660ff16815260200191505060405180910390f35b61028b6004803603602081101561025f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610816565b6040518082815260200191505060405180910390f35b6102a961082e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102e95780820151818401526020810190506102ce565b50505050905090810190601f1680156103165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103706004803603604081101561033a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108cc565b604051808215151515815260200191505060405180910390f35b6103ec600480360360408110156103a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a23565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104985780601f1061046d57610100808354040283529160200191610498565b820191906000526020600020905b81548152906001019060200180831161047b57829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156105e657600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561066f57600080fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60046020528060005260406000206000915090505481565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108c45780601f10610899576101008083540402835291602001916108c4565b820191906000526020600020905b8154815290600101906020018083116108a757829003601f168201915b505050505081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561091a57600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600560205281600052604060002060205280600052604060002060009150915050548156fea265627a7a72315820f02eb38dd50f8073a0ca479d11e6a283a4823cd1de25a5d81dbf6622886183d864736f6c63430005100032", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461022557806370a082311461024957806395d89b41146102a1578063a9059cbb14610324578063dd62ed3e1461038a57610093565b806306fdde0314610098578063095ea7b31461011b57806318160ddd1461018157806323b872dd1461019f575b600080fd5b6100a0610402565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100e05780820151818401526020810190506100c5565b50505050905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101676004803603604081101561013157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104a0565b604051808215151515815260200191505060405180910390f35b610189610592565b6040518082815260200191505060405180910390f35b61020b600480360360608110156101b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610598565b604051808215151515815260200191505060405180910390f35b61022d610803565b604051808260ff1660ff16815260200191505060405180910390f35b61028b6004803603602081101561025f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610816565b6040518082815260200191505060405180910390f35b6102a961082e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102e95780820151818401526020810190506102ce565b50505050905090810190601f1680156103165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103706004803603604081101561033a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108cc565b604051808215151515815260200191505060405180910390f35b6103ec600480360360408110156103a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a23565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104985780601f1061046d57610100808354040283529160200191610498565b820191906000526020600020905b81548152906001019060200180831161047b57829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156105e657600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561066f57600080fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60046020528060005260406000206000915090505481565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108c45780601f10610899576101008083540402835291602001916108c4565b820191906000526020600020905b8154815290600101906020018083116108a757829003601f168201915b505050505081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561091a57600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600560205281600052604060002060205280600052604060002060009150915050548156fea265627a7a72315820f02eb38dd50f8073a0ca479d11e6a283a4823cd1de25a5d81dbf6622886183d864736f6c63430005100032", - "sourceMap": "25:1538:0:-;;;49:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;93:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;158:25;129:54;;235:2;209:28;;;;;;;;;;;;;;;;;;;;593:73;8:9:-1;5:2;;;30:1;27;20:12;5:2;593:73:0;648:11;;624:9;:21;634:10;624:21;;;;;;;;;;;;;;;:35;;;;25:1538;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", - "deployedSourceMap": "25:1538:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:1538:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:38;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;49:38:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;956:212;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;956:212:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;129:54;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1174:387;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1174:387:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;209:28;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;472:44;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;472:44:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;93:30;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;93:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;672:278;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;672:278:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;522:64;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;522:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;49:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;956:212::-;1023:12;1081:6;1047:9;:21;1057:10;1047:21;;;;;;;;;;;;;;;:31;1069:8;1047:31;;;;;;;;;;;;;;;:40;;;;1123:8;1102:38;;1111:10;1102:38;;;1133:6;1102:38;;;;;;;;;;;;;;;;;;1157:4;1150:11;;956:212;;;;:::o;129:54::-;;;;:::o;1174:387::-;1256:12;1298:9;:16;1308:5;1298:16;;;;;;;;;;;;;;;;1288:6;:26;;1280:35;;;;;;1343:9;:16;1353:5;1343:16;;;;;;;;;;;;;;;:28;1360:10;1343:28;;;;;;;;;;;;;;;;1333:6;:38;;1325:47;;;;;;1402:6;1382:9;:16;1392:5;1382:16;;;;;;;;;;;;;;;;:26;;;;;;;;;;;1436:6;1418:9;:14;1428:3;1418:14;;;;;;;;;;;;;;;;:24;;;;;;;;;;;1484:6;1452:9;:16;1462:5;1452:16;;;;;;;;;;;;;;;:28;1469:10;1452:28;;;;;;;;;;;;;;;;:38;;;;;;;;;;;1521:3;1505:28;;1514:5;1505:28;;;1526:6;1505:28;;;;;;;;;;;;;;;;;;1550:4;1543:11;;1174:387;;;;;:::o;209:28::-;;;;;;;;;;;;;:::o;472:44::-;;;;;;;;;;;;;;;;;:::o;93:30::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;672:278::-;735:12;792:6;767:9;:21;777:10;767:21;;;;;;;;;;;;;;;;:31;;759:40;;;;;;834:6;809:9;:21;819:10;809:21;;;;;;;;;;;;;;;;:31;;;;;;;;;;;868:6;850:9;:14;860:3;850:14;;;;;;;;;;;;;;;;:24;;;;;;;;;;;910:3;889:33;;898:10;889:33;;;915:6;889:33;;;;;;;;;;;;;;;;;;939:4;932:11;;672:278;;;;:::o;522:64::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", - "source": "pragma solidity ^0.5.0;\n\ncontract DaiToken {\n string public name = \"Mock DAI Token\";\n string public symbol = \"mDAI\";\n uint256 public totalSupply = 1000000000000000000000000; // 1 million tokens\n uint8 public decimals = 18;\n\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _value\n );\n\n event Approval(\n address indexed _owner,\n address indexed _spender,\n uint256 _value\n );\n\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n\n constructor() public {\n balanceOf[msg.sender] = totalSupply;\n }\n\n function transfer(address _to, uint256 _value) public returns (bool success) {\n require(balanceOf[msg.sender] >= _value);\n balanceOf[msg.sender] -= _value;\n balanceOf[_to] += _value;\n emit Transfer(msg.sender, _to, _value);\n return true;\n }\n\n function approve(address _spender, uint256 _value) public returns (bool success) {\n allowance[msg.sender][_spender] = _value;\n emit Approval(msg.sender, _spender, _value);\n return true;\n }\n\n function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {\n require(_value <= balanceOf[_from]);\n require(_value <= allowance[_from][msg.sender]);\n balanceOf[_from] -= _value;\n balanceOf[_to] += _value;\n allowance[_from][msg.sender] -= _value;\n emit Transfer(_from, _to, _value);\n return true;\n }\n}\n", - "sourcePath": "/Users/gregory/code/defi_tutorial/src/contracts/DaiToken.sol", - "ast": { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/DaiToken.sol", - "exportedSymbols": { - "DaiToken": [ - 180 - ] - }, - "id": 181, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 1, - "literals": [ - "solidity", - "^", - "0.5", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:23:0" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 180, - "linearizedBaseContracts": [ - 180 - ], - "name": "DaiToken", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 4, - "name": "name", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "49:38:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" - }, - "typeName": { - "id": 2, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "49:6:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "4d6f636b2044414920546f6b656e", - "id": 3, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "71:16:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_6d90cba715b117e04c08ba13ca94303f9268ad96badda30ff2a17247cb20acd4", - "typeString": "literal_string \"Mock DAI Token\"" - }, - "value": "Mock DAI Token" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 7, - "name": "symbol", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "93:30:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" - }, - "typeName": { - "id": 5, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "93:6:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "6d444149", - "id": 6, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "117:6:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_3f44f13c76ec4ee5ad23a417aa883a0b3b0a77b84cc11766945e27bcce3e8b39", - "typeString": "literal_string \"mDAI\"" - }, - "value": "mDAI" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 10, - "name": "totalSupply", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "129:54:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 8, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "129:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "31303030303030303030303030303030303030303030303030", - "id": 9, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "158:25:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1000000000000000000000000_by_1", - "typeString": "int_const 1000000000000000000000000" - }, - "value": "1000000000000000000000000" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 13, - "name": "decimals", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "209:28:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" - }, - "typeName": { - "id": 11, - "name": "uint8", - "nodeType": "ElementaryTypeName", - "src": "209:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "3138", - "id": 12, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "235:2:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_18_by_1", - "typeString": "int_const 18" - }, - "value": "18" - }, - "visibility": "public" - }, - { - "anonymous": false, - "documentation": null, - "id": 21, - "name": "Transfer", - "nodeType": "EventDefinition", - "parameters": { - "id": 20, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 15, - "indexed": true, - "name": "_from", - "nodeType": "VariableDeclaration", - "scope": 21, - "src": "268:21:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 14, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "268:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 17, - "indexed": true, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 21, - "src": "299:19:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 16, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "299:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 19, - "indexed": false, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 21, - "src": "328:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 18, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "328:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "258:90:0" - }, - "src": "244:105:0" - }, - { - "anonymous": false, - "documentation": null, - "id": 29, - "name": "Approval", - "nodeType": "EventDefinition", - "parameters": { - "id": 28, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 23, - "indexed": true, - "name": "_owner", - "nodeType": "VariableDeclaration", - "scope": 29, - "src": "379:22:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 22, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "379:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 25, - "indexed": true, - "name": "_spender", - "nodeType": "VariableDeclaration", - "scope": 29, - "src": "411:24:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 24, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "411:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 27, - "indexed": false, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 29, - "src": "445:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 26, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "445:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "369:96:0" - }, - "src": "355:111:0" - }, - { - "constant": false, - "id": 33, - "name": "balanceOf", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "472:44:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "typeName": { - "id": 32, - "keyType": { - "id": 30, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "480:7:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "472:27:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "valueType": { - "id": 31, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "491:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 39, - "name": "allowance", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "522:64:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - }, - "typeName": { - "id": 38, - "keyType": { - "id": 34, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "530:7:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "522:47:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - }, - "valueType": { - "id": 37, - "keyType": { - "id": 35, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "549:7:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "541:27:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "valueType": { - "id": 36, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "560:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 49, - "nodeType": "Block", - "src": "614:52:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 47, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 42, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "624:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 45, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 43, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "634:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 44, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "634:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "624:21:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 46, - "name": "totalSupply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 10, - "src": "648:11:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "624:35:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 48, - "nodeType": "ExpressionStatement", - "src": "624:35:0" - } - ] - }, - "documentation": null, - "id": 50, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 40, - "nodeType": "ParameterList", - "parameters": [], - "src": "604:2:0" - }, - "returnParameters": { - "id": 41, - "nodeType": "ParameterList", - "parameters": [], - "src": "614:0:0" - }, - "scope": 180, - "src": "593:73:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 90, - "nodeType": "Block", - "src": "749:201:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 65, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 60, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "767:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 63, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 61, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "777:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 62, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "777:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "767:21:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">=", - "rightExpression": { - "argumentTypes": null, - "id": 64, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 54, - "src": "792:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "767:31:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 59, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 599, - 600 - ], - "referencedDeclaration": 599, - "src": "759:7:0", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 66, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "759:40:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 67, - "nodeType": "ExpressionStatement", - "src": "759:40:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 73, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 68, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "809:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 71, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 69, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "819:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 70, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "819:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "809:21:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 72, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 54, - "src": "834:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "809:31:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 74, - "nodeType": "ExpressionStatement", - "src": "809:31:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 79, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 75, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "850:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 77, - "indexExpression": { - "argumentTypes": null, - "id": 76, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 52, - "src": "860:3:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "850:14:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "+=", - "rightHandSide": { - "argumentTypes": null, - "id": 78, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 54, - "src": "868:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "850:24:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 80, - "nodeType": "ExpressionStatement", - "src": "850:24:0" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 82, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "898:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 83, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "898:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "id": 84, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 52, - "src": "910:3:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 85, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 54, - "src": "915:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 81, - "name": "Transfer", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 21, - "src": "889:8:0", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 86, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "889:33:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 87, - "nodeType": "EmitStatement", - "src": "884:38:0" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 88, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "939:4:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 58, - "id": 89, - "nodeType": "Return", - "src": "932:11:0" - } - ] - }, - "documentation": null, - "id": 91, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "transfer", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 55, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 52, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 91, - "src": "690:11:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 51, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "690:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 54, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 91, - "src": "703:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 53, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "703:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "689:29:0" - }, - "returnParameters": { - "id": 58, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 57, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 91, - "src": "735:12:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 56, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "735:4:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "734:14:0" - }, - "scope": 180, - "src": "672:278:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 118, - "nodeType": "Block", - "src": "1037:131:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 107, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 100, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 39, - "src": "1047:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 104, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 101, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "1057:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 102, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1057:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1047:21:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 105, - "indexExpression": { - "argumentTypes": null, - "id": 103, - "name": "_spender", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 93, - "src": "1069:8:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1047:31:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 106, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 95, - "src": "1081:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1047:40:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 108, - "nodeType": "ExpressionStatement", - "src": "1047:40:0" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 110, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "1111:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 111, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1111:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "id": 112, - "name": "_spender", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 93, - "src": "1123:8:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 113, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 95, - "src": "1133:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 109, - "name": "Approval", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 29, - "src": "1102:8:0", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 114, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1102:38:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 115, - "nodeType": "EmitStatement", - "src": "1097:43:0" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 116, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1157:4:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 99, - "id": 117, - "nodeType": "Return", - "src": "1150:11:0" - } - ] - }, - "documentation": null, - "id": 119, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "approve", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 96, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 93, - "name": "_spender", - "nodeType": "VariableDeclaration", - "scope": 119, - "src": "973:16:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 92, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "973:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 95, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 119, - "src": "991:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 94, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "991:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "972:34:0" - }, - "returnParameters": { - "id": 99, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 98, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 119, - "src": "1023:12:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 97, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1023:4:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1022:14:0" - }, - "scope": 180, - "src": "956:212:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 178, - "nodeType": "Block", - "src": "1270:291:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 135, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 131, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1288:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<=", - "rightExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 132, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "1298:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 134, - "indexExpression": { - "argumentTypes": null, - "id": 133, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "1308:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1298:16:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1288:26:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 130, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 599, - 600 - ], - "referencedDeclaration": 599, - "src": "1280:7:0", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 136, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1280:35:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 137, - "nodeType": "ExpressionStatement", - "src": "1280:35:0" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 146, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 139, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1333:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<=", - "rightExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 140, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 39, - "src": "1343:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 142, - "indexExpression": { - "argumentTypes": null, - "id": 141, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "1353:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1343:16:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 145, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 143, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "1360:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 144, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1360:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1343:28:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1333:38:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 138, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 599, - 600 - ], - "referencedDeclaration": 599, - "src": "1325:7:0", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 147, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1325:47:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 148, - "nodeType": "ExpressionStatement", - "src": "1325:47:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 153, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 149, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "1382:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 151, - "indexExpression": { - "argumentTypes": null, - "id": 150, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "1392:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1382:16:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 152, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1402:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1382:26:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 154, - "nodeType": "ExpressionStatement", - "src": "1382:26:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 159, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 155, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "1418:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 157, - "indexExpression": { - "argumentTypes": null, - "id": 156, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 123, - "src": "1428:3:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1418:14:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "+=", - "rightHandSide": { - "argumentTypes": null, - "id": 158, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1436:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1418:24:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 160, - "nodeType": "ExpressionStatement", - "src": "1418:24:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 168, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 161, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 39, - "src": "1452:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 165, - "indexExpression": { - "argumentTypes": null, - "id": 162, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "1462:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1452:16:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 166, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 163, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "1469:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 164, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1469:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1452:28:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 167, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1484:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1452:38:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 169, - "nodeType": "ExpressionStatement", - "src": "1452:38:0" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 171, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "1514:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 172, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 123, - "src": "1521:3:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 173, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1526:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 170, - "name": "Transfer", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 21, - "src": "1505:8:0", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 174, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1505:28:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 175, - "nodeType": "EmitStatement", - "src": "1500:33:0" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 176, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1550:4:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 129, - "id": 177, - "nodeType": "Return", - "src": "1543:11:0" - } - ] - }, - "documentation": null, - "id": 179, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "transferFrom", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 126, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 121, - "name": "_from", - "nodeType": "VariableDeclaration", - "scope": 179, - "src": "1196:13:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 120, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1196:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 123, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 179, - "src": "1211:11:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 122, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1211:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 125, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 179, - "src": "1224:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 124, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "1224:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1195:44:0" - }, - "returnParameters": { - "id": 129, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 128, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 179, - "src": "1256:12:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 127, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1256:4:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1255:14:0" - }, - "scope": 180, - "src": "1174:387:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 181, - "src": "25:1538:0" - } - ], - "src": "0:1564:0" - }, - "legacyAST": { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/DaiToken.sol", - "exportedSymbols": { - "DaiToken": [ - 180 - ] - }, - "id": 181, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 1, - "literals": [ - "solidity", - "^", - "0.5", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:23:0" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 180, - "linearizedBaseContracts": [ - 180 - ], - "name": "DaiToken", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 4, - "name": "name", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "49:38:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" - }, - "typeName": { - "id": 2, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "49:6:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "4d6f636b2044414920546f6b656e", - "id": 3, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "71:16:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_6d90cba715b117e04c08ba13ca94303f9268ad96badda30ff2a17247cb20acd4", - "typeString": "literal_string \"Mock DAI Token\"" - }, - "value": "Mock DAI Token" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 7, - "name": "symbol", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "93:30:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" - }, - "typeName": { - "id": 5, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "93:6:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "6d444149", - "id": 6, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "117:6:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_3f44f13c76ec4ee5ad23a417aa883a0b3b0a77b84cc11766945e27bcce3e8b39", - "typeString": "literal_string \"mDAI\"" - }, - "value": "mDAI" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 10, - "name": "totalSupply", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "129:54:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 8, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "129:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "31303030303030303030303030303030303030303030303030", - "id": 9, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "158:25:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1000000000000000000000000_by_1", - "typeString": "int_const 1000000000000000000000000" - }, - "value": "1000000000000000000000000" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 13, - "name": "decimals", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "209:28:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" - }, - "typeName": { - "id": 11, - "name": "uint8", - "nodeType": "ElementaryTypeName", - "src": "209:5:0", - "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "3138", - "id": 12, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "235:2:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_18_by_1", - "typeString": "int_const 18" - }, - "value": "18" - }, - "visibility": "public" - }, - { - "anonymous": false, - "documentation": null, - "id": 21, - "name": "Transfer", - "nodeType": "EventDefinition", - "parameters": { - "id": 20, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 15, - "indexed": true, - "name": "_from", - "nodeType": "VariableDeclaration", - "scope": 21, - "src": "268:21:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 14, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "268:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 17, - "indexed": true, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 21, - "src": "299:19:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 16, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "299:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 19, - "indexed": false, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 21, - "src": "328:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 18, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "328:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "258:90:0" - }, - "src": "244:105:0" - }, - { - "anonymous": false, - "documentation": null, - "id": 29, - "name": "Approval", - "nodeType": "EventDefinition", - "parameters": { - "id": 28, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 23, - "indexed": true, - "name": "_owner", - "nodeType": "VariableDeclaration", - "scope": 29, - "src": "379:22:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 22, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "379:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 25, - "indexed": true, - "name": "_spender", - "nodeType": "VariableDeclaration", - "scope": 29, - "src": "411:24:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 24, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "411:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 27, - "indexed": false, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 29, - "src": "445:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 26, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "445:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "369:96:0" - }, - "src": "355:111:0" - }, - { - "constant": false, - "id": 33, - "name": "balanceOf", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "472:44:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "typeName": { - "id": 32, - "keyType": { - "id": 30, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "480:7:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "472:27:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "valueType": { - "id": 31, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "491:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 39, - "name": "allowance", - "nodeType": "VariableDeclaration", - "scope": 180, - "src": "522:64:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - }, - "typeName": { - "id": 38, - "keyType": { - "id": 34, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "530:7:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "522:47:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - }, - "valueType": { - "id": 37, - "keyType": { - "id": 35, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "549:7:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "541:27:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "valueType": { - "id": 36, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "560:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 49, - "nodeType": "Block", - "src": "614:52:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 47, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 42, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "624:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 45, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 43, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "634:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 44, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "634:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "624:21:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 46, - "name": "totalSupply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 10, - "src": "648:11:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "624:35:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 48, - "nodeType": "ExpressionStatement", - "src": "624:35:0" - } - ] - }, - "documentation": null, - "id": 50, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 40, - "nodeType": "ParameterList", - "parameters": [], - "src": "604:2:0" - }, - "returnParameters": { - "id": 41, - "nodeType": "ParameterList", - "parameters": [], - "src": "614:0:0" - }, - "scope": 180, - "src": "593:73:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 90, - "nodeType": "Block", - "src": "749:201:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 65, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 60, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "767:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 63, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 61, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "777:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 62, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "777:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "767:21:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">=", - "rightExpression": { - "argumentTypes": null, - "id": 64, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 54, - "src": "792:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "767:31:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 59, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 599, - 600 - ], - "referencedDeclaration": 599, - "src": "759:7:0", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 66, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "759:40:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 67, - "nodeType": "ExpressionStatement", - "src": "759:40:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 73, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 68, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "809:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 71, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 69, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "819:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 70, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "819:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "809:21:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 72, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 54, - "src": "834:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "809:31:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 74, - "nodeType": "ExpressionStatement", - "src": "809:31:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 79, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 75, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "850:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 77, - "indexExpression": { - "argumentTypes": null, - "id": 76, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 52, - "src": "860:3:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "850:14:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "+=", - "rightHandSide": { - "argumentTypes": null, - "id": 78, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 54, - "src": "868:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "850:24:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 80, - "nodeType": "ExpressionStatement", - "src": "850:24:0" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 82, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "898:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 83, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "898:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "id": 84, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 52, - "src": "910:3:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 85, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 54, - "src": "915:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 81, - "name": "Transfer", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 21, - "src": "889:8:0", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 86, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "889:33:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 87, - "nodeType": "EmitStatement", - "src": "884:38:0" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 88, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "939:4:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 58, - "id": 89, - "nodeType": "Return", - "src": "932:11:0" - } - ] - }, - "documentation": null, - "id": 91, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "transfer", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 55, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 52, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 91, - "src": "690:11:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 51, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "690:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 54, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 91, - "src": "703:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 53, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "703:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "689:29:0" - }, - "returnParameters": { - "id": 58, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 57, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 91, - "src": "735:12:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 56, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "735:4:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "734:14:0" - }, - "scope": 180, - "src": "672:278:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 118, - "nodeType": "Block", - "src": "1037:131:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 107, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 100, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 39, - "src": "1047:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 104, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 101, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "1057:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 102, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1057:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1047:21:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 105, - "indexExpression": { - "argumentTypes": null, - "id": 103, - "name": "_spender", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 93, - "src": "1069:8:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1047:31:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 106, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 95, - "src": "1081:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1047:40:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 108, - "nodeType": "ExpressionStatement", - "src": "1047:40:0" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 110, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "1111:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 111, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1111:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "id": 112, - "name": "_spender", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 93, - "src": "1123:8:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 113, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 95, - "src": "1133:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 109, - "name": "Approval", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 29, - "src": "1102:8:0", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 114, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1102:38:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 115, - "nodeType": "EmitStatement", - "src": "1097:43:0" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 116, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1157:4:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 99, - "id": 117, - "nodeType": "Return", - "src": "1150:11:0" - } - ] - }, - "documentation": null, - "id": 119, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "approve", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 96, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 93, - "name": "_spender", - "nodeType": "VariableDeclaration", - "scope": 119, - "src": "973:16:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 92, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "973:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 95, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 119, - "src": "991:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 94, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "991:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "972:34:0" - }, - "returnParameters": { - "id": 99, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 98, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 119, - "src": "1023:12:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 97, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1023:4:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1022:14:0" - }, - "scope": 180, - "src": "956:212:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 178, - "nodeType": "Block", - "src": "1270:291:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 135, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 131, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1288:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<=", - "rightExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 132, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "1298:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 134, - "indexExpression": { - "argumentTypes": null, - "id": 133, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "1308:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1298:16:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1288:26:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 130, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 599, - 600 - ], - "referencedDeclaration": 599, - "src": "1280:7:0", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 136, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1280:35:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 137, - "nodeType": "ExpressionStatement", - "src": "1280:35:0" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 146, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 139, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1333:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<=", - "rightExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 140, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 39, - "src": "1343:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 142, - "indexExpression": { - "argumentTypes": null, - "id": 141, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "1353:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1343:16:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 145, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 143, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "1360:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 144, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1360:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1343:28:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1333:38:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 138, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 599, - 600 - ], - "referencedDeclaration": 599, - "src": "1325:7:0", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 147, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1325:47:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 148, - "nodeType": "ExpressionStatement", - "src": "1325:47:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 153, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 149, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "1382:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 151, - "indexExpression": { - "argumentTypes": null, - "id": 150, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "1392:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1382:16:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 152, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1402:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1382:26:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 154, - "nodeType": "ExpressionStatement", - "src": "1382:26:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 159, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 155, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 33, - "src": "1418:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 157, - "indexExpression": { - "argumentTypes": null, - "id": 156, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 123, - "src": "1428:3:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1418:14:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "+=", - "rightHandSide": { - "argumentTypes": null, - "id": 158, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1436:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1418:24:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 160, - "nodeType": "ExpressionStatement", - "src": "1418:24:0" - }, - { - "expression": { - "argumentTypes": null, - "id": 168, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 161, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 39, - "src": "1452:9:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 165, - "indexExpression": { - "argumentTypes": null, - "id": 162, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "1462:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1452:16:0", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 166, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 163, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 596, - "src": "1469:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 164, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1469:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1452:28:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 167, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1484:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1452:38:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 169, - "nodeType": "ExpressionStatement", - "src": "1452:38:0" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 171, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "1514:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 172, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 123, - "src": "1521:3:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 173, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 125, - "src": "1526:6:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 170, - "name": "Transfer", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 21, - "src": "1505:8:0", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 174, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1505:28:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 175, - "nodeType": "EmitStatement", - "src": "1500:33:0" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 176, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1550:4:0", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 129, - "id": 177, - "nodeType": "Return", - "src": "1543:11:0" - } - ] - }, - "documentation": null, - "id": 179, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "transferFrom", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 126, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 121, - "name": "_from", - "nodeType": "VariableDeclaration", - "scope": 179, - "src": "1196:13:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 120, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1196:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 123, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 179, - "src": "1211:11:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 122, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1211:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 125, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 179, - "src": "1224:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 124, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "1224:7:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1195:44:0" - }, - "returnParameters": { - "id": 129, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 128, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 179, - "src": "1256:12:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 127, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1256:4:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1255:14:0" - }, - "scope": 180, - "src": "1174:387:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 181, - "src": "25:1538:0" - } - ], - "src": "0:1564:0" - }, - "compiler": { - "name": "solc", - "version": "0.5.16+commit.9c3226ce.Emscripten.clang" - }, - "networks": { - "5777": { - "events": { - "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - } - }, - "links": {}, - "address": "0x771c1F161FA839CB9c7684E2885446Ba563f9aec", - "transactionHash": "0x91f2c91190469ec42f148e2a8782bbdf77632167e87799709651e3c637c4c670" - } - }, - "schemaVersion": "3.2.3", - "updatedAt": "2020-08-18T20:08:17.483Z", - "networkType": "ethereum", - "devdoc": { - "methods": {} - }, - "userdoc": { - "methods": {} - } -} \ No newline at end of file diff --git a/src/abis/DappToken.json b/src/abis/DappToken.json deleted file mode 100644 index 863ada070..000000000 --- a/src/abis/DappToken.json +++ /dev/null @@ -1,4978 +0,0 @@ -{ - "contractName": "DappToken", - "abi": [ - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ], - "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/gregory/code/defi_tutorial/src/contracts/DappToken.sol\":\"DappToken\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/gregory/code/defi_tutorial/src/contracts/DappToken.sol\":{\"keccak256\":\"0x72dff62b13b1a6be4bcc10002df5dbaf9a7f84a54eabfcc9216b74327bd1c104\",\"urls\":[\"bzz-raw://3f60a240518bea8ad0e8b19ddc2d6638b8969edb528e48ac28f42a452d1fe214\",\"dweb:/ipfs/Qmc3qhuJ6v4sHHAvwBZPTJPLLpdPARDMig93awj3JtLZtE\"]}},\"version\":1}", - "bytecode": "0x60806040526040518060400160405280600a81526020017f4441707020546f6b656e000000000000000000000000000000000000000000008152506000908051906020019061004f92919061011e565b506040518060400160405280600481526020017f44415050000000000000000000000000000000000000000000000000000000008152506001908051906020019061009b92919061011e565b5069d3c21bcecceda10000006002556012600360006101000a81548160ff021916908360ff1602179055503480156100d257600080fd5b50600254600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506101c3565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061015f57805160ff191683800117855561018d565b8280016001018555821561018d579182015b8281111561018c578251825591602001919060010190610171565b5b50905061019a919061019e565b5090565b6101c091905b808211156101bc5760008160009055506001016101a4565b5090565b90565b610a7d806101d26000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461022557806370a082311461024957806395d89b41146102a1578063a9059cbb14610324578063dd62ed3e1461038a57610093565b806306fdde0314610098578063095ea7b31461011b57806318160ddd1461018157806323b872dd1461019f575b600080fd5b6100a0610402565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100e05780820151818401526020810190506100c5565b50505050905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101676004803603604081101561013157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104a0565b604051808215151515815260200191505060405180910390f35b610189610592565b6040518082815260200191505060405180910390f35b61020b600480360360608110156101b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610598565b604051808215151515815260200191505060405180910390f35b61022d610803565b604051808260ff1660ff16815260200191505060405180910390f35b61028b6004803603602081101561025f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610816565b6040518082815260200191505060405180910390f35b6102a961082e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102e95780820151818401526020810190506102ce565b50505050905090810190601f1680156103165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103706004803603604081101561033a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108cc565b604051808215151515815260200191505060405180910390f35b6103ec600480360360408110156103a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a23565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104985780601f1061046d57610100808354040283529160200191610498565b820191906000526020600020905b81548152906001019060200180831161047b57829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156105e657600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561066f57600080fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60046020528060005260406000206000915090505481565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108c45780601f10610899576101008083540402835291602001916108c4565b820191906000526020600020905b8154815290600101906020018083116108a757829003601f168201915b505050505081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561091a57600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600560205281600052604060002060205280600052604060002060009150915050548156fea265627a7a72315820efbea20edb53e1d6d1375785e2df77d9968d6b695eae7e6c2906880a09d809ca64736f6c63430005100032", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461022557806370a082311461024957806395d89b41146102a1578063a9059cbb14610324578063dd62ed3e1461038a57610093565b806306fdde0314610098578063095ea7b31461011b57806318160ddd1461018157806323b872dd1461019f575b600080fd5b6100a0610402565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100e05780820151818401526020810190506100c5565b50505050905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101676004803603604081101561013157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104a0565b604051808215151515815260200191505060405180910390f35b610189610592565b6040518082815260200191505060405180910390f35b61020b600480360360608110156101b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610598565b604051808215151515815260200191505060405180910390f35b61022d610803565b604051808260ff1660ff16815260200191505060405180910390f35b61028b6004803603602081101561025f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610816565b6040518082815260200191505060405180910390f35b6102a961082e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102e95780820151818401526020810190506102ce565b50505050905090810190601f1680156103165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103706004803603604081101561033a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108cc565b604051808215151515815260200191505060405180910390f35b6103ec600480360360408110156103a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a23565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104985780601f1061046d57610100808354040283529160200191610498565b820191906000526020600020905b81548152906001019060200180831161047b57829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156105e657600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561066f57600080fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60046020528060005260406000206000915090505481565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108c45780601f10610899576101008083540402835291602001916108c4565b820191906000526020600020905b8154815290600101906020018083116108a757829003601f168201915b505050505081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561091a57600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600560205281600052604060002060205280600052604060002060009150915050548156fea265627a7a72315820efbea20edb53e1d6d1375785e2df77d9968d6b695eae7e6c2906880a09d809ca64736f6c63430005100032", - "sourceMap": "25:1535:1:-;;;50:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;90:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;155:25;126:54;;232:2;206:28;;;;;;;;;;;;;;;;;;;;590:73;8:9:-1;5:2;;;30:1;27;20:12;5:2;590:73:1;645:11;;621:9;:21;631:10;621:21;;;;;;;;;;;;;;;:35;;;;25:1535;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", - "deployedSourceMap": "25:1535:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:1535:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;50:34;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;50:34:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;953:212;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;953:212:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;126:54;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1171:387;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1171:387:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;206:28;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;469:44;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;469:44:1;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;90:30;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;90:30:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;669:278;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;669:278:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;519:64;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;519:64:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;50:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;953:212::-;1020:12;1078:6;1044:9;:21;1054:10;1044:21;;;;;;;;;;;;;;;:31;1066:8;1044:31;;;;;;;;;;;;;;;:40;;;;1120:8;1099:38;;1108:10;1099:38;;;1130:6;1099:38;;;;;;;;;;;;;;;;;;1154:4;1147:11;;953:212;;;;:::o;126:54::-;;;;:::o;1171:387::-;1253:12;1295:9;:16;1305:5;1295:16;;;;;;;;;;;;;;;;1285:6;:26;;1277:35;;;;;;1340:9;:16;1350:5;1340:16;;;;;;;;;;;;;;;:28;1357:10;1340:28;;;;;;;;;;;;;;;;1330:6;:38;;1322:47;;;;;;1399:6;1379:9;:16;1389:5;1379:16;;;;;;;;;;;;;;;;:26;;;;;;;;;;;1433:6;1415:9;:14;1425:3;1415:14;;;;;;;;;;;;;;;;:24;;;;;;;;;;;1481:6;1449:9;:16;1459:5;1449:16;;;;;;;;;;;;;;;:28;1466:10;1449:28;;;;;;;;;;;;;;;;:38;;;;;;;;;;;1518:3;1502:28;;1511:5;1502:28;;;1523:6;1502:28;;;;;;;;;;;;;;;;;;1547:4;1540:11;;1171:387;;;;;:::o;206:28::-;;;;;;;;;;;;;:::o;469:44::-;;;;;;;;;;;;;;;;;:::o;90:30::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;669:278::-;732:12;789:6;764:9;:21;774:10;764:21;;;;;;;;;;;;;;;;:31;;756:40;;;;;;831:6;806:9;:21;816:10;806:21;;;;;;;;;;;;;;;;:31;;;;;;;;;;;865:6;847:9;:14;857:3;847:14;;;;;;;;;;;;;;;;:24;;;;;;;;;;;907:3;886:33;;895:10;886:33;;;912:6;886:33;;;;;;;;;;;;;;;;;;936:4;929:11;;669:278;;;;:::o;519:64::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", - "source": "pragma solidity ^0.5.0;\n\ncontract DappToken {\n string public name = \"DApp Token\";\n string public symbol = \"DAPP\";\n uint256 public totalSupply = 1000000000000000000000000; // 1 million tokens\n uint8 public decimals = 18;\n\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _value\n );\n\n event Approval(\n address indexed _owner,\n address indexed _spender,\n uint256 _value\n );\n\n mapping(address => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) public allowance;\n\n constructor() public {\n balanceOf[msg.sender] = totalSupply;\n }\n\n function transfer(address _to, uint256 _value) public returns (bool success) {\n require(balanceOf[msg.sender] >= _value);\n balanceOf[msg.sender] -= _value;\n balanceOf[_to] += _value;\n emit Transfer(msg.sender, _to, _value);\n return true;\n }\n\n function approve(address _spender, uint256 _value) public returns (bool success) {\n allowance[msg.sender][_spender] = _value;\n emit Approval(msg.sender, _spender, _value);\n return true;\n }\n\n function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {\n require(_value <= balanceOf[_from]);\n require(_value <= allowance[_from][msg.sender]);\n balanceOf[_from] -= _value;\n balanceOf[_to] += _value;\n allowance[_from][msg.sender] -= _value;\n emit Transfer(_from, _to, _value);\n return true;\n }\n}\n", - "sourcePath": "/Users/gregory/code/defi_tutorial/src/contracts/DappToken.sol", - "ast": { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/DappToken.sol", - "exportedSymbols": { - "DappToken": [ - 361 - ] - }, - "id": 362, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 182, - "literals": [ - "solidity", - "^", - "0.5", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:23:1" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 361, - "linearizedBaseContracts": [ - 361 - ], - "name": "DappToken", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 185, - "name": "name", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "50:34:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" - }, - "typeName": { - "id": 183, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "50:6:1", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "4441707020546f6b656e", - "id": 184, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "72:12:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_4bb1c77e58fe7915ae82d4848a9c7f3a9bd772743e283b0e9e22385825f37dce", - "typeString": "literal_string \"DApp Token\"" - }, - "value": "DApp Token" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 188, - "name": "symbol", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "90:30:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" - }, - "typeName": { - "id": 186, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "90:6:1", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "44415050", - "id": 187, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "114:6:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_2f0440134a0794b969e8c19364bb3c2fbe91c99bfae2a18a4a19e46c2cead377", - "typeString": "literal_string \"DAPP\"" - }, - "value": "DAPP" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 191, - "name": "totalSupply", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "126:54:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 189, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "126:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "31303030303030303030303030303030303030303030303030", - "id": 190, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "155:25:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1000000000000000000000000_by_1", - "typeString": "int_const 1000000000000000000000000" - }, - "value": "1000000000000000000000000" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 194, - "name": "decimals", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "206:28:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" - }, - "typeName": { - "id": 192, - "name": "uint8", - "nodeType": "ElementaryTypeName", - "src": "206:5:1", - "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "3138", - "id": 193, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "232:2:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_18_by_1", - "typeString": "int_const 18" - }, - "value": "18" - }, - "visibility": "public" - }, - { - "anonymous": false, - "documentation": null, - "id": 202, - "name": "Transfer", - "nodeType": "EventDefinition", - "parameters": { - "id": 201, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 196, - "indexed": true, - "name": "_from", - "nodeType": "VariableDeclaration", - "scope": 202, - "src": "265:21:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 195, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "265:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 198, - "indexed": true, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 202, - "src": "296:19:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 197, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "296:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 200, - "indexed": false, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 202, - "src": "325:14:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 199, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "325:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "255:90:1" - }, - "src": "241:105:1" - }, - { - "anonymous": false, - "documentation": null, - "id": 210, - "name": "Approval", - "nodeType": "EventDefinition", - "parameters": { - "id": 209, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 204, - "indexed": true, - "name": "_owner", - "nodeType": "VariableDeclaration", - "scope": 210, - "src": "376:22:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 203, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "376:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 206, - "indexed": true, - "name": "_spender", - "nodeType": "VariableDeclaration", - "scope": 210, - "src": "408:24:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 205, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "408:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 208, - "indexed": false, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 210, - "src": "442:14:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 207, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "442:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "366:96:1" - }, - "src": "352:111:1" - }, - { - "constant": false, - "id": 214, - "name": "balanceOf", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "469:44:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "typeName": { - "id": 213, - "keyType": { - "id": 211, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "477:7:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "469:27:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "valueType": { - "id": 212, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "488:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 220, - "name": "allowance", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "519:64:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - }, - "typeName": { - "id": 219, - "keyType": { - "id": 215, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "527:7:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "519:47:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - }, - "valueType": { - "id": 218, - "keyType": { - "id": 216, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "546:7:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "538:27:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "valueType": { - "id": 217, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "557:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 230, - "nodeType": "Block", - "src": "611:52:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 228, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 223, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "621:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 226, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 224, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "631:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 225, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "631:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "621:21:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 227, - "name": "totalSupply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 191, - "src": "645:11:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "621:35:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 229, - "nodeType": "ExpressionStatement", - "src": "621:35:1" - } - ] - }, - "documentation": null, - "id": 231, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 221, - "nodeType": "ParameterList", - "parameters": [], - "src": "601:2:1" - }, - "returnParameters": { - "id": 222, - "nodeType": "ParameterList", - "parameters": [], - "src": "611:0:1" - }, - "scope": 361, - "src": "590:73:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 271, - "nodeType": "Block", - "src": "746:201:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 246, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 241, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "764:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 244, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 242, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "774:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 243, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "774:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "764:21:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">=", - "rightExpression": { - "argumentTypes": null, - "id": 245, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 235, - "src": "789:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "764:31:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 240, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 464, - 465 - ], - "referencedDeclaration": 464, - "src": "756:7:1", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 247, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "756:40:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 248, - "nodeType": "ExpressionStatement", - "src": "756:40:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 254, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 249, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "806:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 252, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 250, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "816:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 251, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "816:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "806:21:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 253, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 235, - "src": "831:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "806:31:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 255, - "nodeType": "ExpressionStatement", - "src": "806:31:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 260, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 256, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "847:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 258, - "indexExpression": { - "argumentTypes": null, - "id": 257, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 233, - "src": "857:3:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "847:14:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "+=", - "rightHandSide": { - "argumentTypes": null, - "id": 259, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 235, - "src": "865:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "847:24:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 261, - "nodeType": "ExpressionStatement", - "src": "847:24:1" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 263, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "895:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 264, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "895:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "id": 265, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 233, - "src": "907:3:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 266, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 235, - "src": "912:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 262, - "name": "Transfer", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 202, - "src": "886:8:1", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 267, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "886:33:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 268, - "nodeType": "EmitStatement", - "src": "881:38:1" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 269, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "936:4:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 239, - "id": 270, - "nodeType": "Return", - "src": "929:11:1" - } - ] - }, - "documentation": null, - "id": 272, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "transfer", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 236, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 233, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 272, - "src": "687:11:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 232, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "687:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 235, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 272, - "src": "700:14:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 234, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "700:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "686:29:1" - }, - "returnParameters": { - "id": 239, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 238, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 272, - "src": "732:12:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 237, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "732:4:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "731:14:1" - }, - "scope": 361, - "src": "669:278:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 299, - "nodeType": "Block", - "src": "1034:131:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 288, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 281, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 220, - "src": "1044:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 285, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 282, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "1054:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 283, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1054:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1044:21:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 286, - "indexExpression": { - "argumentTypes": null, - "id": 284, - "name": "_spender", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 274, - "src": "1066:8:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1044:31:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 287, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 276, - "src": "1078:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1044:40:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 289, - "nodeType": "ExpressionStatement", - "src": "1044:40:1" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 291, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "1108:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 292, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1108:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "id": 293, - "name": "_spender", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 274, - "src": "1120:8:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 294, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 276, - "src": "1130:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 290, - "name": "Approval", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 210, - "src": "1099:8:1", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 295, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1099:38:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 296, - "nodeType": "EmitStatement", - "src": "1094:43:1" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 297, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1154:4:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 280, - "id": 298, - "nodeType": "Return", - "src": "1147:11:1" - } - ] - }, - "documentation": null, - "id": 300, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "approve", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 277, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 274, - "name": "_spender", - "nodeType": "VariableDeclaration", - "scope": 300, - "src": "970:16:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 273, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "970:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 276, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 300, - "src": "988:14:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 275, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "988:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "969:34:1" - }, - "returnParameters": { - "id": 280, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 279, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 300, - "src": "1020:12:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 278, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1020:4:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1019:14:1" - }, - "scope": 361, - "src": "953:212:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 359, - "nodeType": "Block", - "src": "1267:291:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 316, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 312, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1285:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<=", - "rightExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 313, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "1295:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 315, - "indexExpression": { - "argumentTypes": null, - "id": 314, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "1305:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1295:16:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1285:26:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 311, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 464, - 465 - ], - "referencedDeclaration": 464, - "src": "1277:7:1", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 317, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1277:35:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 318, - "nodeType": "ExpressionStatement", - "src": "1277:35:1" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 327, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 320, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1330:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<=", - "rightExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 321, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 220, - "src": "1340:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 323, - "indexExpression": { - "argumentTypes": null, - "id": 322, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "1350:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1340:16:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 326, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 324, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "1357:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 325, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1357:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1340:28:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1330:38:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 319, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 464, - 465 - ], - "referencedDeclaration": 464, - "src": "1322:7:1", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 328, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1322:47:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 329, - "nodeType": "ExpressionStatement", - "src": "1322:47:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 334, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 330, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "1379:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 332, - "indexExpression": { - "argumentTypes": null, - "id": 331, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "1389:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1379:16:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 333, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1399:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1379:26:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 335, - "nodeType": "ExpressionStatement", - "src": "1379:26:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 340, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 336, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "1415:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 338, - "indexExpression": { - "argumentTypes": null, - "id": 337, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "1425:3:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1415:14:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "+=", - "rightHandSide": { - "argumentTypes": null, - "id": 339, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1433:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1415:24:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 341, - "nodeType": "ExpressionStatement", - "src": "1415:24:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 349, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 342, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 220, - "src": "1449:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 346, - "indexExpression": { - "argumentTypes": null, - "id": 343, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "1459:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1449:16:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 347, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 344, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "1466:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 345, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1466:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1449:28:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 348, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1481:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1449:38:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 350, - "nodeType": "ExpressionStatement", - "src": "1449:38:1" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 352, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "1511:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 353, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "1518:3:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 354, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1523:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 351, - "name": "Transfer", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 202, - "src": "1502:8:1", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 355, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1502:28:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 356, - "nodeType": "EmitStatement", - "src": "1497:33:1" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 357, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1547:4:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 310, - "id": 358, - "nodeType": "Return", - "src": "1540:11:1" - } - ] - }, - "documentation": null, - "id": 360, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "transferFrom", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 307, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 302, - "name": "_from", - "nodeType": "VariableDeclaration", - "scope": 360, - "src": "1193:13:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 301, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1193:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 304, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 360, - "src": "1208:11:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 303, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1208:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 306, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 360, - "src": "1221:14:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 305, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "1221:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1192:44:1" - }, - "returnParameters": { - "id": 310, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 309, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 360, - "src": "1253:12:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 308, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1253:4:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1252:14:1" - }, - "scope": 361, - "src": "1171:387:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 362, - "src": "25:1535:1" - } - ], - "src": "0:1561:1" - }, - "legacyAST": { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/DappToken.sol", - "exportedSymbols": { - "DappToken": [ - 361 - ] - }, - "id": 362, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 182, - "literals": [ - "solidity", - "^", - "0.5", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:23:1" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 361, - "linearizedBaseContracts": [ - 361 - ], - "name": "DappToken", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 185, - "name": "name", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "50:34:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" - }, - "typeName": { - "id": 183, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "50:6:1", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "4441707020546f6b656e", - "id": 184, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "72:12:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_4bb1c77e58fe7915ae82d4848a9c7f3a9bd772743e283b0e9e22385825f37dce", - "typeString": "literal_string \"DApp Token\"" - }, - "value": "DApp Token" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 188, - "name": "symbol", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "90:30:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" - }, - "typeName": { - "id": 186, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "90:6:1", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "44415050", - "id": 187, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "114:6:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_2f0440134a0794b969e8c19364bb3c2fbe91c99bfae2a18a4a19e46c2cead377", - "typeString": "literal_string \"DAPP\"" - }, - "value": "DAPP" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 191, - "name": "totalSupply", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "126:54:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 189, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "126:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "31303030303030303030303030303030303030303030303030", - "id": 190, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "155:25:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1000000000000000000000000_by_1", - "typeString": "int_const 1000000000000000000000000" - }, - "value": "1000000000000000000000000" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 194, - "name": "decimals", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "206:28:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" - }, - "typeName": { - "id": 192, - "name": "uint8", - "nodeType": "ElementaryTypeName", - "src": "206:5:1", - "typeDescriptions": { - "typeIdentifier": "t_uint8", - "typeString": "uint8" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "3138", - "id": 193, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "232:2:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_18_by_1", - "typeString": "int_const 18" - }, - "value": "18" - }, - "visibility": "public" - }, - { - "anonymous": false, - "documentation": null, - "id": 202, - "name": "Transfer", - "nodeType": "EventDefinition", - "parameters": { - "id": 201, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 196, - "indexed": true, - "name": "_from", - "nodeType": "VariableDeclaration", - "scope": 202, - "src": "265:21:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 195, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "265:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 198, - "indexed": true, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 202, - "src": "296:19:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 197, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "296:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 200, - "indexed": false, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 202, - "src": "325:14:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 199, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "325:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "255:90:1" - }, - "src": "241:105:1" - }, - { - "anonymous": false, - "documentation": null, - "id": 210, - "name": "Approval", - "nodeType": "EventDefinition", - "parameters": { - "id": 209, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 204, - "indexed": true, - "name": "_owner", - "nodeType": "VariableDeclaration", - "scope": 210, - "src": "376:22:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 203, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "376:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 206, - "indexed": true, - "name": "_spender", - "nodeType": "VariableDeclaration", - "scope": 210, - "src": "408:24:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 205, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "408:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 208, - "indexed": false, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 210, - "src": "442:14:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 207, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "442:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "366:96:1" - }, - "src": "352:111:1" - }, - { - "constant": false, - "id": 214, - "name": "balanceOf", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "469:44:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "typeName": { - "id": 213, - "keyType": { - "id": 211, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "477:7:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "469:27:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "valueType": { - "id": 212, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "488:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 220, - "name": "allowance", - "nodeType": "VariableDeclaration", - "scope": 361, - "src": "519:64:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - }, - "typeName": { - "id": 219, - "keyType": { - "id": 215, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "527:7:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "519:47:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - }, - "valueType": { - "id": 218, - "keyType": { - "id": 216, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "546:7:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "538:27:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "valueType": { - "id": 217, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "557:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 230, - "nodeType": "Block", - "src": "611:52:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 228, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 223, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "621:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 226, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 224, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "631:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 225, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "631:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "621:21:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 227, - "name": "totalSupply", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 191, - "src": "645:11:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "621:35:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 229, - "nodeType": "ExpressionStatement", - "src": "621:35:1" - } - ] - }, - "documentation": null, - "id": 231, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 221, - "nodeType": "ParameterList", - "parameters": [], - "src": "601:2:1" - }, - "returnParameters": { - "id": 222, - "nodeType": "ParameterList", - "parameters": [], - "src": "611:0:1" - }, - "scope": 361, - "src": "590:73:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 271, - "nodeType": "Block", - "src": "746:201:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 246, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 241, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "764:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 244, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 242, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "774:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 243, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "774:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "764:21:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">=", - "rightExpression": { - "argumentTypes": null, - "id": 245, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 235, - "src": "789:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "764:31:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 240, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 464, - 465 - ], - "referencedDeclaration": 464, - "src": "756:7:1", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 247, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "756:40:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 248, - "nodeType": "ExpressionStatement", - "src": "756:40:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 254, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 249, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "806:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 252, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 250, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "816:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 251, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "816:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "806:21:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 253, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 235, - "src": "831:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "806:31:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 255, - "nodeType": "ExpressionStatement", - "src": "806:31:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 260, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 256, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "847:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 258, - "indexExpression": { - "argumentTypes": null, - "id": 257, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 233, - "src": "857:3:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "847:14:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "+=", - "rightHandSide": { - "argumentTypes": null, - "id": 259, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 235, - "src": "865:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "847:24:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 261, - "nodeType": "ExpressionStatement", - "src": "847:24:1" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 263, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "895:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 264, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "895:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "id": 265, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 233, - "src": "907:3:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 266, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 235, - "src": "912:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 262, - "name": "Transfer", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 202, - "src": "886:8:1", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 267, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "886:33:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 268, - "nodeType": "EmitStatement", - "src": "881:38:1" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 269, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "936:4:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 239, - "id": 270, - "nodeType": "Return", - "src": "929:11:1" - } - ] - }, - "documentation": null, - "id": 272, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "transfer", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 236, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 233, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 272, - "src": "687:11:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 232, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "687:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 235, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 272, - "src": "700:14:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 234, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "700:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "686:29:1" - }, - "returnParameters": { - "id": 239, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 238, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 272, - "src": "732:12:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 237, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "732:4:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "731:14:1" - }, - "scope": 361, - "src": "669:278:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 299, - "nodeType": "Block", - "src": "1034:131:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 288, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 281, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 220, - "src": "1044:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 285, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 282, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "1054:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 283, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1054:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1044:21:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 286, - "indexExpression": { - "argumentTypes": null, - "id": 284, - "name": "_spender", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 274, - "src": "1066:8:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1044:31:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 287, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 276, - "src": "1078:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1044:40:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 289, - "nodeType": "ExpressionStatement", - "src": "1044:40:1" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 291, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "1108:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 292, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1108:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "id": 293, - "name": "_spender", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 274, - "src": "1120:8:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 294, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 276, - "src": "1130:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 290, - "name": "Approval", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 210, - "src": "1099:8:1", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 295, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1099:38:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 296, - "nodeType": "EmitStatement", - "src": "1094:43:1" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 297, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1154:4:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 280, - "id": 298, - "nodeType": "Return", - "src": "1147:11:1" - } - ] - }, - "documentation": null, - "id": 300, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "approve", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 277, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 274, - "name": "_spender", - "nodeType": "VariableDeclaration", - "scope": 300, - "src": "970:16:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 273, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "970:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 276, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 300, - "src": "988:14:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 275, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "988:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "969:34:1" - }, - "returnParameters": { - "id": 280, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 279, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 300, - "src": "1020:12:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 278, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1020:4:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1019:14:1" - }, - "scope": 361, - "src": "953:212:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 359, - "nodeType": "Block", - "src": "1267:291:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 316, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 312, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1285:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<=", - "rightExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 313, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "1295:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 315, - "indexExpression": { - "argumentTypes": null, - "id": 314, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "1305:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1295:16:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1285:26:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 311, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 464, - 465 - ], - "referencedDeclaration": 464, - "src": "1277:7:1", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 317, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1277:35:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 318, - "nodeType": "ExpressionStatement", - "src": "1277:35:1" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 327, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 320, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1330:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<=", - "rightExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 321, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 220, - "src": "1340:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 323, - "indexExpression": { - "argumentTypes": null, - "id": 322, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "1350:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1340:16:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 326, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 324, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "1357:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 325, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1357:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1340:28:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1330:38:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 319, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 464, - 465 - ], - "referencedDeclaration": 464, - "src": "1322:7:1", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 328, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1322:47:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 329, - "nodeType": "ExpressionStatement", - "src": "1322:47:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 334, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 330, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "1379:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 332, - "indexExpression": { - "argumentTypes": null, - "id": 331, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "1389:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1379:16:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 333, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1399:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1379:26:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 335, - "nodeType": "ExpressionStatement", - "src": "1379:26:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 340, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 336, - "name": "balanceOf", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 214, - "src": "1415:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 338, - "indexExpression": { - "argumentTypes": null, - "id": 337, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "1425:3:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1415:14:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "+=", - "rightHandSide": { - "argumentTypes": null, - "id": 339, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1433:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1415:24:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 341, - "nodeType": "ExpressionStatement", - "src": "1415:24:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 349, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 342, - "name": "allowance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 220, - "src": "1449:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_address_$_t_uint256_$_$", - "typeString": "mapping(address => mapping(address => uint256))" - } - }, - "id": 346, - "indexExpression": { - "argumentTypes": null, - "id": 343, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "1459:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1449:16:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 347, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 344, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 461, - "src": "1466:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 345, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1466:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1449:28:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "-=", - "rightHandSide": { - "argumentTypes": null, - "id": 348, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1481:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1449:38:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 350, - "nodeType": "ExpressionStatement", - "src": "1449:38:1" - }, - { - "eventCall": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 352, - "name": "_from", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 302, - "src": "1511:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 353, - "name": "_to", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 304, - "src": "1518:3:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 354, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 306, - "src": "1523:6:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 351, - "name": "Transfer", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 202, - "src": "1502:8:1", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", - "typeString": "function (address,address,uint256)" - } - }, - "id": 355, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1502:28:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 356, - "nodeType": "EmitStatement", - "src": "1497:33:1" - }, - { - "expression": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 357, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1547:4:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "functionReturnParameters": 310, - "id": 358, - "nodeType": "Return", - "src": "1540:11:1" - } - ] - }, - "documentation": null, - "id": 360, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "transferFrom", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 307, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 302, - "name": "_from", - "nodeType": "VariableDeclaration", - "scope": 360, - "src": "1193:13:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 301, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1193:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 304, - "name": "_to", - "nodeType": "VariableDeclaration", - "scope": 360, - "src": "1208:11:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 303, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1208:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 306, - "name": "_value", - "nodeType": "VariableDeclaration", - "scope": 360, - "src": "1221:14:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 305, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "1221:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1192:44:1" - }, - "returnParameters": { - "id": 310, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 309, - "name": "success", - "nodeType": "VariableDeclaration", - "scope": 360, - "src": "1253:12:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 308, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1253:4:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "1252:14:1" - }, - "scope": 361, - "src": "1171:387:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 362, - "src": "25:1535:1" - } - ], - "src": "0:1561:1" - }, - "compiler": { - "name": "solc", - "version": "0.5.16+commit.9c3226ce.Emscripten.clang" - }, - "networks": { - "5777": { - "events": { - "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - } - }, - "links": {}, - "address": "0xC47d5A20615319629d13B8486d1BB02B450b07ff", - "transactionHash": "0x3ce2b197007ea11d209c123c30ed2d041883be5468b53bb46ace141bafee4d76" - } - }, - "schemaVersion": "3.2.3", - "updatedAt": "2020-08-18T20:08:17.479Z", - "networkType": "ethereum", - "devdoc": { - "methods": {} - }, - "userdoc": { - "methods": {} - } -} \ No newline at end of file diff --git a/src/abis/Migrations.json b/src/abis/Migrations.json deleted file mode 100644 index 09e6c0f15..000000000 --- a/src/abis/Migrations.json +++ /dev/null @@ -1,1397 +0,0 @@ -{ - "contractName": "Migrations", - "abi": [ - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "constant": true, - "inputs": [], - "name": "last_completed_migration", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "completed", - "type": "uint256" - } - ], - "name": "setCompleted", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "new_address", - "type": "address" - } - ], - "name": "upgrade", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ], - "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"constant\":true,\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"new_address\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/gregory/code/defi_tutorial/src/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/gregory/code/defi_tutorial/src/contracts/Migrations.sol\":{\"keccak256\":\"0xfdb731592344e2a2890faf03baec7b4bee7057ffba18ba6dbb6eec8db85f8f4c\",\"urls\":[\"bzz-raw://f9b488bbb84816dd04c1b155e943319758db16ee943943648fb264bccecc9879\",\"dweb:/ipfs/QmbW34mYrj3uLteyHf3S46pnp9bnwovtCXHbdBHfzMkSZx\"]}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102b7806100606000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea265627a7a72315820c46be0c3c07eaa3e907f1557f7161dae5b9d38ef67f4c3f2adc1a2df7489fe4664736f6c63430005100032", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea265627a7a72315820c46be0c3c07eaa3e907f1557f7161dae5b9d38ef67f4c3f2adc1a2df7489fe4664736f6c63430005100032", - "sourceMap": "34:480:2:-;;;123:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;123:50:2;158:10;150:5;;:18;;;;;;;;;;;;;;;;;;34:480;;;;;;", - "deployedSourceMap": "34:480:2:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;34:480:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;347:165:2;;;;;;;;;;;;;;;;;;;:::i;:::-;;82:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;58:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;240:103;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;240:103:2;;;;;;;;;;;;;;;;;:::i;:::-;;347:165;223:5;;;;;;;;;;;209:19;;:10;:19;;;205:26;;;409:19;442:11;409:45;;460:8;:21;;;482:24;;460:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;460:47:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;460:47:2;;;;230:1;205:26;347:165;:::o;82:36::-;;;;:::o;58:20::-;;;;;;;;;;;;;:::o;240:103::-;223:5;;;;;;;;;;;209:19;;:10;:19;;;205:26;;;329:9;302:24;:36;;;;205:26;240:103;:::o", - "source": "pragma solidity >=0.4.21 <0.6.0;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n constructor() public {\n owner = msg.sender;\n }\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", - "sourcePath": "/Users/gregory/code/defi_tutorial/src/contracts/Migrations.sol", - "ast": { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/Migrations.sol", - "exportedSymbols": { - "Migrations": [ - 418 - ] - }, - "id": 419, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 363, - "literals": [ - "solidity", - ">=", - "0.4", - ".21", - "<", - "0.6", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:32:2" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 418, - "linearizedBaseContracts": [ - 418 - ], - "name": "Migrations", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 365, - "name": "owner", - "nodeType": "VariableDeclaration", - "scope": 418, - "src": "58:20:2", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 364, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "58:7:2", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 367, - "name": "last_completed_migration", - "nodeType": "VariableDeclaration", - "scope": 418, - "src": "82:36:2", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 366, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "82:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 375, - "nodeType": "Block", - "src": "144:29:2", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 373, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 370, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 365, - "src": "150:5:2", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 371, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 439, - "src": "158:3:2", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 372, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "158:10:2", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "src": "150:18:2", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 374, - "nodeType": "ExpressionStatement", - "src": "150:18:2" - } - ] - }, - "documentation": null, - "id": 376, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 368, - "nodeType": "ParameterList", - "parameters": [], - "src": "134:2:2" - }, - "returnParameters": { - "id": 369, - "nodeType": "ParameterList", - "parameters": [], - "src": "144:0:2" - }, - "scope": 418, - "src": "123:50:2", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 384, - "nodeType": "Block", - "src": "199:37:2", - "statements": [ - { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 381, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 378, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 439, - "src": "209:3:2", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 379, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "209:10:2", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "argumentTypes": null, - "id": 380, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 365, - "src": "223:5:2", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "209:19:2", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 383, - "nodeType": "IfStatement", - "src": "205:26:2", - "trueBody": { - "id": 382, - "nodeType": "PlaceholderStatement", - "src": "230:1:2" - } - } - ] - }, - "documentation": null, - "id": 385, - "name": "restricted", - "nodeType": "ModifierDefinition", - "parameters": { - "id": 377, - "nodeType": "ParameterList", - "parameters": [], - "src": "196:2:2" - }, - "src": "177:59:2", - "visibility": "internal" - }, - { - "body": { - "id": 396, - "nodeType": "Block", - "src": "296:47:2", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 394, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 392, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 367, - "src": "302:24:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 393, - "name": "completed", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 387, - "src": "329:9:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "302:36:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 395, - "nodeType": "ExpressionStatement", - "src": "302:36:2" - } - ] - }, - "documentation": null, - "id": 397, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 390, - "modifierName": { - "argumentTypes": null, - "id": 389, - "name": "restricted", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 385, - "src": "285:10:2", - "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" - } - }, - "nodeType": "ModifierInvocation", - "src": "285:10:2" - } - ], - "name": "setCompleted", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 388, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 387, - "name": "completed", - "nodeType": "VariableDeclaration", - "scope": 397, - "src": "262:14:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 386, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "262:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "261:16:2" - }, - "returnParameters": { - "id": 391, - "nodeType": "ParameterList", - "parameters": [], - "src": "296:0:2" - }, - "scope": 418, - "src": "240:103:2", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 416, - "nodeType": "Block", - "src": "403:109:2", - "statements": [ - { - "assignments": [ - 405 - ], - "declarations": [ - { - "constant": false, - "id": 405, - "name": "upgraded", - "nodeType": "VariableDeclaration", - "scope": 416, - "src": "409:19:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$418", - "typeString": "contract Migrations" - }, - "typeName": { - "contractScope": null, - "id": 404, - "name": "Migrations", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 418, - "src": "409:10:2", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$418", - "typeString": "contract Migrations" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 409, - "initialValue": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 407, - "name": "new_address", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 399, - "src": "442:11:2", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "id": 406, - "name": "Migrations", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 418, - "src": "431:10:2", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Migrations_$418_$", - "typeString": "type(contract Migrations)" - } - }, - "id": 408, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "431:23:2", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$418", - "typeString": "contract Migrations" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "409:45:2" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 413, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 367, - "src": "482:24:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 410, - "name": "upgraded", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 405, - "src": "460:8:2", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$418", - "typeString": "contract Migrations" - } - }, - "id": 412, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "setCompleted", - "nodeType": "MemberAccess", - "referencedDeclaration": 397, - "src": "460:21:2", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", - "typeString": "function (uint256) external" - } - }, - "id": 414, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "460:47:2", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 415, - "nodeType": "ExpressionStatement", - "src": "460:47:2" - } - ] - }, - "documentation": null, - "id": 417, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 402, - "modifierName": { - "argumentTypes": null, - "id": 401, - "name": "restricted", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 385, - "src": "392:10:2", - "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" - } - }, - "nodeType": "ModifierInvocation", - "src": "392:10:2" - } - ], - "name": "upgrade", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 400, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 399, - "name": "new_address", - "nodeType": "VariableDeclaration", - "scope": 417, - "src": "364:19:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 398, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "364:7:2", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "363:21:2" - }, - "returnParameters": { - "id": 403, - "nodeType": "ParameterList", - "parameters": [], - "src": "403:0:2" - }, - "scope": 418, - "src": "347:165:2", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 419, - "src": "34:480:2" - } - ], - "src": "0:515:2" - }, - "legacyAST": { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/Migrations.sol", - "exportedSymbols": { - "Migrations": [ - 418 - ] - }, - "id": 419, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 363, - "literals": [ - "solidity", - ">=", - "0.4", - ".21", - "<", - "0.6", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:32:2" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 418, - "linearizedBaseContracts": [ - 418 - ], - "name": "Migrations", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 365, - "name": "owner", - "nodeType": "VariableDeclaration", - "scope": 418, - "src": "58:20:2", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 364, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "58:7:2", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 367, - "name": "last_completed_migration", - "nodeType": "VariableDeclaration", - "scope": 418, - "src": "82:36:2", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 366, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "82:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 375, - "nodeType": "Block", - "src": "144:29:2", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 373, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 370, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 365, - "src": "150:5:2", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 371, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 439, - "src": "158:3:2", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 372, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "158:10:2", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "src": "150:18:2", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 374, - "nodeType": "ExpressionStatement", - "src": "150:18:2" - } - ] - }, - "documentation": null, - "id": 376, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 368, - "nodeType": "ParameterList", - "parameters": [], - "src": "134:2:2" - }, - "returnParameters": { - "id": 369, - "nodeType": "ParameterList", - "parameters": [], - "src": "144:0:2" - }, - "scope": 418, - "src": "123:50:2", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 384, - "nodeType": "Block", - "src": "199:37:2", - "statements": [ - { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 381, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 378, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 439, - "src": "209:3:2", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 379, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "209:10:2", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "argumentTypes": null, - "id": 380, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 365, - "src": "223:5:2", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "209:19:2", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 383, - "nodeType": "IfStatement", - "src": "205:26:2", - "trueBody": { - "id": 382, - "nodeType": "PlaceholderStatement", - "src": "230:1:2" - } - } - ] - }, - "documentation": null, - "id": 385, - "name": "restricted", - "nodeType": "ModifierDefinition", - "parameters": { - "id": 377, - "nodeType": "ParameterList", - "parameters": [], - "src": "196:2:2" - }, - "src": "177:59:2", - "visibility": "internal" - }, - { - "body": { - "id": 396, - "nodeType": "Block", - "src": "296:47:2", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 394, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 392, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 367, - "src": "302:24:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 393, - "name": "completed", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 387, - "src": "329:9:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "302:36:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 395, - "nodeType": "ExpressionStatement", - "src": "302:36:2" - } - ] - }, - "documentation": null, - "id": 397, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 390, - "modifierName": { - "argumentTypes": null, - "id": 389, - "name": "restricted", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 385, - "src": "285:10:2", - "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" - } - }, - "nodeType": "ModifierInvocation", - "src": "285:10:2" - } - ], - "name": "setCompleted", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 388, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 387, - "name": "completed", - "nodeType": "VariableDeclaration", - "scope": 397, - "src": "262:14:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 386, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "262:4:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "261:16:2" - }, - "returnParameters": { - "id": 391, - "nodeType": "ParameterList", - "parameters": [], - "src": "296:0:2" - }, - "scope": 418, - "src": "240:103:2", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 416, - "nodeType": "Block", - "src": "403:109:2", - "statements": [ - { - "assignments": [ - 405 - ], - "declarations": [ - { - "constant": false, - "id": 405, - "name": "upgraded", - "nodeType": "VariableDeclaration", - "scope": 416, - "src": "409:19:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$418", - "typeString": "contract Migrations" - }, - "typeName": { - "contractScope": null, - "id": 404, - "name": "Migrations", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 418, - "src": "409:10:2", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$418", - "typeString": "contract Migrations" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 409, - "initialValue": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 407, - "name": "new_address", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 399, - "src": "442:11:2", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "id": 406, - "name": "Migrations", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 418, - "src": "431:10:2", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Migrations_$418_$", - "typeString": "type(contract Migrations)" - } - }, - "id": 408, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "431:23:2", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$418", - "typeString": "contract Migrations" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "409:45:2" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 413, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 367, - "src": "482:24:2", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 410, - "name": "upgraded", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 405, - "src": "460:8:2", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$418", - "typeString": "contract Migrations" - } - }, - "id": 412, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "setCompleted", - "nodeType": "MemberAccess", - "referencedDeclaration": 397, - "src": "460:21:2", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", - "typeString": "function (uint256) external" - } - }, - "id": 414, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "460:47:2", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 415, - "nodeType": "ExpressionStatement", - "src": "460:47:2" - } - ] - }, - "documentation": null, - "id": 417, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 402, - "modifierName": { - "argumentTypes": null, - "id": 401, - "name": "restricted", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 385, - "src": "392:10:2", - "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" - } - }, - "nodeType": "ModifierInvocation", - "src": "392:10:2" - } - ], - "name": "upgrade", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 400, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 399, - "name": "new_address", - "nodeType": "VariableDeclaration", - "scope": 417, - "src": "364:19:2", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 398, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "364:7:2", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "363:21:2" - }, - "returnParameters": { - "id": 403, - "nodeType": "ParameterList", - "parameters": [], - "src": "403:0:2" - }, - "scope": 418, - "src": "347:165:2", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 419, - "src": "34:480:2" - } - ], - "src": "0:515:2" - }, - "compiler": { - "name": "solc", - "version": "0.5.16+commit.9c3226ce.Emscripten.clang" - }, - "networks": { - "5777": { - "events": {}, - "links": {}, - "address": "0x237f74501d59e9d8E2D9725c187eCf69de89C2E4", - "transactionHash": "0xf4d4c484b28c131288e1e97c20e82a7cc83a941fce84a77424f27092362b29c8" - } - }, - "schemaVersion": "3.2.3", - "updatedAt": "2020-08-18T20:08:17.487Z", - "networkType": "ethereum", - "devdoc": { - "methods": {} - }, - "userdoc": { - "methods": {} - } -} \ No newline at end of file diff --git a/src/abis/TokenFarm.json b/src/abis/TokenFarm.json deleted file mode 100644 index e0c2cebde..000000000 --- a/src/abis/TokenFarm.json +++ /dev/null @@ -1,5463 +0,0 @@ -{ - "contractName": "TokenFarm", - "abi": [ - { - "inputs": [ - { - "internalType": "contract DappToken", - "name": "_dappToken", - "type": "address" - }, - { - "internalType": "contract DaiToken", - "name": "_daiToken", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "constant": true, - "inputs": [], - "name": "daiToken", - "outputs": [ - { - "internalType": "contract DaiToken", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "dappToken", - "outputs": [ - { - "internalType": "contract DappToken", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "hasStaked", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isStaking", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "stakers", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "stakingBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "stakeTokens", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "unstakeTokens", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "issueTokens", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ], - "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract DappToken\",\"name\":\"_dappToken\",\"type\":\"address\"},{\"internalType\":\"contract DaiToken\",\"name\":\"_daiToken\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"constant\":true,\"inputs\":[],\"name\":\"daiToken\",\"outputs\":[{\"internalType\":\"contract DaiToken\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"dappToken\",\"outputs\":[{\"internalType\":\"contract DappToken\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"hasStaked\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isStaking\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"issueTokens\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"stakeTokens\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"stakers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"stakingBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"unstakeTokens\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/gregory/code/defi_tutorial/src/contracts/TokenFarm.sol\":\"TokenFarm\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/gregory/code/defi_tutorial/src/contracts/DaiToken.sol\":{\"keccak256\":\"0xb1705dd761dc6ad152de0cee7c9aeecf3f03193ca314cdd08906efa1829cf6a0\",\"urls\":[\"bzz-raw://8750066fb987b8f721edebf3824a68869d209a36d2606ec99e38c34870557ce2\",\"dweb:/ipfs/QmefYSoK6EnM3m1LKo7vjCeZxrnSV7n89wjQGuCDfhdzHV\"]},\"/Users/gregory/code/defi_tutorial/src/contracts/DappToken.sol\":{\"keccak256\":\"0x72dff62b13b1a6be4bcc10002df5dbaf9a7f84a54eabfcc9216b74327bd1c104\",\"urls\":[\"bzz-raw://3f60a240518bea8ad0e8b19ddc2d6638b8969edb528e48ac28f42a452d1fe214\",\"dweb:/ipfs/Qmc3qhuJ6v4sHHAvwBZPTJPLLpdPARDMig93awj3JtLZtE\"]},\"/Users/gregory/code/defi_tutorial/src/contracts/TokenFarm.sol\":{\"keccak256\":\"0xbab2c1ac837ce0a03c74496e883d68836a48c689e8d17ec91f7f1bef6d89425b\",\"urls\":[\"bzz-raw://8a0a982f43243c0273d887927eb94a21b407a7fbe8a7f58c9e9b912d66babc47\",\"dweb:/ipfs/QmZghhaYPexr8CX68o78ypJ52wE7ejhKGzzBNTzwVZo4Qw\"]}},\"version\":1}", - "bytecode": "0x60806040526040518060400160405280600f81526020017f4461707020546f6b656e204661726d00000000000000000000000000000000008152506000908051906020019061004f929190610164565b5034801561005c57600080fd5b50604051610fd5380380610fd58339818101604052604081101561007f57600080fd5b81019080805190602001909291908051906020019092919050505081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050610209565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101a557805160ff19168380011785556101d3565b828001600101855582156101d3579182015b828111156101d25782518255916020019190600101906101b7565b5b5090506101e091906101e4565b5090565b61020691905b808211156102025760008160009055506001016101ea565b5090565b90565b610dbd806102186000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80637547c7a3116100715780637547c7a3146102395780638da5cb5b14610267578063a5ce413b146102b1578063be22f546146102bb578063c93c8f3414610305578063fd5e6dd114610361576100a9565b806306fdde03146100ae57806345bc78ab146101315780635eb186f81461018957806360ab5852146101d35780636f49712b146101dd575b600080fd5b6100b66103cf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101736004803603602081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061046d565b6040518082815260200191505060405180910390f35b610191610485565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101db6104ab565b005b61021f600480360360208110156101f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610702565b604051808215151515815260200191505060405180910390f35b6102656004803603602081101561024f57600080fd5b8101908080359060200190929190505050610722565b005b61026f610aa1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102b9610ac7565b005b6102c3610d06565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103476004803603602081101561031b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d2c565b604051808215151515815260200191505060405180910390f35b61038d6004803603602081101561037757600080fd5b8101908080359060200190929190505050610d4c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104655780601f1061043a57610100808354040283529160200191610465565b820191906000526020600020905b81548152906001019060200180831161044857829003601f168201915b505050505081565b60056020528060005260406000206000915090505481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461056e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f63616c6c6572206d75737420626520746865206f776e6572000000000000000081525060200191505060405180910390fd5b60008090505b6004805490508110156106ff5760006004828154811061059057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008111156106f057600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156106b357600080fd5b505af11580156106c7573d6000803e3d6000fd5b505050506040513d60208110156106dd57600080fd5b8101908080519060200190929190505050505b50508080600101915050610574565b50565b60076020528060005260406000206000915054906101000a900460ff1681565b60008111610798576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f616d6f756e742063616e6e6f742062652030000000000000000000000000000081525060200191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561087557600080fd5b505af1158015610889573d6000803e3d6000fd5b505050506040513d602081101561089f57600080fd5b81019080805190602001909291905050505080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166109ee5760043390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505b6001600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008111610b81576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f7374616b696e672062616c616e63652063616e6e6f742062652030000000000081525060200191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c2a57600080fd5b505af1158015610c3e573d6000803e3d6000fd5b505050506040513d6020811015610c5457600080fd5b8101908080519060200190929190505050506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60066020528060005260406000206000915054906101000a900460ff1681565b60048181548110610d5957fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea265627a7a72315820e98c92d87faab2ca5a1ee132ee70c35c0a1fb42c17c8bd851f23b83efe08698b64736f6c63430005100032", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80637547c7a3116100715780637547c7a3146102395780638da5cb5b14610267578063a5ce413b146102b1578063be22f546146102bb578063c93c8f3414610305578063fd5e6dd114610361576100a9565b806306fdde03146100ae57806345bc78ab146101315780635eb186f81461018957806360ab5852146101d35780636f49712b146101dd575b600080fd5b6100b66103cf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101736004803603602081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061046d565b6040518082815260200191505060405180910390f35b610191610485565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101db6104ab565b005b61021f600480360360208110156101f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610702565b604051808215151515815260200191505060405180910390f35b6102656004803603602081101561024f57600080fd5b8101908080359060200190929190505050610722565b005b61026f610aa1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102b9610ac7565b005b6102c3610d06565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103476004803603602081101561031b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d2c565b604051808215151515815260200191505060405180910390f35b61038d6004803603602081101561037757600080fd5b8101908080359060200190929190505050610d4c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104655780601f1061043a57610100808354040283529160200191610465565b820191906000526020600020905b81548152906001019060200180831161044857829003601f168201915b505050505081565b60056020528060005260406000206000915090505481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461056e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f63616c6c6572206d75737420626520746865206f776e6572000000000000000081525060200191505060405180910390fd5b60008090505b6004805490508110156106ff5760006004828154811061059057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008111156106f057600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156106b357600080fd5b505af11580156106c7573d6000803e3d6000fd5b505050506040513d60208110156106dd57600080fd5b8101908080519060200190929190505050505b50508080600101915050610574565b50565b60076020528060005260406000206000915054906101000a900460ff1681565b60008111610798576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f616d6f756e742063616e6e6f742062652030000000000000000000000000000081525060200191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561087557600080fd5b505af1158015610889573d6000803e3d6000fd5b505050506040513d602081101561089f57600080fd5b81019080805190602001909291905050505080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166109ee5760043390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505b6001600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008111610b81576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f7374616b696e672062616c616e63652063616e6e6f742062652030000000000081525060200191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c2a57600080fd5b505af1158015610c3e573d6000803e3d6000fd5b505050506040513d6020811015610c5457600080fd5b8101908080519060200190929190505050506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60066020528060005260406000206000915054906101000a900460ff1681565b60048181548110610d5957fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea265627a7a72315820e98c92d87faab2ca5a1ee132ee70c35c0a1fb42c17c8bd851f23b83efe08698b64736f6c63430005100032", - "sourceMap": "77:2157:3:-;;;102:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;412:158;8:9:-1;5:2;;;30:1;27;20:12;5:2;412:158:3;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;412:158:3;;;;;;;;;;;;;;;;;;;;;;;;;495:10;483:9;;:22;;;;;;;;;;;;;;;;;;526:9;515:8;;:20;;;;;;;;;;;;;;;;;;553:10;545:5;;:18;;;;;;;;;;;;;;;;;;412:158;;77:2157;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", - "deployedSourceMap": "77:2157:3:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;77:2157:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;102:38;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;102:38:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;265:46;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;265:46:3;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;172:26;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1788:444;;;:::i;:::-;;364:41;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;364:41:3;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;576:656;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;576:656:3;;;;;;;;;;;;;;;;;:::i;:::-;;146:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1273:487;;;:::i;:::-;;204:24;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;317:41;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;317:41:3;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;235:24;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;235:24:3;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;102:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;265:46::-;;;;;;;;;;;;;;;;;:::o;172:26::-;;;;;;;;;;;;;:::o;1788:444::-;1895:5;;;;;;;;;;;1881:19;;:10;:19;;;1873:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1984:6;1991:1;1984:8;;1979:247;1996:7;:14;;;;1994:1;:16;1979:247;;;2031:17;2051:7;2059:1;2051:10;;;;;;;;;;;;;;;;;;;;;;;;;2031:30;;2075:12;2090:14;:25;2105:9;2090:25;;;;;;;;;;;;;;;;2075:40;;2142:1;2132:7;:11;2129:87;;;2163:9;;;;;;;;;;;:18;;;2182:9;2193:7;2163:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2163:38:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2163:38:3;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2163:38:3;;;;;;;;;;;;;;;;;2129:87;1979:247;;2012:3;;;;;;;1979:247;;;;1788:444::o;364:41::-;;;;;;;;;;;;;;;;;;;;;;:::o;576:656::-;687:1;677:7;:11;669:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;787:8;;;;;;;;;;;:21;;;809:10;829:4;836:7;787:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;787:57:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;787:57:3;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;787:57:3;;;;;;;;;;;;;;;;;947:7;918:14;:26;933:10;918:26;;;;;;;;;;;;;;;;:36;889:14;:26;904:10;889:26;;;;;;;;;;;;;;;:65;;;;1044:9;:21;1054:10;1044:21;;;;;;;;;;;;;;;;;;;;;;;;;1040:76;;1081:7;1094:10;1081:24;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;1081:24:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1040:76;1183:4;1159:9;:21;1169:10;1159:21;;;;;;;;;;;;;;;;:28;;;;;;;;;;;;;;;;;;1221:4;1197:9;:21;1207:10;1197:21;;;;;;;;;;;;;;;;:28;;;;;;;;;;;;;;;;;;576:656;:::o;146:20::-;;;;;;;;;;;;;:::o;1273:487::-;1348:12;1363:14;:26;1378:10;1363:26;;;;;;;;;;;;;;;;1348:41;;1459:1;1449:7;:11;1441:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1568:8;;;;;;;;;;;:17;;;1586:10;1598:7;1568:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1568:38:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1568:38:3;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1568:38:3;;;;;;;;;;;;;;;;;1679:1;1650:14;:26;1665:10;1650:26;;;;;;;;;;;;;;;:30;;;;1748:5;1724:9;:21;1734:10;1724:21;;;;;;;;;;;;;;;;:29;;;;;;;;;;;;;;;;;;1273:487;:::o;204:24::-;;;;;;;;;;;;;:::o;317:41::-;;;;;;;;;;;;;;;;;;;;;;:::o;235:24::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", - "source": "pragma solidity ^0.5.0;\n\nimport \"./DappToken.sol\";\nimport \"./DaiToken.sol\";\n\ncontract TokenFarm {\n string public name = \"Dapp Token Farm\";\n address public owner;\n DappToken public dappToken;\n DaiToken public daiToken;\n\n address[] public stakers;\n mapping(address => uint) public stakingBalance;\n mapping(address => bool) public hasStaked;\n mapping(address => bool) public isStaking;\n\n constructor(DappToken _dappToken, DaiToken _daiToken) public {\n dappToken = _dappToken;\n daiToken = _daiToken;\n owner = msg.sender;\n }\n\n function stakeTokens(uint _amount) public {\n // Require amount greater than 0\n require(_amount > 0, \"amount cannot be 0\");\n\n // Trasnfer Mock Dai tokens to this contract for staking\n daiToken.transferFrom(msg.sender, address(this), _amount);\n\n // Update staking balance\n stakingBalance[msg.sender] = stakingBalance[msg.sender] + _amount;\n\n // Add user to stakers array *only* if they haven't staked already\n if(!hasStaked[msg.sender]) {\n stakers.push(msg.sender);\n }\n\n // Update staking status\n isStaking[msg.sender] = true;\n hasStaked[msg.sender] = true;\n }\n\n // Unstaking Tokens (Withdraw)\n function unstakeTokens() public {\n // Fetch staking balance\n uint balance = stakingBalance[msg.sender];\n\n // Require amount greater than 0\n require(balance > 0, \"staking balance cannot be 0\");\n\n // Transfer Mock Dai tokens to this contract for staking\n daiToken.transfer(msg.sender, balance);\n\n // Reset staking balance\n stakingBalance[msg.sender] = 0;\n\n // Update staking status\n isStaking[msg.sender] = false;\n }\n\n // Issuing Tokens\n function issueTokens() public {\n // Only owner can call this function\n require(msg.sender == owner, \"caller must be the owner\");\n\n // Issue tokens to all stakers\n for (uint i=0; i 0) {\n dappToken.transfer(recipient, balance);\n }\n }\n }\n}\n", - "sourcePath": "/Users/gregory/code/defi_tutorial/src/contracts/TokenFarm.sol", - "ast": { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/TokenFarm.sol", - "exportedSymbols": { - "TokenFarm": [ - 621 - ] - }, - "id": 622, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 420, - "literals": [ - "solidity", - "^", - "0.5", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:23:3" - }, - { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/DappToken.sol", - "file": "./DappToken.sol", - "id": 421, - "nodeType": "ImportDirective", - "scope": 622, - "sourceUnit": 362, - "src": "25:25:3", - "symbolAliases": [], - "unitAlias": "" - }, - { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/DaiToken.sol", - "file": "./DaiToken.sol", - "id": 422, - "nodeType": "ImportDirective", - "scope": 622, - "sourceUnit": 181, - "src": "51:24:3", - "symbolAliases": [], - "unitAlias": "" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 621, - "linearizedBaseContracts": [ - 621 - ], - "name": "TokenFarm", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 425, - "name": "name", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "102:38:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" - }, - "typeName": { - "id": 423, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "102:6:3", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "4461707020546f6b656e204661726d", - "id": 424, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "123:17:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_112892b16fc49edc60aefbde9609f7bfe1cf220ba7ef93ec6845dbc0b0b30cd5", - "typeString": "literal_string \"Dapp Token Farm\"" - }, - "value": "Dapp Token Farm" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 427, - "name": "owner", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "146:20:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 426, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "146:7:3", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 429, - "name": "dappToken", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "172:26:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - }, - "typeName": { - "contractScope": null, - "id": 428, - "name": "DappToken", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 361, - "src": "172:9:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 431, - "name": "daiToken", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "204:24:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - }, - "typeName": { - "contractScope": null, - "id": 430, - "name": "DaiToken", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 180, - "src": "204:8:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 434, - "name": "stakers", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "235:24:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage", - "typeString": "address[]" - }, - "typeName": { - "baseType": { - "id": 432, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "235:7:3", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 433, - "length": null, - "nodeType": "ArrayTypeName", - "src": "235:9:3", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", - "typeString": "address[]" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 438, - "name": "stakingBalance", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "265:46:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "typeName": { - "id": 437, - "keyType": { - "id": 435, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "273:7:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "265:24:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "valueType": { - "id": 436, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "284:4:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 442, - "name": "hasStaked", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "317:41:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - }, - "typeName": { - "id": 441, - "keyType": { - "id": 439, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "325:7:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "317:24:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - }, - "valueType": { - "id": 440, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "336:4:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 446, - "name": "isStaking", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "364:41:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - }, - "typeName": { - "id": 445, - "keyType": { - "id": 443, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "372:7:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "364:24:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - }, - "valueType": { - "id": 444, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "383:4:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 466, - "nodeType": "Block", - "src": "473:97:3", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 455, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 453, - "name": "dappToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 429, - "src": "483:9:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 454, - "name": "_dappToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 448, - "src": "495:10:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "src": "483:22:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "id": 456, - "nodeType": "ExpressionStatement", - "src": "483:22:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 459, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 457, - "name": "daiToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 431, - "src": "515:8:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 458, - "name": "_daiToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 450, - "src": "526:9:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "src": "515:20:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "id": 460, - "nodeType": "ExpressionStatement", - "src": "515:20:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 464, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 461, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 427, - "src": "545:5:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 462, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "553:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 463, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "553:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "src": "545:18:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 465, - "nodeType": "ExpressionStatement", - "src": "545:18:3" - } - ] - }, - "documentation": null, - "id": 467, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 451, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 448, - "name": "_dappToken", - "nodeType": "VariableDeclaration", - "scope": 467, - "src": "424:20:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - }, - "typeName": { - "contractScope": null, - "id": 447, - "name": "DappToken", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 361, - "src": "424:9:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 450, - "name": "_daiToken", - "nodeType": "VariableDeclaration", - "scope": 467, - "src": "446:18:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - }, - "typeName": { - "contractScope": null, - "id": 449, - "name": "DaiToken", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 180, - "src": "446:8:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "423:42:3" - }, - "returnParameters": { - "id": 452, - "nodeType": "ParameterList", - "parameters": [], - "src": "473:0:3" - }, - "scope": 621, - "src": "412:158:3", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 530, - "nodeType": "Block", - "src": "618:614:3", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 475, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 473, - "name": "_amount", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 469, - "src": "677:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 474, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "687:1:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "677:11:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "argumentTypes": null, - "hexValue": "616d6f756e742063616e6e6f742062652030", - "id": 476, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "690:20:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_d6709398e5a0b78efe2c0f926a4bede798ed30235f19b4d9a0883f2ebb65f426", - "typeString": "literal_string \"amount cannot be 0\"" - }, - "value": "amount cannot be 0" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_d6709398e5a0b78efe2c0f926a4bede798ed30235f19b4d9a0883f2ebb65f426", - "typeString": "literal_string \"amount cannot be 0\"" - } - ], - "id": 472, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 639, - 640 - ], - "referencedDeclaration": 640, - "src": "669:7:3", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 477, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "669:42:3", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 478, - "nodeType": "ExpressionStatement", - "src": "669:42:3" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 482, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "809:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 483, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "809:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 485, - "name": "this", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 654, - "src": "829:4:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_TokenFarm_$621", - "typeString": "contract TokenFarm" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_contract$_TokenFarm_$621", - "typeString": "contract TokenFarm" - } - ], - "id": 484, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "821:7:3", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_address_$", - "typeString": "type(address)" - }, - "typeName": "address" - }, - "id": 486, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "821:13:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 487, - "name": "_amount", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 469, - "src": "836:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 479, - "name": "daiToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 431, - "src": "787:8:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "id": 481, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "transferFrom", - "nodeType": "MemberAccess", - "referencedDeclaration": 179, - "src": "787:21:3", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$", - "typeString": "function (address,address,uint256) external returns (bool)" - } - }, - "id": 488, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "787:57:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 489, - "nodeType": "ExpressionStatement", - "src": "787:57:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 500, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 490, - "name": "stakingBalance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 438, - "src": "889:14:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 493, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 491, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "904:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 492, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "904:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "889:26:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 499, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 494, - "name": "stakingBalance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 438, - "src": "918:14:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 497, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 495, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "933:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 496, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "933:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "918:26:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "id": 498, - "name": "_amount", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 469, - "src": "947:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "918:36:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "889:65:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 501, - "nodeType": "ExpressionStatement", - "src": "889:65:3" - }, - { - "condition": { - "argumentTypes": null, - "id": 506, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "!", - "prefix": true, - "src": "1043:22:3", - "subExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 502, - "name": "hasStaked", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 442, - "src": "1044:9:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - } - }, - "id": 505, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 503, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1054:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 504, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1054:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1044:21:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 515, - "nodeType": "IfStatement", - "src": "1040:76:3", - "trueBody": { - "id": 514, - "nodeType": "Block", - "src": "1067:49:3", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 510, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1094:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 511, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1094:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - ], - "expression": { - "argumentTypes": null, - "id": 507, - "name": "stakers", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 434, - "src": "1081:7:3", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage", - "typeString": "address[] storage ref" - } - }, - "id": 509, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "push", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1081:12:3", - "typeDescriptions": { - "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", - "typeString": "function (address) returns (uint256)" - } - }, - "id": 512, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1081:24:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 513, - "nodeType": "ExpressionStatement", - "src": "1081:24:3" - } - ] - } - }, - { - "expression": { - "argumentTypes": null, - "id": 521, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 516, - "name": "isStaking", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 446, - "src": "1159:9:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - } - }, - "id": 519, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 517, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1169:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 518, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1169:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1159:21:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 520, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1183:4:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "src": "1159:28:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 522, - "nodeType": "ExpressionStatement", - "src": "1159:28:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 528, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 523, - "name": "hasStaked", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 442, - "src": "1197:9:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - } - }, - "id": 526, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 524, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1207:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 525, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1207:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1197:21:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 527, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1221:4:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "src": "1197:28:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 529, - "nodeType": "ExpressionStatement", - "src": "1197:28:3" - } - ] - }, - "documentation": null, - "id": 531, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "stakeTokens", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 470, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 469, - "name": "_amount", - "nodeType": "VariableDeclaration", - "scope": 531, - "src": "597:12:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 468, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "597:4:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "596:14:3" - }, - "returnParameters": { - "id": 471, - "nodeType": "ParameterList", - "parameters": [], - "src": "618:0:3" - }, - "scope": 621, - "src": "576:656:3", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 570, - "nodeType": "Block", - "src": "1305:455:3", - "statements": [ - { - "assignments": [ - 535 - ], - "declarations": [ - { - "constant": false, - "id": 535, - "name": "balance", - "nodeType": "VariableDeclaration", - "scope": 570, - "src": "1348:12:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 534, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "1348:4:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 540, - "initialValue": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 536, - "name": "stakingBalance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 438, - "src": "1363:14:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 539, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 537, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1378:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 538, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1378:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1363:26:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "1348:41:3" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 544, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 542, - "name": "balance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 535, - "src": "1449:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 543, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1459:1:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "1449:11:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "argumentTypes": null, - "hexValue": "7374616b696e672062616c616e63652063616e6e6f742062652030", - "id": 545, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1462:29:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_564d3fe55b23d6db5b6b33df6e8e64dfe96fa04d11a1c5cf5d443beb55d42fba", - "typeString": "literal_string \"staking balance cannot be 0\"" - }, - "value": "staking balance cannot be 0" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_564d3fe55b23d6db5b6b33df6e8e64dfe96fa04d11a1c5cf5d443beb55d42fba", - "typeString": "literal_string \"staking balance cannot be 0\"" - } - ], - "id": 541, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 639, - 640 - ], - "referencedDeclaration": 640, - "src": "1441:7:3", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 546, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1441:51:3", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 547, - "nodeType": "ExpressionStatement", - "src": "1441:51:3" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 551, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1586:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 552, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1586:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "id": 553, - "name": "balance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 535, - "src": "1598:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 548, - "name": "daiToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 431, - "src": "1568:8:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "id": 550, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "transfer", - "nodeType": "MemberAccess", - "referencedDeclaration": 91, - "src": "1568:17:3", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", - "typeString": "function (address,uint256) external returns (bool)" - } - }, - "id": 554, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1568:38:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 555, - "nodeType": "ExpressionStatement", - "src": "1568:38:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 561, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 556, - "name": "stakingBalance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 438, - "src": "1650:14:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 559, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 557, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1665:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 558, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1665:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1650:26:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 560, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1679:1:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "1650:30:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 562, - "nodeType": "ExpressionStatement", - "src": "1650:30:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 568, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 563, - "name": "isStaking", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 446, - "src": "1724:9:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - } - }, - "id": 566, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 564, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1734:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 565, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1734:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1724:21:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "66616c7365", - "id": 567, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1748:5:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "false" - }, - "src": "1724:29:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 569, - "nodeType": "ExpressionStatement", - "src": "1724:29:3" - } - ] - }, - "documentation": null, - "id": 571, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "unstakeTokens", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 532, - "nodeType": "ParameterList", - "parameters": [], - "src": "1295:2:3" - }, - "returnParameters": { - "id": 533, - "nodeType": "ParameterList", - "parameters": [], - "src": "1305:0:3" - }, - "scope": 621, - "src": "1273:487:3", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 619, - "nodeType": "Block", - "src": "1818:414:3", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 578, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 575, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1881:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 576, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1881:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "argumentTypes": null, - "id": 577, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 427, - "src": "1895:5:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "1881:19:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "argumentTypes": null, - "hexValue": "63616c6c6572206d75737420626520746865206f776e6572", - "id": 579, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1902:26:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_3bfff96132c9b3295fc212b6fbfc1c5174f6f9be7b52a9aff62731c1d8706a0b", - "typeString": "literal_string \"caller must be the owner\"" - }, - "value": "caller must be the owner" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_3bfff96132c9b3295fc212b6fbfc1c5174f6f9be7b52a9aff62731c1d8706a0b", - "typeString": "literal_string \"caller must be the owner\"" - } - ], - "id": 574, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 639, - 640 - ], - "referencedDeclaration": 640, - "src": "1873:7:3", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 580, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1873:56:3", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 581, - "nodeType": "ExpressionStatement", - "src": "1873:56:3" - }, - { - "body": { - "id": 617, - "nodeType": "Block", - "src": "2017:209:3", - "statements": [ - { - "assignments": [ - 594 - ], - "declarations": [ - { - "constant": false, - "id": 594, - "name": "recipient", - "nodeType": "VariableDeclaration", - "scope": 617, - "src": "2031:17:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 593, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "2031:7:3", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 598, - "initialValue": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 595, - "name": "stakers", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 434, - "src": "2051:7:3", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage", - "typeString": "address[] storage ref" - } - }, - "id": 597, - "indexExpression": { - "argumentTypes": null, - "id": 596, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 583, - "src": "2059:1:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "2051:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "2031:30:3" - }, - { - "assignments": [ - 600 - ], - "declarations": [ - { - "constant": false, - "id": 600, - "name": "balance", - "nodeType": "VariableDeclaration", - "scope": 617, - "src": "2075:12:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 599, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "2075:4:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 604, - "initialValue": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 601, - "name": "stakingBalance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 438, - "src": "2090:14:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 603, - "indexExpression": { - "argumentTypes": null, - "id": 602, - "name": "recipient", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 594, - "src": "2105:9:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "2090:25:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "2075:40:3" - }, - { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 607, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 605, - "name": "balance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 600, - "src": "2132:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 606, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "2142:1:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "2132:11:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 616, - "nodeType": "IfStatement", - "src": "2129:87:3", - "trueBody": { - "id": 615, - "nodeType": "Block", - "src": "2145:71:3", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 611, - "name": "recipient", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 594, - "src": "2182:9:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 612, - "name": "balance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 600, - "src": "2193:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 608, - "name": "dappToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 429, - "src": "2163:9:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "id": 610, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "transfer", - "nodeType": "MemberAccess", - "referencedDeclaration": 272, - "src": "2163:18:3", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", - "typeString": "function (address,uint256) external returns (bool)" - } - }, - "id": 613, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "2163:38:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 614, - "nodeType": "ExpressionStatement", - "src": "2163:38:3" - } - ] - } - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 589, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 586, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 583, - "src": "1994:1:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 587, - "name": "stakers", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 434, - "src": "1996:7:3", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage", - "typeString": "address[] storage ref" - } - }, - "id": 588, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "length", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1996:14:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1994:16:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 618, - "initializationExpression": { - "assignments": [ - 583 - ], - "declarations": [ - { - "constant": false, - "id": 583, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 618, - "src": "1984:6:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 582, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "1984:4:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 585, - "initialValue": { - "argumentTypes": null, - "hexValue": "30", - "id": 584, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1991:1:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "nodeType": "VariableDeclarationStatement", - "src": "1984:8:3" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 591, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "2012:3:3", - "subExpression": { - "argumentTypes": null, - "id": 590, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 583, - "src": "2012:1:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 592, - "nodeType": "ExpressionStatement", - "src": "2012:3:3" - }, - "nodeType": "ForStatement", - "src": "1979:247:3" - } - ] - }, - "documentation": null, - "id": 620, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "issueTokens", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 572, - "nodeType": "ParameterList", - "parameters": [], - "src": "1808:2:3" - }, - "returnParameters": { - "id": 573, - "nodeType": "ParameterList", - "parameters": [], - "src": "1818:0:3" - }, - "scope": 621, - "src": "1788:444:3", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 622, - "src": "77:2157:3" - } - ], - "src": "0:2235:3" - }, - "legacyAST": { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/TokenFarm.sol", - "exportedSymbols": { - "TokenFarm": [ - 621 - ] - }, - "id": 622, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 420, - "literals": [ - "solidity", - "^", - "0.5", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:23:3" - }, - { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/DappToken.sol", - "file": "./DappToken.sol", - "id": 421, - "nodeType": "ImportDirective", - "scope": 622, - "sourceUnit": 362, - "src": "25:25:3", - "symbolAliases": [], - "unitAlias": "" - }, - { - "absolutePath": "/Users/gregory/code/defi_tutorial/src/contracts/DaiToken.sol", - "file": "./DaiToken.sol", - "id": 422, - "nodeType": "ImportDirective", - "scope": 622, - "sourceUnit": 181, - "src": "51:24:3", - "symbolAliases": [], - "unitAlias": "" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 621, - "linearizedBaseContracts": [ - 621 - ], - "name": "TokenFarm", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 425, - "name": "name", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "102:38:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" - }, - "typeName": { - "id": 423, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "102:6:3", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "value": { - "argumentTypes": null, - "hexValue": "4461707020546f6b656e204661726d", - "id": 424, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "123:17:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_112892b16fc49edc60aefbde9609f7bfe1cf220ba7ef93ec6845dbc0b0b30cd5", - "typeString": "literal_string \"Dapp Token Farm\"" - }, - "value": "Dapp Token Farm" - }, - "visibility": "public" - }, - { - "constant": false, - "id": 427, - "name": "owner", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "146:20:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 426, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "146:7:3", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 429, - "name": "dappToken", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "172:26:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - }, - "typeName": { - "contractScope": null, - "id": 428, - "name": "DappToken", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 361, - "src": "172:9:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 431, - "name": "daiToken", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "204:24:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - }, - "typeName": { - "contractScope": null, - "id": 430, - "name": "DaiToken", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 180, - "src": "204:8:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 434, - "name": "stakers", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "235:24:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage", - "typeString": "address[]" - }, - "typeName": { - "baseType": { - "id": 432, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "235:7:3", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 433, - "length": null, - "nodeType": "ArrayTypeName", - "src": "235:9:3", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", - "typeString": "address[]" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 438, - "name": "stakingBalance", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "265:46:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "typeName": { - "id": 437, - "keyType": { - "id": 435, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "273:7:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "265:24:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - }, - "valueType": { - "id": 436, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "284:4:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 442, - "name": "hasStaked", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "317:41:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - }, - "typeName": { - "id": 441, - "keyType": { - "id": 439, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "325:7:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "317:24:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - }, - "valueType": { - "id": 440, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "336:4:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 446, - "name": "isStaking", - "nodeType": "VariableDeclaration", - "scope": 621, - "src": "364:41:3", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - }, - "typeName": { - "id": 445, - "keyType": { - "id": 443, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "372:7:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Mapping", - "src": "364:24:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - }, - "valueType": { - "id": 444, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "383:4:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 466, - "nodeType": "Block", - "src": "473:97:3", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 455, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 453, - "name": "dappToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 429, - "src": "483:9:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 454, - "name": "_dappToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 448, - "src": "495:10:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "src": "483:22:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "id": 456, - "nodeType": "ExpressionStatement", - "src": "483:22:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 459, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 457, - "name": "daiToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 431, - "src": "515:8:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 458, - "name": "_daiToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 450, - "src": "526:9:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "src": "515:20:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "id": 460, - "nodeType": "ExpressionStatement", - "src": "515:20:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 464, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 461, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 427, - "src": "545:5:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 462, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "553:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 463, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "553:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "src": "545:18:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 465, - "nodeType": "ExpressionStatement", - "src": "545:18:3" - } - ] - }, - "documentation": null, - "id": 467, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 451, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 448, - "name": "_dappToken", - "nodeType": "VariableDeclaration", - "scope": 467, - "src": "424:20:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - }, - "typeName": { - "contractScope": null, - "id": 447, - "name": "DappToken", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 361, - "src": "424:9:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 450, - "name": "_daiToken", - "nodeType": "VariableDeclaration", - "scope": 467, - "src": "446:18:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - }, - "typeName": { - "contractScope": null, - "id": 449, - "name": "DaiToken", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 180, - "src": "446:8:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "423:42:3" - }, - "returnParameters": { - "id": 452, - "nodeType": "ParameterList", - "parameters": [], - "src": "473:0:3" - }, - "scope": 621, - "src": "412:158:3", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 530, - "nodeType": "Block", - "src": "618:614:3", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 475, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 473, - "name": "_amount", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 469, - "src": "677:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 474, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "687:1:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "677:11:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "argumentTypes": null, - "hexValue": "616d6f756e742063616e6e6f742062652030", - "id": 476, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "690:20:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_d6709398e5a0b78efe2c0f926a4bede798ed30235f19b4d9a0883f2ebb65f426", - "typeString": "literal_string \"amount cannot be 0\"" - }, - "value": "amount cannot be 0" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_d6709398e5a0b78efe2c0f926a4bede798ed30235f19b4d9a0883f2ebb65f426", - "typeString": "literal_string \"amount cannot be 0\"" - } - ], - "id": 472, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 639, - 640 - ], - "referencedDeclaration": 640, - "src": "669:7:3", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 477, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "669:42:3", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 478, - "nodeType": "ExpressionStatement", - "src": "669:42:3" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 482, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "809:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 483, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "809:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 485, - "name": "this", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 654, - "src": "829:4:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_TokenFarm_$621", - "typeString": "contract TokenFarm" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_contract$_TokenFarm_$621", - "typeString": "contract TokenFarm" - } - ], - "id": 484, - "isConstant": false, - "isLValue": false, - "isPure": true, - "lValueRequested": false, - "nodeType": "ElementaryTypeNameExpression", - "src": "821:7:3", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_address_$", - "typeString": "type(address)" - }, - "typeName": "address" - }, - "id": 486, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "821:13:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 487, - "name": "_amount", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 469, - "src": "836:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 479, - "name": "daiToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 431, - "src": "787:8:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "id": 481, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "transferFrom", - "nodeType": "MemberAccess", - "referencedDeclaration": 179, - "src": "787:21:3", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$", - "typeString": "function (address,address,uint256) external returns (bool)" - } - }, - "id": 488, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "787:57:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 489, - "nodeType": "ExpressionStatement", - "src": "787:57:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 500, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 490, - "name": "stakingBalance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 438, - "src": "889:14:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 493, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 491, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "904:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 492, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "904:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "889:26:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 499, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 494, - "name": "stakingBalance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 438, - "src": "918:14:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 497, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 495, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "933:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 496, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "933:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "918:26:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "+", - "rightExpression": { - "argumentTypes": null, - "id": 498, - "name": "_amount", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 469, - "src": "947:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "918:36:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "889:65:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 501, - "nodeType": "ExpressionStatement", - "src": "889:65:3" - }, - { - "condition": { - "argumentTypes": null, - "id": 506, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "!", - "prefix": true, - "src": "1043:22:3", - "subExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 502, - "name": "hasStaked", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 442, - "src": "1044:9:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - } - }, - "id": 505, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 503, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1054:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 504, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1054:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1044:21:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 515, - "nodeType": "IfStatement", - "src": "1040:76:3", - "trueBody": { - "id": 514, - "nodeType": "Block", - "src": "1067:49:3", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 510, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1094:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 511, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1094:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - ], - "expression": { - "argumentTypes": null, - "id": 507, - "name": "stakers", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 434, - "src": "1081:7:3", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage", - "typeString": "address[] storage ref" - } - }, - "id": 509, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "push", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1081:12:3", - "typeDescriptions": { - "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", - "typeString": "function (address) returns (uint256)" - } - }, - "id": 512, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1081:24:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 513, - "nodeType": "ExpressionStatement", - "src": "1081:24:3" - } - ] - } - }, - { - "expression": { - "argumentTypes": null, - "id": 521, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 516, - "name": "isStaking", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 446, - "src": "1159:9:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - } - }, - "id": 519, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 517, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1169:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 518, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1169:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1159:21:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 520, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1183:4:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "src": "1159:28:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 522, - "nodeType": "ExpressionStatement", - "src": "1159:28:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 528, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 523, - "name": "hasStaked", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 442, - "src": "1197:9:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - } - }, - "id": 526, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 524, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1207:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 525, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1207:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1197:21:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "74727565", - "id": 527, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1221:4:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "true" - }, - "src": "1197:28:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 529, - "nodeType": "ExpressionStatement", - "src": "1197:28:3" - } - ] - }, - "documentation": null, - "id": 531, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "stakeTokens", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 470, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 469, - "name": "_amount", - "nodeType": "VariableDeclaration", - "scope": 531, - "src": "597:12:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 468, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "597:4:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "596:14:3" - }, - "returnParameters": { - "id": 471, - "nodeType": "ParameterList", - "parameters": [], - "src": "618:0:3" - }, - "scope": 621, - "src": "576:656:3", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 570, - "nodeType": "Block", - "src": "1305:455:3", - "statements": [ - { - "assignments": [ - 535 - ], - "declarations": [ - { - "constant": false, - "id": 535, - "name": "balance", - "nodeType": "VariableDeclaration", - "scope": 570, - "src": "1348:12:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 534, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "1348:4:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 540, - "initialValue": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 536, - "name": "stakingBalance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 438, - "src": "1363:14:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 539, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 537, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1378:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 538, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1378:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "1363:26:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "1348:41:3" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 544, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 542, - "name": "balance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 535, - "src": "1449:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 543, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1459:1:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "1449:11:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "argumentTypes": null, - "hexValue": "7374616b696e672062616c616e63652063616e6e6f742062652030", - "id": 545, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1462:29:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_564d3fe55b23d6db5b6b33df6e8e64dfe96fa04d11a1c5cf5d443beb55d42fba", - "typeString": "literal_string \"staking balance cannot be 0\"" - }, - "value": "staking balance cannot be 0" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_564d3fe55b23d6db5b6b33df6e8e64dfe96fa04d11a1c5cf5d443beb55d42fba", - "typeString": "literal_string \"staking balance cannot be 0\"" - } - ], - "id": 541, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 639, - 640 - ], - "referencedDeclaration": 640, - "src": "1441:7:3", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 546, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1441:51:3", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 547, - "nodeType": "ExpressionStatement", - "src": "1441:51:3" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 551, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1586:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 552, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1586:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - { - "argumentTypes": null, - "id": 553, - "name": "balance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 535, - "src": "1598:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 548, - "name": "daiToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 431, - "src": "1568:8:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DaiToken_$180", - "typeString": "contract DaiToken" - } - }, - "id": 550, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "transfer", - "nodeType": "MemberAccess", - "referencedDeclaration": 91, - "src": "1568:17:3", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", - "typeString": "function (address,uint256) external returns (bool)" - } - }, - "id": 554, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1568:38:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 555, - "nodeType": "ExpressionStatement", - "src": "1568:38:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 561, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 556, - "name": "stakingBalance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 438, - "src": "1650:14:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 559, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 557, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1665:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 558, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1665:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1650:26:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 560, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1679:1:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "1650:30:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 562, - "nodeType": "ExpressionStatement", - "src": "1650:30:3" - }, - { - "expression": { - "argumentTypes": null, - "id": 568, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 563, - "name": "isStaking", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 446, - "src": "1724:9:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", - "typeString": "mapping(address => bool)" - } - }, - "id": 566, - "indexExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 564, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1734:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 565, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1734:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "nodeType": "IndexAccess", - "src": "1724:21:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "66616c7365", - "id": 567, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "bool", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1748:5:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "value": "false" - }, - "src": "1724:29:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 569, - "nodeType": "ExpressionStatement", - "src": "1724:29:3" - } - ] - }, - "documentation": null, - "id": 571, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "unstakeTokens", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 532, - "nodeType": "ParameterList", - "parameters": [], - "src": "1295:2:3" - }, - "returnParameters": { - "id": 533, - "nodeType": "ParameterList", - "parameters": [], - "src": "1305:0:3" - }, - "scope": 621, - "src": "1273:487:3", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 619, - "nodeType": "Block", - "src": "1818:414:3", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 578, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 575, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 636, - "src": "1881:3:3", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 576, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1881:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "argumentTypes": null, - "id": 577, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 427, - "src": "1895:5:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "1881:19:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "argumentTypes": null, - "hexValue": "63616c6c6572206d75737420626520746865206f776e6572", - "id": 579, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1902:26:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_3bfff96132c9b3295fc212b6fbfc1c5174f6f9be7b52a9aff62731c1d8706a0b", - "typeString": "literal_string \"caller must be the owner\"" - }, - "value": "caller must be the owner" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_3bfff96132c9b3295fc212b6fbfc1c5174f6f9be7b52a9aff62731c1d8706a0b", - "typeString": "literal_string \"caller must be the owner\"" - } - ], - "id": 574, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 639, - 640 - ], - "referencedDeclaration": 640, - "src": "1873:7:3", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 580, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1873:56:3", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 581, - "nodeType": "ExpressionStatement", - "src": "1873:56:3" - }, - { - "body": { - "id": 617, - "nodeType": "Block", - "src": "2017:209:3", - "statements": [ - { - "assignments": [ - 594 - ], - "declarations": [ - { - "constant": false, - "id": 594, - "name": "recipient", - "nodeType": "VariableDeclaration", - "scope": 617, - "src": "2031:17:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 593, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "2031:7:3", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 598, - "initialValue": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 595, - "name": "stakers", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 434, - "src": "2051:7:3", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage", - "typeString": "address[] storage ref" - } - }, - "id": 597, - "indexExpression": { - "argumentTypes": null, - "id": 596, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 583, - "src": "2059:1:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "2051:10:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "2031:30:3" - }, - { - "assignments": [ - 600 - ], - "declarations": [ - { - "constant": false, - "id": 600, - "name": "balance", - "nodeType": "VariableDeclaration", - "scope": 617, - "src": "2075:12:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 599, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "2075:4:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 604, - "initialValue": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 601, - "name": "stakingBalance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 438, - "src": "2090:14:3", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", - "typeString": "mapping(address => uint256)" - } - }, - "id": 603, - "indexExpression": { - "argumentTypes": null, - "id": 602, - "name": "recipient", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 594, - "src": "2105:9:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "2090:25:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "2075:40:3" - }, - { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 607, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 605, - "name": "balance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 600, - "src": "2132:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">", - "rightExpression": { - "argumentTypes": null, - "hexValue": "30", - "id": 606, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "2142:1:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "2132:11:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 616, - "nodeType": "IfStatement", - "src": "2129:87:3", - "trueBody": { - "id": 615, - "nodeType": "Block", - "src": "2145:71:3", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 611, - "name": "recipient", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 594, - "src": "2182:9:3", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - { - "argumentTypes": null, - "id": 612, - "name": "balance", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 600, - "src": "2193:7:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - }, - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 608, - "name": "dappToken", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 429, - "src": "2163:9:3", - "typeDescriptions": { - "typeIdentifier": "t_contract$_DappToken_$361", - "typeString": "contract DappToken" - } - }, - "id": 610, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "transfer", - "nodeType": "MemberAccess", - "referencedDeclaration": 272, - "src": "2163:18:3", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", - "typeString": "function (address,uint256) external returns (bool)" - } - }, - "id": 613, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "2163:38:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 614, - "nodeType": "ExpressionStatement", - "src": "2163:38:3" - } - ] - } - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 589, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 586, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 583, - "src": "1994:1:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 587, - "name": "stakers", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 434, - "src": "1996:7:3", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage", - "typeString": "address[] storage ref" - } - }, - "id": 588, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "length", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "1996:14:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1994:16:3", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 618, - "initializationExpression": { - "assignments": [ - 583 - ], - "declarations": [ - { - "constant": false, - "id": 583, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 618, - "src": "1984:6:3", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 582, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "1984:4:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 585, - "initialValue": { - "argumentTypes": null, - "hexValue": "30", - "id": 584, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1991:1:3", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "nodeType": "VariableDeclarationStatement", - "src": "1984:8:3" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 591, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "2012:3:3", - "subExpression": { - "argumentTypes": null, - "id": 590, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 583, - "src": "2012:1:3", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 592, - "nodeType": "ExpressionStatement", - "src": "2012:3:3" - }, - "nodeType": "ForStatement", - "src": "1979:247:3" - } - ] - }, - "documentation": null, - "id": 620, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "issueTokens", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 572, - "nodeType": "ParameterList", - "parameters": [], - "src": "1808:2:3" - }, - "returnParameters": { - "id": 573, - "nodeType": "ParameterList", - "parameters": [], - "src": "1818:0:3" - }, - "scope": 621, - "src": "1788:444:3", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 622, - "src": "77:2157:3" - } - ], - "src": "0:2235:3" - }, - "compiler": { - "name": "solc", - "version": "0.5.16+commit.9c3226ce.Emscripten.clang" - }, - "networks": { - "5777": { - "events": {}, - "links": {}, - "address": "0x689cB867e929Cdd1c69b78B27fb11DAb86B6393e", - "transactionHash": "0x72a1f6b5d98180effbdf5231abfac2a6e06413e2c42e4399647bc90a351385b9" - } - }, - "schemaVersion": "3.2.3", - "updatedAt": "2020-08-18T20:08:17.486Z", - "networkType": "ethereum", - "devdoc": { - "methods": {} - }, - "userdoc": { - "methods": {} - } -} \ No newline at end of file diff --git a/src/components/App.js b/src/components/App.js index 1d1c880ec..ba3c1952e 100755 --- a/src/components/App.js +++ b/src/components/App.js @@ -1,143 +1,195 @@ -import React, { Component } from 'react' -import Web3 from 'web3' -import DaiToken from '../abis/DaiToken.json' -import DappToken from '../abis/DappToken.json' -import TokenFarm from '../abis/TokenFarm.json' -import Navbar from './Navbar' -import Main from './Main' -import './App.css' - -class App extends Component { - - async componentWillMount() { - await this.loadWeb3() - await this.loadBlockchainData() - } - - async loadBlockchainData() { - const web3 = window.web3 - const accounts = await web3.eth.getAccounts() - this.setState({ account: accounts[0] }) +import React from 'react'; +import Web3 from 'web3'; - const networkId = await web3.eth.net.getId() +import DaiToken from '../built-contracts/DaiToken.json'; +import DappToken from '../built-contracts/DappToken.json'; +import TokenFarm from '../built-contracts/TokenFarm.json'; +import Navbar from './Navbar'; +import Main from './Main'; +import './App.css'; - // Load DaiToken - const daiTokenData = DaiToken.networks[networkId] - if(daiTokenData) { - const daiToken = new web3.eth.Contract(DaiToken.abi, daiTokenData.address) - this.setState({ daiToken }) - let daiTokenBalance = await daiToken.methods.balanceOf(this.state.account).call() - this.setState({ daiTokenBalance: daiTokenBalance.toString() }) +const loadWeb3 = async () => { + try { + if (window.ethereum) { + window.web3 = new Web3(window.ethereum); + await window.ethereum.enable(); + } else if (window.web3) { + window.web3 = new Web3(window.web3.currentProvider); } else { - window.alert('DaiToken contract not deployed to detected network.') + window.alert('Non-Ethereum browser detected. You should consider trying MetaMask!'); } - - // Load DappToken - const dappTokenData = DappToken.networks[networkId] - if(dappTokenData) { - const dappToken = new web3.eth.Contract(DappToken.abi, dappTokenData.address) - this.setState({ dappToken }) - let dappTokenBalance = await dappToken.methods.balanceOf(this.state.account).call() - this.setState({ dappTokenBalance: dappTokenBalance.toString() }) - } else { - window.alert('DappToken contract not deployed to detected network.') + } catch (error) { + console.log('[loadWeb3] error.message => ', error.message); + } +}; + +const App = () => { + const [account, setAccount] = React.useState('0x0'); + + const [daiToken, setDaiToken] = React.useState(null); + const [dappToken, setDappToken] = React.useState(null); + const [tokenFarm, setTokenFarm] = React.useState(null); + + const [daiTokenBalance, setDaiTokenBalance] = React.useState('0'); + const [dappTokenBalance, setDappTokenBalance] = React.useState('0'); + const [stakingBalance, setStakingBalance] = React.useState('0'); + + const [loading, setLoading] = React.useState(true); + + React.useEffect(() => { + (async () => { + await loadWeb3(); + await handleLoadBlockchainData(); + })(); + }, []); + + const handleLoadBlockchainData = async () => { + try { + const web3 = window.web3; + + const accounts = await web3.eth.getAccounts(); + const firstAccount = accounts[0]; + setAccount(firstAccount); + + const networkId = await web3.eth.net.getId(); + + // Load DaiToken + const daiTokenData = DaiToken.networks[networkId]; + if(daiTokenData) { + const theDaiToken = new web3.eth.Contract(DaiToken.abi, daiTokenData.address); + setDaiToken(theDaiToken); + const theDaiTokenBalance = await theDaiToken.methods.balanceOf(firstAccount).call(); + setDaiTokenBalance(theDaiTokenBalance.toString()); + } else { + window.alert('DaiToken contract not deployed to detected network.'); + } + + // Load DappToken + const dappTokenData = DappToken.networks[networkId]; + if(dappTokenData) { + const theDappToken = new web3.eth.Contract(DappToken.abi, dappTokenData.address); + setDappToken(theDappToken); + const theDappTokenBalance = await theDappToken.methods.balanceOf(firstAccount).call(); + setDappTokenBalance(theDappTokenBalance); + } else { + window.alert('DappToken contract not deployed to detected network.'); + } + + // Load TokenFarm + const tokenFarmData = TokenFarm.networks[networkId]; + if(tokenFarmData) { + const theTokenFarm = new web3.eth.Contract(TokenFarm.abi, tokenFarmData.address); + setTokenFarm(theTokenFarm); + const theStakingBalance = await theTokenFarm.methods.stakingBalance(firstAccount).call(); + setStakingBalance(theStakingBalance); + } else { + window.alert('TokenFarm contract not deployed to detected network.'); + } + } catch (error) { + console.log('[handleLoadBlockchainData] error.message => ', error.message); + } finally { + setLoading(false); } - - // Load TokenFarm - const tokenFarmData = TokenFarm.networks[networkId] - if(tokenFarmData) { - const tokenFarm = new web3.eth.Contract(TokenFarm.abi, tokenFarmData.address) - this.setState({ tokenFarm }) - let stakingBalance = await tokenFarm.methods.stakingBalance(this.state.account).call() - this.setState({ stakingBalance: stakingBalance.toString() }) - } else { - window.alert('TokenFarm contract not deployed to detected network.') + }; + + const handleStakeDaiTokens = async amount => { + try { + setLoading(true); + await daiToken.methods + .approve(tokenFarm._address, amount) + .send({ from: account }); + await tokenFarm.methods + .stakeDaiTokens(amount) + .send({ from: account }); + + handleDaiTokenDataChange(); + handleDappTokenDataChange(); + handleTokenFarmDataChange(); + } catch (error) { + console.log('[handleStakeTokens] error.message => ', error.message); + } finally { + setLoading(false); } - - this.setState({ loading: false }) - } - - async loadWeb3() { - if (window.ethereum) { - window.web3 = new Web3(window.ethereum) - await window.ethereum.enable() + }; + + const handleUnstakeDaiTokens = async () => { + try { + setLoading(true); + await tokenFarm.methods + .unstakeDaiTokens() + .send({ from: account }); + + handleDaiTokenDataChange(); + handleDappTokenDataChange(); + handleTokenFarmDataChange(); + } catch (error) { + console.log('[handleUnstakeTokens] error.message => ', error.message); + } finally { + setLoading(false); } - else if (window.web3) { - window.web3 = new Web3(window.web3.currentProvider) + }; + + const handleDaiTokenDataChange = async () => { + try { + const theDaiTokenBalance = await daiToken.methods.balanceOf(account).call(); + setDaiTokenBalance(theDaiTokenBalance.toString()); + } catch (error) { + console.log('[handleDaiTokenDataChange] error.message => ', error.message); } - else { - window.alert('Non-Ethereum browser detected. You should consider trying MetaMask!') + }; + + const handleDappTokenDataChange = async () => { + try { + const theDappTokenBalance = await dappToken.methods.balanceOf(account).call(); + setDappTokenBalance(theDappTokenBalance.toString()); + } catch (error) { + console.log('[handleDappTokenDataChange] error.message => ', error.message); } - } - - stakeTokens = (amount) => { - this.setState({ loading: true }) - this.state.daiToken.methods.approve(this.state.tokenFarm._address, amount).send({ from: this.state.account }).on('transactionHash', (hash) => { - this.state.tokenFarm.methods.stakeTokens(amount).send({ from: this.state.account }).on('transactionHash', (hash) => { - this.setState({ loading: false }) - }) - }) - } - - unstakeTokens = (amount) => { - this.setState({ loading: true }) - this.state.tokenFarm.methods.unstakeTokens().send({ from: this.state.account }).on('transactionHash', (hash) => { - this.setState({ loading: false }) - }) - } - - constructor(props) { - super(props) - this.state = { - account: '0x0', - daiToken: {}, - dappToken: {}, - tokenFarm: {}, - daiTokenBalance: '0', - dappTokenBalance: '0', - stakingBalance: '0', - loading: true + }; + + const handleTokenFarmDataChange = async () => { + try { + const theStakingBalance = await tokenFarm.methods.stakingBalance(account).call(); + setStakingBalance(theStakingBalance.toString()); + } catch (error) { + console.log('[handleTokenFarmDataChange] error.message => ', error.message); } + }; + + let content; + if(loading) { + content =

Loading...

; + } else { + content = ( +
+ ); } - render() { - let content - if(this.state.loading) { - content =

Loading...

- } else { - content =
- } - - return ( -
- -
-
-
-
- - - - {content} - -
-
-
+ return ( +
+ +
+
+
+
+ + + {content} +
+
- ); - } -} +
+ ); +}; export default App; diff --git a/src/components/Main.js b/src/components/Main.js index 832ededac..a6a2f7b35 100644 --- a/src/components/Main.js +++ b/src/components/Main.js @@ -1,75 +1,95 @@ -import React, { Component } from 'react' -import dai from '../dai.png' -class Main extends Component { +import React from 'react'; - render() { - return ( -
+import dai from '../dai.png'; - - - - - - - - - - - - - -
Staking BalanceReward Balance
{window.web3.utils.fromWei(this.props.stakingBalance, 'Ether')} mDAI{window.web3.utils.fromWei(this.props.dappTokenBalance, 'Ether')} DAPP
+const Main = ({ + stakingBalance, + dappTokenBalance, + stakeDaiTokens, + daiTokenBalance, + unstakeDaiTokens +}) => { + const inputRef = React.useRef(null); -
+ const handleSubmit = event => { + event.preventDefault(); -
+ let amount; + amount = inputRef.current.value.toString(); + amount = window.web3.utils.toWei(amount, 'Ether'); + stakeDaiTokens(amount); + }; -
{ - event.preventDefault() - let amount - amount = this.input.value.toString() - amount = window.web3.utils.toWei(amount, 'Ether') - this.props.stakeTokens(amount) - }}> -
- - - Balance: {window.web3.utils.fromWei(this.props.daiTokenBalance, 'Ether')} - -
-
- { this.input = input }} - className="form-control form-control-lg" - placeholder="0" - required /> -
-
- -     mDAI -
+ const handleUnstakeClick = () => { + unstakeDaiTokens(); + }; + + return ( +
+ + + + + + + + + + + + + +
Staking Balance (at Token Farm)Reward Balance (at my wallet)
{window.web3.utils.fromWei(stakingBalance, 'Ether')} mDAI{window.web3.utils.fromWei(dappTokenBalance, 'Ether')} DAPP
+
+
+ +
+ + + Balance (at my wallet): {window.web3.utils.fromWei(daiTokenBalance, 'Ether')} + +
+
+ +
+
+ +     mDAI
- - +
-
+ className="btn btn-primary btn-block btn-lg"> + STAKE! + + +
-
- ); - } -} +
+ ); +}; export default Main; diff --git a/src/components/Navbar.js b/src/components/Navbar.js index 4bbe714ec..a1986c3d6 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -1,31 +1,33 @@ -import React, { Component } from 'react' -import farmer from '../farmer.png' -class Navbar extends Component { +import React from 'react'; - render() { - return ( - - ); - } -} +const Navbar = ({ account }) => ( + +); export default Navbar; diff --git a/src/contracts/TokenFarm.sol b/src/contracts/TokenFarm.sol index 6a003f625..2f4e443aa 100644 --- a/src/contracts/TokenFarm.sol +++ b/src/contracts/TokenFarm.sol @@ -20,11 +20,11 @@ contract TokenFarm { owner = msg.sender; } - function stakeTokens(uint _amount) public { + function stakeDaiTokens(uint _amount) public { // Require amount greater than 0 require(_amount > 0, "amount cannot be 0"); - // Trasnfer Mock Dai tokens to this contract for staking + // Transfer Mock DAI tokens to this contract for staking daiToken.transferFrom(msg.sender, address(this), _amount); // Update staking balance @@ -41,14 +41,14 @@ contract TokenFarm { } // Unstaking Tokens (Withdraw) - function unstakeTokens() public { + function unstakeDaiTokens() public { // Fetch staking balance uint balance = stakingBalance[msg.sender]; // Require amount greater than 0 require(balance > 0, "staking balance cannot be 0"); - // Transfer Mock Dai tokens to this contract for staking + // Transfer deposited Mock DAI tokens from this contract to the caller of this method for unstaking daiToken.transfer(msg.sender, balance); // Reset staking balance @@ -59,12 +59,12 @@ contract TokenFarm { } // Issuing Tokens - function issueTokens() public { + function issueDappTokens() public { // Only owner can call this function require(msg.sender == owner, "caller must be the owner"); // Issue tokens to all stakers - for (uint i=0; i 0) { diff --git a/test/TokenFarm.test.js b/test/TokenFarm.test.js index 87940869b..493394749 100644 --- a/test/TokenFarm.test.js +++ b/test/TokenFarm.test.js @@ -1,109 +1,109 @@ -const DaiToken = artifacts.require('DaiToken') -const DappToken = artifacts.require('DappToken') -const TokenFarm = artifacts.require('TokenFarm') + +const DaiToken = artifacts.require('DaiToken'); +const DappToken = artifacts.require('DappToken'); +const TokenFarm = artifacts.require('TokenFarm'); require('chai') .use(require('chai-as-promised')) - .should() + .should(); function tokens(n) { return web3.utils.toWei(n, 'ether'); } +// owner => accounts[0] and investor => accounts[1] contract('TokenFarm', ([owner, investor]) => { - let daiToken, dappToken, tokenFarm + let daiToken, dappToken, tokenFarm; before(async () => { // Load Contracts - daiToken = await DaiToken.new() - dappToken = await DappToken.new() - tokenFarm = await TokenFarm.new(dappToken.address, daiToken.address) + daiToken = await DaiToken.new(); + dappToken = await DappToken.new(); + tokenFarm = await TokenFarm.new(dappToken.address, daiToken.address); // Transfer all Dapp tokens to farm (1 million) - await dappToken.transfer(tokenFarm.address, tokens('1000000')) + await dappToken.transfer(tokenFarm.address, tokens('1000000')); - // Send tokens to investor - await daiToken.transfer(investor, tokens('100'), { from: owner }) - }) + // Send some of Mock DAI tokens to investor + await daiToken.transfer(investor, tokens('100'), { from: owner }); + }); - describe('Mock DAI deployment', async () => { - it('has a name', async () => { - const name = await daiToken.name() - assert.equal(name, 'Mock DAI Token') - }) - }) + describe('Mock DAI Token deployment', async () => { + it('Mock DAI Token has a name', async () => { + const name = await daiToken.name(); + assert.equal(name, 'Mock DAI Token'); + }); + }); describe('Dapp Token deployment', async () => { - it('has a name', async () => { - const name = await dappToken.name() - assert.equal(name, 'DApp Token') - }) - }) + it('Dapp Token has a name', async () => { + const name = await dappToken.name(); + assert.equal(name, 'DApp Token'); + }); + }); describe('Token Farm deployment', async () => { - it('has a name', async () => { - const name = await tokenFarm.name() - assert.equal(name, 'Dapp Token Farm') - }) - - it('contract has tokens', async () => { - let balance = await dappToken.balanceOf(tokenFarm.address) - assert.equal(balance.toString(), tokens('1000000')) - }) - }) + it('Token Farm has a name', async () => { + const name = await tokenFarm.name(); + assert.equal(name, 'Dapp Token Farm'); + }); - describe('Farming tokens', async () => { + it('Token Farm contract has all Dapp tokens', async () => { + let balance = await dappToken.balanceOf(tokenFarm.address); + assert.equal(balance.toString(), tokens('1000000')); + }); + }); - it('rewards investors for staking mDai tokens', async () => { - let result + describe('Farming Dapp tokens', async () => { + it('rewards investors for staking Mock DAI tokens', async () => { + let result; // Check investor balance before staking - result = await daiToken.balanceOf(investor) - assert.equal(result.toString(), tokens('100'), 'investor Mock DAI wallet balance correct before staking') + result = await daiToken.balanceOf(investor); + assert.equal(result.toString(), tokens('100'), 'investor Mock DAI wallet balance correct before staking'); // Stake Mock DAI Tokens - await daiToken.approve(tokenFarm.address, tokens('100'), { from: investor }) - await tokenFarm.stakeTokens(tokens('100'), { from: investor }) + await daiToken.approve(tokenFarm.address, tokens('100'), { from: investor }); + await tokenFarm.stakeDaiTokens(tokens('100'), { from: investor }); // Check staking result - result = await daiToken.balanceOf(investor) - assert.equal(result.toString(), tokens('0'), 'investor Mock DAI wallet balance correct after staking') + result = await daiToken.balanceOf(investor); + assert.equal(result.toString(), tokens('0'), 'investor Mock DAI wallet balance correct after staking'); - result = await daiToken.balanceOf(tokenFarm.address) - assert.equal(result.toString(), tokens('100'), 'Token Farm Mock DAI balance correct after staking') + result = await daiToken.balanceOf(tokenFarm.address); + assert.equal(result.toString(), tokens('100'), 'Token Farm Mock DAI balance correct after staking'); - result = await tokenFarm.stakingBalance(investor) - assert.equal(result.toString(), tokens('100'), 'investor staking balance correct after staking') + result = await tokenFarm.stakingBalance(investor); + assert.equal(result.toString(), tokens('100'), 'investor staking balance correct after staking'); - result = await tokenFarm.isStaking(investor) - assert.equal(result.toString(), 'true', 'investor staking status correct after staking') + result = await tokenFarm.isStaking(investor); + assert.equal(result.toString(), 'true', 'investor staking status correct after staking'); // Issue Tokens - await tokenFarm.issueTokens({ from: owner }) + await tokenFarm.issueDappTokens({ from: owner }); // Check balances after issuance - result = await dappToken.balanceOf(investor) - assert.equal(result.toString(), tokens('100'), 'investor DApp Token wallet balance correct affter issuance') + result = await dappToken.balanceOf(investor); + assert.equal(result.toString(), tokens('100'), 'investor DApp Token wallet balance correct after issuance'); - // Ensure that only onwer can issue tokens - await tokenFarm.issueTokens({ from: investor }).should.be.rejected; + // Ensure that only owner can issue tokens + await tokenFarm.issueDappTokens({ from: investor }).should.be.rejected; // Unstake tokens - await tokenFarm.unstakeTokens({ from: investor }) + await tokenFarm.unstakeDaiTokens({ from: investor }); // Check results after unstaking - result = await daiToken.balanceOf(investor) - assert.equal(result.toString(), tokens('100'), 'investor Mock DAI wallet balance correct after staking') - - result = await daiToken.balanceOf(tokenFarm.address) - assert.equal(result.toString(), tokens('0'), 'Token Farm Mock DAI balance correct after staking') + result = await daiToken.balanceOf(investor); + assert.equal(result.toString(), tokens('100'), 'investor Mock DAI wallet balance correct after unstaking'); - result = await tokenFarm.stakingBalance(investor) - assert.equal(result.toString(), tokens('0'), 'investor staking balance correct after staking') + result = await daiToken.balanceOf(tokenFarm.address); + assert.equal(result.toString(), tokens('0'), 'Token Farm Mock DAI balance correct after unstaking'); - result = await tokenFarm.isStaking(investor) - assert.equal(result.toString(), 'false', 'investor staking status correct after staking') - }) - }) + result = await tokenFarm.stakingBalance(investor); + assert.equal(result.toString(), tokens('0'), 'investor staking balance correct after unstaking'); -}) + result = await tokenFarm.isStaking(investor); + assert.equal(result.toString(), 'false', 'investor staking status correct after unstaking'); + }); + }); +}); diff --git a/truffle-config.js b/truffle-config.js index 1466c8206..a8a4eab6b 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -1,23 +1,25 @@ + require('babel-register'); require('babel-polyfill'); module.exports = { networks: { + // Connection to Ganache development: { - host: "127.0.0.1", + host: '127.0.0.1', port: 7545, - network_id: "*" // Match any network id - }, + network_id: '*' // Match any network id + } }, contracts_directory: './src/contracts/', - contracts_build_directory: './src/abis/', + contracts_build_directory: './src/built-contracts/', compilers: { solc: { optimizer: { enabled: true, runs: 200 }, - evmVersion: "petersburg" + evmVersion: 'petersburg' } } -} +};