The registry of the ConsenSys dapp store prototype that grants model contracts write access to the shared EternalDB.
Key Facts
Description
ModelCoordinator owns the EternalDB store and lets its admin register the model contracts (dapps, users, versions, attributes, licences, reviews) that may write to it.
Source Verified
Exact runtime and creation bytecode match with soljson v0.1.6+commit.d41f8b7c, optimizer on. Source: github.com/ConsenSysMesh/dapp-store-contracts @ 0850f857 (contracts/ModelCoordinator.sol, author original; import/import_headers inlined into one file, every inlined file verbatim). Verified on Etherscan. Not submitted to Sourcify: its oldest supported compiler is v0.1.7.
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract EternalDB {
address public admin;
mapping (uint => uint[])[] data;
modifier restricted { if (msg.sender == admin) _ }
function EternalDB() {
admin = msg.sender;
data.length = 1; // 1-indexed, so things like mappings to ids will work
}
function transfer_ownership(address _admin) restricted {
admin = _admin;
}
function count() constant returns(uint) {
return data.length - 1;
}
function has(uint id) constant returns(bool) {
return id <= count();
}
function new_entry() restricted returns(uint) {
return data.length++;
}
function add(uint id, uint key, uint value) restricted {
uint[] attribute = data[id][key];
attribute[attribute.length++] = value;
}
function get_length(uint id, uint key) constant returns(uint) {
return data[id][key].length;
}
function get_entry(uint id, uint key, uint index) constant returns(uint) {
return data[id][key][index];
}
function get_all(uint id, uint key) constant returns(uint[]) {
return data[id][key];
}
function clear(uint id, uint key) restricted {
data[id][key].length = 0;
}
function delete_entry(uint id, uint key, uint index) restricted {
uint[] attribute = data[id][key];
for (uint i = index; i + 1 < attribute.length; i++) {
attribute[i] = attribute[i + 1];
}
attribute.length--;
}
}
contract AbstractModel {
function set_db(EternalDB _db);
function replace(address replacement);
}
contract ModelCoordinator {
mapping(uint => address) public models;
address public admin;
function ModelCoordinator() {
admin = msg.sender;
}
function register(uint name, AbstractModel model, EternalDB db) {
if (msg.sender == admin) {
if (models[name] != 0) {
AbstractModel old_model = AbstractModel(models[name]);
old_model.replace(model);
}
models[name] = address(model);
if (address(db) == 0) {
db = new EternalDB();
db.transfer_ownership(address(model));
}
model.set_db(db);
}
}
}External Links
Related contracts
EternalDB
Same deployerThe storage contract of the ConsenSys dapp store prototype: a list of records, each a mapping from integer keys to lists of integer values, writable only by its admin.
0x31f8e5...8ef04fNovember 6, 2015LicenseModel
Same deployerThe licence model of the ConsenSys dapp store prototype: records which user holds a licence for which dapp.
0x09e79b...496375November 7, 2015DualIndex
Same deployerA two-key uint lookup table writable only by its admin, used by the ConsenSys dapp store prototype for licences.
0xb549cd...ac249eNovember 7, 2015AttributeModel
Same deployerThe attribute model of the ConsenSys dapp store prototype: stores typed attributes attached to dapps and developers.
0x7e75db...0ba8c7November 7, 2015ReviewModel
Same deployerThe review model of the ConsenSys dapp store prototype: stores ratings and reviews of dapp versions.
0x6f07e5...21b66bNovember 7, 2015DappModel
Same deployerThe dapp model of the ConsenSys dapp store prototype: creates, validates and updates dapp listings kept in an EternalDB.
0xab4192...c9f9eeNovember 7, 2015