├── LICENSE.txt ├── README.md ├── config ├── app.json ├── development │ └── config.json ├── private-chain │ └── config.json ├── production │ ├── AttributeModel.sol.js │ ├── DappModel.sol.js │ ├── DeveloperModel.sol.js │ ├── DualIndex.sol.js │ ├── EternalDB.sol.js │ ├── LicenseModel.sol.js │ ├── Model.sol.js │ ├── ModelCoordinator.sol.js │ ├── ReviewModel.sol.js │ ├── SimpleIndex.sol.js │ ├── UserModel.sol.js │ ├── VersionModel.sol.js │ └── config.json ├── staging │ └── config.json └── test │ ├── AttributeModel.sol.js │ ├── DappModel.sol.js │ ├── DeveloperModel.sol.js │ ├── DualIndex.sol.js │ ├── EternalDB.sol.js │ ├── Example.sol.js │ ├── LicenseModel.sol.js │ ├── Model.sol.js │ ├── ModelCoordinator.sol.js │ ├── ReviewModel.sol.js │ ├── SimpleIndex.sol.js │ ├── UserModel.sol.js │ ├── VersionModel.sol.js │ ├── config.json │ └── contracts.json ├── contracts ├── AttributeModel.sol ├── DappModel.sol ├── DeveloperModel.sol ├── DualIndex.sol ├── EternalDB.sol ├── Example.sol ├── LicenseModel.sol ├── Model.sol ├── ModelCoordinator.sol ├── ReviewModel.sol ├── SimpleIndex.sol ├── UserModel.sol └── VersionModel.sol ├── register_models.es6 └── test ├── dapp-model.js ├── developer-model.js ├── eternal-db.js ├── license-model.js ├── model-coordinator.js ├── review-model.js └── version-model.js /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 ConsenSys, LLC 2 | 3 | 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dapp-store-contracts 2 | 3 | The contracts backing dappstore.io. 4 | 5 | EternalDB.sol is a generic key-value store, which serves as the "database" for these contracts. Model.sol implements a pseudo-SQL schema pattern on top of that. 6 | 7 | The patterns shown here are new and fairly rough, though also useful. Build on top of them at your own peril! 8 | -------------------------------------------------------------------------------- /config/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "deploy": [ 3 | "EternalDB", 4 | "DappModel", 5 | "DeveloperModel", 6 | "ModelCoordinator", 7 | "VersionModel", 8 | "ReviewModel", 9 | "AttributeModel", 10 | "LicenseModel", 11 | "UserModel" 12 | ], 13 | "after_deploy": [ 14 | "register_models.es6" 15 | ], 16 | "rpc": { 17 | "host": "localhost", 18 | "port": 8545 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /config/development/config.json: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /config/private-chain/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "rpc": { 3 | "host": "localhost", 4 | "port": 8546 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /config/production/DualIndex.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var DualIndex = (function (_Pudding) { 15 | _inherits(DualIndex, _Pudding); 16 | 17 | function DualIndex() { 18 | _classCallCheck(this, DualIndex); 19 | 20 | _get(Object.getPrototypeOf(DualIndex.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return DualIndex; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | DualIndex.abi = [{ "constant": false, "inputs": [{ "name": "key1", "type": "uint256" }, { "name": "key2", "type": "uint256" }, { "name": "value", "type": "uint256" }], "name": "set", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "key1", "type": "uint256" }, { "name": "key2", "type": "uint256" }], "name": "lookup", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_admin", "type": "address" }], "name": "transfer_ownership", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "admin", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "inputs": [], "type": "constructor" }]; 30 | DualIndex.binary = "606060405260018054600160a060020a0319163317905560f0806100236000396000f3606060405260e060020a600035046343b0e8df81146038578063b4b9d1f1146079578063f0350c041460a1578063f851a4401460df575b005b603660043560243560443560015433600160a060020a039081169116141560745760008381526020818152604080832085845290915290208190555b505050565b60043560009081526020818152604080832060243584529091529020545b6060908152602090f35b603660043560015433600160a060020a039081169116141560dc576001805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b6097600154600160a060020a03168156"; 31 | 32 | if ("" != "") { 33 | DualIndex.address = ""; 34 | 35 | // Backward compatibility; Deprecated. 36 | DualIndex.deployed_address = ""; 37 | } 38 | 39 | DualIndex.generated_with = "1.0.2"; 40 | DualIndex.contract_name = "DualIndex"; 41 | 42 | return DualIndex; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.DualIndex = factory; 54 | } -------------------------------------------------------------------------------- /config/production/EternalDB.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var EternalDB = (function (_Pudding) { 15 | _inherits(EternalDB, _Pudding); 16 | 17 | function EternalDB() { 18 | _classCallCheck(this, EternalDB); 19 | 20 | _get(Object.getPrototypeOf(EternalDB.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return EternalDB; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | EternalDB.abi = [{ "constant": true, "inputs": [], "name": "count", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }, { "name": "index", "type": "uint256" }], "name": "delete_entry", "outputs": [], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }], "name": "get_length", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }], "name": "clear", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }, { "name": "value", "type": "uint256" }], "name": "add", "outputs": [], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }, { "name": "index", "type": "uint256" }], "name": "get_entry", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }], "name": "get_all", "outputs": [{ "name": "", "type": "uint256[]" }], "type": "function" }, { "constant": false, "inputs": [], "name": "new_entry", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "has", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_admin", "type": "address" }], "name": "transfer_ownership", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "admin", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "inputs": [], "type": "constructor" }]; 30 | EternalDB.binary = "606060405260008054600160a060020a0319163317905560018054818055819081908015829011603a57818360005260206000209182019101505b5050505061052a8061004c6000396000f36060604052361561008d5760e060020a600035046306661abd811461008f5780631a10cfc31461009e578063250108161461013857806341ee903e14610177578063505fb46c146101ef57806358e59c321461028257806389029d8c146102d65780639c851ebc1461036f578063cccf7a8e146103c0578063f0350c04146103d0578063f851a44014610411575b005b6104235b600154600019015b90565b61008d600435602435604435600080548190600160a060020a039081163390911614156104d6576001805486908110156100025750505082815260008051602061050a833981519152840160205260409020815b81546001820110156104dd5781816001018154811015610002579060005260206000209001600050548282815481101561000257505060206000208201556001016100f2565b6104236004356024356000600160005083815481101561000257505081815260008051602061050a833981519152830160205260409020545b92915050565b61008d600435602435600054600160a060020a039081163390911614156104cd576000600160005083815481101561000257505081815260008051602061050a8339815191528301602052604081208054828255829080158290116104c8578183600052602060002091820191016104c8919061026e565b61008d60043560243560443560008054600160a060020a039081163390911614156104be57600180548590811015610002575083825260008051602061050a8339815191528501602052604090912080549182018082559091839183919082908280158290116104a5578183600052602060002091820191016104a591905b808211156104c4576000815560010161026e565b6104236004356024356044356000600160005084815481101561000257505082815260008051602061050a833981519152840160205260408120805483908110156100025750815260209020015492915050565b610435600435602435604080516020810190915260008152600180548490811015610002575050600082815260008051602061050a833981519152840160209081526040918290208054835181840281018401909452808452909183018282801561036357602002820191906000526020600020905b81600050548152602001906001019080831161034c575b50505050509050610171565b61042360008054600160a060020a0390811633909116141561009b57600180548082018083559091908280158290116103b65782855260008051602061050a833981519152015b505050905061009b565b610423600435600061049c610093565b61008d600435600054600160a060020a0390811633909116141561040e576000805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b61047f600054600160a060020a031681565b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b60408051600160a060020a03929092168252519081900360200190f35b90911115919050565b5050508154811015610002576000918252602090912001555b50505050565b5090565b505050505b5050565b505050505b5050505050565b8154600019810180845583908280158290116104d1576000838152602090206104d191810190830161026e56b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"; 31 | 32 | if ("0x7cb1cd868228b971a50f743bc3baffed0ccd925f" != "") { 33 | EternalDB.address = "0x7cb1cd868228b971a50f743bc3baffed0ccd925f"; 34 | 35 | // Backward compatibility; Deprecated. 36 | EternalDB.deployed_address = "0x7cb1cd868228b971a50f743bc3baffed0ccd925f"; 37 | } 38 | 39 | EternalDB.generated_with = "1.0.2"; 40 | EternalDB.contract_name = "EternalDB"; 41 | 42 | return EternalDB; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.EternalDB = factory; 54 | } -------------------------------------------------------------------------------- /config/production/Model.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var Model = (function (_Pudding) { 15 | _inherits(Model, _Pudding); 16 | 17 | function Model() { 18 | _classCallCheck(this, Model); 19 | 20 | _get(Object.getPrototypeOf(Model.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return Model; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | Model.abi = [{ "constant": true, "inputs": [], "name": "coordinator", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "read_only", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_keys", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_read_only_keys", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "association_name", "type": "uint256" }, { "name": "association_id", "type": "uint256" }], "name": "add_to_association", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "db", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_associations", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "has_owners", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "sender", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "attributes", "type": "uint256[101][]" }], "name": "validate", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "keys", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [], "name": "get_default_keys", "outputs": [{ "name": "", "type": "uint256[2][4]" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }], "name": "destroy", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "owner", "type": "address" }], "name": "add_owner", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "attributes", "type": "uint256[101][]" }], "name": "create", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "replacement", "type": "address" }], "name": "replace", "outputs": [], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "to_check", "type": "address" }], "name": "is_owner", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "is_destroyed", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_coordinator", "type": "address" }], "name": "set_coordinator", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "reference_name", "type": "uint256" }, { "name": "reference_id", "type": "uint256" }], "name": "set_reference", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "_db", "type": "address" }], "name": "set_db", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "attributes", "type": "uint256[101][]" }], "name": "update", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "get_blocks_for", "outputs": [{ "name": "", "type": "uint256[2]" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "associations", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "inputs": [], "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "reason", "type": "string" }], "name": "Log", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Create", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Update", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Destroy", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "key", "type": "uint256" }, { "indexed": false, "name": "reason", "type": "string" }], "name": "ValidationError", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "reason", "type": "string" }], "name": "GeneralError", "type": "event" }]; 30 | Model.binary = "606060405260048054600160a060020a0319163317905561187f806100246000396000f3606060405236156101115760e060020a60003504630a00909781146101135780631e3dbb27146101255780633fda12811461016457806341d31feb146101e757806349fb2dc51461026a5780634d655aff146102d7578063582ca57b146102e9578063595da94d1461036c57806367f12ecf146103e05780638b935fb1146104575780638ee21b8e146104965780639d118770146105ac578063b56b2627146105bc578063c27d7721146105cf578063cabfb9341461063f578063d716222c146106c3578063db6fcf01146107cb578063de778edb14610848578063e2deaa8114610888578063e7156dbe146108f7578063eb121e2f14610933578063ebd83378146109a5578063ffd1d50414610add575b005b610b34600454600160a060020a031681565b610b5160043560243560038054839081101561000257906000526020600020906002020160005081600281101561000257909001600091509150505481565b6040805160208181018352600080835283516001805480850283018501909652858252610b6395919390929084015b82821015610cc85760008481526040805160209092208282019182905260028581029091019182845b8160005054815260200190600101908083116101bc575b505050505081526020019060010190610193565b6040805160208181018352600080835283516003805480850283018501909652858252610b6395919390929084015b82821015610cc85760008481526040805160209092208282019182905260028581029091019182845b81600050548152602001906001019080831161023f575b505050505081526020019060010190610216565b610111600435602435604435600080546040805160e160020a636667bd470281526004810187905290518392600160a060020a03169163cccf7a8e916024828101926020929190829003018187876161da5a03f11561000257505060405151821415905061156057611559565b610b34600054600160a060020a031681565b6040805160208181018352600080835283516002805480850283018501909652858252610b6395919390929084015b82821015610cc85760008481526040805160209092208282019182905260028581029091019182845b816000505481526020019060010190808311610341575b505050505081526020019060010190610318565b610b516004355b600080546040805160e160020a631280840b02815260048101859052656f776e65727360248201529051600160a060020a039290921691632501081691604481810192602092909190829003018187876161da5a03f115610002575050604051519091141590505b919050565b60408051604435600481810135602081810285018101909552808452610b51948235946024803595606494929391019190819060009085015b82821015610bbe5760408051610ca0818101909252908381028701906065908390839080828437820191505050505081526020019060010190610419565b610b5160043560243560018054839081101561000257906000526020600020906002020160005081600281101561000257909001600091509150505481565b610bd1610100604051908101604052806004905b6040604051908101604052806002905b60008152602001906001900390816104ba579050508152602001906001900390816104aa5750506040805161010081019091526004815b6040604051908101604052806002905b6000815260200190600190039081610501579050508152602001906001900390816104f157505080516c637265617465645f626c6f636b9052805166696e746567657260209182018190528282018051716c6173745f757064617465645f626c6f636b905251820152604082018051656f776e6572739052516c696e74656765725f6172726179908201526060820180516864657374726f79656490525163626f6f6c910152919050565b61011160043561133781336106cd565b6101116004356024355b61125682610373565b604080516004803580820135602081810285018101909552808452610b51949293602493909284019190819060009085015b82821015610c155760408051610ca0818101909252908381028701906065908390839080828437820191505050505081526020019060010190610601565b610111600435600454600160a060020a039081163390911614156109305760008054604080517ff0350c04000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301529151929091169263f0350c0492602483810193829003018183876161da5a03f1156100025750505050565b610b516004356024355b600080805b600080546040805160e160020a631280840b02815260048101899052656f776e65727360248201529051600160a060020a03929092169263250108169260448381019360209390839003909101908290876161da5a03f1156100025750506040515160ff841610159050610f9d57604080516000805460e160020a632c72ce1902835260048301899052656f776e657273602484015260ff861660448401529251600160a060020a0393909316926358e59c329260648181019360209392839003909101908290876161da5a03f11561000257505060405151915050600160a060020a03848116908216141561124a5760019250610fa2565b610b51600435600080546040805160e160020a632c72ce19028152600481018590526864657374726f7965646024820152604481018490529051600160a060020a0392909216916358e59c3291606481810192602092909190829003018187876161da5a03f1156100025750506040515160011491506103db9050565b610111600435600454600160a060020a03908116339091161415610930576004805473ffffffffffffffffffffffffffffffffffffffff19168217905550565b610111600435602435604435600080546040805160e160020a636667bd47028152600481018790529051600160a060020a03929092169163cccf7a8e91602481810192602092909190829003018187876161da5a03f1156100025750506040515182141590506117f3576117ed565b61011160043560008054600160a060020a03161415610930576000805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b6040805160248035600481810135602081810286018101909652808552610b51958235959294604494019190819060009085015b82821015610c935760408051610ca0818101909252908381028701906065908390839080828437820191505050505081526020019060010190610967565b610cad6004356040604051908101604052806002905b60008152602001906001900390816109bb575050604080518082019091526002815b60008152602001906001900390816109dd575050600080546040805160e160020a632c72ce19028152600481018790526c637265617465645f626c6f636b6024820152604481018490529051600160a060020a0392909216926358e59c329260648381019360209390839003909101908290876161da5a03f11561000257506040805151845260008054825160e160020a632c72ce1902815260048101899052716c6173745f757064617465645f626c6f636b6024820152604481018390529251600160a060020a0391909116945060648381019360209390839003909101908290876161da5a03f1156100025750506040515160208301525092915050565b610b5160043560243560028054839081101561000257600082815291027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0190508160028110156100025701600091509150505481565b60408051600160a060020a03929092168252519081900360200190f35b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080516000925b81841015610bad57602084810284010151604080838184600060046015f1509050019260010192610b81565b925050509250505060405180910390f35b5093955050505050505b60019392505050565b6040516000826004835b81841015610c055760208402830151604080838184600060046015f1509050019260010192610bdb565b9250505091505060405180910390f35b509395505050505050604080516020808252600e908201527f63726561746520737461727465640000000000000000000000000000000000008183015290516000918291829182917fcf34ef537ac33ee1ac626ca1587a0a7e8e51561e5514f8cb36afa1c5102b3bab9181900360600190a1610cd133600087610bc8565b509395505050505050600060006000610faa338686610bc8565b60408051908190839080838184600060046015f15093505050f35b50505050905090565b60011415610f7f57600060009054906101000a9004600160a060020a0316600160a060020a0316639c851ebc6040518160e060020a0281526004018090506020604051808303816000876161da5a03f11561000257505060405151935060009250505b600154821015610f87575060015b848281518110156100025760209081029091010151518111610f915760005460018054600160a060020a03929092169163505fb46c9186918690811015610002576000919091526002027fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60154885189908790811015610002579060200190602002015185606581101561000257909060200201516040518460e060020a0281526004018084815260200183815260200182815260200193505050506000604051808303816000876161da5a03f11561000257505050600101610d42565b600080546040805160e260020a631417ed1b028152600481018790526864657374726f7965646024820152604481018490529051600160a060020a03929092169263505fb46c92606483810193829003018183876161da5a03f1156100025750604080516000805460e260020a631417ed1b028352600483018990526c637265617465645f626c6f636b60248401524360448401529251600160a060020a039390931694506064828101939192829003018183876161da5a03f1156100025750604080516000805460e260020a631417ed1b02835260048301899052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a039390931694506064828101939192829003018183876161da5a03f1156100025750506040805185815290517f07eac9a0695a188fe9d6fd680bcbbbe39041fb114d5d7ac11252401391f7930792509081900360200190a18293505b505050919050565b610e2083336105c6565b60019190910190610d34565b600092505b505092915050565b60011415610f9d57600091505b6001548210156111335760005460018054600160a060020a0392909216916341ee903e91889186908110156100025760009182526002027fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6019050600050546040518360e060020a02815260040180838152602001828152602001925050506000604051808303816000876161da5a03f11561000257505050600190505b83828151811015610002576020908102909101015151811161123e5760005460018054600160a060020a03929092169163505fb46c9188918690811015610002576000919091526002027fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60154875188908790811015610002579060200190602002015185606581101561000257909060200201516040518460e060020a0281526004018084815260200183815260200182815260200193505050506000604051808303816000876161da5a03f11561000257505050600101611055565b600080546040805160e160020a6320f7481f02815260048101899052716c6173745f757064617465645f626c6f636b60248201529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018a9052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f1156100025750506040805187815290517f164f7b2ab803097dab5e39f06d2e4f3c3ddc5d4171abbdcc3e76443b8359c7f592509081900360200190a160019250610fa2565b60019190910190610fb7565b600191909101906106d2565b600014156112c357604080516000805460e260020a631417ed1b02835260048301869052656f776e6572736024840152600160a060020a038581166044850152935193169263505fb46c926064818101939291829003018183876161da5a03f11561000257505050611333565b6112cd82336106cd565b1561133357600080546040805160e260020a631417ed1b02815260048101869052656f776e6572736024820152600160a060020a0385811660448301529151929091169263505fb46c92606483810193829003018183876161da5a03f115610002575050505b5050565b1561093057600080546040805160e160020a6320f7481f028152600481018590526864657374726f79656460248201529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018690526864657374726f7965646024840152600160448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f1156100025750506040805183815290517fd3f5559c9fe2c1b988daa9f5520155e1a89d750e0a7b2ee17afcd4b76dd95bcd92509081900360200190a150565b600080546040805160e260020a631417ed1b0281526004810189905260248101889052604481018790529051600160a060020a03929092169263505fb46c92606483810193829003018183876161da5a03f115610002575050604080516000805460e160020a6320f7481f028352600483018a9052716c6173745f757064617465645f626c6f636b60248401529251600160a060020a039390931693506341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018a9052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f115610002575050505b5050505050565b5060009050805b6002548110156115e457836002600050828154811015610002576000829052027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace015414156116675760028054829081101561000257027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf015491505b816000148061165d5750600460009054906101000a9004600160a060020a0316600160a060020a0316636a030ca9836040518260e060020a028152600401808281526020019150506020604051808303816000876161da5a03f11561000257505060405151600160a060020a0390811633909116141590505b1561143057611559565b600101611567565b600080546040805160e160020a6320f7481f02815260048101889052602481018790529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b0283526004830189905260248301889052604483018790529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f115610002575050604080516000805460e160020a6320f7481f02835260048301899052716c6173745f757064617465645f626c6f636b60248401529251600160a060020a039390931693506341ee903e92604483810193829003018183876161da5a03f115610002575050600080546040805160e260020a631417ed1b02815260048101899052716c6173745f757064617465645f626c6f636b60248201524360448201529051600160a060020a0392909216935063505fb46c926064828101939192829003018183876161da5a03f115610002575050505b50505050565b5060408051600480547f6a030ca90000000000000000000000000000000000000000000000000000000083526301000000860491830182905292519092600160a060020a031691636a030ca991602482810192602092919082900301816000876161da5a03f11561000257505060405151600160a060020a039081163390911614905061166f576117ed56"; 31 | 32 | if ("" != "") { 33 | Model.address = ""; 34 | 35 | // Backward compatibility; Deprecated. 36 | Model.deployed_address = ""; 37 | } 38 | 39 | Model.generated_with = "1.0.2"; 40 | Model.contract_name = "Model"; 41 | 42 | return Model; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.Model = factory; 54 | } -------------------------------------------------------------------------------- /config/production/ModelCoordinator.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var ModelCoordinator = (function (_Pudding) { 15 | _inherits(ModelCoordinator, _Pudding); 16 | 17 | function ModelCoordinator() { 18 | _classCallCheck(this, ModelCoordinator); 19 | 20 | _get(Object.getPrototypeOf(ModelCoordinator.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return ModelCoordinator; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | ModelCoordinator.abi = [{ "constant": true, "inputs": [{ "name": "", "type": "uint256" }], "name": "models", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "name", "type": "uint256" }, { "name": "model", "type": "address" }, { "name": "db", "type": "address" }], "name": "register", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "admin", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "inputs": [], "type": "constructor" }]; 30 | ModelCoordinator.binary = "606060405260018054600160a060020a03191633179055610781806100246000396000f3606060405260e060020a60003504636a030ca98114610031578063a73c50fa14610052578063f851a440146101e6575b005b6101f8600435600060208190529081526040902054600160a060020a031681565b61002f60043560243560443560015460009033600160a060020a03908116911614156101e05783815260208190526040812054600160a060020a031681146100f15760408120547fcabfb934000000000000000000000000000000000000000000000000000000006060908152600160a060020a038581166064529190911691829163cabfb9349160849160248183876161da5a03f115610002575050505b604060009081208582526020829052805473ffffffffffffffffffffffffffffffffffffffff191685179055600160a060020a0383161415610193576040516105768061020b83398101819003906000f09150815081600160a060020a031663f0350c04846040518260e060020a0281526004018082600160a060020a031681526020019150506000604051808303816000876161da5a03f115610002575050505b82600160a060020a031663e7156dbe836040518260e060020a0281526004018082600160a060020a031681526020019150506000604051808303816000876161da5a03f115610002575050505b50505050565b6101f8600154600160a060020a031681565b600160a060020a03166060908152602090f3606060405260008054600160a060020a0319163317905560018054818055819081908015829011603a57818360005260206000209182019101505b5050505061052a8061004c6000396000f36060604052361561008d5760e060020a600035046306661abd811461008f5780631a10cfc31461009e578063250108161461013857806341ee903e14610177578063505fb46c146101ef57806358e59c321461028257806389029d8c146102d65780639c851ebc1461036f578063cccf7a8e146103c0578063f0350c04146103d0578063f851a44014610411575b005b6104235b600154600019015b90565b61008d600435602435604435600080548190600160a060020a039081163390911614156104d6576001805486908110156100025750505082815260008051602061050a833981519152840160205260409020815b81546001820110156104dd5781816001018154811015610002579060005260206000209001600050548282815481101561000257505060206000208201556001016100f2565b6104236004356024356000600160005083815481101561000257505081815260008051602061050a833981519152830160205260409020545b92915050565b61008d600435602435600054600160a060020a039081163390911614156104cd576000600160005083815481101561000257505081815260008051602061050a8339815191528301602052604081208054828255829080158290116104c8578183600052602060002091820191016104c8919061026e565b61008d60043560243560443560008054600160a060020a039081163390911614156104be57600180548590811015610002575083825260008051602061050a8339815191528501602052604090912080549182018082559091839183919082908280158290116104a5578183600052602060002091820191016104a591905b808211156104c4576000815560010161026e565b6104236004356024356044356000600160005084815481101561000257505082815260008051602061050a833981519152840160205260408120805483908110156100025750815260209020015492915050565b610435600435602435604080516020810190915260008152600180548490811015610002575050600082815260008051602061050a833981519152840160209081526040918290208054835181840281018401909452808452909183018282801561036357602002820191906000526020600020905b81600050548152602001906001019080831161034c575b50505050509050610171565b61042360008054600160a060020a0390811633909116141561009b57600180548082018083559091908280158290116103b65782855260008051602061050a833981519152015b505050905061009b565b610423600435600061049c610093565b61008d600435600054600160a060020a0390811633909116141561040e576000805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b61047f600054600160a060020a031681565b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b60408051600160a060020a03929092168252519081900360200190f35b90911115919050565b5050508154811015610002576000918252602090912001555b50505050565b5090565b505050505b5050565b505050505b5050505050565b8154600019810180845583908280158290116104d1576000838152602090206104d191810190830161026e56b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"; 31 | 32 | if ("0x288dcd4682d8f6b7fd849fb3dc9ba7fe57a8523e" != "") { 33 | ModelCoordinator.address = "0x288dcd4682d8f6b7fd849fb3dc9ba7fe57a8523e"; 34 | 35 | // Backward compatibility; Deprecated. 36 | ModelCoordinator.deployed_address = "0x288dcd4682d8f6b7fd849fb3dc9ba7fe57a8523e"; 37 | } 38 | 39 | ModelCoordinator.generated_with = "1.0.2"; 40 | ModelCoordinator.contract_name = "ModelCoordinator"; 41 | 42 | return ModelCoordinator; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.ModelCoordinator = factory; 54 | } -------------------------------------------------------------------------------- /config/production/SimpleIndex.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var SimpleIndex = (function (_Pudding) { 15 | _inherits(SimpleIndex, _Pudding); 16 | 17 | function SimpleIndex() { 18 | _classCallCheck(this, SimpleIndex); 19 | 20 | _get(Object.getPrototypeOf(SimpleIndex.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return SimpleIndex; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | SimpleIndex.abi = [{ "constant": false, "inputs": [{ "name": "key", "type": "uint256" }], "name": "lookup", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "key", "type": "uint256" }, { "name": "value", "type": "uint256" }], "name": "set", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "_admin", "type": "address" }], "name": "transfer_ownership", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "admin", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "inputs": [], "type": "constructor" }]; 30 | SimpleIndex.binary = "606060405260018054600160a060020a0319163317905560d88060226000396000f3606060405260e060020a60003504630a874df6811460385780631ab06ee5146055578063f0350c04146089578063f851a4401460c7575b005b6004356000908152602081905260409020545b6060908152602090f35b603660043560243560015433600160a060020a039081169116141560855760008281526020819052604090208190555b5050565b603660043560015433600160a060020a039081169116141560c4576001805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b604b600154600160a060020a03168156"; 31 | 32 | if ("" != "") { 33 | SimpleIndex.address = ""; 34 | 35 | // Backward compatibility; Deprecated. 36 | SimpleIndex.deployed_address = ""; 37 | } 38 | 39 | SimpleIndex.generated_with = "1.0.2"; 40 | SimpleIndex.contract_name = "SimpleIndex"; 41 | 42 | return SimpleIndex; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.SimpleIndex = factory; 54 | } -------------------------------------------------------------------------------- /config/production/UserModel.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var UserModel = (function (_Pudding) { 15 | _inherits(UserModel, _Pudding); 16 | 17 | function UserModel() { 18 | _classCallCheck(this, UserModel); 19 | 20 | _get(Object.getPrototypeOf(UserModel.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return UserModel; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | UserModel.abi = [{ "constant": true, "inputs": [], "name": "coordinator", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "read_only", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_keys", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_read_only_keys", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "association_name", "type": "uint256" }, { "name": "association_id", "type": "uint256" }], "name": "add_to_association", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "db", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_associations", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "has_owners", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "sender", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "attributes", "type": "uint256[101][]" }], "name": "validate", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_address", "type": "address" }], "name": "id_for_address", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "keys", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [], "name": "get_default_keys", "outputs": [{ "name": "", "type": "uint256[2][4]" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }], "name": "destroy", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "owner", "type": "address" }], "name": "add_owner", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "attributes", "type": "uint256[101][]" }], "name": "create", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "replacement", "type": "address" }], "name": "replace", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "address_index", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "to_check", "type": "address" }], "name": "is_owner", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "is_destroyed", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_coordinator", "type": "address" }], "name": "set_coordinator", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "reference_name", "type": "uint256" }, { "name": "reference_id", "type": "uint256" }], "name": "set_reference", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "_db", "type": "address" }], "name": "set_db", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "attributes", "type": "uint256[101][]" }], "name": "update", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "get_blocks_for", "outputs": [{ "name": "", "type": "uint256[2]" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "associations", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "inputs": [{ "name": "_address_index", "type": "address" }], "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "reason", "type": "string" }], "name": "Log", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Create", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Update", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Destroy", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "key", "type": "uint256" }, { "indexed": false, "name": "reason", "type": "string" }], "name": "ValidationError", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "reason", "type": "string" }], "name": "GeneralError", "type": "event" }]; 30 | UserModel.binary = "6060604052604051602080611e1283395060806040525160048054600160a060020a0319163317905580600160a060020a03166000141561004b57608060fa806101fe8339906000f090505b60058054600160a060020a03191682179055600180548180558190819080158290116100ca5760008290526100ca90600202600080516020611df2833981519152017fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf85b8082111561017d5760008082556001919091019081556100af565b50505050666164647265737360016000506000815481101561000257818152600080516020611df2833981519152839055815481101561000257507fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf7919091556002805482825582908015829011610181576000839052610181908302600080516020611dd2833981519152017f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad06100af565b5090565b50505050676c6963656e73657360026000506000815481101561000257818152600080516020611dd2833981519152929092558054666c6963656e73659290811015610002577f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf9290925550611ada915081906102f890396000f300606060405260018054600160a060020a0319163317905560d88060226000396000f3606060405260e060020a60003504630a874df6811460385780631ab06ee5146055578063f0350c04146089578063f851a4401460c7575b005b6004356000908152602081905260409020545b6060908152602090f35b603660043560243560015433600160a060020a039081169116141560855760008281526020819052604090208190555b5050565b603660043560015433600160a060020a039081169116141560c4576001805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b604b600154600160a060020a03168156606060405236156101275760e060020a60003504630a00909781146101295780631e3dbb271461013b5780633fda12811461017a57806341d31feb146101fd57806349fb2dc5146102805780634d655aff146102ed578063582ca57b146102ff578063595da94d1461038257806367f12ecf146103f6578063743438ad1461046d5780638b935fb1146104d35780638ee21b8e146105125780639d11877014610628578063b56b262714610638578063c27d77211461064b578063cabfb934146106bb578063d528161814610795578063d716222c146107a7578063db6fcf01146108af578063de778edb1461092c578063e2deaa811461096c578063e7156dbe146109db578063eb121e2f14610a17578063ebd8337814610a89578063ffd1d50414610bc1575b005b610c18600454600160a060020a031681565b610c3560043560243560038054839081101561000257906000526020600020906002020160005081600281101561000257909001600091509150505481565b6040805160208181018352600080835283516001805480850283018501909652858252610c4795919390929084015b82821015610e935760008481526040805160209092208282019182905260028581029091019182845b8160005054815260200190600101908083116101d2575b5050505050815260200190600101906101a9565b6040805160208181018352600080835283516003805480850283018501909652858252610c4795919390929084015b82821015610e935760008481526040805160209092208282019182905260028581029091019182845b816000505481526020019060010190808311610255575b50505050508152602001906001019061022c565b610127600435602435604435600080546040805160e160020a636667bd470281526004810187905290518392600160a060020a03169163cccf7a8e916024828101926020929190829003018187876161da5a03f11561000257505060405151821415905061145f57611458565b610c18600054600160a060020a031681565b6040805160208181018352600080835283516002805480850283018501909652858252610c4795919390929084015b82821015610e935760008481526040805160209092208282019182905260028581029091019182845b816000505481526020019060010190808311610357575b50505050508152602001906001019061032e565b610c356004355b600080546040805160e160020a631280840b02815260048101859052656f776e65727360248201529051600160a060020a039290921691632501081691604481810192602092909190829003018187876161da5a03f115610002575050604051519091141590505b919050565b60408051604435600481810135602081810285018101909552808452610c35948235946024803595606494929391019190819060009085015b82821015610ca25760408051610ca081810190925290838102870190606590839083908082843782019150505050508152602001906001019061042f565b610c356004356040805160055460e160020a630543a6fb028252600160a060020a03848116600484015292516000939190911691630a874df6916024828101926020929190829003018187876161da5a03f1156100025750506040515191506103f19050565b610c3560043560243560018054839081101561000257906000526020600020906002020160005081600281101561000257909001600091509150505481565b610d92610100604051908101604052806004905b6040604051908101604052806002905b6000815260200190600190039081610536579050508152602001906001900390816105265750506040805161010081019091526004815b6040604051908101604052806002905b600081526020019060019003908161057d5790505081526020019060019003908161056d57505080516c637265617465645f626c6f636b9052805166696e746567657260209182018190528282018051716c6173745f757064617465645f626c6f636b905251820152604082018051656f776e6572739052516c696e74656765725f6172726179908201526060820180516864657374726f79656490525163626f6f6c910152919050565b61012760043561123681336107b1565b6101276004356024355b61115582610389565b604080516004803580820135602081810285018101909552808452610c35949293602493909284019190819060009085015b82821015610dd65760408051610ca081810190925290838102870190606590839083908082843782019150505050508152602001906001019061067d565b610127600435600454600160a060020a03908116339091161415610a14576040805160055460e260020a633c0d4301028252600160a060020a038481166004840152925192169163f0350c0491602481810192600092909190829003018183876161da5a03f11561000257505050610a1481600454600160a060020a03908116339091161415610a1457600080546040805160e260020a633c0d4301028152600160a060020a0385811660048301529151929091169263f0350c0492602483810193829003018183876161da5a03f1156100025750505050565b610c18600554600160a060020a031681565b610c356004356024355b600080805b600080546040805160e160020a631280840b02815260048101899052656f776e65727360248201529051600160a060020a03929092169263250108169260448381019360209390839003909101908290876161da5a03f1156100025750506040515160ff841610159050610e9c57604080516000805460e160020a632c72ce1902835260048301899052656f776e657273602484015260ff861660448401529251600160a060020a0393909316926358e59c329260648181019360209392839003909101908290876161da5a03f11561000257505060405151915050600160a060020a0381811690851614156111495760019250610ea1565b610c35600435600080546040805160e160020a632c72ce19028152600481018590526864657374726f7965646024820152604481018490529051600160a060020a0392909216916358e59c3291606481810192602092909190829003018187876161da5a03f1156100025750506040515160011491506103f19050565b610127600435600454600160a060020a03908116339091161415610a14576004805473ffffffffffffffffffffffffffffffffffffffff19168217905550565b610127600435602435604435600080546040805160e160020a636667bd47028152600481018790529051600160a060020a03929092169163cccf7a8e91602481810192602092909190829003018187876161da5a03f1156100025750506040515182141590506116f2576116ec565b61012760043560008054600160a060020a03161415610a14576000805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b6040805160248035600481810135602081810286018101909652808552610c35958235959294604494019190819060009085015b82821015610e5e5760408051610ca0818101909252908381028701906065908390839080828437820191505050505081526020019060010190610a4b565b610e786004356040604051908101604052806002905b6000815260200190600190039081610a9f575050604080518082019091526002815b6000815260200190600190039081610ac1575050600080546040805160e160020a632c72ce19028152600481018790526c637265617465645f626c6f636b6024820152604481018490529051600160a060020a0392909216926358e59c329260648381019360209390839003909101908290876161da5a03f11561000257506040805151845260008054825160e160020a632c72ce1902815260048101899052716c6173745f757064617465645f626c6f636b6024820152604481018390529251600160a060020a0391909116945060648381019360209390839003909101908290876161da5a03f1156100025750506040515160208301525092915050565b610c3560043560243560028054839081101561000257600082815291027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0190508160028110156100025701600091509150505481565b60408051600160a060020a03929092168252519081900360200190f35b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080516000925b81841015610c9157602084810284010151604080838184600060046015f1509050019260010192610c65565b925050509250505060405180910390f35b5093955050505050505b60008260001415611813576005548251600160a060020a039190911690630a874df6908490849081101561000257506040805160209283015183015160e160020a630543a6fb0282526004820152905160248281019392829003018187876161da5a03f115610002575050604051518214905061181e57604080516020808252600e908201527f6d75737420626520756e697175650000000000000000000000000000000000008183015290516661646472657373917f1aa3de82ed32b15e46e219f19efd6e4138a410853f46b8a761e6e7e91ccf3cfa919081900360600190a2611817565b6040516000826004835b81841015610dc65760208402830151604080838184600060046015f1509050019260010192610d9c565b9250505091505060405180910390f35b50939550505050505060006000600061177e84604080516020808252600e908201527f63726561746520737461727465640000000000000000000000000000000000008183015290516000918291829182917fcf34ef537ac33ee1ac626ca1587a0a7e8e51561e5514f8cb36afa1c5102b3bab9181900360600190a161182633600087610cac565b509395505050505050600060006000610ea9338686610cac565b60408051908190839080838184600060046015f15093505050f35b50505050905090565b600092505b505092915050565b60011415610e9c57600091505b6001548210156110325760005460018054600160a060020a0392909216916341ee903e91889186908110156100025760009182526002027fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6019050600050546040518360e060020a02815260040180838152602001828152602001925050506000604051808303816000876161da5a03f11561000257505050600190505b83828151811015610002576020908102909101015151811161113d5760005460018054600160a060020a03929092169163505fb46c9188918690811015610002576000919091526002027fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60154875188908790811015610002579060200190602002015185606581101561000257909060200201516040518460e060020a0281526004018084815260200183815260200182815260200193505050506000604051808303816000876161da5a03f11561000257505050600101610f54565b600080546040805160e160020a6320f7481f02815260048101899052716c6173745f757064617465645f626c6f636b60248201529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018a9052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f1156100025750506040805187815290517f164f7b2ab803097dab5e39f06d2e4f3c3ddc5d4171abbdcc3e76443b8359c7f592509081900360200190a160019250610ea1565b60019190910190610eb6565b600191909101906107b6565b600014156111c257604080516000805460e260020a631417ed1b02835260048301869052656f776e6572736024840152600160a060020a038581166044850152935193169263505fb46c926064818101939291829003018183876161da5a03f11561000257505050611232565b6111cc82336107b1565b1561123257604080516000805460e260020a631417ed1b02835260048301869052656f776e6572736024840152600160a060020a038581166044850152935193169263505fb46c926064818101939291829003018183876161da5a03f115610002575050505b5050565b15610a1457600080546040805160e160020a6320f7481f028152600481018590526864657374726f79656460248201529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018690526864657374726f7965646024840152600160448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f1156100025750506040805183815290517fd3f5559c9fe2c1b988daa9f5520155e1a89d750e0a7b2ee17afcd4b76dd95bcd92509081900360200190a150565b600080546040805160e260020a631417ed1b0281526004810189905260248101889052604481018790529051600160a060020a03929092169263505fb46c92606483810193829003018183876161da5a03f115610002575050604080516000805460e160020a6320f7481f028352600483018a9052716c6173745f757064617465645f626c6f636b60248401529251600160a060020a039390931693506341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018a9052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f115610002575050505b5050505050565b5060009050805b6002548110156114e357836002600050828154811015610002576000829052027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace015414156115665760028054829081101561000257027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf015491505b816000148061155c5750600460009054906101000a9004600160a060020a0316600160a060020a0316636a030ca9836040518260e060020a028152600401808281526020019150506020604051808303816000876161da5a03f11561000257505060405151600160a060020a0390811633909116141590505b1561132f57611458565b600101611466565b600080546040805160e160020a6320f7481f02815260048101889052602481018790529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b0283526004830189905260248301889052604483018790529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f115610002575050604080516000805460e160020a6320f7481f02835260048301899052716c6173745f757064617465645f626c6f636b60248401529251600160a060020a039390931693506341ee903e92604483810193829003018183876161da5a03f115610002575050600080546040805160e260020a631417ed1b02815260048101899052716c6173745f757064617465645f626c6f636b60248201524360448201529051600160a060020a0392909216935063505fb46c926064828101939192829003018183876161da5a03f115610002575050505b50505050565b5060408051600480547f6a030ca90000000000000000000000000000000000000000000000000000000083526301000000860491830182905292519092600160a060020a031691636a030ca991602482810192602092919082900301816000876161da5a03f11561000257505060405151600160a060020a039081163390911614905061156e576116ec565b91506000821461180c5783600081518110156100025760408051602093840151909301516005547f1ab06ee500000000000000000000000000000000000000000000000000000000855260048501829052602485018790529151909450600160a060020a039190911692631ab06ee5926044828101939192829003018183876161da5a03f115610002575050505b5092915050565b5060005b9392505050565b506001611817565b60011415611abc57600060009054906101000a9004600160a060020a0316600160a060020a0316639c851ebc6040518160e060020a0281526004018090506020604051808303816000876161da5a03f11561000257505060405151935060009250505b600154821015611ac4575060015b84828151811015610002575050602082810286010151518111611ace5760005460018054600160a060020a03929092169163505fb46c91869186908110156100025790600052602060002090600202016000506000505488868151811015610002579060200190602002015185606581101561000257909060200201516040518460e060020a0281526004018084815260200183815260200182815260200193505050506000604051808303816000876161da5a03f11561000257505050600101611897565b600080546040805160e260020a631417ed1b028152600481018790526864657374726f7965646024820152604481018490529051600160a060020a03929092169263505fb46c92606483810193829003018183876161da5a03f1156100025750604080516000805460e260020a631417ed1b028352600483018990526c637265617465645f626c6f636b60248401524360448401529251600160a060020a039390931694506064828101939192829003018183876161da5a03f1156100025750604080516000805460e260020a631417ed1b02835260048301899052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a039390931694506064828101939192829003018183876161da5a03f1156100025750506040805185815290517f07eac9a0695a188fe9d6fd680bcbbbe39041fb114d5d7ac11252401391f7930792509081900360200190a18293505b505050919050565b61195d8333610642565b6001919091019061188956405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5aceb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"; 31 | 32 | if ("0xe2a363d78124cd2aef06e88c8651a63355822534" != "") { 33 | UserModel.address = "0xe2a363d78124cd2aef06e88c8651a63355822534"; 34 | 35 | // Backward compatibility; Deprecated. 36 | UserModel.deployed_address = "0xe2a363d78124cd2aef06e88c8651a63355822534"; 37 | } 38 | 39 | UserModel.generated_with = "1.0.2"; 40 | UserModel.contract_name = "UserModel"; 41 | 42 | return UserModel; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.UserModel = factory; 54 | } -------------------------------------------------------------------------------- /config/production/config.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /config/staging/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "rpc": { 3 | "host": "theory.academy", 4 | "port": 8545 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /config/test/AttributeModel.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var AttributeModel = (function (_Pudding) { 15 | _inherits(AttributeModel, _Pudding); 16 | 17 | function AttributeModel() { 18 | _classCallCheck(this, AttributeModel); 19 | 20 | _get(Object.getPrototypeOf(AttributeModel.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return AttributeModel; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | AttributeModel.abi = [{ "constant": true, "inputs": [], "name": "coordinator", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "read_only", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_keys", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_read_only_keys", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "association_name", "type": "uint256" }, { "name": "association_id", "type": "uint256" }], "name": "add_to_association", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "db", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_associations", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "has_owners", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "sender", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "attributes", "type": "uint256[101][]" }], "name": "validate", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "keys", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [], "name": "get_default_keys", "outputs": [{ "name": "", "type": "uint256[2][4]" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }], "name": "destroy", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "owner", "type": "address" }], "name": "add_owner", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "attributes", "type": "uint256[101][]" }], "name": "create", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "replacement", "type": "address" }], "name": "replace", "outputs": [], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "to_check", "type": "address" }], "name": "is_owner", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "is_destroyed", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_coordinator", "type": "address" }], "name": "set_coordinator", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "reference_name", "type": "uint256" }, { "name": "reference_id", "type": "uint256" }], "name": "set_reference", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "_db", "type": "address" }], "name": "set_db", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "attributes", "type": "uint256[101][]" }], "name": "update", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "get_blocks_for", "outputs": [{ "name": "", "type": "uint256[2]" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "associations", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "inputs": [], "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "reason", "type": "string" }], "name": "Log", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Create", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Update", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Destroy", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "key", "type": "uint256" }, { "indexed": false, "name": "reason", "type": "string" }], "name": "ValidationError", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "reason", "type": "string" }], "name": "GeneralError", "type": "event" }]; 30 | AttributeModel.binary = "606060405260048054600160a060020a03191633179055600460016000508181548183558181151161005e5760020281600202836000526020600020918201910161005e91905b8082111561021f576000808255908501908155610046565b50508054626b65799250600090811015610002579081526000805160206120dc833981519152905055600180546476616c75659190819081101561000257506000805160206120bc833981519152919091558054676d6f64656c5f69649190600290811015610002575060008051602061209c833981519152919091558054696d6f64656c5f74797065919060039081101561000257507fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cfc91909155805465737472696e679190600090811015610002576000805160206120dc83398151915291505060019090016000508190555065737472696e6760016000506001815481101561000257506000805160206120bc833981519152905060005060019090016000508190555074706f6c796d6f72706869635f7265666572656e6365600160005060028154811015610002575060008051602061209c83398151915290506000506001909001600050819055506f706f6c796d6f72706869635f747970656001600050600381548110156100025750507fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cfd55611e78806102246000396000f35b50905600606060405236156101115760e060020a60003504630a00909781146101135780631e3dbb27146101255780633fda12811461016457806341d31feb146101e757806349fb2dc51461026a5780634d655aff146102d7578063582ca57b146102e9578063595da94d1461036c57806367f12ecf146103e05780638b935fb1146104575780638ee21b8e146104965780639d118770146105ac578063b56b2627146105bc578063c27d7721146105cf578063cabfb9341461063f578063d716222c146106c3578063db6fcf01146107cb578063de778edb14610848578063e2deaa8114610888578063e7156dbe146108f7578063eb121e2f14610933578063ebd83378146109a5578063ffd1d50414610add575b005b610b34600454600160a060020a031681565b610b5160043560243560038054839081101561000257906000526020600020906002020160005081600281101561000257909001600091509150505481565b6040805160208181018352600080835283516001805480850283018501909652858252610b6395919390929084015b82821015610d875760008481526040805160209092208282019182905260028581029091019182845b8160005054815260200190600101908083116101bc575b505050505081526020019060010190610193565b6040805160208181018352600080835283516003805480850283018501909652858252610b6395919390929084015b82821015610d875760008481526040805160209092208282019182905260028581029091019182845b81600050548152602001906001019080831161023f575b505050505081526020019060010190610216565b610111600435602435604435600080546040805160e160020a636667bd470281526004810187905290518392600160a060020a03169163cccf7a8e916024828101926020929190829003018187876161da5a03f11561000257505060405151821415905061132d57611326565b610b34600054600160a060020a031681565b6040805160208181018352600080835283516002805480850283018501909652858252610b6395919390929084015b82821015610d875760008481526040805160209092208282019182905260028581029091019182845b816000505481526020019060010190808311610341575b505050505081526020019060010190610318565b610b516004355b600080546040805160e160020a631280840b02815260048101859052656f776e65727360248201529051600160a060020a039290921691632501081691604481810192602092909190829003018187876161da5a03f115610002575050604051519091141590505b919050565b60408051604435600481810135602081810285018101909552808452610b51948235946024803595606494929391019190819060009085015b82821015610bbe5760408051610ca0818101909252908381028701906065908390839080828437820191505050505081526020019060010190610419565b610b5160043560243560018054839081101561000257906000526020600020906002020160005081600281101561000257909001600091509150505481565b610c82610100604051908101604052806004905b6040604051908101604052806002905b60008152602001906001900390816104ba579050508152602001906001900390816104aa5750506040805161010081019091526004815b6040604051908101604052806002905b6000815260200190600190039081610501579050508152602001906001900390816104f157505080516c637265617465645f626c6f636b9052805166696e746567657260209182018190528282018051716c6173745f757064617465645f626c6f636b905251820152604082018051656f776e6572739052516c696e74656765725f6172726179908201526060820180516864657374726f79656490525163626f6f6c910152919050565b61011160043561110481336106cd565b6101116004356024355b61102382610373565b604080516004803580820135602081810285018101909552808452610b51949293602493909284019190819060009085015b82821015610cc65760408051610ca0818101909252908381028701906065908390839080828437820191505050505081526020019060010190610601565b610111600435600454600160a060020a039081163390911614156109305760008054604080517ff0350c04000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301529151929091169263f0350c0492602483810193829003018183876161da5a03f1156100025750505050565b610b516004356024355b600080805b600080546040805160e160020a631280840b02815260048101899052656f776e65727360248201529051600160a060020a03929092169263250108169260448381019360209390839003909101908290876161da5a03f1156100025750506040515160ff841610159050610d9057604080516000805460e160020a632c72ce1902835260048301899052656f776e657273602484015260ff861660448401529251600160a060020a0393909316926358e59c329260648181019360209392839003909101908290876161da5a03f11561000257505060405151915050600160a060020a0384811690821614156110175760019250610d95565b610b51600435600080546040805160e160020a632c72ce19028152600481018590526864657374726f7965646024820152604481018490529051600160a060020a0392909216916358e59c3291606481810192602092909190829003018187876161da5a03f1156100025750506040515160011491506103db9050565b610111600435600454600160a060020a03908116339091161415610930576004805473ffffffffffffffffffffffffffffffffffffffff19168217905550565b610111600435602435604435600080546040805160e160020a636667bd47028152600481018790529051600160a060020a03929092169163cccf7a8e91602481810192602092909190829003018187876161da5a03f1156100025750506040515182141590506115c1576115bb565b61011160043560008054600160a060020a03161415610930576000805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b6040805160248035600481810135602081810286018101909652808552610b51958235959294604494019190819060009085015b82821015610d525760408051610ca0818101909252908381028701906065908390839080828437820191505050505081526020019060010190610967565b610d6c6004356040604051908101604052806002905b60008152602001906001900390816109bb575050604080518082019091526002815b60008152602001906001900390816109dd575050600080546040805160e160020a632c72ce19028152600481018790526c637265617465645f626c6f636b6024820152604481018490529051600160a060020a0392909216926358e59c329260648381019360209390839003909101908290876161da5a03f11561000257506040805151845260008054825160e160020a632c72ce1902815260048101899052716c6173745f757064617465645f626c6f636b6024820152604481018390529251600160a060020a0391909116945060648381019360209390839003909101908290876161da5a03f1156100025750506040515160208301525092915050565b610b5160043560243560028054839081101561000257600082815291027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0190508160028110156100025701600091509150505481565b60408051600160a060020a03929092168252519081900360200190f35b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080516000925b81841015610bad57602084810284010151604080838184600060046015f1509050019260010192610b81565b925050509250505060405180910390f35b5093955050505050505b6000808080805b60015484101561173857858481518110156100025760209081029091010151516000141561180c576001805485908110156100025760009190915260408051600292909202600080516020611e5883398151915201546020808452600f908401527f6d7573742062652070726573656e7400000000000000000000000000000000008383015290519091600080516020611e38833981519152919081900360600190a2600094505b505050509392505050565b6040516000826004835b81841015610cb65760208402830151604080838184600060046015f1509050019260010192610c8c565b9250505091505060405180910390f35b5093955050505050506000600060006000600061163786604080516020808252600e908201527f63726561746520737461727465640000000000000000000000000000000000008183015290516000918291829182917fcf34ef537ac33ee1ac626ca1587a0a7e8e51561e5514f8cb36afa1c5102b3bab9181900360600190a1611b7e33600087610bc8565b509395505050505050600060006000610d9d338686610bc8565b60408051908190839080838184600060046015f15093505050f35b50505050905090565b600092505b505092915050565b60011415610d9057600091505b600154821015610f005760005460018054600160a060020a0392909216916341ee903e9188918690811015610002576000918252600202600080516020611e5883398151915201546040805160e160020a6320f7481f0281526004810194909452602484019190915251604483810193829003018183876161da5a03f11561000257505050600190505b83828151811015610002576020908102909101015151811161100b5760005460018054600160a060020a03929092169163505fb46c918891869081101561000257600091909152600202600080516020611e588339815191520154875188908790811015610002579060200190602002015185606581101561000257909060200201516040518460e060020a0281526004018084815260200183815260200182815260200193505050506000604051808303816000876161da5a03f11561000257505050600101610e34565b600080546040805160e160020a6320f7481f02815260048101899052716c6173745f757064617465645f626c6f636b60248201529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018a9052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f1156100025750506040805187815290517f164f7b2ab803097dab5e39f06d2e4f3c3ddc5d4171abbdcc3e76443b8359c7f592509081900360200190a160019250610d95565b60019190910190610daa565b600191909101906106d2565b6000141561109057604080516000805460e260020a631417ed1b02835260048301869052656f776e6572736024840152600160a060020a038581166044850152935193169263505fb46c926064818101939291829003018183876161da5a03f11561000257505050611100565b61109a82336106cd565b1561110057600080546040805160e260020a631417ed1b02815260048101869052656f776e6572736024820152600160a060020a0385811660448301529151929091169263505fb46c92606483810193829003018183876161da5a03f115610002575050505b5050565b1561093057600080546040805160e160020a6320f7481f028152600481018590526864657374726f79656460248201529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018690526864657374726f7965646024840152600160448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f1156100025750506040805183815290517fd3f5559c9fe2c1b988daa9f5520155e1a89d750e0a7b2ee17afcd4b76dd95bcd92509081900360200190a150565b600080546040805160e260020a631417ed1b0281526004810189905260248101889052604481018790529051600160a060020a03929092169263505fb46c92606483810193829003018183876161da5a03f115610002575050604080516000805460e160020a6320f7481f028352600483018a9052716c6173745f757064617465645f626c6f636b60248401529251600160a060020a039390931693506341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018a9052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f115610002575050505b5050505050565b5060009050805b6002548110156113b257836002600050828154811015610002576000829052027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0154141561143557600280548290811015610002577f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf9102015491505b816000148061142b5750600460009054906101000a9004600160a060020a0316600160a060020a0316636a030ca9836040518260e060020a028152600401808281526020019150506020604051808303816000876161da5a03f11561000257505060405151600160a060020a0390811633909116141590505b156111fd57611326565b600101611334565b600080546040805160e160020a6320f7481f02815260048101889052602481018790529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b0283526004830189905260248301889052604483018790529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f115610002575050604080516000805460e160020a6320f7481f02835260048301899052716c6173745f757064617465645f626c6f636b60248401529251600160a060020a039390931693506341ee903e92604483810193829003018183876161da5a03f115610002575050600080546040805160e260020a631417ed1b02815260048101899052716c6173745f757064617465645f626c6f636b60248201524360448201529051600160a060020a0392909216935063505fb46c926064828101939192829003018183876161da5a03f115610002575050505b50505050565b50604080516004805460e060020a636a030ca90283526301000000860491830182905292519092600160a060020a031691636a030ca991602482810192602092919082900301816000876161da5a03f11561000257505060405151600160a060020a039081163390911614905061143d576115bb565b93506000841461172e5785600281518110156100025750805160608201516020015194506003908110156100025750506080860151600150604080516020928301516004805460e060020a636a030ca90284529083018290529251909550600160a060020a039290921692636a030ca99260248381019382900301816000876161da5a03f1156100025750505060405180519060200150905080600160a060020a03166349fb2dc5846961747472696275746573876040518460e060020a0281526004018084815260200183815260200182815260200193505050506000604051808303816000876161da5a03f115610002575050505b5091949350505050565b63646170708660038151811015610002575060800151602001511480159061177d575068646576656c6f70657286600381518110156100025750608001516020015114155b15611907576040805160208082526030908201527f68617320756e6b6e6f776e2076616c75653b206d757374206265202764617070818301527f27206f722027646576656c6f706572270000000000000000000000000000000060608201529051696d6f64656c5f7479706591600080516020611e38833981519152919081900360800190a260009450610c77565b65737472696e676001600050858154811015610002576000919091526002027fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf7015414801590611872575085848151811015610002576020908102909101015151600114155b156118fb576001805485908110156100025760009190915260408051600292909202600080516020611e5883398151915201546020808452600a908401527f697320696e76616c6964000000000000000000000000000000000000000000008383015290519091600080516020611e38833981519152919081900360600190a260009450610c77565b60019390930192610bcf565b60008714611aae57600080546040805160e160020a632c72ce19028152600481018b9052676d6f64656c5f69646024820152604481018490529051600160a060020a0392909216926358e59c329260648381019360209390839003909101908290876161da5a03f11561000257506040805180516000805460e160020a632c72ce19028452600484018e9052696d6f64656c5f747970656024850152604484018290529351919850600160a060020a03939093169450606482810193602093839003909101908290876161da5a03f11561000257505060405151925060009150505b600154811015611aae57676d6f64656c5f6964600160005082815481101561000257600091909152600202600080516020611e588339815191520154148015611a4957508286828151811015610002576020908102909101810151015114155b15611ab757604080516020808252818101527f63616e6e6f74206265206368616e676564206166746572206372656174652829818301529051676d6f64656c5f696491600080516020611e38833981519152919081900360600190a260009450610c77565b60019450610c77565b696d6f64656c5f74797065600160005082815481101561000257600091909152600202600080516020611e588339815191520154148015611b0f57508186828151811015610002576020908102909101810151015114155b15611b7657604080516020808252818101527f63616e6e6f74206265206368616e676564206166746572206372656174652829818301529051696d6f64656c5f7479706591600080516020611e38833981519152919081900360600190a260009450610c77565b6001016119e9565b60011415611e1a57600060009054906101000a9004600160a060020a0316600160a060020a0316639c851ebc6040518160e060020a0281526004018090506020604051808303816000876161da5a03f11561000257505060405151935060009250505b600154821015611e22575060015b848281518110156100025760209081029091010151518111611e2c5760005460018054600160a060020a03929092169163505fb46c918691869081101561000257600091909152600202600080516020611e588339815191520154885189908790811015610002579060200190602002015185606581101561000257909060200201516040518460e060020a0281526004018084815260200183815260200182815260200193505050506000604051808303816000876161da5a03f11561000257505050600101611bef565b600080546040805160e260020a631417ed1b028152600481018790526864657374726f7965646024820152604481018490529051600160a060020a03929092169263505fb46c92606483810193829003018183876161da5a03f1156100025750604080516000805460e260020a631417ed1b028352600483018990526c637265617465645f626c6f636b60248401524360448401529251600160a060020a039390931694506064828101939192829003018183876161da5a03f1156100025750604080516000805460e260020a631417ed1b02835260048301899052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a039390931694506064828101939192829003018183876161da5a03f1156100025750506040805185815290517f07eac9a0695a188fe9d6fd680bcbbbe39041fb114d5d7ac11252401391f7930792509081900360200190a18293505b505050919050565b611cbb83336105c6565b60019190910190611be1561aa3de82ed32b15e46e219f19efd6e4138a410853f46b8a761e6e7e91ccf3cfab10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cfab10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf8b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"; 31 | 32 | if ("0x93bbb57590aad225b9697cd0833dfc8557340d37" != "") { 33 | AttributeModel.address = "0x93bbb57590aad225b9697cd0833dfc8557340d37"; 34 | 35 | // Backward compatibility; Deprecated. 36 | AttributeModel.deployed_address = "0x93bbb57590aad225b9697cd0833dfc8557340d37"; 37 | } 38 | 39 | AttributeModel.generated_with = "1.0.2"; 40 | AttributeModel.contract_name = "AttributeModel"; 41 | 42 | return AttributeModel; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.AttributeModel = factory; 54 | } -------------------------------------------------------------------------------- /config/test/DualIndex.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var DualIndex = (function (_Pudding) { 15 | _inherits(DualIndex, _Pudding); 16 | 17 | function DualIndex() { 18 | _classCallCheck(this, DualIndex); 19 | 20 | _get(Object.getPrototypeOf(DualIndex.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return DualIndex; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | DualIndex.abi = [{ "constant": false, "inputs": [{ "name": "key1", "type": "uint256" }, { "name": "key2", "type": "uint256" }, { "name": "value", "type": "uint256" }], "name": "set", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "key1", "type": "uint256" }, { "name": "key2", "type": "uint256" }], "name": "lookup", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_admin", "type": "address" }], "name": "transfer_ownership", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "admin", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "inputs": [], "type": "constructor" }]; 30 | DualIndex.binary = "606060405260018054600160a060020a0319163317905560f0806100236000396000f3606060405260e060020a600035046343b0e8df81146038578063b4b9d1f1146079578063f0350c041460a1578063f851a4401460df575b005b603660043560243560443560015433600160a060020a039081169116141560745760008381526020818152604080832085845290915290208190555b505050565b60043560009081526020818152604080832060243584529091529020545b6060908152602090f35b603660043560015433600160a060020a039081169116141560dc576001805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b6097600154600160a060020a03168156"; 31 | 32 | if ("" != "") { 33 | DualIndex.address = ""; 34 | 35 | // Backward compatibility; Deprecated. 36 | DualIndex.deployed_address = ""; 37 | } 38 | 39 | DualIndex.generated_with = "1.0.2"; 40 | DualIndex.contract_name = "DualIndex"; 41 | 42 | return DualIndex; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.DualIndex = factory; 54 | } -------------------------------------------------------------------------------- /config/test/EternalDB.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var EternalDB = (function (_Pudding) { 15 | _inherits(EternalDB, _Pudding); 16 | 17 | function EternalDB() { 18 | _classCallCheck(this, EternalDB); 19 | 20 | _get(Object.getPrototypeOf(EternalDB.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return EternalDB; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | EternalDB.abi = [{ "constant": true, "inputs": [], "name": "count", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }, { "name": "index", "type": "uint256" }], "name": "delete_entry", "outputs": [], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }], "name": "get_length", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }], "name": "clear", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }, { "name": "value", "type": "uint256" }], "name": "add", "outputs": [], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }, { "name": "index", "type": "uint256" }], "name": "get_entry", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "key", "type": "uint256" }], "name": "get_all", "outputs": [{ "name": "", "type": "uint256[]" }], "type": "function" }, { "constant": false, "inputs": [], "name": "new_entry", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "has", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_admin", "type": "address" }], "name": "transfer_ownership", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "admin", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "inputs": [], "type": "constructor" }]; 30 | EternalDB.binary = "606060405260008054600160a060020a0319163317905560018054818055819081908015829011603a57818360005260206000209182019101505b5050505061052a8061004c6000396000f36060604052361561008d5760e060020a600035046306661abd811461008f5780631a10cfc31461009e578063250108161461013857806341ee903e14610177578063505fb46c146101ef57806358e59c321461028257806389029d8c146102d65780639c851ebc1461036f578063cccf7a8e146103c0578063f0350c04146103d0578063f851a44014610411575b005b6104235b600154600019015b90565b61008d600435602435604435600080548190600160a060020a039081163390911614156104d6576001805486908110156100025750505082815260008051602061050a833981519152840160205260409020815b81546001820110156104dd5781816001018154811015610002579060005260206000209001600050548282815481101561000257505060206000208201556001016100f2565b6104236004356024356000600160005083815481101561000257505081815260008051602061050a833981519152830160205260409020545b92915050565b61008d600435602435600054600160a060020a039081163390911614156104cd576000600160005083815481101561000257505081815260008051602061050a8339815191528301602052604081208054828255829080158290116104c8578183600052602060002091820191016104c8919061026e565b61008d60043560243560443560008054600160a060020a039081163390911614156104be57600180548590811015610002575083825260008051602061050a8339815191528501602052604090912080549182018082559091839183919082908280158290116104a5578183600052602060002091820191016104a591905b808211156104c4576000815560010161026e565b6104236004356024356044356000600160005084815481101561000257505082815260008051602061050a833981519152840160205260408120805483908110156100025750815260209020015492915050565b610435600435602435604080516020810190915260008152600180548490811015610002575050600082815260008051602061050a833981519152840160209081526040918290208054835181840281018401909452808452909183018282801561036357602002820191906000526020600020905b81600050548152602001906001019080831161034c575b50505050509050610171565b61042360008054600160a060020a0390811633909116141561009b57600180548082018083559091908280158290116103b65782855260008051602061050a833981519152015b505050905061009b565b610423600435600061049c610093565b61008d600435600054600160a060020a0390811633909116141561040e576000805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b61047f600054600160a060020a031681565b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b60408051600160a060020a03929092168252519081900360200190f35b90911115919050565b5050508154811015610002576000918252602090912001555b50505050565b5090565b505050505b5050565b505050505b5050505050565b8154600019810180845583908280158290116104d1576000838152602090206104d191810190830161026e56b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"; 31 | 32 | if ("0xc2b29db38d5f83681940422ee36f06021ea5d3a9" != "") { 33 | EternalDB.address = "0xc2b29db38d5f83681940422ee36f06021ea5d3a9"; 34 | 35 | // Backward compatibility; Deprecated. 36 | EternalDB.deployed_address = "0xc2b29db38d5f83681940422ee36f06021ea5d3a9"; 37 | } 38 | 39 | EternalDB.generated_with = "1.0.2"; 40 | EternalDB.contract_name = "EternalDB"; 41 | 42 | return EternalDB; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.EternalDB = factory; 54 | } -------------------------------------------------------------------------------- /config/test/Example.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var Example = (function (_Pudding) { 15 | _inherits(Example, _Pudding); 16 | 17 | function Example() { 18 | _classCallCheck(this, Example); 19 | 20 | _get(Object.getPrototypeOf(Example.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return Example; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | Example.abi = [{ "inputs": [], "type": "constructor" }]; 30 | Example.binary = "606060405260068060106000396000f3606060405200"; 31 | 32 | if ("" != "") { 33 | Example.address = ""; 34 | 35 | // Backward compatibility; Deprecated. 36 | Example.deployed_address = ""; 37 | } 38 | 39 | Example.generated_with = "1.0.2"; 40 | Example.contract_name = "Example"; 41 | 42 | return Example; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.Example = factory; 54 | } -------------------------------------------------------------------------------- /config/test/Model.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var Model = (function (_Pudding) { 15 | _inherits(Model, _Pudding); 16 | 17 | function Model() { 18 | _classCallCheck(this, Model); 19 | 20 | _get(Object.getPrototypeOf(Model.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return Model; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | Model.abi = [{ "constant": true, "inputs": [], "name": "coordinator", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "read_only", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_keys", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_read_only_keys", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "association_name", "type": "uint256" }, { "name": "association_id", "type": "uint256" }], "name": "add_to_association", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "db", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_associations", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "has_owners", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "sender", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "attributes", "type": "uint256[101][]" }], "name": "validate", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "keys", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [], "name": "get_default_keys", "outputs": [{ "name": "", "type": "uint256[2][4]" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }], "name": "destroy", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "owner", "type": "address" }], "name": "add_owner", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "attributes", "type": "uint256[101][]" }], "name": "create", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "replacement", "type": "address" }], "name": "replace", "outputs": [], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "to_check", "type": "address" }], "name": "is_owner", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "is_destroyed", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_coordinator", "type": "address" }], "name": "set_coordinator", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "reference_name", "type": "uint256" }, { "name": "reference_id", "type": "uint256" }], "name": "set_reference", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "_db", "type": "address" }], "name": "set_db", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "attributes", "type": "uint256[101][]" }], "name": "update", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "get_blocks_for", "outputs": [{ "name": "", "type": "uint256[2]" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "associations", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "inputs": [], "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "reason", "type": "string" }], "name": "Log", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Create", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Update", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Destroy", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "key", "type": "uint256" }, { "indexed": false, "name": "reason", "type": "string" }], "name": "ValidationError", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "reason", "type": "string" }], "name": "GeneralError", "type": "event" }]; 30 | Model.binary = "606060405260048054600160a060020a0319163317905561187f806100246000396000f3606060405236156101115760e060020a60003504630a00909781146101135780631e3dbb27146101255780633fda12811461016457806341d31feb146101e757806349fb2dc51461026a5780634d655aff146102d7578063582ca57b146102e9578063595da94d1461036c57806367f12ecf146103e05780638b935fb1146104575780638ee21b8e146104965780639d118770146105ac578063b56b2627146105bc578063c27d7721146105cf578063cabfb9341461063f578063d716222c146106c3578063db6fcf01146107cb578063de778edb14610848578063e2deaa8114610888578063e7156dbe146108f7578063eb121e2f14610933578063ebd83378146109a5578063ffd1d50414610add575b005b610b34600454600160a060020a031681565b610b5160043560243560038054839081101561000257906000526020600020906002020160005081600281101561000257909001600091509150505481565b6040805160208181018352600080835283516001805480850283018501909652858252610b6395919390929084015b82821015610cc85760008481526040805160209092208282019182905260028581029091019182845b8160005054815260200190600101908083116101bc575b505050505081526020019060010190610193565b6040805160208181018352600080835283516003805480850283018501909652858252610b6395919390929084015b82821015610cc85760008481526040805160209092208282019182905260028581029091019182845b81600050548152602001906001019080831161023f575b505050505081526020019060010190610216565b610111600435602435604435600080546040805160e160020a636667bd470281526004810187905290518392600160a060020a03169163cccf7a8e916024828101926020929190829003018187876161da5a03f11561000257505060405151821415905061156057611559565b610b34600054600160a060020a031681565b6040805160208181018352600080835283516002805480850283018501909652858252610b6395919390929084015b82821015610cc85760008481526040805160209092208282019182905260028581029091019182845b816000505481526020019060010190808311610341575b505050505081526020019060010190610318565b610b516004355b600080546040805160e160020a631280840b02815260048101859052656f776e65727360248201529051600160a060020a039290921691632501081691604481810192602092909190829003018187876161da5a03f115610002575050604051519091141590505b919050565b60408051604435600481810135602081810285018101909552808452610b51948235946024803595606494929391019190819060009085015b82821015610bbe5760408051610ca0818101909252908381028701906065908390839080828437820191505050505081526020019060010190610419565b610b5160043560243560018054839081101561000257906000526020600020906002020160005081600281101561000257909001600091509150505481565b610bd1610100604051908101604052806004905b6040604051908101604052806002905b60008152602001906001900390816104ba579050508152602001906001900390816104aa5750506040805161010081019091526004815b6040604051908101604052806002905b6000815260200190600190039081610501579050508152602001906001900390816104f157505080516c637265617465645f626c6f636b9052805166696e746567657260209182018190528282018051716c6173745f757064617465645f626c6f636b905251820152604082018051656f776e6572739052516c696e74656765725f6172726179908201526060820180516864657374726f79656490525163626f6f6c910152919050565b61011160043561133781336106cd565b6101116004356024355b61125682610373565b604080516004803580820135602081810285018101909552808452610b51949293602493909284019190819060009085015b82821015610c155760408051610ca0818101909252908381028701906065908390839080828437820191505050505081526020019060010190610601565b610111600435600454600160a060020a039081163390911614156109305760008054604080517ff0350c04000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301529151929091169263f0350c0492602483810193829003018183876161da5a03f1156100025750505050565b610b516004356024355b600080805b600080546040805160e160020a631280840b02815260048101899052656f776e65727360248201529051600160a060020a03929092169263250108169260448381019360209390839003909101908290876161da5a03f1156100025750506040515160ff841610159050610f9d57604080516000805460e160020a632c72ce1902835260048301899052656f776e657273602484015260ff861660448401529251600160a060020a0393909316926358e59c329260648181019360209392839003909101908290876161da5a03f11561000257505060405151915050600160a060020a03848116908216141561124a5760019250610fa2565b610b51600435600080546040805160e160020a632c72ce19028152600481018590526864657374726f7965646024820152604481018490529051600160a060020a0392909216916358e59c3291606481810192602092909190829003018187876161da5a03f1156100025750506040515160011491506103db9050565b610111600435600454600160a060020a03908116339091161415610930576004805473ffffffffffffffffffffffffffffffffffffffff19168217905550565b610111600435602435604435600080546040805160e160020a636667bd47028152600481018790529051600160a060020a03929092169163cccf7a8e91602481810192602092909190829003018187876161da5a03f1156100025750506040515182141590506117f3576117ed565b61011160043560008054600160a060020a03161415610930576000805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b6040805160248035600481810135602081810286018101909652808552610b51958235959294604494019190819060009085015b82821015610c935760408051610ca0818101909252908381028701906065908390839080828437820191505050505081526020019060010190610967565b610cad6004356040604051908101604052806002905b60008152602001906001900390816109bb575050604080518082019091526002815b60008152602001906001900390816109dd575050600080546040805160e160020a632c72ce19028152600481018790526c637265617465645f626c6f636b6024820152604481018490529051600160a060020a0392909216926358e59c329260648381019360209390839003909101908290876161da5a03f11561000257506040805151845260008054825160e160020a632c72ce1902815260048101899052716c6173745f757064617465645f626c6f636b6024820152604481018390529251600160a060020a0391909116945060648381019360209390839003909101908290876161da5a03f1156100025750506040515160208301525092915050565b610b5160043560243560028054839081101561000257600082815291027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0190508160028110156100025701600091509150505481565b60408051600160a060020a03929092168252519081900360200190f35b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080516000925b81841015610bad57602084810284010151604080838184600060046015f1509050019260010192610b81565b925050509250505060405180910390f35b5093955050505050505b60019392505050565b6040516000826004835b81841015610c055760208402830151604080838184600060046015f1509050019260010192610bdb565b9250505091505060405180910390f35b509395505050505050604080516020808252600e908201527f63726561746520737461727465640000000000000000000000000000000000008183015290516000918291829182917fcf34ef537ac33ee1ac626ca1587a0a7e8e51561e5514f8cb36afa1c5102b3bab9181900360600190a1610cd133600087610bc8565b509395505050505050600060006000610faa338686610bc8565b60408051908190839080838184600060046015f15093505050f35b50505050905090565b60011415610f7f57600060009054906101000a9004600160a060020a0316600160a060020a0316639c851ebc6040518160e060020a0281526004018090506020604051808303816000876161da5a03f11561000257505060405151935060009250505b600154821015610f87575060015b848281518110156100025760209081029091010151518111610f915760005460018054600160a060020a03929092169163505fb46c9186918690811015610002576000919091526002027fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60154885189908790811015610002579060200190602002015185606581101561000257909060200201516040518460e060020a0281526004018084815260200183815260200182815260200193505050506000604051808303816000876161da5a03f11561000257505050600101610d42565b600080546040805160e260020a631417ed1b028152600481018790526864657374726f7965646024820152604481018490529051600160a060020a03929092169263505fb46c92606483810193829003018183876161da5a03f1156100025750604080516000805460e260020a631417ed1b028352600483018990526c637265617465645f626c6f636b60248401524360448401529251600160a060020a039390931694506064828101939192829003018183876161da5a03f1156100025750604080516000805460e260020a631417ed1b02835260048301899052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a039390931694506064828101939192829003018183876161da5a03f1156100025750506040805185815290517f07eac9a0695a188fe9d6fd680bcbbbe39041fb114d5d7ac11252401391f7930792509081900360200190a18293505b505050919050565b610e2083336105c6565b60019190910190610d34565b600092505b505092915050565b60011415610f9d57600091505b6001548210156111335760005460018054600160a060020a0392909216916341ee903e91889186908110156100025760009182526002027fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6019050600050546040518360e060020a02815260040180838152602001828152602001925050506000604051808303816000876161da5a03f11561000257505050600190505b83828151811015610002576020908102909101015151811161123e5760005460018054600160a060020a03929092169163505fb46c9188918690811015610002576000919091526002027fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60154875188908790811015610002579060200190602002015185606581101561000257909060200201516040518460e060020a0281526004018084815260200183815260200182815260200193505050506000604051808303816000876161da5a03f11561000257505050600101611055565b600080546040805160e160020a6320f7481f02815260048101899052716c6173745f757064617465645f626c6f636b60248201529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018a9052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f1156100025750506040805187815290517f164f7b2ab803097dab5e39f06d2e4f3c3ddc5d4171abbdcc3e76443b8359c7f592509081900360200190a160019250610fa2565b60019190910190610fb7565b600191909101906106d2565b600014156112c357604080516000805460e260020a631417ed1b02835260048301869052656f776e6572736024840152600160a060020a038581166044850152935193169263505fb46c926064818101939291829003018183876161da5a03f11561000257505050611333565b6112cd82336106cd565b1561133357600080546040805160e260020a631417ed1b02815260048101869052656f776e6572736024820152600160a060020a0385811660448301529151929091169263505fb46c92606483810193829003018183876161da5a03f115610002575050505b5050565b1561093057600080546040805160e160020a6320f7481f028152600481018590526864657374726f79656460248201529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018690526864657374726f7965646024840152600160448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f1156100025750506040805183815290517fd3f5559c9fe2c1b988daa9f5520155e1a89d750e0a7b2ee17afcd4b76dd95bcd92509081900360200190a150565b600080546040805160e260020a631417ed1b0281526004810189905260248101889052604481018790529051600160a060020a03929092169263505fb46c92606483810193829003018183876161da5a03f115610002575050604080516000805460e160020a6320f7481f028352600483018a9052716c6173745f757064617465645f626c6f636b60248401529251600160a060020a039390931693506341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018a9052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f115610002575050505b5050505050565b5060009050805b6002548110156115e457836002600050828154811015610002576000829052027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace015414156116675760028054829081101561000257027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf015491505b816000148061165d5750600460009054906101000a9004600160a060020a0316600160a060020a0316636a030ca9836040518260e060020a028152600401808281526020019150506020604051808303816000876161da5a03f11561000257505060405151600160a060020a0390811633909116141590505b1561143057611559565b600101611567565b600080546040805160e160020a6320f7481f02815260048101889052602481018790529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b0283526004830189905260248301889052604483018790529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f115610002575050604080516000805460e160020a6320f7481f02835260048301899052716c6173745f757064617465645f626c6f636b60248401529251600160a060020a039390931693506341ee903e92604483810193829003018183876161da5a03f115610002575050600080546040805160e260020a631417ed1b02815260048101899052716c6173745f757064617465645f626c6f636b60248201524360448201529051600160a060020a0392909216935063505fb46c926064828101939192829003018183876161da5a03f115610002575050505b50505050565b5060408051600480547f6a030ca90000000000000000000000000000000000000000000000000000000083526301000000860491830182905292519092600160a060020a031691636a030ca991602482810192602092919082900301816000876161da5a03f11561000257505060405151600160a060020a039081163390911614905061166f576117ed56"; 31 | 32 | if ("0x02b11b4f2e50028bea1e0457f8983fd285710ce3" != "") { 33 | Model.address = "0x02b11b4f2e50028bea1e0457f8983fd285710ce3"; 34 | 35 | // Backward compatibility; Deprecated. 36 | Model.deployed_address = "0x02b11b4f2e50028bea1e0457f8983fd285710ce3"; 37 | } 38 | 39 | Model.generated_with = "1.0.2"; 40 | Model.contract_name = "Model"; 41 | 42 | return Model; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.Model = factory; 54 | } -------------------------------------------------------------------------------- /config/test/ModelCoordinator.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var ModelCoordinator = (function (_Pudding) { 15 | _inherits(ModelCoordinator, _Pudding); 16 | 17 | function ModelCoordinator() { 18 | _classCallCheck(this, ModelCoordinator); 19 | 20 | _get(Object.getPrototypeOf(ModelCoordinator.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return ModelCoordinator; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | ModelCoordinator.abi = [{ "constant": true, "inputs": [{ "name": "", "type": "uint256" }], "name": "models", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "name", "type": "uint256" }, { "name": "model", "type": "address" }, { "name": "db", "type": "address" }], "name": "register", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "admin", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "inputs": [], "type": "constructor" }]; 30 | ModelCoordinator.binary = "606060405260018054600160a060020a03191633179055610781806100246000396000f3606060405260e060020a60003504636a030ca98114610031578063a73c50fa14610052578063f851a440146101e6575b005b6101f8600435600060208190529081526040902054600160a060020a031681565b61002f60043560243560443560015460009033600160a060020a03908116911614156101e05783815260208190526040812054600160a060020a031681146100f15760408120547fcabfb934000000000000000000000000000000000000000000000000000000006060908152600160a060020a038581166064529190911691829163cabfb9349160849160248183876161da5a03f115610002575050505b604060009081208582526020829052805473ffffffffffffffffffffffffffffffffffffffff191685179055600160a060020a0383161415610193576040516105768061020b83398101819003906000f09150815081600160a060020a031663f0350c04846040518260e060020a0281526004018082600160a060020a031681526020019150506000604051808303816000876161da5a03f115610002575050505b82600160a060020a031663e7156dbe836040518260e060020a0281526004018082600160a060020a031681526020019150506000604051808303816000876161da5a03f115610002575050505b50505050565b6101f8600154600160a060020a031681565b600160a060020a03166060908152602090f3606060405260008054600160a060020a0319163317905560018054818055819081908015829011603a57818360005260206000209182019101505b5050505061052a8061004c6000396000f36060604052361561008d5760e060020a600035046306661abd811461008f5780631a10cfc31461009e578063250108161461013857806341ee903e14610177578063505fb46c146101ef57806358e59c321461028257806389029d8c146102d65780639c851ebc1461036f578063cccf7a8e146103c0578063f0350c04146103d0578063f851a44014610411575b005b6104235b600154600019015b90565b61008d600435602435604435600080548190600160a060020a039081163390911614156104d6576001805486908110156100025750505082815260008051602061050a833981519152840160205260409020815b81546001820110156104dd5781816001018154811015610002579060005260206000209001600050548282815481101561000257505060206000208201556001016100f2565b6104236004356024356000600160005083815481101561000257505081815260008051602061050a833981519152830160205260409020545b92915050565b61008d600435602435600054600160a060020a039081163390911614156104cd576000600160005083815481101561000257505081815260008051602061050a8339815191528301602052604081208054828255829080158290116104c8578183600052602060002091820191016104c8919061026e565b61008d60043560243560443560008054600160a060020a039081163390911614156104be57600180548590811015610002575083825260008051602061050a8339815191528501602052604090912080549182018082559091839183919082908280158290116104a5578183600052602060002091820191016104a591905b808211156104c4576000815560010161026e565b6104236004356024356044356000600160005084815481101561000257505082815260008051602061050a833981519152840160205260408120805483908110156100025750815260209020015492915050565b610435600435602435604080516020810190915260008152600180548490811015610002575050600082815260008051602061050a833981519152840160209081526040918290208054835181840281018401909452808452909183018282801561036357602002820191906000526020600020905b81600050548152602001906001019080831161034c575b50505050509050610171565b61042360008054600160a060020a0390811633909116141561009b57600180548082018083559091908280158290116103b65782855260008051602061050a833981519152015b505050905061009b565b610423600435600061049c610093565b61008d600435600054600160a060020a0390811633909116141561040e576000805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b61047f600054600160a060020a031681565b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b60408051600160a060020a03929092168252519081900360200190f35b90911115919050565b5050508154811015610002576000918252602090912001555b50505050565b5090565b505050505b5050565b505050505b5050505050565b8154600019810180845583908280158290116104d1576000838152602090206104d191810190830161026e56b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"; 31 | 32 | if ("0xeee67e69acadbf98058f048ab66434bcfdb7c715" != "") { 33 | ModelCoordinator.address = "0xeee67e69acadbf98058f048ab66434bcfdb7c715"; 34 | 35 | // Backward compatibility; Deprecated. 36 | ModelCoordinator.deployed_address = "0xeee67e69acadbf98058f048ab66434bcfdb7c715"; 37 | } 38 | 39 | ModelCoordinator.generated_with = "1.0.2"; 40 | ModelCoordinator.contract_name = "ModelCoordinator"; 41 | 42 | return ModelCoordinator; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.ModelCoordinator = factory; 54 | } -------------------------------------------------------------------------------- /config/test/SimpleIndex.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var SimpleIndex = (function (_Pudding) { 15 | _inherits(SimpleIndex, _Pudding); 16 | 17 | function SimpleIndex() { 18 | _classCallCheck(this, SimpleIndex); 19 | 20 | _get(Object.getPrototypeOf(SimpleIndex.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return SimpleIndex; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | SimpleIndex.abi = [{ "constant": false, "inputs": [{ "name": "key", "type": "uint256" }], "name": "lookup", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "key", "type": "uint256" }, { "name": "value", "type": "uint256" }], "name": "set", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "_admin", "type": "address" }], "name": "transfer_ownership", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "admin", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "inputs": [], "type": "constructor" }]; 30 | SimpleIndex.binary = "606060405260018054600160a060020a0319163317905560d88060226000396000f3606060405260e060020a60003504630a874df6811460385780631ab06ee5146055578063f0350c04146089578063f851a4401460c7575b005b6004356000908152602081905260409020545b6060908152602090f35b603660043560243560015433600160a060020a039081169116141560855760008281526020819052604090208190555b5050565b603660043560015433600160a060020a039081169116141560c4576001805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b604b600154600160a060020a03168156"; 31 | 32 | if ("" != "") { 33 | SimpleIndex.address = ""; 34 | 35 | // Backward compatibility; Deprecated. 36 | SimpleIndex.deployed_address = ""; 37 | } 38 | 39 | SimpleIndex.generated_with = "1.0.2"; 40 | SimpleIndex.contract_name = "SimpleIndex"; 41 | 42 | return SimpleIndex; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.SimpleIndex = factory; 54 | } -------------------------------------------------------------------------------- /config/test/UserModel.sol.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var factory = function factory(Pudding) { 10 | // Inherit from Pudding. The dependency on Babel sucks, but it's 11 | // the easiest way to extend a Babel-based class. Note that the 12 | // resulting .js file does not have a dependency on Babel. 13 | 14 | var UserModel = (function (_Pudding) { 15 | _inherits(UserModel, _Pudding); 16 | 17 | function UserModel() { 18 | _classCallCheck(this, UserModel); 19 | 20 | _get(Object.getPrototypeOf(UserModel.prototype), "constructor", this).apply(this, arguments); 21 | } 22 | 23 | return UserModel; 24 | })(Pudding); 25 | 26 | ; 27 | 28 | // Set up specific data for this class. 29 | UserModel.abi = [{ "constant": true, "inputs": [], "name": "coordinator", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "read_only", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_keys", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_read_only_keys", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "association_name", "type": "uint256" }, { "name": "association_id", "type": "uint256" }], "name": "add_to_association", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "db", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [], "name": "get_associations", "outputs": [{ "name": "", "type": "uint256[2][]" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "has_owners", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "sender", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "attributes", "type": "uint256[101][]" }], "name": "validate", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_address", "type": "address" }], "name": "id_for_address", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "keys", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [], "name": "get_default_keys", "outputs": [{ "name": "", "type": "uint256[2][4]" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }], "name": "destroy", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "owner", "type": "address" }], "name": "add_owner", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "attributes", "type": "uint256[101][]" }], "name": "create", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "replacement", "type": "address" }], "name": "replace", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "address_index", "outputs": [{ "name": "", "type": "address" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "to_check", "type": "address" }], "name": "is_owner", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "is_destroyed", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": false, "inputs": [{ "name": "_coordinator", "type": "address" }], "name": "set_coordinator", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "reference_name", "type": "uint256" }, { "name": "reference_id", "type": "uint256" }], "name": "set_reference", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "_db", "type": "address" }], "name": "set_db", "outputs": [], "type": "function" }, { "constant": false, "inputs": [{ "name": "id", "type": "uint256" }, { "name": "attributes", "type": "uint256[101][]" }], "name": "update", "outputs": [{ "name": "", "type": "bool" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "id", "type": "uint256" }], "name": "get_blocks_for", "outputs": [{ "name": "", "type": "uint256[2]" }], "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }], "name": "associations", "outputs": [{ "name": "", "type": "uint256" }], "type": "function" }, { "inputs": [{ "name": "_address_index", "type": "address" }], "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "reason", "type": "string" }], "name": "Log", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Create", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Update", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "id", "type": "uint256" }], "name": "Destroy", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "key", "type": "uint256" }, { "indexed": false, "name": "reason", "type": "string" }], "name": "ValidationError", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "name": "reason", "type": "string" }], "name": "GeneralError", "type": "event" }]; 30 | UserModel.binary = "6060604052604051602080611e1283395060806040525160048054600160a060020a0319163317905580600160a060020a03166000141561004b57608060fa806101fe8339906000f090505b60058054600160a060020a03191682179055600180548180558190819080158290116100ca5760008290526100ca90600202600080516020611df2833981519152017fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf85b8082111561017d5760008082556001919091019081556100af565b50505050666164647265737360016000506000815481101561000257818152600080516020611df2833981519152839055815481101561000257507fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf7919091556002805482825582908015829011610181576000839052610181908302600080516020611dd2833981519152017f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad06100af565b5090565b50505050676c6963656e73657360026000506000815481101561000257818152600080516020611dd2833981519152929092558054666c6963656e73659290811015610002577f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf9290925550611ada915081906102f890396000f300606060405260018054600160a060020a0319163317905560d88060226000396000f3606060405260e060020a60003504630a874df6811460385780631ab06ee5146055578063f0350c04146089578063f851a4401460c7575b005b6004356000908152602081905260409020545b6060908152602090f35b603660043560243560015433600160a060020a039081169116141560855760008281526020819052604090208190555b5050565b603660043560015433600160a060020a039081169116141560c4576001805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b604b600154600160a060020a03168156606060405236156101275760e060020a60003504630a00909781146101295780631e3dbb271461013b5780633fda12811461017a57806341d31feb146101fd57806349fb2dc5146102805780634d655aff146102ed578063582ca57b146102ff578063595da94d1461038257806367f12ecf146103f6578063743438ad1461046d5780638b935fb1146104d35780638ee21b8e146105125780639d11877014610628578063b56b262714610638578063c27d77211461064b578063cabfb934146106bb578063d528161814610795578063d716222c146107a7578063db6fcf01146108af578063de778edb1461092c578063e2deaa811461096c578063e7156dbe146109db578063eb121e2f14610a17578063ebd8337814610a89578063ffd1d50414610bc1575b005b610c18600454600160a060020a031681565b610c3560043560243560038054839081101561000257906000526020600020906002020160005081600281101561000257909001600091509150505481565b6040805160208181018352600080835283516001805480850283018501909652858252610c4795919390929084015b82821015610e935760008481526040805160209092208282019182905260028581029091019182845b8160005054815260200190600101908083116101d2575b5050505050815260200190600101906101a9565b6040805160208181018352600080835283516003805480850283018501909652858252610c4795919390929084015b82821015610e935760008481526040805160209092208282019182905260028581029091019182845b816000505481526020019060010190808311610255575b50505050508152602001906001019061022c565b610127600435602435604435600080546040805160e160020a636667bd470281526004810187905290518392600160a060020a03169163cccf7a8e916024828101926020929190829003018187876161da5a03f11561000257505060405151821415905061145f57611458565b610c18600054600160a060020a031681565b6040805160208181018352600080835283516002805480850283018501909652858252610c4795919390929084015b82821015610e935760008481526040805160209092208282019182905260028581029091019182845b816000505481526020019060010190808311610357575b50505050508152602001906001019061032e565b610c356004355b600080546040805160e160020a631280840b02815260048101859052656f776e65727360248201529051600160a060020a039290921691632501081691604481810192602092909190829003018187876161da5a03f115610002575050604051519091141590505b919050565b60408051604435600481810135602081810285018101909552808452610c35948235946024803595606494929391019190819060009085015b82821015610ca25760408051610ca081810190925290838102870190606590839083908082843782019150505050508152602001906001019061042f565b610c356004356040805160055460e160020a630543a6fb028252600160a060020a03848116600484015292516000939190911691630a874df6916024828101926020929190829003018187876161da5a03f1156100025750506040515191506103f19050565b610c3560043560243560018054839081101561000257906000526020600020906002020160005081600281101561000257909001600091509150505481565b610d92610100604051908101604052806004905b6040604051908101604052806002905b6000815260200190600190039081610536579050508152602001906001900390816105265750506040805161010081019091526004815b6040604051908101604052806002905b600081526020019060019003908161057d5790505081526020019060019003908161056d57505080516c637265617465645f626c6f636b9052805166696e746567657260209182018190528282018051716c6173745f757064617465645f626c6f636b905251820152604082018051656f776e6572739052516c696e74656765725f6172726179908201526060820180516864657374726f79656490525163626f6f6c910152919050565b61012760043561123681336107b1565b6101276004356024355b61115582610389565b604080516004803580820135602081810285018101909552808452610c35949293602493909284019190819060009085015b82821015610dd65760408051610ca081810190925290838102870190606590839083908082843782019150505050508152602001906001019061067d565b610127600435600454600160a060020a03908116339091161415610a14576040805160055460e260020a633c0d4301028252600160a060020a038481166004840152925192169163f0350c0491602481810192600092909190829003018183876161da5a03f11561000257505050610a1481600454600160a060020a03908116339091161415610a1457600080546040805160e260020a633c0d4301028152600160a060020a0385811660048301529151929091169263f0350c0492602483810193829003018183876161da5a03f1156100025750505050565b610c18600554600160a060020a031681565b610c356004356024355b600080805b600080546040805160e160020a631280840b02815260048101899052656f776e65727360248201529051600160a060020a03929092169263250108169260448381019360209390839003909101908290876161da5a03f1156100025750506040515160ff841610159050610e9c57604080516000805460e160020a632c72ce1902835260048301899052656f776e657273602484015260ff861660448401529251600160a060020a0393909316926358e59c329260648181019360209392839003909101908290876161da5a03f11561000257505060405151915050600160a060020a0381811690851614156111495760019250610ea1565b610c35600435600080546040805160e160020a632c72ce19028152600481018590526864657374726f7965646024820152604481018490529051600160a060020a0392909216916358e59c3291606481810192602092909190829003018187876161da5a03f1156100025750506040515160011491506103f19050565b610127600435600454600160a060020a03908116339091161415610a14576004805473ffffffffffffffffffffffffffffffffffffffff19168217905550565b610127600435602435604435600080546040805160e160020a636667bd47028152600481018790529051600160a060020a03929092169163cccf7a8e91602481810192602092909190829003018187876161da5a03f1156100025750506040515182141590506116f2576116ec565b61012760043560008054600160a060020a03161415610a14576000805473ffffffffffffffffffffffffffffffffffffffff1916821790555b50565b6040805160248035600481810135602081810286018101909652808552610c35958235959294604494019190819060009085015b82821015610e5e5760408051610ca0818101909252908381028701906065908390839080828437820191505050505081526020019060010190610a4b565b610e786004356040604051908101604052806002905b6000815260200190600190039081610a9f575050604080518082019091526002815b6000815260200190600190039081610ac1575050600080546040805160e160020a632c72ce19028152600481018790526c637265617465645f626c6f636b6024820152604481018490529051600160a060020a0392909216926358e59c329260648381019360209390839003909101908290876161da5a03f11561000257506040805151845260008054825160e160020a632c72ce1902815260048101899052716c6173745f757064617465645f626c6f636b6024820152604481018390529251600160a060020a0391909116945060648381019360209390839003909101908290876161da5a03f1156100025750506040515160208301525092915050565b610c3560043560243560028054839081101561000257600082815291027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0190508160028110156100025701600091509150505481565b60408051600160a060020a03929092168252519081900360200190f35b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080516000925b81841015610c9157602084810284010151604080838184600060046015f1509050019260010192610c65565b925050509250505060405180910390f35b5093955050505050505b60008260001415611813576005548251600160a060020a039190911690630a874df6908490849081101561000257506040805160209283015183015160e160020a630543a6fb0282526004820152905160248281019392829003018187876161da5a03f115610002575050604051518214905061181e57604080516020808252600e908201527f6d75737420626520756e697175650000000000000000000000000000000000008183015290516661646472657373917f1aa3de82ed32b15e46e219f19efd6e4138a410853f46b8a761e6e7e91ccf3cfa919081900360600190a2611817565b6040516000826004835b81841015610dc65760208402830151604080838184600060046015f1509050019260010192610d9c565b9250505091505060405180910390f35b50939550505050505060006000600061177e84604080516020808252600e908201527f63726561746520737461727465640000000000000000000000000000000000008183015290516000918291829182917fcf34ef537ac33ee1ac626ca1587a0a7e8e51561e5514f8cb36afa1c5102b3bab9181900360600190a161182633600087610cac565b509395505050505050600060006000610ea9338686610cac565b60408051908190839080838184600060046015f15093505050f35b50505050905090565b600092505b505092915050565b60011415610e9c57600091505b6001548210156110325760005460018054600160a060020a0392909216916341ee903e91889186908110156100025760009182526002027fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6019050600050546040518360e060020a02815260040180838152602001828152602001925050506000604051808303816000876161da5a03f11561000257505050600190505b83828151811015610002576020908102909101015151811161113d5760005460018054600160a060020a03929092169163505fb46c9188918690811015610002576000919091526002027fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60154875188908790811015610002579060200190602002015185606581101561000257909060200201516040518460e060020a0281526004018084815260200183815260200182815260200193505050506000604051808303816000876161da5a03f11561000257505050600101610f54565b600080546040805160e160020a6320f7481f02815260048101899052716c6173745f757064617465645f626c6f636b60248201529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018a9052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f1156100025750506040805187815290517f164f7b2ab803097dab5e39f06d2e4f3c3ddc5d4171abbdcc3e76443b8359c7f592509081900360200190a160019250610ea1565b60019190910190610eb6565b600191909101906107b6565b600014156111c257604080516000805460e260020a631417ed1b02835260048301869052656f776e6572736024840152600160a060020a038581166044850152935193169263505fb46c926064818101939291829003018183876161da5a03f11561000257505050611232565b6111cc82336107b1565b1561123257604080516000805460e260020a631417ed1b02835260048301869052656f776e6572736024840152600160a060020a038581166044850152935193169263505fb46c926064818101939291829003018183876161da5a03f115610002575050505b5050565b15610a1457600080546040805160e160020a6320f7481f028152600481018590526864657374726f79656460248201529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018690526864657374726f7965646024840152600160448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f1156100025750506040805183815290517fd3f5559c9fe2c1b988daa9f5520155e1a89d750e0a7b2ee17afcd4b76dd95bcd92509081900360200190a150565b600080546040805160e260020a631417ed1b0281526004810189905260248101889052604481018790529051600160a060020a03929092169263505fb46c92606483810193829003018183876161da5a03f115610002575050604080516000805460e160020a6320f7481f028352600483018a9052716c6173745f757064617465645f626c6f636b60248401529251600160a060020a039390931693506341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b028352600483018a9052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f115610002575050505b5050505050565b5060009050805b6002548110156114e357836002600050828154811015610002576000829052027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace015414156115665760028054829081101561000257027f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf015491505b816000148061155c5750600460009054906101000a9004600160a060020a0316600160a060020a0316636a030ca9836040518260e060020a028152600401808281526020019150506020604051808303816000876161da5a03f11561000257505060405151600160a060020a0390811633909116141590505b1561132f57611458565b600101611466565b600080546040805160e160020a6320f7481f02815260048101889052602481018790529051600160a060020a0392909216926341ee903e92604483810193829003018183876161da5a03f115610002575050604080516000805460e260020a631417ed1b0283526004830189905260248301889052604483018790529251600160a060020a0393909316935063505fb46c92606483810193829003018183876161da5a03f115610002575050604080516000805460e160020a6320f7481f02835260048301899052716c6173745f757064617465645f626c6f636b60248401529251600160a060020a039390931693506341ee903e92604483810193829003018183876161da5a03f115610002575050600080546040805160e260020a631417ed1b02815260048101899052716c6173745f757064617465645f626c6f636b60248201524360448201529051600160a060020a0392909216935063505fb46c926064828101939192829003018183876161da5a03f115610002575050505b50505050565b5060408051600480547f6a030ca90000000000000000000000000000000000000000000000000000000083526301000000860491830182905292519092600160a060020a031691636a030ca991602482810192602092919082900301816000876161da5a03f11561000257505060405151600160a060020a039081163390911614905061156e576116ec565b91506000821461180c5783600081518110156100025760408051602093840151909301516005547f1ab06ee500000000000000000000000000000000000000000000000000000000855260048501829052602485018790529151909450600160a060020a039190911692631ab06ee5926044828101939192829003018183876161da5a03f115610002575050505b5092915050565b5060005b9392505050565b506001611817565b60011415611abc57600060009054906101000a9004600160a060020a0316600160a060020a0316639c851ebc6040518160e060020a0281526004018090506020604051808303816000876161da5a03f11561000257505060405151935060009250505b600154821015611ac4575060015b84828151811015610002575050602082810286010151518111611ace5760005460018054600160a060020a03929092169163505fb46c91869186908110156100025790600052602060002090600202016000506000505488868151811015610002579060200190602002015185606581101561000257909060200201516040518460e060020a0281526004018084815260200183815260200182815260200193505050506000604051808303816000876161da5a03f11561000257505050600101611897565b600080546040805160e260020a631417ed1b028152600481018790526864657374726f7965646024820152604481018490529051600160a060020a03929092169263505fb46c92606483810193829003018183876161da5a03f1156100025750604080516000805460e260020a631417ed1b028352600483018990526c637265617465645f626c6f636b60248401524360448401529251600160a060020a039390931694506064828101939192829003018183876161da5a03f1156100025750604080516000805460e260020a631417ed1b02835260048301899052716c6173745f757064617465645f626c6f636b60248401524360448401529251600160a060020a039390931694506064828101939192829003018183876161da5a03f1156100025750506040805185815290517f07eac9a0695a188fe9d6fd680bcbbbe39041fb114d5d7ac11252401391f7930792509081900360200190a18293505b505050919050565b61195d8333610642565b6001919091019061188956405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5aceb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"; 31 | 32 | if ("0xd853dbf029c2216f29481a7f90a05f2dba8ab738" != "") { 33 | UserModel.address = "0xd853dbf029c2216f29481a7f90a05f2dba8ab738"; 34 | 35 | // Backward compatibility; Deprecated. 36 | UserModel.deployed_address = "0xd853dbf029c2216f29481a7f90a05f2dba8ab738"; 37 | } 38 | 39 | UserModel.generated_with = "1.0.2"; 40 | UserModel.contract_name = "UserModel"; 41 | 42 | return UserModel; 43 | }; 44 | 45 | // Nicety for Node. 46 | factory.load = factory; 47 | 48 | if (typeof module != "undefined") { 49 | module.exports = factory; 50 | } else { 51 | // There will only be one version of Pudding in the browser, 52 | // and we can use that. 53 | window.UserModel = factory; 54 | } -------------------------------------------------------------------------------- /config/test/config.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /contracts/AttributeModel.sol: -------------------------------------------------------------------------------- 1 | import "Model"; 2 | 3 | contract AttributeModel is Model { 4 | uint constant KEY = 0x6b6579; // "key" 5 | uint constant VALUE = 0x76616c7565; // "value" 6 | uint constant MODEL_ID = 0x6d6f64656c5f6964; // "model_id" 7 | uint constant MODEL_TYPE = 0x6d6f64656c5f74797065; // "model_type" 8 | 9 | uint constant DAPP = 0x64617070; // "dapp" 10 | uint constant DEVELOPER = 0x646576656c6f706572; // "developer" 11 | 12 | uint constant ATTRIBUTES = 0x61747472696275746573; // "attributes" 13 | 14 | function AttributeModel() { 15 | keys.length = 4; 16 | keys[0][0] = KEY; 17 | keys[1][0] = VALUE; 18 | keys[2][0] = MODEL_ID; 19 | keys[3][0] = MODEL_TYPE; 20 | 21 | keys[0][1] = STRING; 22 | keys[1][1] = STRING; 23 | keys[2][1] = POLYMORPHIC_REFERENCE; 24 | keys[3][1] = POLYMORPHIC_TYPE; 25 | } 26 | 27 | function create(uint[101][] attributes) returns(uint) { 28 | uint id = super.create(attributes); 29 | 30 | if (id != 0) { 31 | uint model_id = attributes[2][1]; 32 | uint model_type = attributes[3][1]; 33 | Model model = Model(coordinator.models(model_type)); 34 | model.add_to_association(model_id, ATTRIBUTES, id); 35 | } 36 | 37 | return id; 38 | } 39 | 40 | function validate(address sender, uint id, uint[101][] attributes) returns(bool) { 41 | // Require all keys to be present, and all non-string types 42 | // to fit into one data slot. 43 | for (uint i = 0; i < keys.length; i++) { 44 | if (attributes[i][0] == 0) { 45 | ValidationError(keys[i][0], "must be present"); 46 | return false; 47 | } 48 | if (keys[i][1] != STRING && attributes[i][0] != 1) { 49 | ValidationError(keys[i][0], "is invalid"); 50 | return false; 51 | } 52 | } 53 | 54 | // Require MODEL_TYPE to be "dapp" or "developer" 55 | if (attributes[3][1] != DAPP && attributes[3][1] != DEVELOPER) { 56 | ValidationError(MODEL_TYPE, "has unknown value; must be 'dapp' or 'developer'"); 57 | return false; 58 | } 59 | 60 | if (id != 0) { 61 | uint current_model_id = db.get_entry(id, MODEL_ID, 0); 62 | uint current_model_type = db.get_entry(id, MODEL_TYPE, 0); 63 | 64 | for (uint k = 0; k < keys.length; k++) { 65 | if (keys[k][0] == MODEL_ID && attributes[k][1] != current_model_id) { 66 | ValidationError(MODEL_ID, "cannot be changed after create()"); 67 | return false; 68 | } 69 | if (keys[k][0] == MODEL_TYPE && attributes[k][1] != current_model_type) { 70 | ValidationError(MODEL_TYPE, "cannot be changed after create()"); 71 | return false; 72 | } 73 | } 74 | } 75 | 76 | return true; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /contracts/DappModel.sol: -------------------------------------------------------------------------------- 1 | import "Model"; 2 | import "SimpleIndex"; 3 | 4 | contract DappModel is Model { 5 | SimpleIndex public nym_index; 6 | 7 | uint constant NYM = 0x6e796d; 8 | uint constant NAME = 0x6e616d65; 9 | uint constant DEVELOPER_ID = 0x646576656c6f7065725f6964; 10 | uint constant LOGO = 0x6c6f676f; 11 | 12 | uint constant ADDRESS = 0x61646472657373; 13 | uint constant DEVELOPER = 0x646576656c6f706572; 14 | uint constant SHORT_DESCRIPTION = 0x73686f72745f6465736372697074696f6e; 15 | uint constant LONG_DESCRIPTION = 0x6c6f6e675f6465736372697074696f6e; 16 | uint constant VERSION = 0x76657273696f6e; 17 | uint constant VERSIONS = 0x76657273696f6e73; 18 | uint constant VERSION_ID = 0x76657273696f6e5f6964; // "version_id" 19 | 20 | uint constant DAPPS = 0x6461707073; 21 | 22 | uint constant ATTRIBUTE = 0x617474726962757465; // "attribute" 23 | uint constant ATTRIBUTES = 0x61747472696275746573; // "attributes" 24 | 25 | function DappModel(SimpleIndex _nym_index) { 26 | if (address(_nym_index) == 0) { 27 | _nym_index = new SimpleIndex(); 28 | } 29 | 30 | nym_index = _nym_index; 31 | 32 | keys.length = 6; 33 | keys[0][0] = NYM; 34 | keys[1][0] = NAME; 35 | keys[2][0] = DEVELOPER_ID; 36 | keys[3][0] = LOGO; 37 | keys[4][0] = SHORT_DESCRIPTION; 38 | keys[5][0] = LONG_DESCRIPTION; 39 | 40 | keys[0][1] = STRING; 41 | keys[1][1] = STRING; 42 | keys[2][1] = REFERENCE; 43 | keys[3][1] = STRING; 44 | keys[4][1] = STRING; 45 | keys[5][1] = STRING; 46 | 47 | associations.length = 2; 48 | associations[0][0] = VERSIONS; 49 | associations[0][1] = VERSION; 50 | associations[1][0] = ATTRIBUTES; 51 | associations[1][1] = ATTRIBUTE; 52 | 53 | read_only.length = 1; 54 | read_only[0][0] = VERSION_ID; 55 | read_only[0][1] = REFERENCE; 56 | } 57 | 58 | function create(uint[101][] attributes) returns(uint) { 59 | uint id = super.create(attributes); 60 | 61 | if (id != 0) { 62 | uint nym = attributes[0][1]; 63 | nym_index.set(nym, id); 64 | 65 | Model developer_model = Model(coordinator.models(DEVELOPER)); 66 | uint dev_id = attributes[2][1]; 67 | developer_model.add_to_association(dev_id, DAPPS, id); 68 | } 69 | 70 | return id; 71 | } 72 | 73 | function validate(address sender, uint id, uint[101][] attributes) returns(bool) { 74 | // Require nym to be present, and fit into one data slot 75 | if (attributes[0][0] != 1) { 76 | ValidationError(NYM, "must be present"); 77 | return false; 78 | } 79 | 80 | // Require display name to be present 81 | if (attributes[1][0] == 0) { 82 | ValidationError(NAME, "must be present"); 83 | return false; 84 | } 85 | 86 | // Require developer ID to be present, and fit into one data slot 87 | if (attributes[2][0] != 1) { 88 | ValidationError(DEVELOPER_ID, "must be present"); 89 | return false; 90 | } 91 | 92 | // Require logo to be present, and fit into one data slot 93 | if (attributes[3][0] != 1) { 94 | ValidationError(LOGO, "must be present"); 95 | return false; 96 | } 97 | 98 | // Require short description to be present 99 | if (attributes[4][0] == 0) { 100 | ValidationError(SHORT_DESCRIPTION, "must be present"); 101 | return false; 102 | } 103 | 104 | // Require long description to be present 105 | if (attributes[5][0] == 0) { 106 | ValidationError(LONG_DESCRIPTION, "must be present"); 107 | return false; 108 | } 109 | 110 | // Require developer ID to be valid 111 | Model developer_model = Model(coordinator.models(DEVELOPER)); 112 | EternalDB dev_db = EternalDB(developer_model.db()); 113 | uint dev_id = attributes[2][1]; 114 | if (dev_db.count() < dev_id) { 115 | ValidationError(DEVELOPER_ID, "is invalid"); 116 | return false; 117 | } 118 | 119 | // Require sender to be the developer's address 120 | address developer = address(dev_db.get_entry(dev_id, ADDRESS, 0)); 121 | if (developer != sender) { 122 | ValidationError(DEVELOPER_ID, "is not the sender of this transaction"); 123 | return false; 124 | } 125 | 126 | if (id == 0) { 127 | // Create only 128 | 129 | // Require nym to be unique 130 | if (nym_index.lookup(attributes[0][1]) != 0) { 131 | ValidationError(NYM, "must be unique"); 132 | return false; 133 | } 134 | 135 | } else { 136 | // Update only 137 | 138 | // Require developer_id to be unchanged 139 | uint current_dev_id = db.get_entry(id, DEVELOPER_ID, 0); 140 | if (current_dev_id != dev_id) { 141 | ValidationError(DEVELOPER_ID, "should be unchanged on update()"); 142 | return false; 143 | } 144 | 145 | // Require nym to be unchanged 146 | if (nym_index.lookup(attributes[0][1]) != id) { 147 | ValidationError(NYM, "should be unchanged on update()"); 148 | return false; 149 | } 150 | } 151 | 152 | return true; 153 | } 154 | 155 | function id_for_nym(uint nym) returns(uint) { 156 | return nym_index.lookup(nym); 157 | } 158 | 159 | function replace(address replacement) { 160 | if (msg.sender == address(coordinator)) { 161 | nym_index.transfer_ownership(replacement); 162 | super.replace(replacement); 163 | } 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /contracts/DeveloperModel.sol: -------------------------------------------------------------------------------- 1 | import "Model"; 2 | import "SimpleIndex"; 3 | 4 | contract DeveloperModel is Model { 5 | SimpleIndex public address_index; 6 | 7 | uint constant NAME = 0x6e616d65; 8 | uint constant LOGO = 0x6c6f676f; 9 | uint constant DESCRIPTION = 0x6465736372697074696f6e; 10 | 11 | uint constant ADDRESS = 0x61646472657373; 12 | uint constant DAPP = 0x64617070; 13 | uint constant DAPPS = 0x6461707073; 14 | uint constant ATTRIBUTE = 0x617474726962757465; // "attribute" 15 | uint constant ATTRIBUTES = 0x61747472696275746573; // "attributes" 16 | uint constant REVIEW = 0x726576696577; // "review" 17 | uint constant REVIEWS = 0x72657669657773; // "reviews" 18 | uint constant RATING_COUNT = 0x726174696e675f636f756e74; 19 | uint constant RATING_TOTAL = 0x726174696e675f746f74616c; 20 | 21 | function DeveloperModel(SimpleIndex _address_index) { 22 | if (address(_address_index) == 0) { 23 | _address_index = new SimpleIndex(); 24 | } 25 | 26 | address_index = _address_index; 27 | 28 | keys.length = 3; 29 | 30 | // Names 31 | keys[0][0] = NAME; 32 | keys[1][0] = LOGO; 33 | keys[2][0] = DESCRIPTION; 34 | 35 | // Types 36 | keys[0][1] = STRING; 37 | keys[1][1] = STRING; 38 | keys[2][1] = STRING; 39 | 40 | associations.length = 3; 41 | associations[0][0] = DAPPS; // name of association 42 | associations[0][1] = DAPP; // type 43 | associations[1][0] = ATTRIBUTES; 44 | associations[1][1] = ATTRIBUTE; 45 | associations[2][0] = REVIEWS; 46 | associations[2][1] = REVIEW; 47 | 48 | read_only.length = 3; 49 | read_only[0][0] = ADDRESS; 50 | read_only[1][0] = RATING_COUNT; 51 | read_only[2][0] = RATING_TOTAL; 52 | 53 | read_only[0][1] = ADDRESS; 54 | read_only[1][1] = INTEGER; 55 | read_only[2][1] = INTEGER; 56 | } 57 | 58 | function create(uint[101][] attributes) returns(uint) { 59 | uint id = super.create(attributes); 60 | 61 | if (id != 0) { 62 | db.add(id, RATING_COUNT, 0); 63 | db.add(id, RATING_TOTAL, 0); 64 | db.add(id, ADDRESS, uint(msg.sender)); 65 | 66 | address_index.set(uint(msg.sender), id); 67 | } 68 | } 69 | 70 | function validate(address sender, uint id, uint[101][] attributes) returns(bool) { 71 | if (id == 0) { 72 | // Create only 73 | 74 | // Require address to be unique 75 | if (id_for_address(sender) != 0) { 76 | ValidationError(ADDRESS, "must be unique"); 77 | return false; 78 | } 79 | 80 | } else { 81 | // Require sender to be original creator 82 | if (sender != address(db.get_entry(id, ADDRESS, 0))) { 83 | ValidationError(ADDRESS, "must be the owner of this entry"); 84 | return false; 85 | } 86 | } 87 | return true; 88 | } 89 | 90 | function add_rating(uint id, uint rating) { 91 | if (msg.sender == coordinator.models(REVIEW)) { 92 | uint current_count = db.get_entry(id, RATING_COUNT, 0); 93 | uint current_total = db.get_entry(id, RATING_TOTAL, 0); 94 | 95 | db.clear(id, RATING_COUNT); 96 | db.clear(id, RATING_TOTAL); 97 | 98 | db.add(id, RATING_COUNT, current_count + 1); 99 | db.add(id, RATING_TOTAL, current_total + rating); 100 | } 101 | } 102 | 103 | function id_for_address(address _address) returns(uint) { 104 | return address_index.lookup(uint(_address)); 105 | } 106 | 107 | function replace(address replacement) { 108 | if (msg.sender == address(coordinator)) { 109 | address_index.transfer_ownership(replacement); 110 | super.replace(replacement); 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /contracts/DualIndex.sol: -------------------------------------------------------------------------------- 1 | contract DualIndex { 2 | mapping(uint => mapping(uint => uint)) data; 3 | address public admin; 4 | 5 | modifier restricted { if (msg.sender == admin) _ } 6 | 7 | function DualIndex() { 8 | admin = msg.sender; 9 | } 10 | 11 | function set(uint key1, uint key2, uint value) restricted { 12 | data[key1][key2] = value; 13 | } 14 | 15 | function transfer_ownership(address _admin) restricted { 16 | admin = _admin; 17 | } 18 | 19 | function lookup(uint key1, uint key2) returns(uint) { 20 | return data[key1][key2]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /contracts/EternalDB.sol: -------------------------------------------------------------------------------- 1 | contract EternalDB { 2 | address public admin; 3 | mapping (uint => uint[])[] data; 4 | 5 | modifier restricted { if (msg.sender == admin) _ } 6 | 7 | function EternalDB() { 8 | admin = msg.sender; 9 | data.length = 1; // 1-indexed, so things like mappings to ids will work 10 | } 11 | 12 | function transfer_ownership(address _admin) restricted { 13 | admin = _admin; 14 | } 15 | 16 | function count() constant returns(uint) { 17 | return data.length - 1; 18 | } 19 | 20 | function has(uint id) constant returns(bool) { 21 | return id <= count(); 22 | } 23 | 24 | function new_entry() restricted returns(uint) { 25 | return data.length++; 26 | } 27 | 28 | function add(uint id, uint key, uint value) restricted { 29 | uint[] attribute = data[id][key]; 30 | attribute[attribute.length++] = value; 31 | } 32 | 33 | function get_length(uint id, uint key) constant returns(uint) { 34 | return data[id][key].length; 35 | } 36 | 37 | function get_entry(uint id, uint key, uint index) constant returns(uint) { 38 | return data[id][key][index]; 39 | } 40 | 41 | function get_all(uint id, uint key) constant returns(uint[]) { 42 | return data[id][key]; 43 | } 44 | 45 | function clear(uint id, uint key) restricted { 46 | data[id][key].length = 0; 47 | } 48 | 49 | function delete_entry(uint id, uint key, uint index) restricted { 50 | uint[] attribute = data[id][key]; 51 | 52 | for (uint i = index; i + 1 < attribute.length; i++) { 53 | attribute[i] = attribute[i + 1]; 54 | } 55 | 56 | attribute.length--; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /contracts/Example.sol: -------------------------------------------------------------------------------- 1 | contract Example { 2 | function Example() { 3 | // constructor 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /contracts/LicenseModel.sol: -------------------------------------------------------------------------------- 1 | import "Model"; 2 | import "DualIndex"; 3 | import_headers "UserModel"; 4 | 5 | contract LicenseModel is Model { 6 | DualIndex public user_version_index; 7 | 8 | uint constant VERSION_ID = 0x76657273696f6e5f6964; 9 | 10 | uint constant VERSION = 0x76657273696f6e; 11 | uint constant LICENSES = 0x6c6963656e736573; 12 | uint constant USER = 0x75736572; 13 | uint constant USERS = 0x7573657273; 14 | uint constant USER_ID = 0x757365725f6964; 15 | 16 | function LicenseModel(DualIndex _user_version_index) { 17 | if (address(_user_version_index) == 0) { 18 | _user_version_index = new DualIndex(); 19 | } 20 | 21 | user_version_index = _user_version_index; 22 | 23 | keys.length = 1; 24 | 25 | keys[0][0] = VERSION_ID; 26 | keys[0][1] = REFERENCE; 27 | 28 | read_only.length = 1; 29 | read_only[0][0] = USER_ID; 30 | read_only[0][1] = REFERENCE; 31 | } 32 | 33 | function create(uint[101][] attributes) returns(uint) { 34 | uint id = super.create(attributes); 35 | 36 | if (id != 0) { 37 | Model version_model = Model(coordinator.models(VERSION)); 38 | uint version_id = attributes[0][1]; 39 | version_model.add_to_association(version_id, LICENSES, id); 40 | 41 | UserModel user_model = UserModel(coordinator.models(USER)); 42 | uint user_id = user_model.id_for_address(msg.sender); 43 | user_model.add_to_association(user_id, LICENSES, id); 44 | 45 | db.add(id, USER_ID, user_id); 46 | user_version_index.set(user_id, version_id, id); 47 | } 48 | 49 | return id; 50 | } 51 | 52 | function validate(address sender, uint id, uint[101][] attributes) returns(bool) { 53 | // Require version ID to be present, and fit into one data slot 54 | if (attributes[0][0] != 1) { 55 | ValidationError(VERSION_ID, "must be present"); 56 | return false; 57 | } 58 | 59 | // Require version ID to be valid 60 | Model version_model = Model(coordinator.models(VERSION)); 61 | EternalDB version_db = EternalDB(version_model.db()); 62 | uint version_id = attributes[0][1]; 63 | if (version_db.count() < version_id) { 64 | ValidationError(VERSION_ID, "invalid"); 65 | return false; 66 | } 67 | 68 | UserModel user_model = UserModel(coordinator.models(USER)); 69 | EternalDB user_db = EternalDB(user_model.db()); 70 | uint user_id = user_model.id_for_address(sender); 71 | 72 | if (user_id == 0) { 73 | ValidationError(USER_ID, "doesn't exist for the sender address"); 74 | return false; 75 | } 76 | 77 | // On create 78 | if (id == 0) { 79 | if (id_for_user_version(user_id, version_id) != 0) { 80 | ValidationError(USER_ID, "already has a license for this app"); 81 | return false; 82 | } 83 | } 84 | 85 | // On update 86 | if (id != 0) { 87 | address user_address = address(user_db.get_entry(user_id, ADDRESS, 0)); 88 | if (sender != user_address) { 89 | ValidationError(USER_ID, "is not the owner of this license"); 90 | return false; 91 | } 92 | } 93 | 94 | return true; 95 | } 96 | 97 | function id_for_user_version(uint user_id, uint version_id) returns(uint) { 98 | return user_version_index.lookup(user_id, version_id); 99 | } 100 | 101 | function replace(address replacement) { 102 | if (msg.sender == address(coordinator)) { 103 | user_version_index.transfer_ownership(replacement); 104 | super.replace(replacement); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /contracts/Model.sol: -------------------------------------------------------------------------------- 1 | import_headers "EternalDB"; 2 | import_headers "ModelCoordinator"; 3 | 4 | contract Model { 5 | EternalDB public db; 6 | uint[2][] public keys; 7 | uint[2][] public associations; 8 | uint[2][] public read_only; 9 | 10 | ModelCoordinator public coordinator; 11 | 12 | uint constant INTEGER = 0x696e7465676572; // "integer" 13 | uint constant NUMBER = 0x6e756d626572; // "number" 14 | uint constant ADDRESS = 0x61646472657373; // "address" 15 | uint constant STRING = 0x737472696e67; // "string" 16 | uint constant DATETIME = 0x6461746574696d65; // "datetime" 17 | uint constant BOOL = 0x626f6f6c; // "bool" 18 | uint constant INTEGER_ARRAY = 0x696e74656765725f6172726179; // "integer_array" 19 | uint constant STRING_ARRAY = 0x737472696e675f6172726179; // "string_array" 20 | 21 | // References are a single pointer to another model, and that 22 | // model type is inferred by the key name. i.e., "version_id" -> VersionModel 23 | // References should not be confused with associations. Associations 24 | // have a "has_many" relationship whereas references point to a single instance. 25 | // Note: All reference keys must end in "_id". 26 | uint constant REFERENCE = 0x7265666572656e6365; // "reference" 27 | 28 | // Used to designate polymorphic associations on your models. 29 | // These are like references, except that the type is pulled from the 30 | // associated key which has the polymorphic type specified. Note the 31 | // id must come first in the keys list, and the type must follow 32 | // immediately after the id. 33 | uint constant POLYMORPHIC_REFERENCE = 0x706f6c796d6f72706869635f7265666572656e6365; // "polymorphic_reference" 34 | uint constant POLYMORPHIC_TYPE = 0x706f6c796d6f72706869635f74797065; // "polymorphic_type" 35 | 36 | // Constants used for saving the created and last udpated blocks for each entry. 37 | // With these blocks, you can garner a lot of information about when the entry 38 | // was created and updated, and what happened during. 39 | uint constant CREATED_BLOCK = 0x637265617465645f626c6f636b; // "created_block" 40 | uint constant LAST_UPDATED_BLOCK = 0x6c6173745f757064617465645f626c6f636b; // "last_updated_block" 41 | 42 | uint constant OWNERS = 0x6f776e657273; // "owners" 43 | 44 | // Constant for marking a model entry as destroyed. 45 | uint constant DESTROYED = 0x64657374726f796564; // "destroyed" 46 | 47 | // Note: If you change the signature of any of these events, 48 | // the Javascript library needs to be updated accordingly. 49 | event Log(string reason); 50 | event Create(uint256 id); 51 | event Update(uint256 id); 52 | event Destroy(uint256 id); 53 | event ValidationError(uint256 indexed key, string reason); 54 | event GeneralError(string reason); 55 | 56 | function Model() { 57 | coordinator = ModelCoordinator(msg.sender); 58 | } 59 | 60 | function get_keys() constant returns(uint[2][]) { 61 | return keys; 62 | } 63 | 64 | function get_read_only_keys() constant returns(uint[2][]) { 65 | return read_only; 66 | } 67 | 68 | function get_associations() constant returns(uint[2][]) { 69 | return associations; 70 | } 71 | 72 | function get_default_keys() returns(uint[2][4]) { 73 | uint[2][4] memory defaults; 74 | 75 | defaults[0][0] = CREATED_BLOCK; 76 | defaults[0][1] = INTEGER; 77 | defaults[1][0] = LAST_UPDATED_BLOCK; 78 | defaults[1][1] = INTEGER; 79 | defaults[2][0] = OWNERS; 80 | defaults[2][1] = INTEGER_ARRAY; // Need to implement address arrays. 81 | defaults[3][0] = DESTROYED; 82 | defaults[3][1] = BOOL; 83 | 84 | return defaults; 85 | } 86 | 87 | function set_db(EternalDB _db) { 88 | if (address(db) == 0) { 89 | db = _db; 90 | } 91 | } 92 | 93 | function set_coordinator(ModelCoordinator _coordinator) { 94 | if (msg.sender == address(coordinator)) { 95 | coordinator = _coordinator; 96 | } 97 | } 98 | 99 | function create(uint[101][] attributes) returns(uint) { 100 | Log("create started"); 101 | 102 | if (validate(msg.sender, 0, attributes) == true) { 103 | uint id = db.new_entry(); 104 | 105 | for (uint i = 0; i < keys.length; i++) { 106 | for (uint j = 1; j <= attributes[i][0]; j++) { 107 | db.add(id, keys[i][0], attributes[i][j]); 108 | } 109 | } 110 | 111 | add_owner(id, msg.sender); 112 | db.add(id, DESTROYED, 0); // false 113 | db.add(id, CREATED_BLOCK, block.number); 114 | db.add(id, LAST_UPDATED_BLOCK, block.number); 115 | 116 | Create(id); 117 | 118 | return id; 119 | } 120 | } 121 | 122 | function update(uint id, uint[101][] attributes) returns(bool) { 123 | if (validate(msg.sender, id, attributes) == true) { 124 | 125 | for (uint i = 0; i < keys.length; i++) { 126 | db.clear(id, keys[i][0]); 127 | 128 | for (uint j = 1; j <= attributes[i][0]; j++) { 129 | db.add(id, keys[i][0], attributes[i][j]); 130 | } 131 | } 132 | 133 | db.clear(id, LAST_UPDATED_BLOCK); 134 | db.add(id, LAST_UPDATED_BLOCK, block.number); 135 | 136 | Update(id); 137 | 138 | return true; 139 | } 140 | return false; 141 | } 142 | 143 | function has_owners(uint id) constant returns(bool) { 144 | return db.get_length(id, OWNERS) != 0; 145 | } 146 | 147 | function is_owner(uint id, address to_check) constant returns(bool) { 148 | for (var i = 0; i < db.get_length(id, OWNERS); i++) { 149 | uint owner = db.get_entry(id, OWNERS, i); 150 | if (address(owner) == to_check) { 151 | return true; 152 | } 153 | } 154 | 155 | return false; 156 | } 157 | 158 | function add_owner(uint id, address owner) { 159 | if (has_owners(id) == false) { 160 | db.add(id, OWNERS, uint(owner)); 161 | return; 162 | } 163 | 164 | if (is_owner(id, msg.sender)) { 165 | db.add(id, OWNERS, uint(owner)); 166 | } 167 | } 168 | 169 | function destroy(uint id) { 170 | if (is_owner(id, msg.sender)) { 171 | db.clear(id, DESTROYED); 172 | db.add(id, DESTROYED, 1); // true 173 | Destroy(id); 174 | } 175 | } 176 | 177 | function is_destroyed(uint id) constant returns(bool) { 178 | return db.get_entry(id, DESTROYED, 0) == 1; 179 | } 180 | 181 | function validate(address sender, uint id, uint[101][] attributes) returns(bool) { 182 | return true; 183 | } 184 | 185 | function get_blocks_for(uint id) constant returns (uint[2]) { 186 | uint[2] memory blocks; 187 | blocks[0] = db.get_entry(id, CREATED_BLOCK, 0); 188 | blocks[1] = db.get_entry(id, LAST_UPDATED_BLOCK, 0); 189 | return blocks; 190 | } 191 | 192 | // Example: 193 | // 194 | // id = id of this model (say, Dapp) 195 | // association_name = VERSIONS (association on Dapp that holds the association) 196 | // association_id = id of Version to associate with 197 | // 198 | // The association_type is inferred from the name and will be used to ensure 199 | // the association is being set by the right model. 200 | function add_to_association(uint id, uint association_name, uint association_id) { 201 | if (db.has(id) == false) { 202 | return; 203 | } 204 | 205 | uint association_type = 0x0; 206 | 207 | // Find the type matching the association_name. 208 | for (uint i = 0; i < associations.length; i++) { 209 | if (associations[i][0] == association_name) { 210 | association_type = associations[i][1]; 211 | break; 212 | } 213 | } 214 | 215 | // Only accept associations from the type specified. 216 | if (association_type == 0x0 || msg.sender != coordinator.models(association_type)) { 217 | return; 218 | } 219 | 220 | // Since we found the type with the right name, then can just go ahead and add the association. 221 | db.add(id, association_name, association_id); 222 | 223 | // Update timestamp 224 | db.clear(id, LAST_UPDATED_BLOCK); 225 | db.add(id, LAST_UPDATED_BLOCK, block.number); 226 | } 227 | 228 | function set_reference(uint id, uint reference_name, uint reference_id) { 229 | if (db.has(id) == false) { 230 | return; 231 | } 232 | 233 | // Here, we use a little "hack" to get the reference type. Since 234 | // the reference type is string data packed into an integer, we can 235 | // "pop off" the "_id" part of the reference name using division, 236 | // which will give us the type. 237 | // Note: 16777216 is 16 ^ 6, or 3 ASCII characters. 238 | uint reference_type = reference_name / 16777216; 239 | 240 | if (msg.sender != coordinator.models(reference_type)) { 241 | return; 242 | } 243 | 244 | // Since we found the type with the right name, then can just go ahead and set the reference. 245 | db.clear(id, reference_name); 246 | db.add(id, reference_name, reference_id); 247 | 248 | // Update timestamp 249 | db.clear(id, LAST_UPDATED_BLOCK); 250 | db.add(id, LAST_UPDATED_BLOCK, block.number); 251 | } 252 | 253 | /*function paged(uint start_id, uint page_size) constant returns(uint[102]) { 254 | uint[102] memory page; 255 | 256 | if (page_size > 100) { 257 | page_size = 100; 258 | } 259 | 260 | uint found = 0; 261 | uint next = 0; 262 | uint current_id = start_id; 263 | 264 | while(db.has(current_id) && found < 100) { 265 | if (is_destroyed(current_id) == false) { 266 | found += 1; 267 | next = current_id + 1; 268 | page[found+1] = current_id; 269 | } 270 | 271 | current_id += 1; 272 | } 273 | 274 | if (db.has(next) == false) { 275 | next = 0; 276 | } 277 | 278 | page[0] = found; 279 | page[1] = next; 280 | 281 | return page; 282 | }*/ 283 | 284 | function replace(address replacement) { 285 | if (msg.sender == address(coordinator)) { 286 | db.transfer_ownership(replacement); 287 | } 288 | } 289 | } 290 | -------------------------------------------------------------------------------- /contracts/ModelCoordinator.sol: -------------------------------------------------------------------------------- 1 | import "EternalDB"; 2 | 3 | contract AbstractModel { 4 | function set_db(EternalDB _db); 5 | function replace(address replacement); 6 | } 7 | 8 | contract ModelCoordinator { 9 | mapping(uint => address) public models; 10 | address public admin; 11 | 12 | function ModelCoordinator() { 13 | admin = msg.sender; 14 | } 15 | 16 | function register(uint name, AbstractModel model, EternalDB db) { 17 | if (msg.sender == admin) { 18 | if (models[name] != 0) { 19 | AbstractModel old_model = AbstractModel(models[name]); 20 | old_model.replace(model); 21 | } 22 | 23 | models[name] = address(model); 24 | 25 | if (address(db) == 0) { 26 | db = new EternalDB(); 27 | db.transfer_ownership(address(model)); 28 | } 29 | 30 | model.set_db(db); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /contracts/ReviewModel.sol: -------------------------------------------------------------------------------- 1 | import "Model"; 2 | import_headers "DeveloperModel"; 3 | import_headers "VersionModel"; 4 | 5 | contract ReviewModel is Model { 6 | uint constant VERSION_ID = 0x76657273696f6e5f6964; 7 | uint constant RATING = 0x726174696e67; 8 | uint constant DATE = 0x64617465; 9 | uint constant SUBJECT = 0x7375626a656374; 10 | uint constant TEXT = 0x74657874; 11 | 12 | uint constant VERSION = 0x76657273696f6e; 13 | uint constant DEVELOPER = 0x646576656c6f706572; 14 | 15 | uint constant REVIEWS = 0x72657669657773; // "reviews" 16 | 17 | uint constant MODEL_ID = 0x6d6f64656c5f6964; // "model_id" 18 | uint constant MODEL_TYPE = 0x6d6f64656c5f74797065; // "model_type" 19 | 20 | function ReviewModel() { 21 | keys.length = 6; 22 | 23 | keys[0][0] = MODEL_ID; 24 | keys[1][0] = MODEL_TYPE; 25 | keys[2][0] = RATING; 26 | keys[3][0] = DATE; 27 | keys[4][0] = SUBJECT; 28 | keys[5][0] = TEXT; 29 | 30 | keys[0][1] = POLYMORPHIC_REFERENCE; 31 | keys[1][1] = POLYMORPHIC_TYPE; 32 | keys[2][1] = INTEGER; 33 | keys[3][1] = DATETIME; 34 | keys[4][1] = STRING; 35 | keys[5][1] = STRING; 36 | 37 | read_only.length = 1; 38 | read_only[0][0] = ADDRESS; 39 | read_only[0][1] = ADDRESS; 40 | } 41 | 42 | function create(uint[101][] attributes) returns(uint) { 43 | uint id = super.create(attributes); 44 | 45 | if (id != 0) { 46 | // This is a little gross, but it seemed easier than consolidating 47 | // the rating code into a separate contract. TODO: It should be consolidated. 48 | if (attributes[1][1] == DEVELOPER) { 49 | DeveloperModel developer_model = DeveloperModel(coordinator.models(attributes[1][1])); 50 | uint developer_id = attributes[0][1]; 51 | developer_model.add_to_association(developer_id, REVIEWS, id); 52 | developer_model.add_rating(developer_id, attributes[2][1]); 53 | } 54 | 55 | if (attributes[1][1] == VERSION) { 56 | VersionModel version_model = VersionModel(coordinator.models(attributes[1][1])); 57 | uint version_id = attributes[0][1]; 58 | version_model.add_to_association(version_id, REVIEWS, id); 59 | version_model.add_rating(version_id, attributes[2][1]); 60 | } 61 | 62 | db.add(id, ADDRESS, uint(msg.sender)); 63 | } 64 | 65 | return id; 66 | } 67 | 68 | function validate(address sender, uint id, uint[101][] attributes) returns(bool) { 69 | // Require model ID to be present, and fit into one data slot 70 | if (attributes[0][0] != 1) { 71 | ValidationError(MODEL_ID, "must be present"); 72 | return false; 73 | } 74 | 75 | if (attributes[1][0] != 1) { 76 | ValidationError(MODEL_TYPE, "must be present"); 77 | return false; 78 | } 79 | 80 | if (attributes[1][1] != DEVELOPER && attributes[1][1] != VERSION) { 81 | ValidationError(MODEL_TYPE, "invalid"); 82 | return false; 83 | } 84 | 85 | // Require model id to be valid 86 | Model model = Model(coordinator.models(attributes[1][1])); 87 | EternalDB model_db = EternalDB(model.db()); 88 | uint model_id = attributes[0][1]; 89 | if (model_db.count() < model_id) { 90 | ValidationError(MODEL_ID, "invalid"); 91 | return false; 92 | } 93 | 94 | // Require rating to be present, and fit into one data slot 95 | if (attributes[2][0] != 1) { 96 | ValidationError(RATING, "must be present"); 97 | return false; 98 | } 99 | 100 | // Require rating to be between 1 and 5 101 | if (attributes[2][1] < 1 || attributes[2][1] > 5) { 102 | ValidationError(RATING, "must be between 1 and 5"); 103 | return false; 104 | } 105 | 106 | return true; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /contracts/SimpleIndex.sol: -------------------------------------------------------------------------------- 1 | contract SimpleIndex { 2 | mapping(uint => uint) data; 3 | address public admin; 4 | 5 | modifier restricted { if (msg.sender == admin) _ } 6 | 7 | function SimpleIndex() { 8 | admin = msg.sender; 9 | } 10 | 11 | function set(uint key, uint value) restricted { 12 | data[key] = value; 13 | } 14 | 15 | function transfer_ownership(address _admin) restricted { 16 | admin = _admin; 17 | } 18 | 19 | function lookup(uint key) returns(uint) { 20 | return data[key]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /contracts/UserModel.sol: -------------------------------------------------------------------------------- 1 | import "Model"; 2 | import "SimpleIndex"; 3 | 4 | contract UserModel is Model { 5 | SimpleIndex public address_index; 6 | 7 | uint constant LICENSE = 0x6c6963656e7365; 8 | uint constant LICENSES = 0x6c6963656e736573; 9 | 10 | function UserModel(SimpleIndex _address_index) { 11 | if (address(_address_index) == 0) { 12 | _address_index = new SimpleIndex(); 13 | } 14 | 15 | address_index = _address_index; 16 | 17 | keys.length = 1; 18 | keys[0][0] = ADDRESS; 19 | keys[0][1] = ADDRESS; 20 | 21 | associations.length = 1; 22 | associations[0][0] = LICENSES; 23 | associations[0][1] = LICENSE; 24 | } 25 | 26 | function create(uint[101][] attributes) returns(uint) { 27 | uint id = super.create(attributes); 28 | 29 | if (id != 0) { 30 | uint _address = attributes[0][1]; 31 | address_index.set(_address, id); 32 | } 33 | 34 | return id; 35 | } 36 | 37 | function validate(address sender, uint id, uint[101][] attributes) returns(bool) { 38 | if (id == 0) { 39 | // Create only 40 | 41 | // Require address to be unique 42 | if (address_index.lookup(attributes[0][1]) != 0) { 43 | ValidationError(ADDRESS, "must be unique"); 44 | return false; 45 | } 46 | 47 | } else { 48 | // No updates. 49 | return false; 50 | } 51 | 52 | return true; 53 | } 54 | 55 | function id_for_address(address _address) returns(uint) { 56 | return address_index.lookup(uint(_address)); 57 | } 58 | 59 | function replace(address replacement) { 60 | if (msg.sender == address(coordinator)) { 61 | address_index.transfer_ownership(replacement); 62 | super.replace(replacement); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /contracts/VersionModel.sol: -------------------------------------------------------------------------------- 1 | import "Model"; 2 | 3 | contract VersionModel is Model { 4 | uint constant DAPP_ID = 0x646170705f6964; 5 | uint constant NUMBER = 0x6e756d626572; 6 | uint constant WHATS_NEW = 0x77686174735f6e6577; 7 | uint constant SCREENSHOTS = 0x73637265656e73686f7473; 8 | uint constant LOCATION = 0x6c6f636174696f6e; 9 | uint constant PRICE = 0x7072696365; 10 | 11 | uint constant DAPP = 0x64617070; 12 | uint constant DEVELOPER_ID = 0x646576656c6f7065725f6964; 13 | uint constant DEVELOPER = 0x646576656c6f706572; 14 | uint constant ADDRESS = 0x61646472657373; 15 | uint constant REVIEW = 0x726576696577; 16 | uint constant REVIEWS = 0x72657669657773; 17 | uint constant RATING_COUNT = 0x726174696e675f636f756e74; 18 | uint constant RATING_TOTAL = 0x726174696e675f746f74616c; 19 | uint constant LICENSE = 0x6c6963656e7365; 20 | uint constant LICENSES = 0x6c6963656e736573; 21 | 22 | uint constant VERSIONS = 0x76657273696f6e73; // "versions" 23 | uint constant VERSION_ID = 0x76657273696f6e5f6964; // "version_id" 24 | 25 | function VersionModel() { 26 | keys.length = 6; 27 | keys[0][0] = DAPP_ID; 28 | keys[1][0] = NUMBER; 29 | keys[2][0] = WHATS_NEW; 30 | keys[3][0] = SCREENSHOTS; 31 | keys[4][0] = LOCATION; 32 | keys[5][0] = PRICE; 33 | 34 | keys[0][1] = REFERENCE; 35 | keys[1][1] = STRING; 36 | keys[2][1] = STRING; 37 | keys[3][1] = STRING_ARRAY; 38 | keys[4][1] = STRING; 39 | keys[5][1] = INTEGER; 40 | 41 | associations.length = 2; 42 | associations[0][0] = REVIEWS; 43 | associations[0][1] = REVIEW; 44 | associations[1][0] = LICENSES; 45 | associations[1][1] = LICENSE; 46 | 47 | read_only.length = 2; 48 | read_only[0][0] = RATING_COUNT; 49 | read_only[1][0] = RATING_TOTAL; 50 | 51 | read_only[0][1] = INTEGER; 52 | read_only[1][1] = INTEGER; 53 | } 54 | 55 | function create(uint[101][] attributes) returns(uint) { 56 | uint id = super.create(attributes); 57 | 58 | if (id != 0) { 59 | uint dapp_id = attributes[0][1]; 60 | 61 | Model dapp_model = Model(coordinator.models(DAPP)); 62 | dapp_model.add_to_association(dapp_id, VERSIONS, id); 63 | dapp_model.set_reference(dapp_id, VERSION_ID, id); 64 | 65 | db.add(id, RATING_COUNT, 0); 66 | db.add(id, RATING_TOTAL, 0); 67 | } 68 | 69 | return id; 70 | } 71 | 72 | function validate(address sender, uint id, uint[101][] attributes) returns(bool) { 73 | // Require dapp ID to be present, and fit into one data slot 74 | if (attributes[0][0] != 1) { 75 | ValidationError(DAPP_ID, "must be present"); 76 | return false; 77 | } 78 | 79 | // Require dapp ID to be valid 80 | Model dapp_model = Model(coordinator.models(DAPP)); 81 | EternalDB dapp_db = EternalDB(dapp_model.db()); 82 | uint dapp_id = attributes[0][1]; 83 | if (dapp_db.count() < dapp_id) { 84 | ValidationError(DAPP_ID, "is invalid"); 85 | return false; 86 | } 87 | 88 | // Require sender to be the developer's address 89 | Model developer_model = Model(coordinator.models(DEVELOPER)); 90 | EternalDB dev_db = EternalDB(developer_model.db()); 91 | uint dev_id = dapp_db.get_entry(dapp_id, DEVELOPER_ID, 0); 92 | address developer = address(dev_db.get_entry(dev_id, ADDRESS, 0)); 93 | if (developer != sender) { 94 | ValidationError(DEVELOPER_ID, "is not the right sender"); 95 | return false; 96 | } 97 | 98 | if (id != 0) { 99 | // Update only 100 | 101 | // Require dapp_id to be unchanged 102 | uint current_dapp_id = db.get_entry(id, DAPP_ID, 0); 103 | if (current_dapp_id != dapp_id) { 104 | ValidationError(DAPP_ID, "must not change on update()"); 105 | return false; 106 | } 107 | } 108 | 109 | return true; 110 | } 111 | 112 | function add_rating(uint id, uint rating) { 113 | if (msg.sender == coordinator.models(REVIEW)) { 114 | uint current_count = db.get_entry(id, RATING_COUNT, 0); 115 | uint current_total = db.get_entry(id, RATING_TOTAL, 0); 116 | 117 | db.clear(id, RATING_COUNT); 118 | db.clear(id, RATING_TOTAL); 119 | 120 | db.add(id, RATING_COUNT, current_count + 1); 121 | db.add(id, RATING_TOTAL, current_total + rating); 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /register_models.es6: -------------------------------------------------------------------------------- 1 | var coordinator = ModelCoordinator.deployed(); 2 | 3 | var models = { 4 | "dapp": DappModel, 5 | "developer": DeveloperModel, 6 | "review": ReviewModel, 7 | "version": VersionModel, 8 | "attribute": AttributeModel, 9 | "license": LicenseModel, 10 | "user": UserModel 11 | }; 12 | 13 | var registrations = []; 14 | var model_names = Object.keys(models); 15 | 16 | for (var i = 0; i < model_names.length; i++) { 17 | var name = model_names[i]; 18 | var model = models[name].deployed(); 19 | registrations.push(coordinator.register(web3.fromAscii(name), model.address, 0)); 20 | registrations.push(model.set_coordinator(coordinator.address)); 21 | } 22 | 23 | Promise.all(registrations).then(function() { 24 | process.exit(); 25 | }).catch(function(err) { 26 | console.log(err); 27 | process.exit(1); 28 | }) 29 | -------------------------------------------------------------------------------- /test/dapp-model.js: -------------------------------------------------------------------------------- 1 | contract('DappModel', function(accounts) { 2 | 3 | before(function(done) { 4 | var developer_model = DeveloperModel.deployed() 5 | var dapp_model = DappModel.deployed(); 6 | var coordinator = ModelCoordinator.deployed(); 7 | 8 | var DEVELOPER = "0x646576656c6f706572"; 9 | var DAPP = "0x64617070"; 10 | 11 | developer_model.create([[0], [0], [0]], {from: accounts[0]}). 12 | then(function() { return developer_model.create([[0], [0], [0]], {from: accounts[2]}) }). 13 | then(function(tx) { 14 | done(); 15 | }).catch(done); 16 | }); 17 | 18 | it("lets you create a dapp", function(done) { 19 | var dapp_model = DappModel.at(DappModel.deployed_address); 20 | var NAME = "0x6e616d65"; 21 | 22 | dapp_model.db.call(). 23 | then(function(db_address) { 24 | var db = EternalDB.at(db_address); 25 | dapp_model.create([[1, 23], [1, 42], [1, 1], [1, 1], [1, 1], [1, 1]]). 26 | then(function() { return db.count.call() }). 27 | then(function(result) { assert.equal(result, 1); }). 28 | then(function() { return db.get_length.call(1, NAME) }). 29 | then(function(result) { assert.equal(result, 1) }). 30 | then(function() { return db.get_entry.call(1, NAME, 0) }). 31 | then(function(result) { 32 | assert.equal(result, 42); 33 | done(); 34 | }).catch(done); 35 | }).catch(done); 36 | }); 37 | 38 | it("lets you update a dapp", function(done) { 39 | var dapp_model = DappModel.at(DappModel.deployed_address); 40 | var NAME = "0x6e616d65"; 41 | 42 | dapp_model.db.call(). 43 | then(function(db_address) { 44 | var db = EternalDB.at(db_address); 45 | dapp_model.update(1, [[1, 23], [1, 72], [1, 1], [1, 1], [1, 1], [1, 1]]). 46 | then(function() { return db.get_length.call(1, NAME) }). 47 | then(function(result) { assert.equal(result, 1) }). 48 | then(function() { return db.get_entry.call(1, NAME, 0) }). 49 | then(function(result) { 50 | assert.equal(result, 72); 51 | done(); 52 | }).catch(done); 53 | }).catch(done); 54 | }); 55 | 56 | it("requires the developer_id to refer to something", function(done) { 57 | var dapp_model = DappModel.at(DappModel.deployed_address); 58 | 59 | dapp_model.db.call(). 60 | then(function(db_address) { 61 | var db = EternalDB.at(db_address); 62 | dapp_model.create([[1, 24], [1, 42], [1, 100], [1, 1], [1, 1], [1, 1]]). 63 | then(function() { return db.count.call() }). 64 | then(function(result) { 65 | assert.equal(result, 1); 66 | done(); 67 | }).catch(done); 68 | }).catch(done); 69 | }); 70 | 71 | it("requires the sender to be the developer", function(done) { 72 | var dapp_model = DappModel.at(DappModel.deployed_address); 73 | 74 | dapp_model.db.call(). 75 | then(function(db_address) { 76 | var db = EternalDB.at(db_address); 77 | dapp_model.create([[1, 25], [1, 42], [1, 1], [1, 1], [1, 1], [1, 1]], {from: accounts[1]}). 78 | then(function() { return db.count.call() }). 79 | then(function(result) { 80 | assert.equal(result, 1); 81 | done(); 82 | }).catch(done); 83 | }).catch(done); 84 | }); 85 | 86 | it("doesn't allow updates to change the developer", function(done) { 87 | var dapp_model = DappModel.at(DappModel.deployed_address); 88 | var DEVELOPER_ID = "0x646576656c6f7065725f6964"; 89 | 90 | dapp_model.db.call(). 91 | then(function(db_address) { 92 | var db = EternalDB.at(db_address); 93 | dapp_model.update(1, [[1, 23], [1, 72], [1, 2], [1, 1], [1, 1], [1, 1]]). 94 | then(function() { return db.get_entry.call(1, DEVELOPER_ID, 0) }). 95 | then(function(result) { 96 | assert.equal(result, 1); 97 | done(); 98 | }).catch(done); 99 | }).catch(done); 100 | }); 101 | 102 | it("requires a nym of 32 chars or less", function(done) { 103 | var dapp_model = DappModel.at(DappModel.deployed_address); 104 | 105 | dapp_model.db.call(). 106 | then(function(db_address) { 107 | var db = EternalDB.at(db_address); 108 | 109 | dapp_model.create([[0], [1, 42], [1, 1], [1, 1], [1, 1], [1, 1]]). 110 | then(function() { return dapp_model.create([[2, 42, 42], [1, 42], [1, 1], [1, 1], [1, 1], [1, 1]]) }). 111 | then(function() { return db.count.call() }). 112 | then(function(result) { 113 | assert.equal(result, 1); 114 | done(); 115 | }).catch(done); 116 | }).catch(done); 117 | }); 118 | 119 | it("requires a unique nym", function(done) { 120 | var dapp_model = DappModel.at(DappModel.deployed_address); 121 | 122 | dapp_model.db.call(). 123 | then(function(db_address) { 124 | var db = EternalDB.at(db_address); 125 | dapp_model.create([[1, 23], [1, 42], [1, 1], [1, 1], [1, 1], [1, 1]]). 126 | then(function() { return db.count.call() }). 127 | then(function(result) { 128 | assert.equal(result, 1); 129 | done(); 130 | }).catch(done); 131 | }).catch(done); 132 | }); 133 | 134 | it("doesn't allow updates to change the nym", function(done) { 135 | var dapp_model = DappModel.at(DappModel.deployed_address); 136 | var NYM = "0x6e796d"; 137 | 138 | dapp_model.db.call(). 139 | then(function(db_address) { 140 | var db = EternalDB.at(db_address); 141 | dapp_model.update(1, [[1, 13], [1, 72], [1, 1], [1, 1], [1, 1], [1, 1]]). 142 | then(function() { return db.get_entry.call(1, NYM, 0) }). 143 | then(function(result) { 144 | assert.equal(result, 23); 145 | done(); 146 | }).catch(done); 147 | }).catch(done); 148 | }); 149 | 150 | it("updates dapp list on developer when new dapp is created", function(done) { 151 | var dapp_model = DappModel.deployed(); 152 | var developer_model = DeveloperModel.deployed(); 153 | 154 | var DAPPS = "0x6461707073"; 155 | 156 | developer_model.db.call(). 157 | then(function(db_address) { 158 | var dev_db = EternalDB.at(db_address); 159 | 160 | dapp_model.create([[1, 73], [1, 42], [1, 2], [1, 1], [1, 1], [1, 1]], {from: accounts[2]}). 161 | then(function() { return dev_db.get_length.call(2, DAPPS) }). 162 | then(function(result) { assert.equal(result.valueOf(), 1) }). 163 | then(function() { return dev_db.get_entry.call(2, DAPPS, 0) }). 164 | then(function(result) { 165 | assert.equal(result.valueOf(), 2); 166 | done(); 167 | }).catch(done); 168 | }); 169 | }); 170 | 171 | it("returns a list of keys", function(done) { 172 | var dapp_model = DappModel.at(DappModel.deployed_address); 173 | var NAME = web3.toDecimal("0x6e616d65"); 174 | var DEVELOPER_ID = web3.toDecimal("0x646576656c6f7065725f6964"); 175 | 176 | dapp_model.get_keys.call(). 177 | then(function(result) { 178 | assert.equal(result[1][0], NAME); 179 | assert.equal(result[2][0], DEVELOPER_ID); 180 | done(); 181 | }).catch(done) 182 | }); 183 | }); 184 | -------------------------------------------------------------------------------- /test/developer-model.js: -------------------------------------------------------------------------------- 1 | contract('DeveloperModel', function(accounts) { 2 | it("automatically stores the address", function(done) { 3 | var developer_model = DeveloperModel.deployed(); 4 | var ADDRESS = "0x61646472657373"; 5 | 6 | developer_model.db.call(). 7 | then(function(db_address) { 8 | var db = EternalDB.at(db_address); 9 | developer_model.create([[0], [0], [0]]). 10 | then(function() { return db.count.call() }). 11 | then(function(result) { assert.equal(result, 1); }). 12 | then(function() { return db.get_length.call(1, ADDRESS) }). 13 | then(function(result) { assert.equal(result, 1) }). 14 | then(function() { return db.get_entry.call(1, ADDRESS, 0) }). 15 | then(function(result) { 16 | assert.equal(web3.toHex(result), accounts[0]); 17 | done(); 18 | }).catch(done); 19 | }).catch(done); 20 | }); 21 | 22 | it("doesn't let other users update a developer", function(done) { 23 | var developer_model = DeveloperModel.deployed(); 24 | var NAME = web3.fromAscii("name"); 25 | 26 | // NOTE: This relies on the previous test! 27 | 28 | developer_model.db.call(). 29 | then(function(db_address) { 30 | var db = EternalDB.at(db_address); 31 | developer_model.update(1, [[1, 33], [0], [0]], {from: accounts[1]}). 32 | then(function() { return db.get_length.call(1, NAME) }). 33 | then(function(result) { 34 | assert.equal(result, 0); 35 | done(); 36 | }).catch(done); 37 | }).catch(done); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /test/eternal-db.js: -------------------------------------------------------------------------------- 1 | contract('EternalDB', function(accounts) { 2 | it("should set the admin to its creator", function(done) { 3 | var db = EternalDB.at(EternalDB.deployed_address); 4 | 5 | db.admin.call() 6 | .then(function(result) { 7 | assert.equal(result, accounts[0]); 8 | done(); 9 | }).catch(done); 10 | }); 11 | 12 | it("should allow you to create a new entry", function(done) { 13 | var db = EternalDB.at(EternalDB.deployed_address); 14 | 15 | db.new_entry(). 16 | then(function() { return db.count.call() }). 17 | then(function(result) { 18 | assert.equal(result, 1); 19 | done(); 20 | }).catch(done); 21 | }); 22 | 23 | it("should only allow admin to make changes", function(done) { 24 | var db = EternalDB.at(EternalDB.deployed_address); 25 | 26 | var id = 1; 27 | var key = 17; 28 | var value = 42; 29 | 30 | db.new_entry({from: accounts[1]}). 31 | then(function() { return db.count.call() }). 32 | then(function(result) { assert.equal(result, 1) }). 33 | then(function() { return db.add(id, key, value, {from: accounts[1]}) }). 34 | then(function() { return db.get_length.call(id, key) }). 35 | then(function(result) { 36 | assert.equal(result, 0); 37 | done(); 38 | }).catch(done) 39 | }); 40 | 41 | it("should allow storage of attributes", function(done) { 42 | var db = EternalDB.at(EternalDB.deployed_address); 43 | 44 | var id = 1; 45 | var key = 66; 46 | 47 | db.add(id, key, 11). 48 | then(function() { return db.add(id, key, 22) }). 49 | then(function() { return db.get_length.call(id, key) }). 50 | then(function(result) { assert.equal(result, 2) }). 51 | then(function() { return db.get_entry.call(id, key, 0) }). 52 | then(function(result) { assert.equal(result, 11) }). 53 | then(function() { return db.get_all.call(id, key) }). 54 | then(function(result) { 55 | assert.equal(result[0], 11); 56 | assert.equal(result[1], 22); 57 | done(); 58 | }).catch(done) 59 | }); 60 | 61 | it("should allow deletion of elements from array by index", function(done) { 62 | var db = EternalDB.at(EternalDB.deployed_address); 63 | 64 | var id = 1; 65 | var key = 63; 66 | 67 | db.add(id, key, 11). 68 | then(function() { return db.add(id, key, 22) }). 69 | then(function() { return db.add(id, key, 33) }). 70 | then(function() { return db.add(id, key, 44) }). 71 | then(function() { return db.delete_entry(id, key, 1) }). 72 | then(function() { return db.get_length.call(id, key) }). 73 | then(function(result) { assert.equal(result, 3) }). 74 | then(function() { return db.get_entry.call(id, key, 1) }). 75 | then(function(result) { 76 | assert.equal(result, 33); 77 | done(); 78 | }).catch(done) 79 | }) 80 | 81 | it("should allow admin to transfer ownership", function(done) { 82 | var db = EternalDB.at(EternalDB.deployed_address); 83 | 84 | db.transfer_ownership(accounts[1]). 85 | then(function() { return db.admin.call() }). 86 | then(function(result) { 87 | assert.equal(result, accounts[1]); 88 | done(); 89 | }).catch(done); 90 | }); 91 | }); 92 | -------------------------------------------------------------------------------- /test/license-model.js: -------------------------------------------------------------------------------- 1 | contract('LicenseModel', function(accounts) { 2 | before(function(done) { 3 | var version_model = VersionModel.at(VersionModel.deployed_address); 4 | var developer_model = DeveloperModel.at(DeveloperModel.deployed_address); 5 | var dapp_model = DappModel.at(DappModel.deployed_address); 6 | var user_model = UserModel.at(UserModel.deployed_address); 7 | 8 | return developer_model.create([[0], [0], [0], [0]]). 9 | then(function() { return user_model.create([[1, accounts[0]]]) }). 10 | then(function() { return dapp_model.create([[1, 33], [1, 52], [1, 1], [1, 1], [1, 1], [1, 1]]) }). 11 | then(function() { return version_model.create([[1, 1], [0], [0], [0], [0], [0]]) }). 12 | then(function() { 13 | done(); 14 | }).catch(done); 15 | }); 16 | 17 | it("updates license list on version", function(done) { 18 | var version_model = VersionModel.deployed(); 19 | var license_model = LicenseModel.deployed(); 20 | 21 | var LICENSES = "0x6c6963656e736573"; 22 | 23 | version_model.db.call(). 24 | then(function(db_address) { 25 | var version_db = EternalDB.at(db_address); 26 | 27 | license_model.create([[1, 1]]). 28 | then(function() { return version_db.get_length.call(1, LICENSES) }). 29 | then(function(result) { assert.equal(result, 1) }). 30 | then(function() { return version_db.get_entry.call(1, LICENSES, 0) }). 31 | then(function(result) { 32 | assert.equal(result, 1); 33 | done(); 34 | }).catch(done); 35 | }).catch(done); 36 | }); 37 | 38 | it("updates license list on user", function(done) { 39 | var user_model = UserModel.at(UserModel.deployed_address); 40 | var license_model = LicenseModel.at(LicenseModel.deployed_address); 41 | 42 | var LICENSES = "0x6c6963656e736573"; 43 | 44 | user_model.db.call(). 45 | then(function(db_address) { 46 | var user_db = EternalDB.at(db_address); 47 | 48 | return user_db.get_length.call(1, LICENSES). 49 | then(function(result) { assert.equal(result, 1) }). 50 | then(function() { return user_db.get_entry.call(1, LICENSES, 0) }). 51 | then(function(result) { 52 | assert.equal(result, 1); 53 | done(); 54 | }).catch(done); 55 | }); 56 | }); 57 | }); 58 | -------------------------------------------------------------------------------- /test/model-coordinator.js: -------------------------------------------------------------------------------- 1 | contract('ModelCoordinator', function(accounts) { 2 | it("lets admin replace models", function(done) { 3 | var old_user_model = UserModel.deployed(); 4 | var model_coordinator = ModelCoordinator.deployed(); 5 | 6 | var USER = "0x75736572"; 7 | 8 | old_user_model.db.call(). 9 | then(function(db_address) { 10 | var user_db = EternalDB.at(db_address); 11 | 12 | old_user_model.address_index.call(). 13 | then(function(index_address) { 14 | UserModel.new(index_address). 15 | then(function(new_user_model) { 16 | model_coordinator.register(USER, new_user_model.address, db_address). 17 | then(function() { return user_db.count.call() }). 18 | then(function(result) { assert.equal(result, 0) }). 19 | then(function() { return new_user_model.create([[1, accounts[0]]]) }). 20 | then(function() { return new_user_model.create([[1, accounts[1]]]) }). 21 | then(function() { return old_user_model.create([[1, accounts[2]]]) }). 22 | then(function() { return user_db.count.call() }). 23 | then(function(result) { 24 | assert.equal(result, 2); 25 | done(); 26 | }).catch(done); 27 | }).catch(done); 28 | }).catch(done); 29 | }); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /test/review-model.js: -------------------------------------------------------------------------------- 1 | contract('ReviewModel', function(accounts) { 2 | var DEVELOPER = "0x646576656c6f706572"; 3 | var DAPP = "0x64617070"; 4 | var VERSION = "0x76657273696f6e"; 5 | var REVIEW = "0x726576696577"; 6 | 7 | before(function(done) { 8 | var review_model = ReviewModel.at(ReviewModel.deployed_address); 9 | var version_model = VersionModel.at(VersionModel.deployed_address); 10 | var developer_model = DeveloperModel.at(DeveloperModel.deployed_address); 11 | var dapp_model = DappModel.at(DappModel.deployed_address); 12 | var coordinator = ModelCoordinator.at(ModelCoordinator.deployed_address); 13 | 14 | developer_model.create([[0], [0], [0]]). 15 | then(function(dev_id) {return dapp_model.create([[1, 33], [1, 52], [1, 1], [1, 1], [1, 1], [1, 1]]) }). 16 | then(function() { return version_model.create([[1, 1], [0], [0], [0], [0], [0]]) }). 17 | then(function(tx) { 18 | done(); 19 | }).catch(done); 20 | }); 21 | 22 | it("requires a rating", function(done) { 23 | var review_model = ReviewModel.at(ReviewModel.deployed_address); 24 | 25 | review_model.validate.call(accounts[0], 0, [[1, 1], [1, VERSION], [0], [0], [0], [0]]). 26 | then(function(result) { 27 | assert.equal(result, false); 28 | done(); 29 | }).catch(done); 30 | }); 31 | 32 | it("requires rating to be between 1 and 5", function(done) { 33 | var review_model = ReviewModel.at(ReviewModel.deployed_address); 34 | 35 | review_model.validate.call(accounts[0], 0, [[1, 1], [1, VERSION], [1, 0], [0], [0], [0]]). 36 | then(function(result) { assert.equal(result, false); }). 37 | then(function() { return review_model.validate.call(accounts[0], 0, [[1, 1], [1, VERSION], [1, 6], [0], [0], [0]]) }). 38 | then(function(result) { 39 | assert.equal(result, false); 40 | done(); 41 | }).catch(done); 42 | }); 43 | 44 | it("updates review list on model", function(done) { 45 | var version_model = VersionModel.at(VersionModel.deployed_address); 46 | var review_model = ReviewModel.at(ReviewModel.deployed_address); 47 | 48 | var REVIEWS = "0x72657669657773"; 49 | 50 | version_model.db.call(). 51 | then(function(db_address) { 52 | var version_db = EternalDB.at(db_address); 53 | 54 | review_model.create([[1, 1], [1, VERSION], [1, 5], [0], [0], [0]]). 55 | then(function() { return version_db.get_length.call(1, REVIEWS) }). 56 | then(function(result) { assert.equal(result, 1) }). 57 | then(function() { return version_db.get_entry.call(1, REVIEWS, 0) }). 58 | then(function(result) { 59 | assert.equal(result, 1); 60 | done(); 61 | }).catch(done); 62 | }); 63 | }); 64 | 65 | it("requires a real version", function(done) { 66 | var review_model = ReviewModel.at(ReviewModel.deployed_address); 67 | 68 | review_model.db.call(). 69 | then(function(db_address) { 70 | var db = EternalDB.at(db_address); 71 | 72 | review_model.create([[1, 100], [1, VERSION], [1, 5], [0], [0], [0]]). 73 | then(function() { return db.count.call() }). 74 | then(function(result) { 75 | assert.equal(result, 1); 76 | done(); 77 | }).catch(done); 78 | }); 79 | }); 80 | 81 | it("updates rating counts and total on model", function(done) { 82 | var version_model = VersionModel.at(VersionModel.deployed_address); 83 | var review_model = ReviewModel.at(ReviewModel.deployed_address); 84 | 85 | var RATING_COUNT = "0x726174696e675f636f756e74"; 86 | var RATING_TOTAL = "0x726174696e675f746f74616c"; 87 | 88 | version_model.db.call(). 89 | then(function(db_address) { 90 | var version_db = EternalDB.at(db_address); 91 | 92 | review_model.create([[1, 1], [1, VERSION], [1, 3], [0], [0], [0]]). 93 | then(function() { return version_db.get_length.call(1, RATING_COUNT) }). 94 | then(function(result) { assert.equal(result, 1) }). 95 | then(function() { return version_db.get_length.call(1, RATING_TOTAL) }). 96 | then(function(result) { assert.equal(result, 1) }). 97 | then(function() { return version_db.get_entry.call(1, RATING_COUNT, 0) }). 98 | then(function(result) { assert.equal(result, 2) }). 99 | then(function() { return version_db.get_entry.call(1, RATING_TOTAL, 0) }). 100 | then(function(result) { 101 | assert.equal(result, 8); 102 | done(); 103 | }).catch(done); 104 | }); 105 | }); 106 | 107 | it("automatically stores the address", function(done) { 108 | var review_model = ReviewModel.at(ReviewModel.deployed_address); 109 | var ADDRESS = "0x61646472657373"; 110 | 111 | review_model.db.call(). 112 | then(function(db_address) { 113 | var db = EternalDB.at(db_address); 114 | review_model.create([[1,1], [1, VERSION], [1, 5], [0], [0], [0]]). 115 | then(function() { return db.get_length.call(2, ADDRESS) }). 116 | then(function(result) { assert.equal(result, 1) }). 117 | then(function() { return db.get_entry.call(2, ADDRESS, 0) }). 118 | then(function(result) { 119 | assert.equal(web3.toHex(result), accounts[0]); 120 | done(); 121 | }).catch(done); 122 | }).catch(done); 123 | }); 124 | 125 | it("lets developers have reviews too", function(done) { 126 | var developer_model = DeveloperModel.deployed(); 127 | var review_model = ReviewModel.deployed(); 128 | 129 | var REVIEWS = "0x72657669657773"; 130 | 131 | developer_model.db.call(). 132 | then(function(db_address) { 133 | var developer_db = EternalDB.at(db_address); 134 | 135 | // NOTE: This depends on previous tests!!! 4th review created. 136 | review_model.create([[1, 1], [1, DEVELOPER], [1, 5], [0], [0], [0]]). 137 | then(function(tx) {return developer_db.get_length.call(1, REVIEWS) }). 138 | then(function(result) { assert.equal(result.valueOf(), 1) }). 139 | then(function() { return developer_db.get_entry.call(1, REVIEWS, 0) }). 140 | then(function(result) { 141 | assert.equal(result.valueOf(), 4); 142 | done(); 143 | }).catch(done); 144 | }); 145 | }); 146 | }); 147 | -------------------------------------------------------------------------------- /test/version-model.js: -------------------------------------------------------------------------------- 1 | contract('VersionModel', function(accounts) { 2 | before(function(done) { 3 | var version_model = VersionModel.at(VersionModel.deployed_address); 4 | var developer_model = DeveloperModel.at(DeveloperModel.deployed_address); 5 | var dapp_model = DappModel.at(DappModel.deployed_address); 6 | var coordinator = ModelCoordinator.at(ModelCoordinator.deployed_address); 7 | 8 | var DEVELOPER = "0x646576656c6f706572"; 9 | var DAPP = "0x64617070"; 10 | var VERSION = "0x76657273696f6e"; 11 | 12 | developer_model.create([[0], [0], [0], [0]]). 13 | then(function() { return dapp_model.create([[1, 23], [1, 42], [1, 1], [1, 1], [1, 1], [1, 1]]) }). 14 | then(function() { return dapp_model.create([[1, 33], [1, 52], [1, 1], [1, 1], [1, 1], [1, 1]]) }). 15 | then(function(tx) { 16 | done(); 17 | }).catch(done); 18 | }); 19 | 20 | it("updates version list on dapp", function(done) { 21 | var version_model = VersionModel.at(VersionModel.deployed_address); 22 | var dapp_model = DappModel.at(DappModel.deployed_address); 23 | 24 | var VERSIONS = "0x76657273696f6e73"; 25 | var NAME = "0x6e616d65"; 26 | 27 | dapp_model.db.call(). 28 | then(function(db_address) { 29 | var dapp_db = EternalDB.at(db_address); 30 | 31 | version_model.create([[1, 1], [0], [0], [0], [0], [0]]). 32 | then(function() { return dapp_db.get_length.call(1, VERSIONS) }). 33 | then(function(result) { assert.equal(result, 1) }). 34 | then(function() { return dapp_db.get_entry.call(1, VERSIONS, 0) }). 35 | then(function(result) { 36 | assert.equal(result, 1); 37 | done(); 38 | }).catch(done); 39 | }).catch(done); 40 | }); 41 | 42 | it("requires a real dapp", function(done) { 43 | var version_model = VersionModel.at(VersionModel.deployed_address); 44 | 45 | version_model.db.call(). 46 | then(function(db_address) { 47 | var db = EternalDB.at(db_address); 48 | 49 | version_model.create([[1, 100], [0], [0], [0], [0], [0]]). 50 | then(function() { return db.count.call() }). 51 | then(function(result) { 52 | assert.equal(result, 1); 53 | done(); 54 | }).catch(done); 55 | }).catch(done); 56 | }); 57 | 58 | it("only allows dapp developer to create version", function(done) { 59 | var version_model = VersionModel.at(VersionModel.deployed_address); 60 | 61 | version_model.db.call(). 62 | then(function(db_address) { 63 | var db = EternalDB.at(db_address); 64 | 65 | version_model.create([[1, 1], [0], [0], [0], [0], [0]], {from: accounts[2]}). 66 | then(function() { return db.count.call() }). 67 | then(function(result) { 68 | assert.equal(result, 1); 69 | done(); 70 | }).catch(done); 71 | }).catch(done); 72 | }); 73 | 74 | it("doesn't allow dapp_id to be changed", function(done) { 75 | var version_model = VersionModel.at(VersionModel.deployed_address); 76 | var DAPP_ID = "0x646170705f6964"; 77 | 78 | version_model.db.call(). 79 | then(function(db_address) { 80 | var db = EternalDB.at(db_address); 81 | 82 | version_model.update(1, [[1, 2], [0], [0], [0], [0], [0]]). 83 | then(function() { return db.get_entry.call(1, DAPP_ID, 0) }). 84 | then(function(result) { 85 | assert.equal(result, 1); 86 | done(); 87 | }).catch(done); 88 | }).catch(done); 89 | }); 90 | }); 91 | --------------------------------------------------------------------------------