UNPKG

@daostack/access_control

Version:

Capability-based access control for Ethereum smart contracts.

702 lines 841 kB
{ "contractName": "Permissioned", "abi": [ { "constant": true, "inputs": [ { "name": "", "type": "bytes32" }, { "name": "", "type": "address" } ], "name": "keys", "outputs": [ { "name": "exists", "type": "bool" }, { "name": "assignable", "type": "bool" }, { "name": "start", "type": "uint256" }, { "name": "expiration", "type": "uint256" }, { "name": "uses", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "_id", "type": "bytes32" }, { "indexed": true, "name": "_from", "type": "address" }, { "indexed": true, "name": "_to", "type": "address" }, { "indexed": false, "name": "_assignable", "type": "bool" }, { "indexed": false, "name": "_start", "type": "uint256" }, { "indexed": false, "name": "_expiration", "type": "uint256" }, { "indexed": false, "name": "_uses", "type": "uint256" } ], "name": "AssignKey", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "_id", "type": "bytes32" }, { "indexed": true, "name": "_owner", "type": "address" } ], "name": "RevokeKey", "type": "event" }, { "constant": true, "inputs": [ { "name": "interfaceID", "type": "bytes4" } ], "name": "supportsInterface", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "_id", "type": "bytes32" }, { "name": "_owner", "type": "address" } ], "name": "getKey", "outputs": [ { "name": "", "type": "bool" }, { "name": "", "type": "bool" }, { "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }, { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "_expiration", "type": "uint256" } ], "name": "isValidExpiration", "outputs": [ { "name": "valid", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "_id", "type": "bytes32" }, { "name": "_owner", "type": "address" } ], "name": "unlockable", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "_id", "type": "bytes32" }, { "name": "_to", "type": "address" }, { "name": "_assignable", "type": "bool" }, { "name": "_start", "type": "uint256" }, { "name": "_expiration", "type": "uint256" }, { "name": "_uses", "type": "uint256" } ], "name": "assignKey", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_id", "type": "bytes32" }, { "name": "_to", "type": "address" } ], "name": "assignFullKey", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_id", "type": "bytes32" } ], "name": "revokeKey", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "bytecode": "0x608060405234801561001057600080fd5b50610e9d806100206000396000f30060806040526004361061008d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301ffc9a7811461009257806313fb5c3d146100e05780632903b8ee1461011357806343751d6014610171578063572f221014610189578063719af01f146101a1578063baf81f65146101d2578063bc4f5a3314610203575b600080fd5b34801561009e57600080fd5b506100cc7fffffffff0000000000000000000000000000000000000000000000000000000060043516610242565b604080519115158252519081900360200190f35b3480156100ec57600080fd5b5061011160043573ffffffffffffffffffffffffffffffffffffffff602435166102db565b005b34801561011f57600080fd5b5061014460043573ffffffffffffffffffffffffffffffffffffffff6024351661036f565b60408051951515865293151560208601528484019290925260608401526080830152519081900360a00190f35b34801561017d57600080fd5b506100cc6004356103a9565b34801561019557600080fd5b506101116004356103ba565b3480156101ad57600080fd5b506100cc60043573ffffffffffffffffffffffffffffffffffffffff602435166103c7565b3480156101de57600080fd5b5061014460043573ffffffffffffffffffffffffffffffffffffffff60243516610474565b34801561020f57600080fd5b5061011160043573ffffffffffffffffffffffffffffffffffffffff60243516604435151560643560843560a4356104c7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102d557507fffffffff0000000000000000000000000000000000000000000000000000000082167f33f9cb6400000000000000000000000000000000000000000000000000000000145b92915050565b6102e3610e3d565b5060008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825291829020825160a081018452815460ff80821615158352610100909104161515928101839052600182015493810184905260028201546060820181905260039092015460808201819052909361036a93879387939192916104c7565b505050565b6000602081815292815260408082209093529081522080546001820154600283015460039093015460ff8084169461010090940416929085565b60008115806102d557505042111590565b6103c48133610c72565b50565b60006103d1610e3d565b5060008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452825291829020825160a081018452815460ff808216158015808552610100909304909116151594830194909452600183015494820194909452600282015460608201526003909101546080820152919061045c575061045c81606001516103a9565b801561046c575042816040015111155b949350505050565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff939093168452919052902080546001820154600283015460039093015460ff8084169561010090940416939192565b6104cf610e3d565b6104d7610e3d565b6000888152602081815260408083203384528252808320815160a081018352815460ff80821615801580855261010090930490911615159583019590955260018301549382019390935260028201546060820152600390910154608082015294509061054b575061054b83606001516103a9565b15156105b857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f496e76616c6964206b6579000000000000000000000000000000000000000000604482015290519081900360640190fd5b8260200151151561062a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4b6579206973206e6f742061737369676e61626c650000000000000000000000604482015290519081900360640190fd5b428360400151111580610641575082604001518610155b15156106d457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f43616e6e6f7420726564756365206b657927732066757475726520737461727460448201527f2074696d65000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b606083015115806106f45750826060015185111580156106f45750600085115b151561076157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f43616e6e6f7420657874656e64206b657927732065787069726174696f6e0000604482015290519081900360640190fd5b84158061076d57508486105b151561080057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f53746172742074696d65206d757374206265207374726963746c79206c65737360448201527f207468616e2065787069726174696f6e00000000000000000000000000000000606482015290519081900360840190fd5b610809856103a9565b151561087657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f45787069726174696f6e206d75737420626520696e2074686520667574757265604482015290519081900360640190fd5b608083015115806108965750826080015184111580156108965750600084115b151561090357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4e6f7420656e6f7567682075736573206176616961626c650000000000000000604482015290519081900360640190fd5b60008981526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8c168452825291829020825160a081018452815460ff8082161515835261010090910416151592810192909252600181015492820192909252600282015460608201526003909101546080820152915061098189896103c7565b8061098f5750428260400151115b90508015806109dc5750861515826020015115151480156109b35750848260600151145b80156109dc5750428260400151111580156109ce5750428611155b806109dc5750858260400151145b1515610a6f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f43616e6e6f74206d6572676520696e746f20726563657065696e742773206b6560448201527f7900000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b610a798985610d07565b610a8389896103c7565b15610b1b57608082015115610b1657831515610acf5760008981526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8c168452909152812060030155610b16565b6080820151610ae4908563ffffffff610e1e16565b60008a81526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8d1684529091529020600301555b610c01565b60a0604051908101604052806001151581526020018815158152602001878152602001868152602001858152506000808b6000191660001916815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff0219169083151502179055506040820151816001015560608201518160020155608082015181600301559050505b6040805188151581526020810188905280820187905260608101869052905173ffffffffffffffffffffffffffffffffffffffff8a169133918c917f6bb983ad4fd27414749e3cd41e18f0e39e54a860dad0a7ccb2a2ecb902226e17919081900360800190a4505050505050505050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000168155600181018490556002810184905560030183905551909184917ffed57faa4b67e0f08c65114689e4d61da45604656746dbbd5218f0ed1286ce299190a35050565b610d0f610e3d565b506000828152602081815260408083203384528252808320815160a081018352815460ff80821615158352610100909104161515938101939093526001810154918301919091526002810154606083015260030154608082018190529091101561036a578181608001511415610dd357600083815260208181526040808320338452909152812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000016815560018101829055600281018290556003015561036a565b600083815260208181526040808320338452909152902060030154610dfe908363ffffffff610e2b16565b600084815260208181526040808320338452909152902060030155505050565b818101828110156102d557fe5b600082821115610e3757fe5b50900390565b60a06040519081016040528060001515815260200160001515815260200160008152602001600081526020016000815250905600a165627a7a72305820d09e0b39d5b100df9bb52702e43cd58ef443c766b893a3948f595d6fda86a90e0029", "deployedBytecode": "0x60806040526004361061008d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301ffc9a7811461009257806313fb5c3d146100e05780632903b8ee1461011357806343751d6014610171578063572f221014610189578063719af01f146101a1578063baf81f65146101d2578063bc4f5a3314610203575b600080fd5b34801561009e57600080fd5b506100cc7fffffffff0000000000000000000000000000000000000000000000000000000060043516610242565b604080519115158252519081900360200190f35b3480156100ec57600080fd5b5061011160043573ffffffffffffffffffffffffffffffffffffffff602435166102db565b005b34801561011f57600080fd5b5061014460043573ffffffffffffffffffffffffffffffffffffffff6024351661036f565b60408051951515865293151560208601528484019290925260608401526080830152519081900360a00190f35b34801561017d57600080fd5b506100cc6004356103a9565b34801561019557600080fd5b506101116004356103ba565b3480156101ad57600080fd5b506100cc60043573ffffffffffffffffffffffffffffffffffffffff602435166103c7565b3480156101de57600080fd5b5061014460043573ffffffffffffffffffffffffffffffffffffffff60243516610474565b34801561020f57600080fd5b5061011160043573ffffffffffffffffffffffffffffffffffffffff60243516604435151560643560843560a4356104c7565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102d557507fffffffff0000000000000000000000000000000000000000000000000000000082167f33f9cb6400000000000000000000000000000000000000000000000000000000145b92915050565b6102e3610e3d565b5060008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825291829020825160a081018452815460ff80821615158352610100909104161515928101839052600182015493810184905260028201546060820181905260039092015460808201819052909361036a93879387939192916104c7565b505050565b6000602081815292815260408082209093529081522080546001820154600283015460039093015460ff8084169461010090940416929085565b60008115806102d557505042111590565b6103c48133610c72565b50565b60006103d1610e3d565b5060008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452825291829020825160a081018452815460ff808216158015808552610100909304909116151594830194909452600183015494820194909452600282015460608201526003909101546080820152919061045c575061045c81606001516103a9565b801561046c575042816040015111155b949350505050565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff939093168452919052902080546001820154600283015460039093015460ff8084169561010090940416939192565b6104cf610e3d565b6104d7610e3d565b6000888152602081815260408083203384528252808320815160a081018352815460ff80821615801580855261010090930490911615159583019590955260018301549382019390935260028201546060820152600390910154608082015294509061054b575061054b83606001516103a9565b15156105b857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f496e76616c6964206b6579000000000000000000000000000000000000000000604482015290519081900360640190fd5b8260200151151561062a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4b6579206973206e6f742061737369676e61626c650000000000000000000000604482015290519081900360640190fd5b428360400151111580610641575082604001518610155b15156106d457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f43616e6e6f7420726564756365206b657927732066757475726520737461727460448201527f2074696d65000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b606083015115806106f45750826060015185111580156106f45750600085115b151561076157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f43616e6e6f7420657874656e64206b657927732065787069726174696f6e0000604482015290519081900360640190fd5b84158061076d57508486105b151561080057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f53746172742074696d65206d757374206265207374726963746c79206c65737360448201527f207468616e2065787069726174696f6e00000000000000000000000000000000606482015290519081900360840190fd5b610809856103a9565b151561087657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f45787069726174696f6e206d75737420626520696e2074686520667574757265604482015290519081900360640190fd5b608083015115806108965750826080015184111580156108965750600084115b151561090357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4e6f7420656e6f7567682075736573206176616961626c650000000000000000604482015290519081900360640190fd5b60008981526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8c168452825291829020825160a081018452815460ff8082161515835261010090910416151592810192909252600181015492820192909252600282015460608201526003909101546080820152915061098189896103c7565b8061098f5750428260400151115b90508015806109dc5750861515826020015115151480156109b35750848260600151145b80156109dc5750428260400151111580156109ce5750428611155b806109dc5750858260400151145b1515610a6f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f43616e6e6f74206d6572676520696e746f20726563657065696e742773206b6560448201527f7900000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b610a798985610d07565b610a8389896103c7565b15610b1b57608082015115610b1657831515610acf5760008981526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8c168452909152812060030155610b16565b6080820151610ae4908563ffffffff610e1e16565b60008a81526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8d1684529091529020600301555b610c01565b60a0604051908101604052806001151581526020018815158152602001878152602001868152602001858152506000808b6000191660001916815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff0219169083151502179055506040820151816001015560608201518160020155608082015181600301559050505b6040805188151581526020810188905280820187905260608101869052905173ffffffffffffffffffffffffffffffffffffffff8a169133918c917f6bb983ad4fd27414749e3cd41e18f0e39e54a860dad0a7ccb2a2ecb902226e17919081900360800190a4505050505050505050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000168155600181018490556002810184905560030183905551909184917ffed57faa4b67e0f08c65114689e4d61da45604656746dbbd5218f0ed1286ce299190a35050565b610d0f610e3d565b506000828152602081815260408083203384528252808320815160a081018352815460ff80821615158352610100909104161515938101939093526001810154918301919091526002810154606083015260030154608082018190529091101561036a578181608001511415610dd357600083815260208181526040808320338452909152812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000016815560018101829055600281018290556003015561036a565b600083815260208181526040808320338452909152902060030154610dfe908363ffffffff610e2b16565b600084815260208181526040808320338452909152902060030155505050565b818101828110156102d557fe5b600082821115610e3757fe5b50900390565b60a06040519081016040528060001515815260200160001515815260200160008152602001600081526020016000815250905600a165627a7a72305820d09e0b39d5b100df9bb52702e43cd58ef443c766b893a3948f595d6fda86a90e0029", "sourceMap": "292:8387:5:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;292:8387:5;;;;;;;", "deployedSourceMap": "292:8387:5:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1050:481;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1050:481:5;;;;;;;;;;;;;;;;;;;;;;;;;5592:294;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5592:294:5;;;;;;;;;;;164:55:2;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;164:55:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2219:202:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2219:202:5;;;;;5956:87;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5956:87:5;;;;;2551:273;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2551:273:5;;;;;;;;;1724:327;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1724:327:5;;;;;;;;;3267:2196;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3267:2196:5;;;;;;;;;;;;;;;;;;;1050:481;1120:4;1155:46;;;1170:31;1155:46;;:347;;-1:-1:-1;1298:204:5;;;1325:177;1298:204;1155:347;1136:366;1050:481;-1:-1:-1;;1050:481:5:o;5592:294::-;5684:14;;:::i;:::-;-1:-1:-1;5701:4:5;:9;;;;;;;;;;;:14;;;;;;;;;;;5684:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5725:154;;5706:3;;5711;;5684:31;;;5725:9;:154::i;:::-;5592:294;;;:::o;164:55:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2219:202:5:-;2285:10;2376:16;;;:38;;-1:-1:-1;;2411:3:5;-1:-1:-1;2396:18:5;;2219:202::o;5956:87::-;6005:31;6020:3;6025:10;6005:14;:31::i;:::-;5956:87;:::o;2551:273::-;2621:4;2637:14;;:::i;:::-;-1:-1:-1;2654:4:5;:9;;;;;;;;;;;:17;;;;;;;;;;;2637:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2750:47;;;2764:33;2782:3;:14;;;2764:17;:33::i;:::-;2750:67;;;;;2814:3;2801;:9;;;:16;;2750:67;2743:74;2551:273;-1:-1:-1;;;;2551:273:5:o;1724:327::-;1792:4;1853:9;;;;;;;;;;;:17;;;;;;;;;;;;:24;;;1933:23;;;1970:28;;;;2012:22;;;;;1853:24;;;;;;1891:28;;;;;1933:23;;1724:327::o;3267:2196::-;3448:14;;:::i;:::-;4279:18;;:::i;:::-;4324:14;3465:9;;;;;;;;;;;3475:10;3465:21;;;;;;;3448:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3448:38:5;3504:47;;;3518:33;3536:3;:14;;;3518:17;:33::i;:::-;3496:71;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3585:3;:14;;;3577:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3719:3;3706;:9;;;:16;;:39;;;;3736:3;:9;;;3726:6;:19;;3706:39;3698:89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3805:14;;;;:19;;:73;;;3844:3;:14;;;3829:11;:29;;:48;;;;;3876:1;3862:11;:15;3829:48;3797:116;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3931:16;;;:40;;;3960:11;3951:6;:20;3931:40;3923:101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4042:30;4060:11;4042:17;:30::i;:::-;4034:75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4127:8;;;;:13;;:49;;;4154:3;:8;;;4145:5;:17;;:30;;;;;4174:1;4166:5;:9;4145:30;4119:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4300:4;:9;;;;;;;;;;;:14;;;;;;;;;;;4279:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4341:20:5;4305:3;4310;4341:10;:20::i;:::-;:43;;;;4381:3;4365:7;:13;;;:19;4341:43;4324:60;;4416:9;4415:10;:381;;;;4469:11;4447:33;;:7;:18;;;:33;;;:70;;;;;4506:11;4484:7;:18;;;:33;4447:70;:335;;;;;4696:3;4679:7;:13;;;:20;;:37;;;;;4713:3;4703:6;:13;;4679:37;4678:86;;;;4758:6;4741:7;:13;;;:23;4678:86;4394:461;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4866:23;4879:3;4883:5;4866:12;:23::i;:::-;4904:20;4915:3;4920;4904:10;:20::i;:::-;4900:375;;;4944:12;;;;:17;4940:227;;4985:10;;4981:172;;;5041:1;5019:9;;;;;;;;;;;:14;;;;;;;;;;:19;;:23;4981:172;;;5111:12;;;;:23;;5128:5;5111:23;:16;:23;:::i;:::-;5089:4;:9;;;;;;;;;;;:14;;;;;;;;;;:19;;:45;4981:172;4900:375;;;5214:50;;;;;;;;;5218:4;5214:50;;;;;;5224:11;5214:50;;;;;;5237:6;5214:50;;;;5245:11;5214:50;;;;5258:5;5214:50;;;5197:4;:9;5202:3;5197:9;;;;;;;;;;;;;;;;;:14;5207:3;5197:14;;;;;;;;;;;;;;;:67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4900:375;5290:166;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5330:10;;5313:3;;5290:166;;;;;;;;;;3267:2196;;;;;;;;;:::o;6156:140::-;6235:4;:9;;;;;;;;;;;:17;;;;;;;;;;;6228:24;;;;;;;;;;;;;;;;;;;;;;;6267:22;6235:17;;6240:3;;6267:22;;6235:4;6267:22;6156:140;;:::o;8327:350::-;8392:14;;:::i;:::-;-1:-1:-1;8409:4:5;:9;;;;;;;;;;;8419:10;8409:21;;;;;;;8392:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8440:231:5;;;8488:5;8476:3;:8;;;:17;8472:189;;;8520:4;:9;;;;;;;;;;;8530:10;8520:21;;;;;;;8513:28;;;;;;;;;;;;;;;;;;;;;8472:189;;;8609:4;:9;;;;;;;;;;;8619:10;8609:21;;;;;;;:26;;;:37;;8640:5;8609:37;:30;:37;:::i;:::-;8580:4;:9;;;;;;;;;;;8590:10;8580:21;;;;;;;:26;;:66;8327:350;;;:::o;1238:128:10:-;1319:7;;;1339;;;;1332:15;;;1060:116;1120:7;1142:8;;;;1135:16;;;;-1:-1:-1;1164:7:10;;;1060:116::o;292:8387:5:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", "source": "pragma solidity ^0.4.24;\n\nimport \"openzeppelin-solidity/contracts/introspection/ERC165.sol\";\nimport \"openzeppelin-solidity/contracts/math/SafeMath.sol\";\nimport \"./ERC1480Storage.sol\";\n\n\n/// @title Permissioned\n/// @dev base class that gives contracts a sophisticated access control mechanism\ncontract Permissioned is ERC165, ERC1480Storage {\n using SafeMath for uint;\n\n /// @dev A convenience modifier that guarentees a condition to be true. eg. `guarentee(unlock('Admin') || unlock('Worker'))`\n /// @param _condition the condition to be met\n modifier guarentee(bool _condition) {\n require(_condition, \"Insufficient permissions\");\n _;\n }\n\n /// @notice Query if a contract implements an interface\n /// @param interfaceID The interface identifier, as specified in ERC-165\n /// @dev Interface identification is specified in ERC-165. This function\n /// uses less than 30,000 gas.\n /// @return `true` if the contract implements `interfaceID` and\n /// `interfaceID` is not 0xffffffff, `false` otherwise\n function supportsInterface(bytes4 interfaceID) external view returns (bool) {\n return\n interfaceID == this.supportsInterface.selector || // ERC165 0x01ffc9a7\n // solium-disable-next-line operator-whitespace\n interfaceID ==\n this.assignKey.selector ^\n this.assignFullKey.selector ^\n this.revokeKey.selector ^\n this.unlockable.selector ^\n this.getKey.selector; // ERC1480 0x33f9cb64\n }\n\n /// @dev does the owner have a valid key for the lock id\n /// @param _id lock id\n /// @param _owner owner address\n /// @return the properties of the requested key as a tuple\n function getKey(bytes32 _id, address _owner) external view returns (bool, bool, uint, uint, uint) {\n return (\n keys[_id][_owner].exists,\n keys[_id][_owner].assignable,\n keys[_id][_owner].start,\n keys[_id][_owner].expiration,\n keys[_id][_owner].uses\n );\n }\n\n /// @dev is the current block timestamp less than `_expiration`\n /// @param _expiration expiration block timestamp\n /// @return is the expiration valid\n function isValidExpiration(uint _expiration) public view returns (bool valid) {\n // solium-disable-next-line security/no-block-members\n return _expiration == 0 || _expiration >= now;\n }\n\n /// @dev does the owner have a valid key for the lock id\n /// @param _id lock id\n /// @param _owner owner address\n function unlockable(bytes32 _id, address _owner) public view returns (bool) {\n Key memory key = keys[_id][_owner];\n // solium-disable-next-line security/no-block-members\n return key.exists && isValidExpiration(key.expiration) && key.start <= now;\n }\n\n /// @dev assign partial or all capabilities from the sender to an account\n /// @param _id lock id\n /// @param _to recipient\n /// @param _assignable can the recipient further assignKey capabilities to other accounts?\n /// @param _start the key's start time (block timestamp)\n /// @param _expiration the key's expiration time (block timestamp)\n /// @param _uses number of times this key can be used (in `unlock(..)`)\n function assignKey(\n bytes32 _id,\n address _to,\n bool _assignable,\n uint _start,\n uint _expiration,\n uint _uses\n ) public\n {\n Key memory key = keys[_id][msg.sender];\n require(key.exists && isValidExpiration(key.expiration), \"Invalid key\");\n require(key.assignable, \"Key is not assignable\");\n\n // solium-disable-next-line security/no-block-members\n require(key.start <= now || _start >= key.start, \"Cannot reduce key's future start time\");\n require(key.expiration == 0 || (_expiration <= key.expiration && _expiration > 0), \"Cannot extend key's expiration\");\n require(_expiration == 0 || _start < _expiration, \"Start time must be strictly less than expiration\");\n require(isValidExpiration(_expiration), \"Expiration must be in the future\");\n require(key.uses == 0 || (_uses <= key.uses && _uses > 0), \"Not enough uses avaiable\");\n\n // solium-disable-next-line security/no-block-members\n\n Key memory destKey = keys[_id][_to];\n bool possesKey = unlockable(_id, _to) || destKey.start > now;\n require(\n !possesKey || (\n destKey.assignable == _assignable && destKey.expiration == _expiration && (\n // both in the past or are exactly equal\n // solium-disable-next-line security/no-block-members\n (destKey.start <= now && _start <= now) ||\n destKey.start == _start\n )\n ),\n \"Cannot merge into recepeint's key\"\n );\n\n subtractUses(_id,_uses);\n\n if (unlockable(_id, _to)) {\n if (destKey.uses != 0) {\n if (_uses == 0) {\n keys[_id][_to].uses = 0;\n } else {\n keys[_id][_to].uses = destKey.uses.add(_uses);\n }\n }\n } else {\n keys[_id][_to] = Key(true, _assignable, _start, _expiration, _uses);\n }\n\n emit AssignKey(\n _id,\n msg.sender,\n _to,\n _assignable,\n _start,\n _expiration,\n _uses\n );\n }\n\n /// @dev assign all capabilities from the sender to an account\n /// @param _id lock id\n /// @param _to recipient\n function assignFullKey(\n bytes32 _id,\n address _to\n ) public\n {\n Key memory key = keys[_id][_to];\n assignKey(\n _id,\n _to,\n key.assignable,\n key.start,\n key.expiration,\n key.uses\n );\n }\n\n /// @dev revoke the sender's key\n /// @param _id lock id\n function revokeKey(bytes32 _id) public {\n revokeOwnerKey(_id, msg.sender);\n }\n\n /// @dev Revokes an account's key\n /// @param _id lock id\n /// @param _owner the account address\n function revokeOwnerKey(bytes32 _id, address _owner) internal {\n delete keys[_id][_owner];\n emit RevokeKey(_id, _owner);\n }\n\n /// @dev Grant capabilities to account (overwrites existing key)\n /// @param _id lock id\n /// @param _to recipient\n /// @param _assignable can the recipient further assignKey his capabilities to other accounts?\n /// @param _start the key's start time (block timestamp)\n /// @param _expiration the key's expiration time (block timestamp)\n /// @param _uses number of times this key can be used (in `unlock(..)`)\n function grantKey(\n bytes32 _id,\n address _to,\n bool _assignable,\n uint _start,\n uint _expiration,\n uint _uses\n ) internal\n {\n require(_expiration == 0 || _start < _expiration, \"Start time must be strictly less than expiration\");\n require(isValidExpiration(_expiration), \"Expiration must be in the future\");\n\n keys[_id][_to].exists = true;\n keys[_id][_to].assignable = _assignable;\n keys[_id][_to].start = _start;\n keys[_id][_to].expiration = _expiration;\n keys[_id][_to].uses = _uses;\n\n emit AssignKey(\n _id,\n 0,\n _to,\n _assignable,\n _start,\n _expiration,\n _uses\n );\n }\n\n /// @dev Grant full capabilities to account (assignable, no start time, no expiration, infinite uses)\n /// @param _id lock id\n /// @param _to recipient\n function grantFullKey(\n bytes32 _id,\n address _to\n ) internal\n {\n grantKey(\n _id,\n _to,\n true,\n 0,\n 0,\n 0\n );\n }\n\n /// @dev unlock a lock if sender has a valid key.\n /// @param _id lock id\n function unlock(bytes32 _id) internal returns (bool) {\n if (unlockable(_id, msg.sender)) {\n subtractUses(_id, 1);\n return true;\n }\n return false;\n }\n\n /// @dev subtract uses from a key, delete the key if it has no uses left.\n /// @param _id lock id\n /// @param _uses uses count to subtract from the key\n function subtractUses(bytes32 _id, uint _uses) private {\n Key memory key = keys[_id][msg.sender];\n if (key.uses > 0) {\n if (key.uses == _uses) {\n delete keys[_id][msg.sender];\n } else {\n keys[_id][msg.sender].uses = keys[_id][msg.sender].uses.sub(_uses);\n }\n }\n }\n}\n", "sourcePath": "/home/tsuberim/projects/daostack/access_control/contracts/Permissioned.sol", "ast": { "absolutePath": "/home/tsuberim/projects/daostack/access_control/contracts/Permissioned.sol", "exportedSymbols": { "Permissioned": [ 1050 ] }, "id": 1051, "nodeType": "SourceUnit", "nodes": [ { "id": 414, "literals": [ "solidity", "^", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:24:5" }, { "absolutePath": "openzeppelin-solidity/contracts/introspection/ERC165.sol", "file": "openzeppelin-solidity/contracts/introspection/ERC165.sol", "id": 415, "nodeType": "ImportDirective", "scope": 1051, "sourceUnit": 1354, "src": "26:66:5", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "openzeppelin-solidity/contracts/math/SafeMath.sol", "file": "openzeppelin-solidity/contracts/math/SafeMath.sol", "id": 416, "nodeType": "ImportDirective", "scope": 1051, "sourceUnit": 1448, "src": "93:59:5", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/home/tsuberim/projects/daostack/access_control/contracts/ERC1480Storage.sol", "file": "./ERC1480Storage.sol", "id": 417, "nodeType": "ImportDirective", "scope": 1051, "sourceUnit": 139, "src": "153:30:5", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 418, "name": "ERC165", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1353, "src": "317:6:5", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC165_$1353", "typeString": "contract ERC165" } }, "id": 419, "nodeType": "InheritanceSpecifier", "src": "317:6:5" }, { "arguments": null, "baseName": { "contractScope": null, "id": 420, "name": "ERC1480Storage", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 138, "src": "325:14:5", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC1480Storage_$138", "typeString": "contract ERC1480Storage" } }, "id": 421, "nodeType": "InheritanceSpecifier", "src": "325:14:5" } ], "contractDependencies": [ 48, 126, 138, 1353 ], "contractKind": "contract", "documentation": "@title Permissioned\n @dev base class that gives contracts a sophisticated access control mechanism", "fullyImplemented": true, "id": 1050, "linearizedBaseContracts": [ 1050, 138, 48, 126, 1353 ], "name": "Permissioned", "nodeType": "ContractDefinition", "nodes": [ { "id": 424, "libraryName": { "contractScope": null, "id": 422, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1447, "src": "352:8:5", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$1447", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "346:24:5", "typeName": { "id": 423, "name": "uint", "nodeType": "ElementaryTypeName", "src": "365:4:5", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "body": { "id": 434, "nodeType": "Block", "src": "591:75:5", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 429, "name": "_condition", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 426, "src": "609:10:5", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "496e73756666696369656e74207065726d697373696f6e73", "id": 430, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "621:26:5", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_624088eb9e260841d447bb796cedb0b0d3c2d49261ff88490ed2094aeda800f3", "typeString": "literal_string \"Insufficient permissions\"" }, "value": "Insufficient permissions" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_624088eb9e260841d447bb796cedb0b0d3c2d49261ff88490ed2094aeda800f3", "typeString": "literal_string \"Insufficient permissions\"" } ], "id": 428, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 1465, 1466 ], "referencedDeclaration": 1466, "src": "601:7:5", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 431, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "601:47:5", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 432, "nodeType": "ExpressionStatement", "src": "601:47:5" }, { "id": 433, "nodeType": "PlaceholderStatement", "src": "658:1:5" } ] }, "documentation": "@dev A convenience modifier that guarentees a condition to be true. eg. `guarentee(unlock('Admin') || unlock('Worker'))`\n @param _condition the condition to be met", "id": 435, "name": "guarentee", "nodeType": "ModifierDefinition", "parameters": { "id": 427, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 426, "name": "_condition", "nodeType": "VariableDeclaration", "scope": 435, "src": "574:15:5", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 425, "name": "bool", "nodeType": "ElementaryTypeName", "src": "574:4:5", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "573:17:5" }, "src": "555:111:5", "visibility": "internal" }, { "body": { "id": 470, "nodeType": "Block", "src": "1126:405:5", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 468, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "id": 446, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 442, "name": "interfaceID", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 437, "src": "1155:11:5", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 443, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1497, "src": "1170:4:5", "typeDescriptions": { "typeIdentifier": "t_contract$_Permissioned_$1050", "typeString": "contract Permissioned" } }, "id": 444, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "supportsInterface", "nodeType": "MemberAccess", "referencedDeclaration": 471, "src": "1170:22:5", "typeDescriptions": { "typeIdentifier": "t_function_external_view$_t_bytes4_$returns$_t_bool_$", "typeString": "function (bytes4) view external returns (bool)" } }, "id": 445, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "selector", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1170:31:5", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "src": "1155:46:5", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "||", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "id": 467, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 447, "name": "interfaceID", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 437, "src": "1298:11:5", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "id": 466, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "id": 462, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "id": 458, "isConstant": false, "isLValue": false, "isPure": false, "lV