arc_dx
Version:
A platform for building DAOs
995 lines (994 loc) • 263 kB
JSON
{
"contractName": "FixedReputationAllocation",
"abi": [
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
}
],
"name": "beneficiaries",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "numberOfBeneficiaries",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "redeemEnableTime",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "isEnable",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "avatar",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "beneficiaryReward",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "reputationReward",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_beneficiary",
"type": "address"
},
{
"indexed": false,
"name": "_amount",
"type": "uint256"
}
],
"name": "Redeem",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "_beneficiary",
"type": "address"
}
],
"name": "BeneficiaryAddressAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "previousOwner",
"type": "address"
}
],
"name": "OwnershipRenounced",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"constant": false,
"inputs": [
{
"name": "_avatar",
"type": "address"
},
{
"name": "_reputationReward",
"type": "uint256"
},
{
"name": "_redeemEnableTime",
"type": "uint256"
}
],
"name": "initialize",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_beneficiary",
"type": "address"
}
],
"name": "redeem",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_beneficiary",
"type": "address"
}
],
"name": "addBeneficiary",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_beneficiaries",
"type": "address[]"
}
],
"name": "addBeneficiaries",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "enable",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x608060405260008054600160a060020a03191633179055610a8c806100256000396000f3006080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630156773981146100df57806326e9a57e146101145780633d1678f41461013b5780634bb77d6814610150578063590411da146101655780635926651d146101bc5780635aef7de6146101dd578063715018a61461020e5780637a1ac61e146102235780638da5cb5b1461024a57806395a2251f1461025f578063a3907d7114610280578063d044de6314610295578063ed1ff6d8146102aa578063f2fde38b146102bf575b600080fd5b3480156100eb57600080fd5b50610100600160a060020a03600435166102e0565b604080519115158252519081900360200190f35b34801561012057600080fd5b506101296102f5565b60408051918252519081900360200190f35b34801561014757600080fd5b506101296102fb565b34801561015c57600080fd5b50610100610301565b34801561017157600080fd5b50604080516020600480358082013583810280860185019096528085526101ba9536959394602494938501929182918501908490808284375094975061030a9650505050505050565b005b3480156101c857600080fd5b506101ba600160a060020a036004351661035b565b3480156101e957600080fd5b506101f261047a565b60408051600160a060020a039092168252519081900360200190f35b34801561021a57600080fd5b506101ba610489565b34801561022f57600080fd5b506101ba600160a060020a03600435166024356044356104f5565b34801561025657600080fd5b506101f2610605565b34801561026b57600080fd5b50610100600160a060020a0360043516610614565b34801561028c57600080fd5b506101ba610940565b3480156102a157600080fd5b5061012961098e565b3480156102b657600080fd5b50610129610994565b3480156102cb57600080fd5b506101ba600160a060020a036004351661099a565b60016020526000908152604090205460ff1681565b60055481565b60075481565b60045460ff1681565b60008054600160a060020a0316331461032257600080fd5b5060005b81518110156103575761034f828281518110151561034057fe5b9060200190602002015161035b565b600101610326565b5050565b600054600160a060020a0316331461037257600080fd5b60045460ff16156103f3576040805160e560020a62461bcd02815260206004820152602e60248201527f63616e206164642062656e6566696369617279206f6e6c79206966206e6f742060448201527f616c726561647920656e61626c65000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03811660009081526001602052604090205460ff16151561047757600160a060020a038116600081815260016020818152604092839020805460ff19168317905560058054909201909155815192835290517f95b0b3bbe2a97e90a67cbf83ff77fbde1eb5b70051247f9d1a62822ccdc919979281900390910190a15b50565b600254600160a060020a031681565b600054600160a060020a031633146104a057600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a0316331461050c57600080fd5b600254600160a060020a03161561056d576040805160e560020a62461bcd02815260206004820152601b60248201527f63616e2062652063616c6c6564206f6e6c79206f6e652074696d650000000000604482015290519081900360640190fd5b600160a060020a03831615156105cd576040805160e560020a62461bcd02815260206004820152601560248201527f6176617461722063616e6e6f74206265207a65726f0000000000000000000000604482015290519081900360640190fd5b6003919091556007556002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031681565b60045460009060ff161515610673576040805160e560020a62461bcd02815260206004820152601460248201527f7265717569726520746f20626520656e61626c65000000000000000000000000604482015290519081900360640190fd5b600160a060020a03821660009081526001602052604090205460ff16151561070b576040805160e560020a62461bcd02815260206004820152603660248201527f72657175697265205f62656e656669636961727920746f20657869737420696e60448201527f207468652062656e65666963696172696573206d617000000000000000000000606482015290519081900360840190fd5b6007544211610764576040805160e560020a62461bcd02815260206004820152601e60248201527f72657175697265206e6f77203e2072656465656d456e61626c6554696d650000604482015290519081900360640190fd5b600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156107d057600080fd5b505af11580156107e4573d6000803e3d6000fd5b505050506040513d60208110156107fa57600080fd5b5051600654600254604080517feaf994b20000000000000000000000000000000000000000000000000000000081526004810193909352600160a060020a03868116602485015291821660448401525192169163eaf994b2916064808201926020929091908290030181600087803b15801561087557600080fd5b505af1158015610889573d6000803e3d6000fd5b505050506040513d602081101561089f57600080fd5b505115156108f7576040805160e560020a62461bcd02815260206004820152601e60248201527f6d696e742072657075746174696f6e2073686f756c6420737563636573730000604482015290519081900360640190fd5b6006546040805191825251600160a060020a038416917f222838db2794d11532d940e8dec38ae307ed0b63cd97c233322e221f998767a6919081900360200190a2506001919050565b600054600160a060020a0316331461095757600080fd5b6004805460ff191660011790556005546003546109869161098191601a0b9063ffffffff6109ba16565b6109d7565b601a0b600655565b60065481565b60035481565b600054600160a060020a031633146109b157600080fd5b610477816109e3565b6000816501000000000084028115156109cf57fe5b059392505050565b65010000000000900590565b600160a060020a03811615156109f857600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a72305820fed0873f2ac422089ef948787e3ca6467d12e9ad8ae99e43cd32955e34c620160029",
"deployedBytecode": "0x6080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630156773981146100df57806326e9a57e146101145780633d1678f41461013b5780634bb77d6814610150578063590411da146101655780635926651d146101bc5780635aef7de6146101dd578063715018a61461020e5780637a1ac61e146102235780638da5cb5b1461024a57806395a2251f1461025f578063a3907d7114610280578063d044de6314610295578063ed1ff6d8146102aa578063f2fde38b146102bf575b600080fd5b3480156100eb57600080fd5b50610100600160a060020a03600435166102e0565b604080519115158252519081900360200190f35b34801561012057600080fd5b506101296102f5565b60408051918252519081900360200190f35b34801561014757600080fd5b506101296102fb565b34801561015c57600080fd5b50610100610301565b34801561017157600080fd5b50604080516020600480358082013583810280860185019096528085526101ba9536959394602494938501929182918501908490808284375094975061030a9650505050505050565b005b3480156101c857600080fd5b506101ba600160a060020a036004351661035b565b3480156101e957600080fd5b506101f261047a565b60408051600160a060020a039092168252519081900360200190f35b34801561021a57600080fd5b506101ba610489565b34801561022f57600080fd5b506101ba600160a060020a03600435166024356044356104f5565b34801561025657600080fd5b506101f2610605565b34801561026b57600080fd5b50610100600160a060020a0360043516610614565b34801561028c57600080fd5b506101ba610940565b3480156102a157600080fd5b5061012961098e565b3480156102b657600080fd5b50610129610994565b3480156102cb57600080fd5b506101ba600160a060020a036004351661099a565b60016020526000908152604090205460ff1681565b60055481565b60075481565b60045460ff1681565b60008054600160a060020a0316331461032257600080fd5b5060005b81518110156103575761034f828281518110151561034057fe5b9060200190602002015161035b565b600101610326565b5050565b600054600160a060020a0316331461037257600080fd5b60045460ff16156103f3576040805160e560020a62461bcd02815260206004820152602e60248201527f63616e206164642062656e6566696369617279206f6e6c79206966206e6f742060448201527f616c726561647920656e61626c65000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03811660009081526001602052604090205460ff16151561047757600160a060020a038116600081815260016020818152604092839020805460ff19168317905560058054909201909155815192835290517f95b0b3bbe2a97e90a67cbf83ff77fbde1eb5b70051247f9d1a62822ccdc919979281900390910190a15b50565b600254600160a060020a031681565b600054600160a060020a031633146104a057600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a0316331461050c57600080fd5b600254600160a060020a03161561056d576040805160e560020a62461bcd02815260206004820152601b60248201527f63616e2062652063616c6c6564206f6e6c79206f6e652074696d650000000000604482015290519081900360640190fd5b600160a060020a03831615156105cd576040805160e560020a62461bcd02815260206004820152601560248201527f6176617461722063616e6e6f74206265207a65726f0000000000000000000000604482015290519081900360640190fd5b6003919091556007556002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031681565b60045460009060ff161515610673576040805160e560020a62461bcd02815260206004820152601460248201527f7265717569726520746f20626520656e61626c65000000000000000000000000604482015290519081900360640190fd5b600160a060020a03821660009081526001602052604090205460ff16151561070b576040805160e560020a62461bcd02815260206004820152603660248201527f72657175697265205f62656e656669636961727920746f20657869737420696e60448201527f207468652062656e65666963696172696573206d617000000000000000000000606482015290519081900360840190fd5b6007544211610764576040805160e560020a62461bcd02815260206004820152601e60248201527f72657175697265206e6f77203e2072656465656d456e61626c6554696d650000604482015290519081900360640190fd5b600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156107d057600080fd5b505af11580156107e4573d6000803e3d6000fd5b505050506040513d60208110156107fa57600080fd5b5051600654600254604080517feaf994b20000000000000000000000000000000000000000000000000000000081526004810193909352600160a060020a03868116602485015291821660448401525192169163eaf994b2916064808201926020929091908290030181600087803b15801561087557600080fd5b505af1158015610889573d6000803e3d6000fd5b505050506040513d602081101561089f57600080fd5b505115156108f7576040805160e560020a62461bcd02815260206004820152601e60248201527f6d696e742072657075746174696f6e2073686f756c6420737563636573730000604482015290519081900360640190fd5b6006546040805191825251600160a060020a038416917f222838db2794d11532d940e8dec38ae307ed0b63cd97c233322e221f998767a6919081900360200190a2506001919050565b600054600160a060020a0316331461095757600080fd5b6004805460ff191660011790556005546003546109869161098191601a0b9063ffffffff6109ba16565b6109d7565b601a0b600655565b60065481565b60035481565b600054600160a060020a031633146109b157600080fd5b610477816109e3565b6000816501000000000084028115156109cf57fe5b059392505050565b65010000000000900590565b600160a060020a03811615156109f857600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a72305820fed0873f2ac422089ef948787e3ca6467d12e9ad8ae99e43cd32955e34c620160029",
"sourceMap": "352:2862:11:-;;;567:5:55;:18;;-1:-1:-1;;;;;;567:18:55;575:10;567:18;;;352:2862:11;;;;;;",
"deployedSourceMap": "352:2862:11:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;644:45;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;644:45:11;-1:-1:-1;;;;;644:45:11;;;;;;;;;;;;;;;;;;;;;;;782:33;;8:9:-1;5:2;;;30:1;27;20:12;5:2;782:33:11;;;;;;;;;;;;;;;;;;;;856:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;856:28:11;;;;756:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;756:20:11;;;;2751:195;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2751:195:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2751:195:11;;-1:-1:-1;2751:195:11;;-1:-1:-1;;;;;;;2751:195:11;;;2303:345;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2303:345:11;-1:-1:-1;;;;;2303:345:11;;;;;696:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;696:20:11;;;;;;;;-1:-1:-1;;;;;696:20:11;;;;;;;;;;;;;;1001:111:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1001:111:55;;;;1120:361:11;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1120:361:11;-1:-1:-1;;;;;1120:361:11;;;;;;;;;238:20:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;238:20:55;;;;1621:579:11;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1621:579:11;-1:-1:-1;;;;;1621:579:11;;;;;2996:216;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2996:216:11;;;;821:29;;8:9:-1;5:2;;;30:1;27;20:12;5:2;821:29:11;;;;722:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;722:28:11;;;;1274:103:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1274:103:55;-1:-1:-1;;;;;1274:103:55;;;;;644:45:11;;;;;;;;;;;;;;;:::o;782:33::-;;;;:::o;856:28::-;;;;:::o;756:20::-;;;;;;:::o;2751:195::-;2835:9;719:5:55;;-1:-1:-1;;;;;719:5:55;705:10;:19;697:28;;;;;;-1:-1:-1;2847:1:11;2830:110;2854:14;:21;2850:1;:25;2830:110;;;2896:33;2911:14;2926:1;2911:17;;;;;;;;;;;;;;;;;;2896:14;:33::i;:::-;2877:3;;2830:110;;;2751:195;;:::o;2303:345::-;719:5:55;;-1:-1:-1;;;;;719:5:55;705:10;:19;697:28;;;;;;2385:8:11;;;;2384:9;2376:68;;;;;-1:-1:-1;;;;;2376:68:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2460:27:11;;;;;;:13;:27;;;;;;;;2459:28;2455:187;;;-1:-1:-1;;;;;2503:27:11;;;;;;2533:4;2503:27;;;;;;;;;:34;;-1:-1:-1;;2503:34:11;;;;;2551:21;:23;;;;;;;;2594:37;;;;;;;;;;;;;;;;;2455:187;2303:345;:::o;696:20::-;;;-1:-1:-1;;;;;696:20:11;;:::o;1001:111:55:-;719:5;;-1:-1:-1;;;;;719:5:55;705:10;:19;697:28;;;;;;1077:5;;;1058:25;;-1:-1:-1;;;;;1077:5:55;;;;1058:25;;;1105:1;1089:18;;-1:-1:-1;;1089:18:55;;;1001:111::o;1120:361:11:-;719:5:55;;-1:-1:-1;;;;;719:5:55;705:10;:19;697:28;;;;;;1241:6:11;;-1:-1:-1;;;;;1241:6:11;:19;1233:59;;;;;-1:-1:-1;;;;;1233:59:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1310:20:11;;;;1302:54;;;;;-1:-1:-1;;;;;1302:54:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;1366:16;:36;;;;1412:16;:36;1458:6;:16;;-1:-1:-1;;1458:16:11;-1:-1:-1;;;;;1458:16:11;;;;;;;;;;1120:361::o;238:20:55:-;;;-1:-1:-1;;;;;238:20:55;;:::o;1621:579:11:-;1698:8;;1674:4;;1698:8;;1690:41;;;;;;;-1:-1:-1;;;;;1690:41:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1749:27:11;;;;;;:13;:27;;;;;;;;1741:94;;;;;;;-1:-1:-1;;;;;1741:94:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1921:16;;1915:3;:22;1907:65;;;;;-1:-1:-1;;;;;1907:65:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;2010:6;;;;;;;;;-1:-1:-1;;;;;2010:6:11;-1:-1:-1;;;;;2010:12:11;;:14;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2010:14:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2010:14:11;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2010:14:11;2041:17;;2074:6;;1990:91;;;;;;;;;;;;;-1:-1:-1;;;;;1990:91:11;;;;;;;2074:6;;;1990:91;;;;;:50;;;;;:91;;;;;2010:14;;1990:91;;;;;;;;2074:6;1990:50;:91;;;5:2:-1;;;;30:1;27;20:12;5:2;1990:91:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1990:91:11;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1990:91:11;1982:134;;;;;;;-1:-1:-1;;;;;1982:134:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;2153:17;;2132:39;;;;;;;-1:-1:-1;;;;;2132:39:11;;;;;;;;;;;;;-1:-1:-1;2189:4:11;1621:579;;;:::o;2996:216::-;719:5:55;;-1:-1:-1;;;;;719:5:55;705:10;:19;697:28;;;;;;3041:8:11;:15;;-1:-1:-1;;3041:15:11;3052:4;3041:15;;;3170:21;;3141:16;;3134:70;;:59;;:28;;;:59;:28;:59;:::i;:::-;:68;:70::i;:::-;3126:79;;3106:17;:99;2996:216::o;821:29::-;;;;:::o;722:28::-;;;;:::o;1274:103:55:-;719:5;;-1:-1:-1;;;;;719:5:55;705:10;:19;697:28;;;;;;1343:29;1362:9;1343:18;:29::i;5040:348:8:-;5122:6;5364:15;1184:23;5321:32;;5320:60;;;;;;;;;5040:348;-1:-1:-1;;;5040:348:8:o;2307:119::-;1184:23;2398:20;;;2307:119::o;1512:171:55:-;-1:-1:-1;;;;;1582:23:55;;;;1574:32;;;;;;1638:5;;;1617:38;;-1:-1:-1;;;;;1617:38:55;;;;1638:5;;;1617:38;;;1661:5;:17;;-1:-1:-1;;1661:17:55;-1:-1:-1;;;;;1661:17:55;;;;;;;;;;1512:171::o",
"source": "pragma solidity ^0.4.25;\n\nimport \"../controller/ControllerInterface.sol\";\nimport { RealMath } from \"../libs/RealMath.sol\";\nimport \"openzeppelin-solidity/contracts/ownership/Ownable.sol\";\n\n\n/**\n * @title A fixed reputation allocation contract\n * This scheme can be used to allocate a pre define amount of reputation to whitelisted\n * beneficiaries.\n */\ncontract FixedReputationAllocation is Ownable {\n using SafeMath for uint;\n using RealMath for int216;\n using RealMath for int256;\n\n event Redeem(address indexed _beneficiary, uint _amount);\n event BeneficiaryAddressAdded(address _beneficiary);\n\n // beneficiary -> exist\n mapping(address => bool) public beneficiaries;\n\n Avatar public avatar;\n uint public reputationReward;\n bool public isEnable;\n uint public numberOfBeneficiaries;\n uint public beneficiaryReward;\n uint public redeemEnableTime;\n\n /**\n * @dev initialize\n * @param _avatar the avatar to mint reputation from\n * @param _reputationReward the total reputation this contract will reward\n * @param _redeemEnableTime time to enable redeem\n */\n function initialize(Avatar _avatar, uint _reputationReward, uint _redeemEnableTime) external onlyOwner {\n require(avatar == Avatar(0), \"can be called only one time\");\n require(_avatar != Avatar(0), \"avatar cannot be zero\");\n reputationReward = _reputationReward;\n redeemEnableTime = _redeemEnableTime;\n avatar = _avatar;\n }\n\n /**\n * @dev redeem reputation function\n * @param _beneficiary the beneficiary for the release\n * @return bool\n */\n function redeem(address _beneficiary) public returns(bool) {\n require(isEnable, \"require to be enable\");\n require(beneficiaries[_beneficiary], \"require _beneficiary to exist in the beneficiaries map\");\n // solium-disable-next-line security/no-block-members\n require(now > redeemEnableTime, \"require now > redeemEnableTime\");\n require(ControllerInterface(avatar.owner()).mintReputation(beneficiaryReward, _beneficiary, avatar), \"mint reputation should success\");\n\n emit Redeem(_beneficiary, beneficiaryReward);\n\n return true;\n }\n\n /**\n * @dev addBeneficiary function\n * @param _beneficiary to be whitelisted\n */\n function addBeneficiary(address _beneficiary) public onlyOwner {\n require(!isEnable, \"can add beneficiary only if not already enable\");\n\n if (!beneficiaries[_beneficiary]) {\n beneficiaries[_beneficiary] = true;\n numberOfBeneficiaries++;\n\n emit BeneficiaryAddressAdded(_beneficiary);\n }\n }\n\n /**\n * @dev add addBeneficiaries function\n * @param _beneficiaries addresses\n */\n function addBeneficiaries(address[] _beneficiaries) public onlyOwner {\n for (uint256 i = 0; i < _beneficiaries.length; i++) {\n addBeneficiary(_beneficiaries[i]);\n }\n }\n\n /**\n * @dev enable function\n */\n function enable() public onlyOwner {\n isEnable = true;\n // Calculate beneficiary reward\n beneficiaryReward = uint256(int216(reputationReward).div(int256(numberOfBeneficiaries)).fromReal());\n }\n}\n",
"sourcePath": "/Users/oren/daostack/daostack2/daostack/contracts/schemes/FixedReputationAllocation.sol",
"ast": {
"absolutePath": "/Users/oren/daostack/daostack2/daostack/contracts/schemes/FixedReputationAllocation.sol",
"exportedSymbols": {
"FixedReputationAllocation": [
5702
]
},
"id": 5703,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 5484,
"literals": [
"solidity",
"^",
"0.4",
".25"
],
"nodeType": "PragmaDirective",
"src": "0:24:11"
},
{
"absolutePath": "/Users/oren/daostack/daostack2/daostack/contracts/controller/ControllerInterface.sol",
"file": "../controller/ControllerInterface.sol",
"id": 5485,
"nodeType": "ImportDirective",
"scope": 5703,
"sourceUnit": 2007,
"src": "26:47:11",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/Users/oren/daostack/daostack2/daostack/contracts/libs/RealMath.sol",
"file": "../libs/RealMath.sol",
"id": 5487,
"nodeType": "ImportDirective",
"scope": 5703,
"sourceUnit": 4958,
"src": "74:48:11",
"symbolAliases": [
{
"foreign": 5486,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol",
"file": "openzeppelin-solidity/contracts/ownership/Ownable.sol",
"id": 5488,
"nodeType": "ImportDirective",
"scope": 5703,
"sourceUnit": 20878,
"src": "123:63:11",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 5489,
"name": "Ownable",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 20877,
"src": "390:7:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Ownable_$20877",
"typeString": "contract Ownable"
}
},
"id": 5490,
"nodeType": "InheritanceSpecifier",
"src": "390:7:11"
}
],
"contractDependencies": [
20877
],
"contractKind": "contract",
"documentation": "@title A fixed reputation allocation contract\nThis scheme can be used to allocate a pre define amount of reputation to whitelisted\nbeneficiaries.",
"fullyImplemented": true,
"id": 5702,
"linearizedBaseContracts": [
5702,
20877
],
"name": "FixedReputationAllocation",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 5493,
"libraryName": {
"contractScope": null,
"id": 5491,
"name": "SafeMath",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 20791,
"src": "410:8:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SafeMath_$20791",
"typeString": "library SafeMath"
}
},
"nodeType": "UsingForDirective",
"src": "404:24:11",
"typeName": {
"id": 5492,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "423:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
{
"id": 5496,
"libraryName": {
"contractScope": null,
"id": 5494,
"name": "RealMath",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4957,
"src": "439:8:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_RealMath_$4957",
"typeString": "library RealMath"
}
},
"nodeType": "UsingForDirective",
"src": "433:26:11",
"typeName": {
"id": 5495,
"name": "int216",
"nodeType": "ElementaryTypeName",
"src": "452:6:11",
"typeDescriptions": {
"typeIdentifier": "t_int216",
"typeString": "int216"
}
}
},
{
"id": 5499,
"libraryName": {
"contractScope": null,
"id": 5497,
"name": "RealMath",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4957,
"src": "470:8:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_RealMath_$4957",
"typeString": "library RealMath"
}
},
"nodeType": "UsingForDirective",
"src": "464:26:11",
"typeName": {
"id": 5498,
"name": "int256",
"nodeType": "ElementaryTypeName",
"src": "483:6:11",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
}
},
{
"anonymous": false,
"documentation": null,
"id": 5505,
"name": "Redeem",
"nodeType": "EventDefinition",
"parameters": {
"id": 5504,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5501,
"indexed": true,
"name": "_beneficiary",
"nodeType": "VariableDeclaration",
"scope": 5505,
"src": "509:28:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 5500,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "509:7:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 5503,
"indexed": false,
"name": "_amount",
"nodeType": "VariableDeclaration",
"scope": 5505,
"src": "539:12:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5502,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "539:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "508:44:11"
},
"src": "496:57:11"
},
{
"anonymous": false,
"documentation": null,
"id": 5509,
"name": "BeneficiaryAddressAdded",
"nodeType": "EventDefinition",
"parameters": {
"id": 5508,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5507,
"indexed": false,
"name": "_beneficiary",
"nodeType": "VariableDeclaration",
"scope": 5509,
"src": "588:20:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 5506,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "588:7:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "587:22:11"
},
"src": "558:52:11"
},
{
"constant": false,
"id": 5513,
"name": "beneficiaries",
"nodeType": "VariableDeclaration",
"scope": 5702,
"src": "644:45:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
},
"typeName": {
"id": 5512,
"keyType": {
"id": 5510,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "652:7:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "644:24:11",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_bool_$",
"typeString": "mapping(address => bool)"
},
"valueType": {
"id": 5511,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "663:4:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 5515,
"name": "avatar",
"nodeType": "VariableDeclaration",
"scope": 5702,
"src": "696:20:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Avatar_$333",
"typeString": "contract Avatar"
},
"typeName": {
"contractScope": null,
"id": 5514,
"name": "Avatar",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 333,
"src": "696:6:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Avatar_$333",
"typeString": "contract Avatar"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 5517,
"name": "reputationReward",
"nodeType": "VariableDeclaration",
"scope": 5702,
"src": "722:28:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5516,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "722:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 5519,
"name": "isEnable",
"nodeType": "VariableDeclaration",
"scope": 5702,
"src": "756:20:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 5518,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "756:4:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 5521,
"name": "numberOfBeneficiaries",
"nodeType": "VariableDeclaration",
"scope": 5702,
"src": "782:33:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5520,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "782:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 5523,
"name": "beneficiaryReward",
"nodeType": "VariableDeclaration",
"scope": 5702,
"src": "821:29:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5522,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "821:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 5525,
"name": "redeemEnableTime",
"nodeType": "VariableDeclaration",
"scope": 5702,
"src": "856:28:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5524,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "856:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"body": {
"id": 5566,
"nodeType": "Block",
"src": "1223:258:11",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_Avatar_$333",
"typeString": "contract Avatar"
},
"id": 5541,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 5537,
"name": "avatar",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5515,
"src": "1241:6:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Avatar_$333",
"typeString": "contract Avatar"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 5539,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1258:1:11",
"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": 5538,
"name": "Avatar",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 333,
"src": "1251:6:11",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_Avatar_$333_$",
"typeString": "type(contract Avatar)"
}
},
"id": 5540,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1251:9:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Avatar_$333",
"typeString": "contract Avatar"
}
},
"src": "1241:19:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "63616e2062652063616c6c6564206f6e6c79206f6e652074696d65",
"id": 5542,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1262:29:11",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_61459d8c2e83c03ac4ccaf4013950b2282c585e1eb42ab84ceae1eecfe85edd8",
"typeString": "literal_string \"can be called only one time\""
},
"value": "can be called only one time"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_61459d8c2e83c03ac4ccaf4013950b2282c585e1eb42ab84ceae1eecfe85edd8",
"typeString": "literal_string \"can be called only one time\""
}
],
"id": 5536,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
21552,
21553
],
"referencedDeclaration": 21553,
"src": "1233:7:11",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 5543,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1233:59:11",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 5544,
"nodeType": "ExpressionStatement",
"src": "1233:59:11"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_contract$_Avatar_$333",
"typeString": "contract Avatar"
},
"id": 5550,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 5546,
"name": "_avatar",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5527,
"src": "1310:7:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Avatar_$333",
"typeString": "contract Avatar"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 5548,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1328:1:11",
"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": 5547,
"name": "Avatar",