UNPKG

arc_dx

Version:

A platform for building DAOs

869 lines (868 loc) 315 kB
{ "contractName": "VotingMachineCallbacks", "abi": [ { "constant": true, "inputs": [ { "name": "_proposalId", "type": "bytes32" } ], "name": "getTotalReputationSupply", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "_amount", "type": "uint256" }, { "name": "_beneficiary", "type": "address" }, { "name": "_proposalId", "type": "bytes32" } ], "name": "mintReputation", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_amount", "type": "uint256" }, { "name": "_beneficiary", "type": "address" }, { "name": "_proposalId", "type": "bytes32" } ], "name": "burnReputation", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "name": "_owner", "type": "address" }, { "name": "_proposalId", "type": "bytes32" } ], "name": "reputationOf", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "_stakingToken", "type": "address" }, { "name": "_beneficiary", "type": "address" }, { "name": "_amount", "type": "uint256" }, { "name": "_proposalId", "type": "bytes32" } ], "name": "stakingTokenTransfer", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "name": "_stakingToken", "type": "address" }, { "name": "_proposalId", "type": "bytes32" } ], "name": "balanceOfStakingToken", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "bytecode": "0x608060405234801561001057600080fd5b50610a38806100206000396000f30060806040526004361061005e5763ffffffff60e060020a6000350416636b8eb40381146100635780639588378e14610099578063b551c373146100bd578063bea75f28146100d5578063d29b5d2f14610116578063f81f8bf61461013d575b600080fd5b34801561006f57600080fd5b50610087600160a060020a0360043516602435610164565b60408051918252519081900360200190f35b3480156100a557600080fd5b50610087600160a060020a0360043516602435610210565b3480156100c957600080fd5b50610087600435610349565b3480156100e157600080fd5b50610102600160a060020a03600435811690602435166044356064356104ae565b604080519115158252519081900360200190f35b34801561012257600080fd5b50610102600435600160a060020a0360243516604435610686565b34801561014957600080fd5b50610102600435600160a060020a0360243516604435610855565b6000818152602081815260408083206001015481517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a039182166004820181905292519293918716926370a082319260248084019391929182900301818887803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b505050506040513d602081101561020457600080fd5b505191505b5092915050565b600061021a6109ec565b50600082815260208181526040918290208251606081018452815481526001820154600160a060020a0390811693820184905260029092015490911692810192909252151561026c5760009150610209565b8060200151600160a060020a03166389ae1c906040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156102ae57600080fd5b505af11580156102c2573d6000803e3d6000fd5b505050506040513d60208110156102d857600080fd5b50518151604080517f4ee2cd7e000000000000000000000000000000000000000000000000000000008152600160a060020a038881166004830152602482019390935290519190921691634ee2cd7e9160448083019260209291908290030181600087803b1580156101da57600080fd5b60006103536109ec565b50600082815260208181526040918290208251606081018452815481526001820154600160a060020a039081169382018490526002909201549091169281019290925215156103a557600091506104a8565b8060200151600160a060020a03166389ae1c906040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156103e757600080fd5b505af11580156103fb573d6000803e3d6000fd5b505050506040513d602081101561041157600080fd5b50518151604080517f981b24d0000000000000000000000000000000000000000000000000000000008152600481019290925251600160a060020a039092169163981b24d0916024808201926020929091908290030181600087803b15801561047957600080fd5b505af115801561048d573d6000803e3d6000fd5b505050506040513d60208110156104a357600080fd5b505191505b50919050565b60008181526020819052604081206002015481908390600160a060020a0316331461053a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6f6e6c7920566f74696e674d616368696e650000000000000000000000000000604482015290519081900360640190fd5b600084815260208190526040902060010154600160a060020a03169150811515610567576000925061067c565b81600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156105a557600080fd5b505af11580156105b9573d6000803e3d6000fd5b505050506040513d60208110156105cf57600080fd5b5051604080517fb9a04cdd000000000000000000000000000000000000000000000000000000008152600160a060020a038a8116600483015289811660248301526044820189905285811660648301529151919092169163b9a04cdd9160848083019260209291908290030181600087803b15801561064d57600080fd5b505af1158015610661573d6000803e3d6000fd5b505050506040513d602081101561067757600080fd5b505192505b5050949350505050565b60008181526020819052604081206002015481908390600160a060020a0316331461071257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6f6e6c7920566f74696e674d616368696e650000000000000000000000000000604482015290519081900360640190fd5b600084815260208190526040902060010154600160a060020a0316915081151561073f576000925061084c565b81600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561077d57600080fd5b505af1158015610791573d6000803e3d6000fd5b505050506040513d60208110156107a757600080fd5b5051604080517feaf994b200000000000000000000000000000000000000000000000000000000815260048101899052600160a060020a03888116602483015285811660448301529151919092169163eaf994b29160648083019260209291908290030181600087803b15801561081d57600080fd5b505af1158015610831573d6000803e3d6000fd5b505050506040513d602081101561084757600080fd5b505192505b50509392505050565b60008181526020819052604081206002015481908390600160a060020a031633146108e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6f6e6c7920566f74696e674d616368696e650000000000000000000000000000604482015290519081900360640190fd5b600084815260208190526040902060010154600160a060020a0316915081151561090e576000925061084c565b81600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561094c57600080fd5b505af1158015610960573d6000803e3d6000fd5b505050506040513d602081101561097657600080fd5b5051604080517f6e94d27800000000000000000000000000000000000000000000000000000000815260048101899052600160a060020a038881166024830152858116604483015291519190921691636e94d2789160648083019260209291908290030181600087803b15801561081d57600080fd5b6040805160608101825260008082526020820181905291810191909152905600a165627a7a72305820e6a090d9bae4056c37ce3a71783b47db9b725c7d5b2ffa4a081615a12fb56afc0029", "deployedBytecode": "0x60806040526004361061005e5763ffffffff60e060020a6000350416636b8eb40381146100635780639588378e14610099578063b551c373146100bd578063bea75f28146100d5578063d29b5d2f14610116578063f81f8bf61461013d575b600080fd5b34801561006f57600080fd5b50610087600160a060020a0360043516602435610164565b60408051918252519081900360200190f35b3480156100a557600080fd5b50610087600160a060020a0360043516602435610210565b3480156100c957600080fd5b50610087600435610349565b3480156100e157600080fd5b50610102600160a060020a03600435811690602435166044356064356104ae565b604080519115158252519081900360200190f35b34801561012257600080fd5b50610102600435600160a060020a0360243516604435610686565b34801561014957600080fd5b50610102600435600160a060020a0360243516604435610855565b6000818152602081815260408083206001015481517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a039182166004820181905292519293918716926370a082319260248084019391929182900301818887803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b505050506040513d602081101561020457600080fd5b505191505b5092915050565b600061021a6109ec565b50600082815260208181526040918290208251606081018452815481526001820154600160a060020a0390811693820184905260029092015490911692810192909252151561026c5760009150610209565b8060200151600160a060020a03166389ae1c906040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156102ae57600080fd5b505af11580156102c2573d6000803e3d6000fd5b505050506040513d60208110156102d857600080fd5b50518151604080517f4ee2cd7e000000000000000000000000000000000000000000000000000000008152600160a060020a038881166004830152602482019390935290519190921691634ee2cd7e9160448083019260209291908290030181600087803b1580156101da57600080fd5b60006103536109ec565b50600082815260208181526040918290208251606081018452815481526001820154600160a060020a039081169382018490526002909201549091169281019290925215156103a557600091506104a8565b8060200151600160a060020a03166389ae1c906040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156103e757600080fd5b505af11580156103fb573d6000803e3d6000fd5b505050506040513d602081101561041157600080fd5b50518151604080517f981b24d0000000000000000000000000000000000000000000000000000000008152600481019290925251600160a060020a039092169163981b24d0916024808201926020929091908290030181600087803b15801561047957600080fd5b505af115801561048d573d6000803e3d6000fd5b505050506040513d60208110156104a357600080fd5b505191505b50919050565b60008181526020819052604081206002015481908390600160a060020a0316331461053a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6f6e6c7920566f74696e674d616368696e650000000000000000000000000000604482015290519081900360640190fd5b600084815260208190526040902060010154600160a060020a03169150811515610567576000925061067c565b81600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156105a557600080fd5b505af11580156105b9573d6000803e3d6000fd5b505050506040513d60208110156105cf57600080fd5b5051604080517fb9a04cdd000000000000000000000000000000000000000000000000000000008152600160a060020a038a8116600483015289811660248301526044820189905285811660648301529151919092169163b9a04cdd9160848083019260209291908290030181600087803b15801561064d57600080fd5b505af1158015610661573d6000803e3d6000fd5b505050506040513d602081101561067757600080fd5b505192505b5050949350505050565b60008181526020819052604081206002015481908390600160a060020a0316331461071257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6f6e6c7920566f74696e674d616368696e650000000000000000000000000000604482015290519081900360640190fd5b600084815260208190526040902060010154600160a060020a0316915081151561073f576000925061084c565b81600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561077d57600080fd5b505af1158015610791573d6000803e3d6000fd5b505050506040513d60208110156107a757600080fd5b5051604080517feaf994b200000000000000000000000000000000000000000000000000000000815260048101899052600160a060020a03888116602483015285811660448301529151919092169163eaf994b29160648083019260209291908290030181600087803b15801561081d57600080fd5b505af1158015610831573d6000803e3d6000fd5b505050506040513d602081101561084757600080fd5b505192505b50509392505050565b60008181526020819052604081206002015481908390600160a060020a031633146108e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6f6e6c7920566f74696e674d616368696e650000000000000000000000000000604482015290519081900360640190fd5b600084815260208190526040902060010154600160a060020a0316915081151561090e576000925061084c565b81600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561094c57600080fd5b505af1158015610960573d6000803e3d6000fd5b505050506040513d602081101561097657600080fd5b5051604080517f6e94d27800000000000000000000000000000000000000000000000000000000815260048101899052600160a060020a038881166024830152858116604483015291519190921691636e94d2789160648083019260209291908290030181600087803b15801561081d57600080fd5b6040805160608101825260008082526020820181905291810191909152905600a165627a7a72305820e6a090d9bae4056c37ce3a71783b47db9b725c7d5b2ffa4a081615a12fb56afc0029", "sourceMap": "149:2665:39:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;149:2665:39;;;;;;;", "deployedSourceMap": "149:2665:39:-;;;;;;;;;-1:-1:-1;;;149:2665:39;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2581:231;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2581:231:39;-1:-1:-1;;;;;2581:231:39;;;;;;;;;;;;;;;;;;;;;;;1759:328;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1759:328:39;-1:-1:-1;;;;;1759:328:39;;;;;;;668:323;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;668:323:39;;;;;2093:482;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2093:482:39;-1:-1:-1;;;;;2093:482:39;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;997:375;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;997:375:39;;;-1:-1:-1;;;;;997:375:39;;;;;;;1378;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1378:375:39;;;-1:-1:-1;;;;;1378:375:39;;;;;;;2581:231;2683:4;2715:26;;;;;;;;;;;:33;;;2765:40;;;;;-1:-1:-1;;;;;2715:33:39;;;2765:40;;;;;;;;2715:33;;2765:23;;;;;;:40;;;;;2715:26;;2765:40;;;;;;2683:4;2765:23;:40;;;5:2:-1;;;;30:1;27;20:12;5:2;2765:40:39;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2765:40:39;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2765:40:39;;-1:-1:-1;2581:231:39;;;;;;:::o;1759:328::-;1839:4;1855:28;;:::i;:::-;-1:-1:-1;1886:13:39;:26;;;;;;;;;;;;1855:57;;;;;;;;;;;;;;;-1:-1:-1;;;;;1855:57:39;;;;;;;;;;;;;;;;;;;;;;;;1926:28;1922:67;;;1977:1;1970:8;;;;1922:67;2005:8;:15;;;-1:-1:-1;;;;;2005:32:39;;:34;;;;;-1:-1:-1;;;2005:34:39;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2005:34:39;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2005:34:39;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2005:34:39;2059:20;;2005:75;;;;;;-1:-1:-1;;;;;2005:75:39;;;;;;;;;;;;;;;;:46;;;;;;;:75;;;;;:34;;:75;;;;;;;2059:20;2005:46;:75;;;5:2:-1;;;;30:1;27;20:12;668:323:39;745:7;764:28;;:::i;:::-;-1:-1:-1;795:13:39;:26;;;;;;;;;;;;764:57;;;;;;;;;;;;;;;-1:-1:-1;;;;;764:57:39;;;;;;;;;;;;;;;;;;;;;;;;835:28;831:67;;;886:1;879:8;;;;831:67;914:8;:15;;;-1:-1:-1;;;;;914:32:39;;:34;;;;;-1:-1:-1;;;914:34:39;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;914:34:39;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;914:34:39;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;914:34:39;963:20;;914:70;;;;;;;;;;;;;;-1:-1:-1;;;;;914:48:39;;;;;;:70;;;;;:34;;:70;;;;;;;;963:20;914:48;:70;;;5:2:-1;;;;30:1;27;20:12;5:2;914:70:39;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;914:70:39;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;914:70:39;;-1:-1:-1;668:323:39;;;;;:::o;2093:482::-;2302:4;472:26;;;;;;;;;;:40;;;2302:4;;472:26;;-1:-1:-1;;;;;472:40:39;458:10;:54;450:84;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2338:13;:26;;;;;;;;;;:33;;;-1:-1:-1;;;;;2338:33:39;;-1:-1:-1;2385:19:39;;2381:62;;;2427:5;2420:12;;;;2381:62;2479:6;-1:-1:-1;;;;;2479:12:39;;:14;;;;;-1:-1:-1;;;2479:14:39;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2479:14:39;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2479:14:39;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2479:14:39;2459:109;;;;;;-1:-1:-1;;;;;2459:109:39;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:57;;;;;;;:109;;;;;2479:14;;2459:109;;;;;;;-1:-1:-1;2459:57:39;:109;;;5:2:-1;;;;30:1;27;20:12;5:2;2459:109:39;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2459:109:39;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2459:109:39;;-1:-1:-1;544:1:39;2093:482;;;;;;;;:::o;997:375::-;1124:4;472:26;;;;;;;;;;:40;;;1124:4;;472:26;;-1:-1:-1;;;;;472:40:39;458:10;:54;450:84;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1156:13;:26;;;;;;;;;;:33;;;-1:-1:-1;;;;;1156:33:39;;-1:-1:-1;1203:19:39;;1199:62;;;1245:5;1238:12;;;;1199:62;1297:6;-1:-1:-1;;;;;1297:12:39;;:14;;;;;-1:-1:-1;;;1297:14:39;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1297:14:39;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1297:14:39;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1297:14:39;1277:88;;;;;;;;;;;;-1:-1:-1;;;;;1277:88:39;;;;;;;;;;;;;;;;:50;;;;;;;:88;;;;;1297:14;;1277:88;;;;;;;-1:-1:-1;1277:50:39;:88;;;5:2:-1;;;;30:1;27;20:12;5:2;1277:88:39;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1277:88:39;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1277:88:39;;-1:-1:-1;544:1:39;997:375;;;;;;;:::o;1378:::-;1505:4;472:26;;;;;;;;;;:40;;;1505:4;;472:26;;-1:-1:-1;;;;;472:40:39;458:10;:54;450:84;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1537:13;:26;;;;;;;;;;:33;;;-1:-1:-1;;;;;1537:33:39;;-1:-1:-1;1584:19:39;;1580:62;;;1626:5;1619:12;;;;1580:62;1678:6;-1:-1:-1;;;;;1678:12:39;;:14;;;;;-1:-1:-1;;;1678:14:39;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1678:14:39;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1678:14:39;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1678:14:39;1658:88;;;;;;;;;;;;-1:-1:-1;;;;;1658:88:39;;;;;;;;;;;;;;;;:50;;;;;;;:88;;;;;1678:14;;1658:88;;;;;;;-1:-1:-1;1658:50:39;:88;;;5:2:-1;;;;30:1;27;20:12;149:2665:39;;;;;;;;;-1:-1:-1;149:2665:39;;;;;;;;;;;;;;;;;:::o", "source": "pragma solidity ^0.4.25;\n\nimport \"../universalSchemes/UniversalScheme.sol\";\nimport \"@daostack/infra/contracts/votingMachines/GenesisProtocol.sol\";\n\n\ncontract VotingMachineCallbacks is VotingMachineCallbacksInterface {\n\n struct ProposalInfo {\n uint blockNumber; // the proposal's block number\n Avatar avatar; // the proposal's avatar\n address votingMachine;\n }\n\n modifier onlyVotingMachine(bytes32 _proposalId) {\n require(msg.sender == proposalsInfo[_proposalId].votingMachine,\"only VotingMachine\");\n _;\n }\n //proposalId -> ProposalInfo\n mapping(bytes32 => ProposalInfo ) proposalsInfo;\n\n function getTotalReputationSupply(bytes32 _proposalId) external view returns(uint256) {\n ProposalInfo memory proposal = proposalsInfo[_proposalId];\n if (proposal.avatar == Avatar(0)) {\n return 0;\n }\n return proposal.avatar.nativeReputation().totalSupplyAt(proposal.blockNumber);\n }\n\n function mintReputation(uint _amount,address _beneficiary,bytes32 _proposalId) external onlyVotingMachine(_proposalId) returns(bool) {\n Avatar avatar = proposalsInfo[_proposalId].avatar;\n if (avatar == Avatar(0)) {\n return false;\n }\n return ControllerInterface(avatar.owner()).mintReputation(_amount,_beneficiary,address(avatar));\n }\n\n function burnReputation(uint _amount,address _beneficiary,bytes32 _proposalId) external onlyVotingMachine(_proposalId) returns(bool) {\n Avatar avatar = proposalsInfo[_proposalId].avatar;\n if (avatar == Avatar(0)) {\n return false;\n }\n return ControllerInterface(avatar.owner()).burnReputation(_amount,_beneficiary,address(avatar));\n }\n\n function reputationOf(address _owner,bytes32 _proposalId) external view returns(uint) {\n ProposalInfo memory proposal = proposalsInfo[_proposalId];\n if (proposal.avatar == Avatar(0)) {\n return 0;\n }\n return proposal.avatar.nativeReputation().balanceOfAt(_owner,proposal.blockNumber);\n }\n\n function stakingTokenTransfer(\n StandardToken _stakingToken,\n address _beneficiary,\n uint _amount,\n bytes32 _proposalId)\n external\n onlyVotingMachine(_proposalId)\n returns(bool)\n {\n Avatar avatar = proposalsInfo[_proposalId].avatar;\n if (avatar == Avatar(0)) {\n return false;\n }\n return ControllerInterface(avatar.owner()).externalTokenTransfer(_stakingToken,_beneficiary,_amount,address(avatar));\n }\n\n function balanceOfStakingToken(StandardToken _stakingToken,bytes32 _proposalId) external view returns(uint) {\n Avatar avatar = proposalsInfo[_proposalId].avatar;\n return _stakingToken.balanceOf(address(avatar));\n }\n}\n", "sourcePath": "/Users/oren/daostack/daostack2/daostack/contracts/votingMachines/VotingMachineCallbacks.sol", "ast": { "absolutePath": "/Users/oren/daostack/daostack2/daostack/contracts/votingMachines/VotingMachineCallbacks.sol", "exportedSymbols": { "VotingMachineCallbacks": [ 12959 ] }, "id": 12960, "nodeType": "SourceUnit", "nodes": [ { "id": 12698, "literals": [ "solidity", "^", "0.4", ".25" ], "nodeType": "PragmaDirective", "src": "0:24:39" }, { "absolutePath": "/Users/oren/daostack/daostack2/daostack/contracts/universalSchemes/UniversalScheme.sol", "file": "../universalSchemes/UniversalScheme.sol", "id": 12699, "nodeType": "ImportDirective", "scope": 12960, "sourceUnit": 10669, "src": "26:49:39", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@daostack/infra/contracts/votingMachines/GenesisProtocol.sol", "file": "@daostack/infra/contracts/votingMachines/GenesisProtocol.sol", "id": 12700, "nodeType": "ImportDirective", "scope": 12960, "sourceUnit": 20209, "src": "76:70:39", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 12701, "name": "VotingMachineCallbacksInterface", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 20588, "src": "184:31:39", "typeDescriptions": { "typeIdentifier": "t_contract$_VotingMachineCallbacksInterface_$20588", "typeString": "contract VotingMachineCallbacksInterface" } }, "id": 12702, "nodeType": "InheritanceSpecifier", "src": "184:31:39" } ], "contractDependencies": [ 20588 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 12959, "linearizedBaseContracts": [ 12959, 20588 ], "name": "VotingMachineCallbacks", "nodeType": "ContractDefinition", "nodes": [ { "canonicalName": "VotingMachineCallbacks.ProposalInfo", "id": 12709, "members": [ { "constant": false, "id": 12704, "name": "blockNumber", "nodeType": "VariableDeclaration", "scope": 12709, "src": "253:16:39", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 12703, "name": "uint", "nodeType": "ElementaryTypeName", "src": "253:4:39", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 12706, "name": "avatar", "nodeType": "VariableDeclaration", "scope": 12709, "src": "310:13:39", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Avatar_$333", "typeString": "contract Avatar" }, "typeName": { "contractScope": null, "id": 12705, "name": "Avatar", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 333, "src": "310:6:39", "typeDescriptions": { "typeIdentifier": "t_contract$_Avatar_$333", "typeString": "contract Avatar" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 12708, "name": "votingMachine", "nodeType": "VariableDeclaration", "scope": 12709, "src": "358:21:39", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 12707, "name": "address", "nodeType": "ElementaryTypeName", "src": "358:7:39", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "name": "ProposalInfo", "nodeType": "StructDefinition", "scope": 12959, "src": "223:163:39", "visibility": "public" }, { "body": { "id": 12725, "nodeType": "Block", "src": "440:112:39", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 12720, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 12714, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21549, "src": "458:3:39", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 12715, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "458:10:39", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 12716, "name": "proposalsInfo", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 12730, "src": "472:13:39", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_ProposalInfo_$12709_storage_$", "typeString": "mapping(bytes32 => struct VotingMachineCallbacks.ProposalInfo storage ref)" } }, "id": 12718, "indexExpression": { "argumentTypes": null, "id": 12717, "name": "_proposalId", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 12711, "src": "486:11:39", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "472:26:39", "typeDescriptions": { "typeIdentifier": "t_struct$_ProposalInfo_$12709_storage", "typeString": "struct VotingMachineCallbacks.ProposalInfo storage ref" } }, "id": 12719, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "votingMachine", "nodeType": "MemberAccess", "referencedDeclaration": 12708, "src": "472:40:39", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "458:54:39", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "6f6e6c7920566f74696e674d616368696e65", "id": 12721, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "513:20:39", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_d09f602d792b11aff19268ca8644e6115c2e269c3f2202bcaa79f7e4908e11bb", "typeString": "literal_string \"only VotingMachine\"" }, "value": "only VotingMachine" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_d09f602d792b11aff19268ca8644e6115c2e269c3f2202bcaa79f7e4908e11bb", "typeString": "literal_string \"only VotingMachine\"" } ], "id": 12713, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 21552, 21553 ], "referencedDeclaration": 21553, "src": "450:7:39", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 12722, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "450:84:39", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 12723, "nodeType": "ExpressionStatement", "src": "450:84:39" }, { "id": 12724, "nodeType": "PlaceholderStatement", "src": "544:1:39" } ] }, "documentation": null, "id": 12726, "name": "onlyVotingMachine", "nodeType": "ModifierDefinition", "parameters": { "id": 12712, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 12711, "name": "_proposalId", "nodeType": "VariableDeclaration", "scope": 12726, "src": "419:19:39", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 12710, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "419:7:39", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "src": "418:21:39" }, "src": "392:160:39", "visibility": "internal" }, { "constant": false, "id": 12730, "name": "proposalsInfo", "nodeType": "VariableDeclaration", "scope": 12959, "src": "602:59:39", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_ProposalInfo_$12709_storage_$", "typeString": "mapping(bytes32 => struct VotingMachineCallbacks.ProposalInfo)" }, "typeName": { "id": 12729, "keyType": { "id": 12727, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "610:7:39", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "Mapping", "src": "602:45:39", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_ProposalInfo_$12709_storage_$", "typeString": "mapping(bytes32 => struct VotingMachineCallbacks.ProposalInfo)" }, "valueType": { "contractScope": null, "id": 12728, "name": "ProposalInfo", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 12709, "src": "630:12:39", "typeDescriptions": { "typeIdentifier": "t_struct$_ProposalInfo_$12709_storage_ptr", "typeString": "struct VotingMachineCallbacks.ProposalInfo" } } }, "value": null, "visibility": "internal" }, { "body": { "id": 12762, "nodeType": "Block", "src": "754:237:39", "statements": [ { "assignments": [ 12738 ], "declarations": [ { "constant": false, "id": 12738, "name": "proposal", "nodeType": "VariableDeclaration", "scope": 12763, "src": "764:28:39", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_ProposalInfo_$12709_memory_ptr", "typeString": "struct VotingMachineCallbacks.ProposalInfo" }, "typeName": { "contractScope": null, "id": 12737, "name": "ProposalInfo", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 12709, "src": "764:12:39", "typeDescriptions": { "typeIdentifier": "t_struct$_ProposalInfo_$12709_storage_ptr", "typeString": "struct VotingMachineCallbacks.ProposalInfo" } }, "value": null, "visibility": "internal" } ], "id": 12742, "initialValue": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 12739, "name": "proposalsInfo", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 12730, "src": "795:13:39", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_ProposalInfo_$12709_storage_$", "typeString": "mapping(bytes32 => struct VotingMachineCallbacks.ProposalInfo storage ref)" } }, "id": 12741, "indexExpression": { "argumentTypes": null, "id": 12740, "name": "_proposalId", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 12732, "src": "809:11:39", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "795:26:39", "typeDescriptions": { "typeIdentifier": "t_struct$_ProposalInfo_$12709_storage", "typeString": "struct VotingMachineCallbacks.ProposalInfo storage ref" } }, "nodeType": "VariableDeclarationStatement", "src": "764:57:39" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_contract$_Avatar_$333", "typeString": "contract Avatar" }, "id": 12748, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 12743, "name": "proposal", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 12738, "src": "835:8:39", "typeDescriptions": { "typeIdentifier": "t_struct$_ProposalInfo_$12709_memory_ptr", "typeString": "struct VotingMachineCallbacks.ProposalInfo memory" } }, "id": 12744, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "avatar", "nodeType": "MemberAccess", "referencedDeclaration": 12706, "src": "835:15:39", "typeDescriptions": { "typeIdentifier": "t_contract$_Avatar_$333", "typeString": "contract Avatar" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 12746, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "861:1:39", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 12745, "name": "Avatar", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 333, "src": "854:6:39", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Avatar_$333_$", "typeString": "type(contract Avatar)" } }, "id": 12747, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "854:9:39", "typeDescriptions": { "typeIdentifier": "t_contract$_Avatar_$333", "typeString": "contract Avatar" } }, "src": "835:28:39", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 12752, "nodeType": "IfStatement", "src": "831:67:39", "trueBody": { "id": 12751, "nodeType": "Block", "src": "865:33:39", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "30", "id": 12749, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "886:1:39", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "functionReturnParameters": 12736, "id": 12750, "nodeType": "Return", "src": "879:8:39" } ] } }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 12758, "name": "proposal", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 12738, "src": "963:8:39", "typeDescriptions": { "typeIdentifier": "t_struct$_ProposalInfo_$12709_memory_ptr", "typeString": "struct VotingMachineCallbacks.ProposalInfo memory" } }, "id": 12759, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "blockNumber", "nodeType": "MemberAccess", "referencedDeclaration": 12704, "src": "963:20:39", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [],