UNPKG

dc-protocol

Version:

Start ganache and deploy our contracts

933 lines (932 loc) 409 kB
{ "contractName": "ERC20", "abi": [ { "constant": true, "inputs": [], "name": "name", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x06fdde03" }, { "constant": false, "inputs": [ { "name": "_spender", "type": "address" }, { "name": "_amount", "type": "uint256" } ], "name": "approve", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x095ea7b3" }, { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x18160ddd" }, { "constant": false, "inputs": [ { "name": "_from", "type": "address" }, { "name": "_to", "type": "address" }, { "name": "_amount", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x23b872dd" }, { "constant": true, "inputs": [], "name": "decimals", "outputs": [ { "name": "", "type": "uint8" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x313ce567" }, { "constant": true, "inputs": [ { "name": "_owner", "type": "address" } ], "name": "balanceOf", "outputs": [ { "name": "balance", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x70a08231" }, { "constant": false, "inputs": [], "name": "acceptOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x79ba5097" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x8da5cb5b" }, { "constant": true, "inputs": [], "name": "symbol", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x95d89b41" }, { "constant": false, "inputs": [ { "name": "_to", "type": "address" }, { "name": "_amount", "type": "uint256" } ], "name": "transfer", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xa9059cbb" }, { "constant": true, "inputs": [], "name": "newOwner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xd4ee1d90" }, { "constant": true, "inputs": [ { "name": "_owner", "type": "address" }, { "name": "_spender", "type": "address" } ], "name": "allowance", "outputs": [ { "name": "remaining", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xdd62ed3e" }, { "constant": false, "inputs": [ { "name": "_newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xf2fde38b" }, { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor", "signature": "constructor" }, { "constant": false, "inputs": [], "name": "faucet", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xde5f72fd" }, { "constant": false, "inputs": [ { "name": "tokenAddress", "type": "address" }, { "name": "amount", "type": "uint256" } ], "name": "transferAnyERC20Token", "outputs": [ { "name": "success", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xdc39d06d" } ], "bytecode": "0x60806040526000805534801561001457600080fd5b5060038054600160a060020a031916331790556108b3806100366000396000f3006080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd146101a157806323b872dd146101c8578063313ce567146101f257806370a082311461021d57806379ba50971461023e5780638da5cb5b1461025557806395d89b4114610286578063a9059cbb1461029b578063d4ee1d90146102bf578063dc39d06d146102d4578063dd62ed3e146102f8578063de5f72fd1461031f578063f2fde38b14610334575b600080fd5b3480156100eb57600080fd5b506100f4610355565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b5061018d600160a060020a036004351660243561038c565b604080519115158252519081900360200190f35b3480156101ad57600080fd5b506101b66103f7565b60408051918252519081900360200190f35b3480156101d457600080fd5b5061018d600160a060020a03600435811690602435166044356103fd565b3480156101fe57600080fd5b50610207610559565b6040805160ff9092168252519081900360200190f35b34801561022957600080fd5b506101b6600160a060020a036004351661055e565b34801561024a57600080fd5b50610253610579565b005b34801561026157600080fd5b5061026a6105be565b60408051600160a060020a039092168252519081900360200190f35b34801561029257600080fd5b506100f46105cd565b3480156102a757600080fd5b5061018d600160a060020a0360043516602435610604565b3480156102cb57600080fd5b5061026a6106cd565b3480156102e057600080fd5b5061018d600160a060020a03600435166024356106dc565b34801561030457600080fd5b506101b6600160a060020a0360043581169060243516610798565b34801561032b57600080fd5b506102536107c3565b34801561034057600080fd5b50610253600160a060020a0360043516610820565b60408051808201909152600881527f5445535420424554000000000000000000000000000000000000000000000000602082015281565b60008115806103bc5750336000908152600260209081526040808320600160a060020a0387168452909152902054155b15156103c757600080fd5b50336000908152600260209081526040808320600160a060020a0386168452909152902081905560015b92915050565b60005490565b600160a060020a03831660009081526001602052604081205482118015906104485750600160a060020a03841660009081526002602090815260408083203384529091529020548211155b80156104545750600082115b80156104795750600160a060020a038316600090815260016020526040902054828101115b1561054e57600160a060020a0384166000908152600160205260409020546104a7908363ffffffff61086616565b600160a060020a03851660009081526001602090815260408083209390935560028152828220338352905220546104e4908363ffffffff61086616565b600160a060020a038086166000908152600260209081526040808320338452825280832094909455918616815260019091522054610528908363ffffffff61087816565b600160a060020a0384166000908152600160208190526040909120919091559050610552565b5060005b9392505050565b601281565b600160a060020a031660009081526001602052604090205490565b600454600160a060020a03163314156105bc576004546003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b600354600160a060020a031681565b60408051808201909152600381527f4245540000000000000000000000000000000000000000000000000000000000602082015281565b3360009081526001602052604081205482118015906106235750600082115b80156106485750600160a060020a038316600090815260016020526040902054828101115b156106c5573360009081526001602052604090205461066d908363ffffffff61086616565b3360009081526001602052604080822092909255600160a060020a0385168152205461069f908363ffffffff61087816565b600160a060020a03841660009081526001602081905260409091209190915590506103f1565b5060006103f1565b600454600160a060020a031681565b600354600090600160a060020a031633146106f657600080fd5b600354604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810185905290519185169163a9059cbb916044808201926020929091908290030181600087803b15801561076557600080fd5b505af1158015610779573d6000803e3d6000fd5b505050506040513d602081101561078f57600080fd5b50519392505050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b336000908152600160205260409020546107ed9069021e19e0c9bab240000063ffffffff61087816565b336000908152600160205260408120919091555461081b9069021e19e0c9bab240000063ffffffff61087816565b600055565b600354600160a060020a0316331461083757600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008282111561087257fe5b50900390565b60008282018381101561055257fe00a165627a7a723058202f68356d1e342b428b0094c967e3de998416b181e3abb7cb2faeec0e20f31d110029", "deployedBytecode": "0x6080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd146101a157806323b872dd146101c8578063313ce567146101f257806370a082311461021d57806379ba50971461023e5780638da5cb5b1461025557806395d89b4114610286578063a9059cbb1461029b578063d4ee1d90146102bf578063dc39d06d146102d4578063dd62ed3e146102f8578063de5f72fd1461031f578063f2fde38b14610334575b600080fd5b3480156100eb57600080fd5b506100f4610355565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b5061018d600160a060020a036004351660243561038c565b604080519115158252519081900360200190f35b3480156101ad57600080fd5b506101b66103f7565b60408051918252519081900360200190f35b3480156101d457600080fd5b5061018d600160a060020a03600435811690602435166044356103fd565b3480156101fe57600080fd5b50610207610559565b6040805160ff9092168252519081900360200190f35b34801561022957600080fd5b506101b6600160a060020a036004351661055e565b34801561024a57600080fd5b50610253610579565b005b34801561026157600080fd5b5061026a6105be565b60408051600160a060020a039092168252519081900360200190f35b34801561029257600080fd5b506100f46105cd565b3480156102a757600080fd5b5061018d600160a060020a0360043516602435610604565b3480156102cb57600080fd5b5061026a6106cd565b3480156102e057600080fd5b5061018d600160a060020a03600435166024356106dc565b34801561030457600080fd5b506101b6600160a060020a0360043581169060243516610798565b34801561032b57600080fd5b506102536107c3565b34801561034057600080fd5b50610253600160a060020a0360043516610820565b60408051808201909152600881527f5445535420424554000000000000000000000000000000000000000000000000602082015281565b60008115806103bc5750336000908152600260209081526040808320600160a060020a0387168452909152902054155b15156103c757600080fd5b50336000908152600260209081526040808320600160a060020a0386168452909152902081905560015b92915050565b60005490565b600160a060020a03831660009081526001602052604081205482118015906104485750600160a060020a03841660009081526002602090815260408083203384529091529020548211155b80156104545750600082115b80156104795750600160a060020a038316600090815260016020526040902054828101115b1561054e57600160a060020a0384166000908152600160205260409020546104a7908363ffffffff61086616565b600160a060020a03851660009081526001602090815260408083209390935560028152828220338352905220546104e4908363ffffffff61086616565b600160a060020a038086166000908152600260209081526040808320338452825280832094909455918616815260019091522054610528908363ffffffff61087816565b600160a060020a0384166000908152600160208190526040909120919091559050610552565b5060005b9392505050565b601281565b600160a060020a031660009081526001602052604090205490565b600454600160a060020a03163314156105bc576004546003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b600354600160a060020a031681565b60408051808201909152600381527f4245540000000000000000000000000000000000000000000000000000000000602082015281565b3360009081526001602052604081205482118015906106235750600082115b80156106485750600160a060020a038316600090815260016020526040902054828101115b156106c5573360009081526001602052604090205461066d908363ffffffff61086616565b3360009081526001602052604080822092909255600160a060020a0385168152205461069f908363ffffffff61087816565b600160a060020a03841660009081526001602081905260409091209190915590506103f1565b5060006103f1565b600454600160a060020a031681565b600354600090600160a060020a031633146106f657600080fd5b600354604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810185905290519185169163a9059cbb916044808201926020929091908290030181600087803b15801561076557600080fd5b505af1158015610779573d6000803e3d6000fd5b505050506040513d602081101561078f57600080fd5b50519392505050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b336000908152600160205260409020546107ed9069021e19e0c9bab240000063ffffffff61087816565b336000908152600160205260408120919091555461081b9069021e19e0c9bab240000063ffffffff61087816565b600055565b600354600160a060020a0316331461083757600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008282111561087257fe5b50900390565b60008282018381101561055257fe00a165627a7a723058202f68356d1e342b428b0094c967e3de998416b181e3abb7cb2faeec0e20f31d110029", "sourceMap": "6066:1166:16:-;;;1905:1;1882:24;;6425:28;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1035:5:16;:18;;-1:-1:-1;;;;;;1035:18:16;1043:10;1035:18;;;6066:1166;;;;;;", "deployedSourceMap": "6066:1166:16:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6294:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6294:40:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;6294:40:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4066:622;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4066:622:16;-1:-1:-1;;;;;4066:622:16;;;;;;;;;;;;;;;;;;;;;;;;;2644:89;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2644:89:16;;;;;;;;;;;;;;;;;;;;5050:565;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5050:565:16;-1:-1:-1;;;;;5050:565:16;;;;;;;;;;;;6383:35;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6383:35:16;;;;;;;;;;;;;;;;;;;;;;;2969:113;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2969:113:16;-1:-1:-1;;;;;2969:113:16;;;;;1254:119;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1254:119:16;;;;;;948:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;948:20:16;;;;;;;;-1:-1:-1;;;;;948:20:16;;;;;;;;;;;;;;6340:37;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6340:37:16;;;;3316:394;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3316:394:16;-1:-1:-1;;;;;3316:394:16;;;;;;;974:23;;8:9:-1;5:2;;;30:1;27;20:12;5:2;974:23:16;;;;7041:189;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7041:189:16;-1:-1:-1;;;;;7041:189:16;;;;;;;5895:165;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5895:165:16;-1:-1:-1;;;;;5895:165:16;;;;;;;;;;6654:156;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6654:156:16;;;;1147:100;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1147:100:16;-1:-1:-1;;;;;1147:100:16;;;;;6294:40;;;;;;;;;;;;;;;;;;;:::o;4066:622::-;4165:12;4556;;;4555:54;;-1:-1:-1;4582:10:16;4574:19;;;;:7;:19;;;;;;;;-1:-1:-1;;;;;4574:29:16;;;;;;;;;;:34;4555:54;4547:63;;;;;;;;-1:-1:-1;4629:10:16;4621:19;;;;:7;:19;;;;;;;;-1:-1:-1;;;;;4621:29:16;;;;;;;;;:39;;;4677:4;4066:622;;;;;:::o;2644:89::-;2688:7;2714:12;2644:89;:::o;5050:565::-;-1:-1:-1;;;;;5205:15:16;;5172:12;5205:15;;;:8;:15;;;;;;:26;-1:-1:-1;5205:26:16;;;:67;;-1:-1:-1;;;;;;5235:14:16;;;;;;:7;:14;;;;;;;;5250:10;5235:26;;;;;;;;:37;-1:-1:-1;5235:37:16;5205:67;:82;;;;;5286:1;5276:7;:11;5205:82;:125;;;;-1:-1:-1;;;;;;5317:13:16;;;;;;:8;:13;;;;;;5291:23;;;:39;5205:125;5201:408;;;-1:-1:-1;;;;;5364:15:16;;;;;;:8;:15;;;;;;:28;;5384:7;5364:28;:19;:28;:::i;:::-;-1:-1:-1;;;;;5346:15:16;;;;;;:8;:15;;;;;;;;:46;;;;5435:7;:14;;;;;5450:10;5435:26;;;;;;:39;;5466:7;5435:39;:30;:39;:::i;:::-;-1:-1:-1;;;;;5406:14:16;;;;;;;:7;:14;;;;;;;;5421:10;5406:26;;;;;;;:68;;;;5504:13;;;;;:8;:13;;;;;:26;;5522:7;5504:26;:17;:26;:::i;:::-;-1:-1:-1;;;;;5488:13:16;;;;;;:8;:13;;;;;;;;:42;;;;:8;-1:-1:-1;5544:11:16;;5201:408;-1:-1:-1;5593:5:16;5201:408;5050:565;;;;;:::o;6383:35::-;6416:2;6383:35;:::o;2969:113::-;-1:-1:-1;;;;;3059:16:16;3025:15;3059:16;;;:8;:16;;;;;;;2969:113::o;1254:119::-;1316:8;;-1:-1:-1;;;;;1316:8:16;1302:10;:22;1298:69;;;1348:8;;1340:5;:16;;-1:-1:-1;;1340:16:16;-1:-1:-1;;;;;1348:8:16;;;1340:16;;;;;;1298:69;1254:119::o;948:20::-;;;-1:-1:-1;;;;;948:20:16;;:::o;6340:37::-;;;;;;;;;;;;;;;;;;;:::o;3316:394::-;3417:10;3380:12;3408:20;;;:8;:20;;;;;;:31;-1:-1:-1;3408:31:16;;;:46;;;3453:1;3443:7;:11;3408:46;:89;;;;-1:-1:-1;;;;;;3484:13:16;;;;;;:8;:13;;;;;;3458:23;;;:39;3408:89;3404:300;;;3545:10;3536:20;;;;:8;:20;;;;;;:33;;3561:7;3536:33;:24;:33;:::i;:::-;3522:10;3513:20;;;;:8;:20;;;;;;:56;;;;-1:-1:-1;;;;;3599:13:16;;;;;;:26;;3617:7;3599:26;:17;:26;:::i;:::-;-1:-1:-1;;;;;3583:13:16;;;;;;:8;:13;;;;;;;;:42;;;;:8;-1:-1:-1;3639:11:16;;3404:300;-1:-1:-1;3688:5:16;3681:12;;974:23;;;-1:-1:-1;;;;;974:23:16;;:::o;7041:189::-;1117:5;;7139:12;;-1:-1:-1;;;;;1117:5:16;1103:10;:19;1095:28;;;;;;7209:5;;7175:48;;;;;;-1:-1:-1;;;;;7209:5:16;;;7175:48;;;;;;;;;;;;:33;;;;;;:48;;;;;;;;;;;;;;;7209:5;7175:33;:48;;;5:2:-1;;;;30:1;27;20:12;5:2;7175:48:16;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;7175:48:16;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7175:48:16;;7041:189;-1:-1:-1;;;7041:189:16:o;5895:165::-;-1:-1:-1;;;;;6028:15:16;;;5992:17;6028:15;;;:7;:15;;;;;;;;:25;;;;;;;;;;;;;5895:165::o;6654:156::-;6721:10;6712:20;;;;:8;:20;;;;;;:37;;6737:11;6712:37;:24;:37;:::i;:::-;6698:10;6689:20;;;;:8;:20;;;;;:60;;;;6774:12;:29;;6791:11;6774:29;:16;:29;:::i;:::-;6759:12;:44;6654:156::o;1147:100::-;1117:5;;-1:-1:-1;;;;;1117:5:16;1103:10;:19;1095:28;;;;;;1220:8;:20;;-1:-1:-1;;1220:20:16;-1:-1:-1;;;;;1220:20:16;;;;;;;;;;1147:100::o;865:110:11:-;923:7;945:6;;;;938:14;;;;-1:-1:-1;965:5:11;;;865:110::o;1035:129::-;1093:7;1120:5;;;1138:6;;;;1131:14;;", "source": "pragma solidity ^0.4.11;\n\n// ----------------------------------------------------------------------------\n// Dao.Casino Crowdsale Token Contract\n//\n// NOTE: This is the new Dao.Casino token contract as the old Dao.Casino\n// crowdsale/token contract was attached to a buggy Parity multisig that\n// was vulnerable to hackers\n//\n// Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd for Dao.Casino 2017\n// The MIT Licence.\n// ----------------------------------------------------------------------------\n\n\n// ----------------------------------------------------------------------------\n// Safe maths, borrowed from OpenZeppelin\n// ----------------------------------------------------------------------------\nimport '../library/SafeMath.sol';\n\n\n// ----------------------------------------------------------------------------\n// Owned contract\n// ----------------------------------------------------------------------------\ncontract Owned {\n address public owner;\n address public newOwner;\n\n constructor() public {\n owner = msg.sender;\n }\n\n modifier onlyOwner {\n require(msg.sender == owner);\n _;\n }\n\n function transferOwnership(address _newOwner) public onlyOwner {\n newOwner = _newOwner;\n }\n \n function acceptOwnership() public {\n if (msg.sender == newOwner) {\n owner = newOwner;\n }\n }\n}\n\n// ----------------------------------------------------------------------------\n// ERC20 Token, with the addition of symbol, name and decimals\n// https://github.com/ethereum/EIPs/issues/20\n// ----------------------------------------------------------------------------\ncontract ERC20Token {\n using SafeMath for uint;\n\n // ------------------------------------------------------------------------\n // Total Supply\n // ------------------------------------------------------------------------\n uint256 _totalSupply = 0;\n\n // ------------------------------------------------------------------------\n // Balances for each account\n // ------------------------------------------------------------------------\n mapping(address => uint256) balances;\n\n // ------------------------------------------------------------------------\n // Owner of account approves the transfer of an amount to another account\n // ------------------------------------------------------------------------\n mapping(address => mapping (address => uint256)) allowed;\n\n // ------------------------------------------------------------------------\n // Get the total token supply\n // ------------------------------------------------------------------------\n function totalSupply() public view returns (uint256) {\n return _totalSupply;\n }\n\n // ------------------------------------------------------------------------\n // Get the account balance of another account with address _owner\n // ------------------------------------------------------------------------\n function balanceOf(address _owner) public view returns (uint256 balance) {\n return balances[_owner];\n }\n\n // ------------------------------------------------------------------------\n // Transfer the balance from owner's account to another account\n // ------------------------------------------------------------------------\n function transfer(address _to, uint256 _amount) public returns (bool success) {\n if (balances[msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) {\n balances[msg.sender] = balances[msg.sender].sub(_amount);\n balances[_to] = balances[_to].add(_amount);\n return true;\n } else {\n return false;\n }\n }\n\n // ------------------------------------------------------------------------\n // Allow _spender to withdraw from your account, multiple times, up to the\n // _value amount. If this function is called again it overwrites the\n // current allowance with _value.\n // ------------------------------------------------------------------------\n function approve(\n address _spender,\n uint256 _amount\n ) \n public returns (bool success) \n {\n // Borrowed from the MiniMeToken contract\n // To change the approve amount you first have to reduce the addresses`\n // allowance to zero by calling `approve(_spender,0)` if it is not\n // already 0 to mitigate the race condition described here:\n // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n require((_amount == 0) || (allowed[msg.sender][_spender] == 0));\n\n allowed[msg.sender][_spender] = _amount;\n return true;\n }\n\n // ------------------------------------------------------------------------\n // Spender of tokens transfer an amount of tokens from the token owner's\n // balance to the spender's account. The owner of the tokens must already\n // have approve(...)-d this transfer\n // ------------------------------------------------------------------------\n function transferFrom(\n address _from,\n address _to,\n uint256 _amount\n ) \n public returns (bool success) \n {\n if (balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) {\n balances[_from] = balances[_from].sub(_amount);\n allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);\n balances[_to] = balances[_to].add(_amount);\n return true;\n } else {\n return false;\n }\n }\n\n // ------------------------------------------------------------------------\n // Returns the amount of tokens approved by the owner that can be\n // transferred to the spender's account\n // ------------------------------------------------------------------------\n function allowance(\n address _owner, \n address _spender\n ) public view returns (uint256 remaining)\n {\n return allowed[_owner][_spender];\n }\n\n}\n\n\ncontract ERC20 is ERC20Token, Owned {\n\n // ------------------------------------------------------------------------\n // Token information\n // ------------------------------------------------------------------------\n string public constant name = \"TEST BET\";\n string public constant symbol = \"BET\";\n uint8 public constant decimals = 18;\n\n constructor() public {\n }\n\n // ------------------------------------------------------------------------\n // Only for testing in testnet\n // ------------------------------------------------------------------------\n function faucet() public {\n balances[msg.sender] = balances[msg.sender].add(10000 ether);\n _totalSupply = _totalSupply.add(10000 ether);\n }\n\n // ------------------------------------------------------------------------\n // Owner can transfer out any accidentally sent ERC20 tokens\n // ------------------------------------------------------------------------\n function transferAnyERC20Token(address tokenAddress, uint amount)\n public onlyOwner returns (bool success) \n {\n return ERC20Token(tokenAddress).transfer(owner, amount);\n }\n}", "sourcePath": "/Users/fanyshu/Documents/Projects/DCLabs/monorepo/packages/dc-sdk-example/dapp/contracts/token/ERC20.sol", "ast": { "absolutePath": "/Users/fanyshu/Documents/Projects/DCLabs/monorepo/packages/dc-sdk-example/dapp/contracts/token/ERC20.sol", "exportedSymbols": { "ERC20": [ 3262 ], "ERC20Token": [ 3200 ], "Owned": [ 2962 ] }, "id": 3263, "nodeType": "SourceUnit", "nodes": [ { "id": 2910, "literals": [ "solidity", "^", "0.4", ".11" ], "nodeType": "PragmaDirective", "src": "0:24:16" }, { "absolutePath": "/Users/fanyshu/Documents/Projects/DCLabs/monorepo/packages/dc-sdk-example/dapp/contracts/library/SafeMath.sol", "file": "../library/SafeMath.sol", "id": 2911, "nodeType": "ImportDirective", "scope": 3263, "sourceUnit": 1928, "src": "713:33:16", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 2962, "linearizedBaseContracts": [ 2962 ], "name": "Owned", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 2913, "name": "owner", "nodeType": "VariableDeclaration", "scope": 2962, "src": "948:20:16", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2912, "name": "address", "nodeType": "ElementaryTypeName", "src": "948:7:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 2915, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 2962, "src": "974:23:16", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2914, "name": "address", "nodeType": "ElementaryTypeName", "src": "974:7:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "body": { "id": 2923, "nodeType": "Block", "src": "1025:35:16", "statements": [ { "expression": { "argumentTypes": null, "id": 2921, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 2918, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2913, "src": "1035:5:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 2919, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3277, "src": "1043:3:16", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 2920, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1043:10:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1035:18:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 2922, "nodeType": "ExpressionStatement", "src": "1035:18:16" } ] }, "documentation": null, "id": 2924, "implemented": true, "isConstructor": true, "isDeclaredConst": false, "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 2916, "nodeType": "ParameterList", "parameters": [], "src": "1015:2:16" }, "payable": false, "returnParameters": { "id": 2917, "nodeType": "ParameterList", "parameters": [], "src": "1025:0:16" }, "scope": 2962, "src": "1004:56:16", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 2934, "nodeType": "Block", "src": "1085:56:16", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 2930, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 2927, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3277, "src": "1103:3:16", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 2928, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1103:10:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 2929, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2913, "src": "1117:5:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1103:19:16", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 2926, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 3280, 3281 ], "referencedDeclaration": 3280, "src": "1095:7:16", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 2931, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1095:28:16", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 2932, "nodeType": "ExpressionStatement", "src": "1095:28:16" }, { "id": 2933, "nodeType": "PlaceholderStatement", "src": "1133:1:16" } ] }, "documentation": null, "id": 2935, "name": "onlyOwner", "nodeType": "ModifierDefinition", "parameters": { "id": 2925, "nodeType": "ParameterList", "parameters": [], "src": "1085:0:16" }, "src": "1066:75:16", "visibility": "internal" }, { "body": { "id": 2946, "nodeType": "Block", "src": "1210:37:16", "statements": [ { "expression": { "argumentTypes": null, "id": 2944, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 2942, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2915, "src": "1220:8:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 2943, "name": "_newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2937, "src": "1231:9:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1220:20:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 2945, "nodeType": "ExpressionStatement", "src": "1220:20:16" } ] }, "documentation": null, "id": 2947, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [ { "arguments": null, "id": 2940, "modifierName": { "argumentTypes": null, "id": 2939, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2935, "src": "1200:9:16", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1200:9:16" } ], "name": "transferOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 2938, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2937, "name": "_newOwner", "nodeType": "VariableDeclaration", "scope": 2947, "src": "1174:17:16", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2936, "name": "address", "nodeType": "ElementaryTypeName", "src": "1174:7:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1173:19:16" }, "payable": false, "returnParameters": { "id": 2941, "nodeType": "ParameterList", "parameters": [], "src": "1210:0:16" }, "scope": 2962, "src": "1147:100:16", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 2960, "nodeType": "Block", "src": "1288:85:16", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 2953, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 2950, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3277, "src": "1302:3:16", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 2951, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1302:10:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 2952, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2915, "src": "1316:8:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1302:22:16", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 2959, "nodeType": "IfStatement", "src": "1298:69:16", "trueBody": { "id": 2958, "nodeType": "Block", "src": "1326:41:16", "statements": [ { "expression": { "argumentTypes": null, "id": 2956, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 2954, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2913, "src": "1340:5:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 2955, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2915, "src": "1348:8:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1340:16:16", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 2957, "nodeType": "ExpressionStatement", "src": "1340:16:16" } ] } } ] }, "documentation": null, "id": 2961, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "acceptOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 2948, "nodeType": "ParameterList", "parameters": [], "src": "1278:2:16" }, "payable": false, "returnParameters": { "id": 2949, "nodeType": "ParameterList", "parameters": [], "src": "1288:0:16" }, "scope": 2962, "src": "1254:119:16", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], "scope": 3263, "src": "927:448:16" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 3200, "linearizedBaseContracts": [ 3200 ], "name": "ERC20Token", "nodeType": "ContractDefinition", "nodes": [ { "id": 2965, "libraryName": { "contractScope": null, "id": 2963, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1927, "src": "1678:8:16", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$1927", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective",