Skip to content
Verified contractPartial

xreg

Address0xe0d2d2fbdcccc8a3861131d4012bab76792a69d1
Balance

0 ETH

 

Transactions

11

 

Compiler

solc 0.5.10

 

Same code

Only this contract

 

Details

Compiler
solc 0.5.10+commit.5a6ea5b1
Language
solidity
Optimization
Yes, 200 runs
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
8,134,061
Creation transaction
0x2a768fa126…03ef5e754d

xreg.sol

// dmap .x.
// the worst registry
// do not use this one

pragma solidity ^0.5.10;

contract DMap {
    address owner;
    mapping(bytes32=>bytes32) values;

    event ValueUpdate( bytes32 indexed key
                     , bytes32 indexed value );
    event OwnerUpdate( address indexed oldOwner
                     , address indexed newOwner );

    constructor() public {
        owner = msg.sender;
        emit OwnerUpdate(address(0), owner);
    }
    function getValue(bytes32 key)
        public view returns (bytes32)
    {
        return values[key];
    }
    function setValue(bytes32 key, bytes32 value)
        public
    {
        assert(msg.sender == owner);
        values[key] = value;
        emit ValueUpdate(key, value);
    }
    function getOwner()
        public view returns (address)
    {
        return owner;
    }
    function setOwner(address newOwner)
        public
    {
        assert(msg.sender == owner);
        owner = newOwner;
        emit OwnerUpdate(msg.sender, owner);
    }
}

contract xreg {
    DMap public x;
    constructor() public {
        x = new DMap();
    }
    function newChild(bytes32 name) public returns (DMap) {
        DMap map = new DMap();
        register(name, bytes32(bytes20(address( map ))));
        map.setOwner(msg.sender);
        return map;
    }
    function register(bytes32 key, bytes32 val) public {
        assert(x.getValue(key) == 0x0);
        x.setValue(key, val);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.