ethereum / ethendance

5 stars 10 forks source link

Forwarding / proxy contract to register names #3

Closed chriseth closed 6 years ago

chriseth commented 7 years ago

A specific contract should forward new requests to register names to the actual registrar. It should work by just sending a transaction with the name as data, i.e. its fallback function should forward the request to the registrar. Furthermore, there should be at most one successful register attempt per sender.

yann300 commented 7 years ago
contract RegistrarProxy {
    mapping (address => address) addresses;
    address registrar;
    bytes32 functioncall = sha3("register(bytes32,address)");

    function RegistrarProxy (address _registrar) {
        registrar = _registrar;
    }

    function () {
        if (addresses[msg.sender] == 1) {
            throw;
        }
        if (registrar.call(functioncall, msg.data, msg.sender)) {
            addresses[msg.sender] = 1;
        }
    }
}
chfast commented 7 years ago

Can you move it to GitHub to be loaded into remix?

I think the proxy represent an event so it should have a name. And that name should go to the registrar.

Also, should we allow the user to add additional message? Line name?

yann300 commented 7 years ago

the name to register is msg.data

gumb0 commented 7 years ago

Shouldn't we have a function making suicide ? we'll call it when disabling proxy