arc_dx
Version:
A platform for building DAOs
889 lines • 541 kB
JSON
{
"contractName": "Reputation",
"abi": [
{
"constant": true,
"inputs": [],
"name": "creationBlock",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"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": false,
"inputs": [
{
"name": "_newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_to",
"type": "address"
},
{
"indexed": false,
"name": "_amount",
"type": "uint256"
}
],
"name": "Mint",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_from",
"type": "address"
},
{
"indexed": false,
"name": "_amount",
"type": "uint256"
}
],
"name": "Burn",
"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": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "balance",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_blockNumber",
"type": "uint256"
}
],
"name": "balanceOfAt",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_blockNumber",
"type": "uint256"
}
],
"name": "totalSupplyAt",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_amount",
"type": "uint256"
}
],
"name": "mint",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_amount",
"type": "uint256"
}
],
"name": "burn",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x60806040526000805460a060020a60ff0219167412000000000000000000000000000000000000000017905534801561003757600080fd5b5060008054600160a060020a03191633179055436001556108fa8061005d6000396000f3006080604052600436106100ae5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631763451481146100b357806318160ddd146100da578063313ce567146100ef57806340c10f191461011a5780634ee2cd7e1461015257806370a0823114610176578063715018a6146101975780638da5cb5b146101ae578063981b24d0146101df5780639dc29fac146101f7578063f2fde38b1461021b575b600080fd5b3480156100bf57600080fd5b506100c861023c565b60408051918252519081900360200190f35b3480156100e657600080fd5b506100c8610242565b3480156100fb57600080fd5b50610104610253565b6040805160ff9092168252519081900360200190f35b34801561012657600080fd5b5061013e600160a060020a0360043516602435610274565b604080519115158252519081900360200190f35b34801561015e57600080fd5b506100c8600160a060020a036004351660243561033e565b34801561018257600080fd5b506100c8600160a060020a03600435166103d2565b3480156101a357600080fd5b506101ac6103e6565b005b3480156101ba57600080fd5b506101c3610452565b60408051600160a060020a039092168252519081900360200190f35b3480156101eb57600080fd5b506100c8600435610461565b34801561020357600080fd5b5061013e600160a060020a03600435166024356104b5565b34801561022757600080fd5b506101ac600160a060020a0360043516610581565b60015481565b600061024d43610461565b90505b90565b60005474010000000000000000000000000000000000000000900460ff1681565b6000805481908190600160a060020a0316331461029057600080fd5b610298610242565b91508382018211156102a957600080fd5b6102b2856103d2565b90508381018111156102c357600080fd5b6102d060038584016105a4565b600160a060020a03851660009081526002602052604090206102f4908286016105a4565b604080518581529051600160a060020a038716917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a2506001949350505050565b600160a060020a038216600090815260026020526040812054158061039a5750600160a060020a03831660009081526002602052604081208054849290811061038357fe5b6000918252602090912001546001608060020a0316115b156103a7575060006103cc565b600160a060020a03831660009081526002602052604090206103c990836106ad565b90505b92915050565b60006103de824361033e565b90505b919050565b600054600160a060020a031633146103fd57600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031681565b60035460009015806104965750816003600081548110151561047f57fe5b6000918252602090912001546001608060020a0316115b156104a3575060006103e1565b6104ae6003836106ad565b90506103e1565b60008054819081908190600160a060020a031633146104d357600080fd5b6104db610242565b9250849150818310156104ec578291505b6104f5866103d2565b905081811015610503578091505b61051060038385036105a4565b600160a060020a0386166000908152600260205260409020610534908383036105a4565b604080518381529051600160a060020a038816917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2600193505b50505092915050565b600054600160a060020a0316331461059857600080fd5b6105a18161080a565b50565b6000806001608060020a03831683146105bc57600080fd5b835415806105f0575083544390859060001981019081106105d957fe5b6000918252602090912001546001608060020a0316105b1561066257835484906106068260018301610887565b8154811061061057fe5b600091825260209091200180546001608060020a03858116700100000000000000000000000000000000024382166fffffffffffffffffffffffffffffffff19909316929092171617815591506106a7565b83548490600019810190811061067457fe5b600091825260209091200180546001608060020a0380861670010000000000000000000000000000000002911617815590505b50505050565b6000806000808580549050600014156106c95760009350610578565b8554869060001981019081106106db57fe5b6000918252602090912001546001608060020a031685106107385785548690600019810190811061070857fe5b60009182526020909120015470010000000000000000000000000000000090046001608060020a03169350610578565b85600081548110151561074757fe5b6000918252602090912001546001608060020a031685101561076c5760009350610578565b8554600093506000190191505b828211156107c957600260018385010104905084868281548110151561079b57fe5b6000918252602090912001546001608060020a0316116107bd578092506107c4565b6001810391505b610779565b85838154811015156107d757fe5b60009182526020909120015470010000000000000000000000000000000090046001608060020a03169695505050505050565b600160a060020a038116151561081f57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b8154818355818111156108ab576000838152602090206108ab9181019083016108b0565b505050565b61025091905b808211156108ca57600081556001016108b6565b50905600a165627a7a72305820cc3cd9b636e8a525bc979f82e8950f9db4530ccb0f2ac4f05d213970dd1b67d30029",
"deployedBytecode": "0x6080604052600436106100ae5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631763451481146100b357806318160ddd146100da578063313ce567146100ef57806340c10f191461011a5780634ee2cd7e1461015257806370a0823114610176578063715018a6146101975780638da5cb5b146101ae578063981b24d0146101df5780639dc29fac146101f7578063f2fde38b1461021b575b600080fd5b3480156100bf57600080fd5b506100c861023c565b60408051918252519081900360200190f35b3480156100e657600080fd5b506100c8610242565b3480156100fb57600080fd5b50610104610253565b6040805160ff9092168252519081900360200190f35b34801561012657600080fd5b5061013e600160a060020a0360043516602435610274565b604080519115158252519081900360200190f35b34801561015e57600080fd5b506100c8600160a060020a036004351660243561033e565b34801561018257600080fd5b506100c8600160a060020a03600435166103d2565b3480156101a357600080fd5b506101ac6103e6565b005b3480156101ba57600080fd5b506101c3610452565b60408051600160a060020a039092168252519081900360200190f35b3480156101eb57600080fd5b506100c8600435610461565b34801561020357600080fd5b5061013e600160a060020a03600435166024356104b5565b34801561022757600080fd5b506101ac600160a060020a0360043516610581565b60015481565b600061024d43610461565b90505b90565b60005474010000000000000000000000000000000000000000900460ff1681565b6000805481908190600160a060020a0316331461029057600080fd5b610298610242565b91508382018211156102a957600080fd5b6102b2856103d2565b90508381018111156102c357600080fd5b6102d060038584016105a4565b600160a060020a03851660009081526002602052604090206102f4908286016105a4565b604080518581529051600160a060020a038716917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a2506001949350505050565b600160a060020a038216600090815260026020526040812054158061039a5750600160a060020a03831660009081526002602052604081208054849290811061038357fe5b6000918252602090912001546001608060020a0316115b156103a7575060006103cc565b600160a060020a03831660009081526002602052604090206103c990836106ad565b90505b92915050565b60006103de824361033e565b90505b919050565b600054600160a060020a031633146103fd57600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031681565b60035460009015806104965750816003600081548110151561047f57fe5b6000918252602090912001546001608060020a0316115b156104a3575060006103e1565b6104ae6003836106ad565b90506103e1565b60008054819081908190600160a060020a031633146104d357600080fd5b6104db610242565b9250849150818310156104ec578291505b6104f5866103d2565b905081811015610503578091505b61051060038385036105a4565b600160a060020a0386166000908152600260205260409020610534908383036105a4565b604080518381529051600160a060020a038816917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2600193505b50505092915050565b600054600160a060020a0316331461059857600080fd5b6105a18161080a565b50565b6000806001608060020a03831683146105bc57600080fd5b835415806105f0575083544390859060001981019081106105d957fe5b6000918252602090912001546001608060020a0316105b1561066257835484906106068260018301610887565b8154811061061057fe5b600091825260209091200180546001608060020a03858116700100000000000000000000000000000000024382166fffffffffffffffffffffffffffffffff19909316929092171617815591506106a7565b83548490600019810190811061067457fe5b600091825260209091200180546001608060020a0380861670010000000000000000000000000000000002911617815590505b50505050565b6000806000808580549050600014156106c95760009350610578565b8554869060001981019081106106db57fe5b6000918252602090912001546001608060020a031685106107385785548690600019810190811061070857fe5b60009182526020909120015470010000000000000000000000000000000090046001608060020a03169350610578565b85600081548110151561074757fe5b6000918252602090912001546001608060020a031685101561076c5760009350610578565b8554600093506000190191505b828211156107c957600260018385010104905084868281548110151561079b57fe5b6000918252602090912001546001608060020a0316116107bd578092506107c4565b6001810391505b610779565b85838154811015156107d757fe5b60009182526020909120015470010000000000000000000000000000000090046001608060020a03169695505050505050565b600160a060020a038116151561081f57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b8154818355818111156108ab576000838152602090206108ab9181019083016108b0565b505050565b61025091905b808211156108ca57600081556001016108b6565b50905600a165627a7a72305820cc3cd9b636e8a525bc979f82e8950f9db4530ccb0f2ac4f05d213970dd1b67d30029",
"sourceMap": "574:7109:40:-;;;612:26;;;-1:-1:-1;;;;;;612:26:40;;;;;1863:75;5:2:-1;;;;30:1;27;20:12;5:2;-1:-1;567:5:55;:18;;-1:-1:-1;;;;;;567:18:55;575:10;567:18;;;1919:12:40;567:18:55;1903:28:40;574:7109;;;;;;",
"deployedSourceMap": "574:7109:40:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1421:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1421:25:40;;;;;;;;;;;;;;;;;;;;2070:101;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2070:101:40;;;;612:26;;8:9:-1;5:2;;;30:1;27;20:12;5:2;612:26:40;;;;;;;;;;;;;;;;;;;;;;;4092:554;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4092:554:40;;;-1:-1:-1;;;;;4092:554:40;;;;;;;;;;;;;;;;;;;;;;;2825:382;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2825:382:40;;;-1:-1:-1;;;;;2825:382:40;;;;;2413:130;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2413:130:40;;;-1:-1:-1;;;;;2413:130:40;;;1001:111:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1001:111:55;;;;;;238:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;238:20:55;;;;;;;;-1:-1:-1;;;;;238:20:55;;;;;;;;;;;;;;3434:369:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3434:369:40;;;;;4899:697;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4899:697:40;;;-1:-1:-1;;;;;4899:697:40;;;;;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;;;1421:25:40;;;;:::o;2070:101::-;2114:4;2137:27;2151:12;2137:13;:27::i;:::-;2130:34;;2070:101;;:::o;612:26::-;;;;;;;;;:::o;4092:554::-;4162:4;719:5:55;;4162:4:40;;;;-1:-1:-1;;;;;719:5:55;705:10;:19;697:28;;;;;;4200:13:40;:11;:13::i;:::-;4178:35;-1:-1:-1;4231:24:40;;;:42;-1:-1:-1;4231:42:40;4223:51;;;;;;4331:17;4341:6;4331:9;:17::i;:::-;4306:42;-1:-1:-1;4366:27:40;;;:48;-1:-1:-1;4366:48:40;4358:57;;;;;;4447:62;4464:18;4501:7;4484:14;:24;4447:16;:62::i;:::-;-1:-1:-1;;;;;4536:16:40;;;;;;-1:-1:-1;4536:16:40;;;;;4519:63;;4554:27;;;4519:16;:63::i;:::-;4597:21;;;;;;;;-1:-1:-1;;;;;4597:21:40;;;;;;;;;;;;;-1:-1:-1;4635:4:40;;4092:554;-1:-1:-1;;;;4092:554:40:o;2825:382::-;-1:-1:-1;;;;;2931:16:40;;2906:4;2931:16;;;-1:-1:-1;2931:16:40;;;;;:23;:28;;2930:80;;-1:-1:-1;;;;;;2965:16:40;;;;;;-1:-1:-1;2965:16:40;;;;;:19;;2997:12;;2965:16;:19;;;;;;;;;;;;;;;:29;-1:-1:-1;;;;;2965:29:40;:44;2930:80;2926:275;;;-1:-1:-1;3033:1:40;3026:8;;2926:275;-1:-1:-1;;;;;3159:16:40;;;;;;-1:-1:-1;3159:16:40;;;;;3148:42;;3177:12;3148:10;:42::i;:::-;3141:49;;2926:275;2825:382;;;;:::o;2413:130::-;2469:15;2503:33;2515:6;2523:12;2503:11;:33::i;:::-;2496:40;;2413:130;;;;:::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;238:20::-;;;-1:-1:-1;;;;;238:20:55;;:::o;3434:369:40:-;3517:18;:25;3496:4;;3517:30;;3516:84;;;3587:12;3553:18;3572:1;3553:21;;;;;;;;;;;;;;;;;;;:31;-1:-1:-1;;;;;3553:31:40;:46;3516:84;3512:285;;;-1:-1:-1;3623:1:40;3616:8;;3512:285;3742:44;3753:18;3773:12;3742:10;:44::i;:::-;3735:51;;;;4899:697;4969:4;719:5:55;;4969:4:40;;;;;;-1:-1:-1;;;;;719:5:55;705:10;:19;697:28;;;;;;5007:13:40;:11;:13::i;:::-;4985:35;;5050:7;5030:27;;5088:12;5071:14;:29;5067:89;;;5131:14;5116:29;;5067:89;5192:17;5202:6;5192:9;:17::i;:::-;5165:44;;5245:12;5223:19;:34;5219:99;;;5288:19;5273:34;;5219:99;5380:67;5397:18;5434:12;5417:14;:29;5380:16;:67::i;:::-;-1:-1:-1;;;;;5474:16:40;;;;;;-1:-1:-1;5474:16:40;;;;;5457:70;;5492:34;;;5457:16;:70::i;:::-;5542:26;;;;;;;;-1:-1:-1;;;;;5542:26:40;;;;;;;;;;;;;5585:4;5578:11;;731:1:55;4899:697:40;;;;;;;:::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;:::-;1274:103;:::o;7043:638:40:-;7334:32;;-1:-1:-1;;;;;7143:25:40;;;;7135:34;;;;;;7228:18;;:23;;7227:91;;-1:-1:-1;7269:18:40;;7305:12;;7269:18;;-1:-1:-1;;7269:22:40;;;7257:35;;;;;;;;;;;;;;;:45;-1:-1:-1;;;;;7257:45:40;:60;7227:91;7223:452;;;7381:20;;7369:11;;7381:20;7369:11;7381:20;;;;:::i;:::-;7369:33;;;;;;;;;;;;;;;;;7416:47;;-1:-1:-1;;7416:47:40;7450:12;-1:-1:-1;;;;;7416:47:40;;;;;;;7477:37;;;;;-1:-1:-1;7477:37:40;;;;7369:33;-1:-1:-1;7223:452:40;;;7592:18;;;;-1:-1:-1;;7592:20:40;;;7580:33;;;;;;;;;;;;;;;7627:37;;-1:-1:-1;;;;;7627:37:40;;;;;;-1:-1:-1;7627:37:40;;;;7580:33;-1:-1:-1;7223:452:40;7043:638;;;;:::o;5992:821::-;6082:4;6487:8;6509;6582;6102:11;:18;;;;6124:1;6102:23;6098:62;;;6148:1;6141:8;;;;6098:62;6239:18;;;;-1:-1:-1;;6239:20:40;;;6227:33;;;;;;;;;;;;;;;:43;-1:-1:-1;;;;;6227:43:40;6217:53;;6213:130;;6305:18;;;;-1:-1:-1;;6305:20:40;;;6293:33;;;;;;;;;;;;;;;:39;;;;-1:-1:-1;;;;;6293:39:40;;-1:-1:-1;6286:46:40;;6213:130;6365:11;6377:1;6365:14;;;;;;;;;;;;;;;;;;;:24;-1:-1:-1;;;;;6365:24:40;6356:33;;6352:72;;;6412:1;6405:8;;;;6352:72;6520:18;;6498:1;;-1:-1:-1;;;6520:20:40;;-1:-1:-1;6550:218:40;6563:3;6557;:9;6550:218;;;6611:1;6606;6594:9;;;:13;6593:19;6582:30;;6658:6;6630:11;6642:3;6630:16;;;;;;;;;;;;;;;;;;;:26;-1:-1:-1;;;;;6630:26:40;:34;6626:132;;6690:3;6684:9;;6626:132;;;6742:1;6738:3;:5;6732:11;;6626:132;6550:218;;;6784:11;6796:3;6784:16;;;;;;;;;;;;;;;;;;;:22;;;;-1:-1:-1;;;;;6784:22:40;;;-1:-1:-1;;;;;;5992:821:40: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;574:7109:40:-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;",
"source": "pragma solidity ^0.4.25;\n\nimport \"openzeppelin-solidity/contracts/ownership/Ownable.sol\";\n\n\n/**\n * @title Reputation system\n * @dev A DAO has Reputation System which allows peers to rate other peers in order to build trust .\n * A reputation is use to assign influence measure to a DAO'S peers.\n * Reputation is similar to regular tokens but with one crucial difference: It is non-transferable.\n * The Reputation contract maintain a map of address to reputation value.\n * It provides an onlyOwner functions to mint and burn reputation _to (or _from) a specific address.\n */\n\ncontract Reputation is Ownable {\n\n uint8 public decimals = 18; //Number of decimals of the smallest unit\n // Event indicating minting of reputation to an address.\n event Mint(address indexed _to, uint256 _amount);\n // Event indicating burning of reputation for an address.\n event Burn(address indexed _from, uint256 _amount);\n\n /// @dev `Checkpoint` is the structure that attaches a block number to a\n /// given value, the block number attached is the one that last changed the\n /// value\n struct Checkpoint {\n\n // `fromBlock` is the block number that the value was generated from\n uint128 fromBlock;\n\n // `value` is the amount of reputation at a specific block number\n uint128 value;\n }\n\n // `creationBlock` is the block number that the Clone Token was created\n uint public creationBlock;\n\n // `balances` is the map that tracks the balance of each address, in this\n // contract when the balance changes the block number that the change\n // occurred is also included in the map\n mapping (address => Checkpoint[]) balances;\n\n // Tracks the history of the `totalSupply` of the reputation\n Checkpoint[] totalSupplyHistory;\n\n /// @notice Constructor to create a MiniMeToken\n constructor(\n ) public\n {\n creationBlock = block.number;\n }\n\n /// @dev This function makes it easy to get the total number of reputation\n /// @return The total number of reputation\n function totalSupply() public view returns (uint) {\n return totalSupplyAt(block.number);\n }\n\n ////////////////\n // Query balance and totalSupply in History\n ////////////////\n /**\n * @dev return the reputation amount of a given owner\n * @param _owner an address of the owner which we want to get his reputation\n */\n function balanceOf(address _owner) public view returns (uint256 balance) {\n return balanceOfAt(_owner, block.number);\n }\n\n /// @dev Queries the balance of `_owner` at a specific `_blockNumber`\n /// @param _owner The address from which the balance will be retrieved\n /// @param _blockNumber The block number when the balance is queried\n /// @return The balance at `_blockNumber`\n function balanceOfAt(address _owner, uint _blockNumber)\n public view returns (uint)\n {\n if ((balances[_owner].length == 0) || (balances[_owner][0].fromBlock > _blockNumber)) {\n return 0;\n // This will return the expected balance during normal situations\n } else {\n return getValueAt(balances[_owner], _blockNumber);\n }\n }\n\n /// @notice Total amount of reputation at a specific `_blockNumber`.\n /// @param _blockNumber The block number when the totalSupply is queried\n /// @return The total amount of reputation at `_blockNumber`\n function totalSupplyAt(uint _blockNumber) public view returns(uint) {\n if ((totalSupplyHistory.length == 0) || (totalSupplyHistory[0].fromBlock > _blockNumber)) {\n return 0;\n // This will return the expected totalSupply during normal situations\n } else {\n return getValueAt(totalSupplyHistory, _blockNumber);\n }\n }\n\n /// @notice Generates `_amount` reputation that are assigned to `_owner`\n /// @param _owner The address that will be assigned the new reputation\n /// @param _amount The quantity of reputation generated\n /// @return True if the reputation are generated correctly\n function mint(address _owner, uint _amount) public onlyOwner returns (bool) {\n uint curTotalSupply = totalSupply();\n require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow\n uint previousBalanceTo = balanceOf(_owner);\n require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow\n updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount);\n updateValueAtNow(balances[_owner], previousBalanceTo + _amount);\n emit Mint(_owner, _amount);\n return true;\n }\n\n /// @notice Burns `_amount` reputation from `_owner`\n /// @param _owner The address that will lose the reputation\n /// @param _amount The quantity of reputation to burn\n /// @return True if the reputation are burned correctly\n function burn(address _owner, uint _amount) public onlyOwner returns (bool) {\n uint curTotalSupply = totalSupply();\n uint amountBurned = _amount;\n if (curTotalSupply < amountBurned) {\n amountBurned = curTotalSupply;\n }\n uint previousBalanceFrom = balanceOf(_owner);\n if (previousBalanceFrom < amountBurned) {\n amountBurned = previousBalanceFrom;\n }\n //require(previousBalanceFrom >= _amount);\n updateValueAtNow(totalSupplyHistory, curTotalSupply - amountBurned);\n updateValueAtNow(balances[_owner], previousBalanceFrom - amountBurned);\n emit Burn(_owner, amountBurned);\n return true;\n }\n\n ////////////////\n // Internal helper functions to query and set a value in a snapshot array\n ////////////////\n\n /// @dev `getValueAt` retrieves the number of reputation at a given block number\n /// @param checkpoints The history of values being queried\n /// @param _block The block number to retrieve the value at\n /// @return The number of reputation being queried\n function getValueAt(Checkpoint[] storage checkpoints, uint _block) internal view returns (uint) {\n if (checkpoints.length == 0) {\n return 0;\n }\n\n // Shortcut for the actual value\n if (_block >= checkpoints[checkpoints.length-1].fromBlock) {\n return checkpoints[checkpoints.length-1].value;\n }\n if (_block < checkpoints[0].fromBlock) {\n return 0;\n }\n\n // Binary search of the value in the array\n uint min = 0;\n uint max = checkpoints.length-1;\n while (max > min) {\n uint mid = (max + min + 1) / 2;\n if (checkpoints[mid].fromBlock<=_block) {\n min = mid;\n } else {\n max = mid-1;\n }\n }\n return checkpoints[min].value;\n }\n\n /// @dev `updateValueAtNow` used to update the `balances` map and the\n /// `totalSupplyHistory`\n /// @param checkpoints The history of data being updated\n /// @param _value The new number of reputation\n function updateValueAtNow(Checkpoint[] storage checkpoints, uint _value) internal {\n require(uint128(_value) == _value); //check value is in the 128 bits bounderies\n if ((checkpoints.length == 0) || (checkpoints[checkpoints.length - 1].fromBlock < block.number)) {\n Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++];\n newCheckPoint.fromBlock = uint128(block.number);\n newCheckPoint.value = uint128(_value);\n } else {\n Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length-1];\n oldCheckPoint.value = uint128(_value);\n }\n }\n}\n",
"sourcePath": "@daostack/infra/contracts/Reputation.sol",
"ast": {
"absolutePath": "@daostack/infra/contracts/Reputation.sol",
"exportedSymbols": {
"Reputation": [
13407
]
},
"id": 13408,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 12961,
"literals": [
"solidity",
"^",
"0.4",
".25"
],
"nodeType": "PragmaDirective",
"src": "0:24:40"
},
{
"absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol",
"file": "openzeppelin-solidity/contracts/ownership/Ownable.sol",
"id": 12962,
"nodeType": "ImportDirective",
"scope": 13408,
"sourceUnit": 20878,
"src": "26:63:40",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 12963,
"name": "Ownable",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 20877,
"src": "597:7:40",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Ownable_$20877",
"typeString": "contract Ownable"
}
},
"id": 12964,
"nodeType": "InheritanceSpecifier",
"src": "597:7:40"
}
],
"contractDependencies": [
20877
],
"contractKind": "contract",
"documentation": "@title Reputation system\n@dev A DAO has Reputation System which allows peers to rate other peers in order to build trust .\nA reputation is use to assign influence measure to a DAO'S peers.\nReputation is similar to regular tokens but with one crucial difference: It is non-transferable.\nThe Reputation contract maintain a map of address to reputation value.\nIt provides an onlyOwner functions to mint and burn reputation _to (or _from) a specific address.",
"fullyImplemented": true,
"id": 13407,
"linearizedBaseContracts": [
13407,
20877
],
"name": "Reputation",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 12967,
"name": "decimals",
"nodeType": "VariableDeclaration",
"scope": 13407,
"src": "612:26:40",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"typeName": {
"id": 12965,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "612:5:40",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"value": {
"argumentTypes": null,
"hexValue": "3138",
"id": 12966,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "636:2:40",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_18_by_1",
"typeString": "int_const 18"
},
"value": "18"
},
"visibility": "public"
},
{
"anonymous": false,
"documentation": null,
"id": 12973,
"name": "Mint",
"nodeType": "EventDefinition",
"parameters": {
"id": 12972,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 12969,
"indexed": true,
"name": "_to",
"nodeType": "VariableDeclaration",
"scope": 12973,
"src": "770:19:40",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 12968,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "770:7:40",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 12971,
"indexed": false,
"name": "_amount",
"nodeType": "VariableDeclaration",
"scope": 12973,
"src": "791:15:40",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 12970,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "791:7:40",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "769:38:40"
},
"src": "759:49:40"
},
{
"anonymous": false,
"documentation": null,
"id": 12979,
"name": "Burn",
"nodeType": "EventDefinition",
"parameters": {
"id": 12978,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 12975,
"indexed": true,
"name": "_from",
"nodeType": "VariableDeclaration",
"scope": 12979,
"src": "886:21:40",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 12974,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "886:7:40",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 12977,
"indexed": false,
"name": "_amount",
"nodeType": "VariableDeclaration",
"scope": 12979,
"src": "909:15:40",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 12976,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "909:7:40",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "885:40:40"
},
"src": "875:51:40"
},
{
"canonicalName": "Reputation.Checkpoint",
"id": 12984,
"members": [
{
"constant": false,
"id": 12981,
"name": "fromBlock",
"nodeType": "VariableDeclaration",
"scope": 12984,
"src": "1213:17:40",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 12980,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "1213:7:40",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 12983,
"name": "value",
"nodeType": "VariableDeclaration",
"scope": 12984,
"src": "1317:13:40",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 12982,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "1317:7:40",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "Checkpoint",
"nodeType": "StructDefinition",
"scope": 13407,
"src": "1111:226:40",
"visibility": "public"
},
{
"constant": false,
"id": 12986,
"name": "creationBlock",
"nodeType": "VariableDeclaration",
"scope": 13407,
"src": "1421:25:40",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 12985,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "1421:4:40",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 12991,
"name": "balances",
"nodeType": "VariableDeclaration",
"scope": 13407,
"src": "1657:42:40",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Checkpoint_$12984_storage_$dyn_storage_$",
"typeString": "mapping(address => struct Reputation.Checkpoint[])"
},
"typeName": {
"id": 12990,
"keyType": {
"id": 12987,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1666:7:40",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "1657:33:40",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Checkpoint_$12984_storage_$dyn_storage_$",
"typeString": "mapping(address => struct Reputation.Checkpoint[])"
},
"valueType": {
"baseType": {
"contractScope": null,
"id": 12988,
"name": "Checkpoint",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 12984,
"src": "1677:10:40",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Checkpoint_$12984_storage_ptr",
"typeString": "struct Reputation.Checkpoint"
}
},
"id": 12989,
"length": null,
"nodeType": "ArrayTypeName",
"src": "1677:12:40",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_struct$_Checkpoint_$12984_storage_$dyn_storage_ptr",
"typeString": "struct Reputation.Checkpoint[]"
}
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 12994,
"name": "totalSupplyHistory",
"nodeType": "VariableDeclaration",
"scope": 13407,
"src": "1773:31:40",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_struct$_Checkpoint_$12984_storage_$dyn_storage",
"typeString": "struct Reputation.Checkpoint[]"
},
"typeName": {
"baseType": {
"contractScope": null,
"id": 12992,
"name": "Checkpoint",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 12984,
"src": "1773:10:40",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Checkpoint_$12984_storage_ptr",
"typeString": "struct Reputation.Checkpoint"
}
},
"id": 12993,
"length": null,
"nodeType": "ArrayTypeName",
"src": "1773:12:40",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_struct$_Checkpoint_$12984_storage_$dyn_storage_ptr",
"typeString": "struct Reputation.Checkpoint[]"
}
},
"value": null,
"visibility": "internal"
},
{
"body": {
"id": 13002,
"nodeType": "Block",
"src": "1893:45:40",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 13000,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 12997,
"name": "creationBlock",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 12986,
"src": "1903:13:40",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 12998,
"name": "block",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21539,
"src": "1919:5:40",
"typeDescriptions": {
"typeIdentifier": "t_magic_block",
"typeString": "block"
}
},
"id": 12999,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "number",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1919:12:40",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1903:28:40",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 13001,
"nodeType": "ExpressionStatement",
"src": "1903:28:40"
}
]
},
"documentation": "@notice Constructor to create a MiniMeToken",
"id": 13003,
"implemented": true,
"isConstructor": true,
"isDeclaredConst": false,
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 12995,
"nodeType": "ParameterList",
"parameters": [],
"src": "1874:7:40"
},
"payable": false,
"returnParameters": {
"id": 12996,
"nodeType": "ParameterList",
"parameters": [],
"src": "1893:0:40"
},
"scope": 13407,
"src": "1863:75:40",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 13013,
"nodeType": "Block",
"src": "2120:51:40",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 13009,
"name": "block",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 21539,
"src": "2151:5:40",
"typeDescriptions": {
"typeIdentifier": "t_magic_block",
"typeString": "block"
}
},
"id": 13010,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "number",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "2151:12:40",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 13008,
"name": "totalSupplyAt",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13098,
"src": "2137:13:40",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256) view returns (uint256)"
}
},
"id": 13011,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2137:27:40",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 13007,
"id": 13012,
"nodeType": "Return",
"src": "2130:34:40"
}
]
},
"documentation": "@dev This function makes it easy to get the total number of reputation\n @return The total number of reputation",
"id": 13014,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "totalSupply",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 13004,
"nodeType": "ParameterList",
"parameters": [],
"src": "2090:2:40"
},
"payable": false,
"return