Skip to content

Commit

Permalink
Automatically merged updates to draft EIP(s) 820
Browse files Browse the repository at this point in the history
Hi, I'm a bot! This change was automatically merged because:

 - It only modifies existing Draft or Last Call EIP(s)
 - The PR was approved or written by at least one author of each modified EIP
 - The build is passing
  • Loading branch information
jbaylina authored and eip-automerger committed Jul 18, 2018
1 parent 5f68f4d commit deeb2db
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions EIPS/eip-820.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This standard also solves the problem of having different addresses for differen
### The smart contract

```solidity
pragma solidity 0.4.20;
pragma solidity 0.4.24;
interface ERC820ImplementerInterface {
/// @notice Contracts that implement an interferce in behalf of another contract must return true
Expand All @@ -57,17 +57,10 @@ contract ERC820Registry {
bytes4 constant ERC165ID = 0x01ffc9a7;
bytes32 constant ERC820_ACCEPT_MAGIC = keccak256("ERC820_ACCEPT_MAGIC");
mapping (address => mapping(bytes32 => address)) interfaces;
mapping (address => address) managers;
mapping (address => mapping(bytes4 => bool)) erc165Cache;
modifier canManage(address addr) {
require(getManager(addr) == msg.sender);
_;
}
event InterfaceImplementerSet(address indexed addr, bytes32 indexed interfaceHash, address indexed implementer);
event ManagerChanged(address indexed addr, address indexed newManager);
Expand All @@ -89,21 +82,25 @@ contract ERC820Registry {
/// @notice Sets an external `manager` that will be able to call `setInterfaceImplementer()`
/// on behalf of the address.
/// @param addr Address that you are defining the manager for.
/// @param _addr Address that you are defining the manager for. (0x0 if is msg.sender)
/// @param newManager The address of the manager for the `addr` that will replace
/// the old one. Set to 0x0 if you want to remove the manager.
function setManager(address addr, address newManager) public canManage(addr) {
function setManager(address _addr, address newManager) public {
address addr = _addr == 0 ? msg.sender : _addr;
require(getManager(addr) == msg.sender);
managers[addr] = newManager == addr ? 0 : newManager;
ManagerChanged(addr, newManager);
}
/// @notice Query if an address implements an interface and thru which contract
/// @param addr Address that is being queried for the implementation of an interface
/// @param _addr Address that is being queried for the implementation of an interface
/// (if _addr == 0 them `msg.sender` is assumed)
/// @param iHash SHA3 of the name of the interface as a string
/// Example `web3.utils.sha3('ERC777Token`')`
/// @return The address of the contract that implements a specific interface
/// or 0x0 if `addr` does not implement this interface
function getInterfaceImplementer(address addr, bytes32 iHash) constant public returns (address) {
function getInterfaceImplementer(address _addr, bytes32 iHash) constant public returns (address) {
address addr = _addr == 0 ? msg.sender : _addr;
if (isERC165Interface(iHash)) {
bytes4 i165Hash = bytes4(iHash);
return erc165InterfaceSupported(addr, i165Hash) ? addr : 0;
Expand All @@ -112,11 +109,16 @@ contract ERC820Registry {
}
/// @notice Sets the contract that will handle a specific interface; only
/// the address itself or a `manager` defined for that address can set it
/// @param addr Address that you want to define the interface for
/// a `manager` defined for that address can set it.
/// ( Each address is the manager for itself until a new manager is defined)
/// @param _addr Address that you want to define the interface for
/// (if _addr == 0 them `msg.sender` is assumed)
/// @param iHash SHA3 of the name of the interface as a string
/// For example `web3.utils.sha3('Ierc777')` for the Ierc777
function setInterfaceImplementer(address addr, bytes32 iHash, address implementer) public canManage(addr) {
function setInterfaceImplementer(address _addr, bytes32 iHash, address implementer) public {
address addr = _addr == 0 ? msg.sender : _addr;
require(getManager(addr) == msg.sender);
require(!isERC165Interface(iHash));
if ((implementer != 0) && (implementer!=msg.sender)) {
require(ERC820ImplementerInterface(implementer).canImplementInterfaceForAddress(addr, iHash)
Expand Down Expand Up @@ -192,7 +194,7 @@ contract ERC820Registry {
### Raw transaction for deploying the smart contract on any chain

```
0xf908778085174876e800830c35008080b908246060604052341561000f57600080fd5b6108068061001e6000396000f30060606040526004361061008d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166329965a1d81146100925780633d584063146100bd578063571a1f66146100f85780635df8122f1461012457806365ba36c11461014957806390e47957146101ac578063aabbb8ca146101ec578063ddc23ddd1461020e575b600080fd5b341561009d57600080fd5b6100bb600160a060020a03600435811690602435906044351661023a565b005b34156100c857600080fd5b6100dc600160a060020a03600435166103ec565b604051600160a060020a03909116815260200160405180910390f35b341561010357600080fd5b6100bb600160a060020a0360043516600160e060020a031960243516610438565b341561012f57600080fd5b6100bb600160a060020a03600435811690602435166104c2565b341561015457600080fd5b61019a60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061057d95505050505050565b60405190815260200160405180910390f35b34156101b757600080fd5b6101d8600160a060020a0360043516600160e060020a0319602435166105e2565b604051901515815260200160405180910390f35b34156101f757600080fd5b6100dc600160a060020a0360043516602435610658565b341561021957600080fd5b6101d8600160a060020a0360043516600160e060020a0319602435166106b7565b8233600160a060020a031661024e826103ec565b600160a060020a03161461026157600080fd5b61026a8361076e565b1561027457600080fd5b600160a060020a0382161580159061029e575033600160a060020a031682600160a060020a031614155b15610373576040517f4552433832305f4143434550545f4d41474943000000000000000000000000008152601301604051908190039020600160a060020a03831663f008325086866000604051602001526040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561034b57600080fd5b6102c65a03f1151561035c57600080fd5b505050604051805191909114905061037357600080fd5b600160a060020a0384811660008181526020818152604080832088845290915290819020805473ffffffffffffffffffffffffffffffffffffffff191693861693841790558591907f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db153905160405180910390a450505050565b600160a060020a038082166000908152600160205260408120549091161515610416575080610433565b50600160a060020a03808216600090815260016020526040902054165b919050565b61044282826106b7565b61044d57600061044f565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b8133600160a060020a03166104d6826103ec565b600160a060020a0316146104e957600080fd5b82600160a060020a031682600160a060020a031614610508578161050b565b60005b600160a060020a0384811660008181526001602052604090819020805473ffffffffffffffffffffffffffffffffffffffff191694841694909417909355908416917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a4350905160405180910390a3505050565b6000816040518082805190602001908083835b602083106105af5780518252601f199092019160209182019101610590565b6001836020036101000a038019825116818451161790925250505091909101925060409150505180910390209050919050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff161515610623576106238383610438565b50600160a060020a03918216600090815260208181526040808320600160e060020a0319949094168352929052205416151590565b6000806106648361076e565b1561068957508161067584826105e2565b610680576000610682565b835b91506106b0565b600160a060020a038085166000908152602081815260408083208784529091529020541691505b5092915050565b600080806106e5857f01ffc9a700000000000000000000000000000000000000000000000000000000610790565b90925090508115806106f5575080155b156107035760009250610766565b61071585600160e060020a0319610790565b909250905081158061072657508015155b156107345760009250610766565b61073e8585610790565b90925090506001821480156107535750806001145b156107615760019250610766565b600092505b505092915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6000807f01ffc9a70000000000000000000000000000000000000000000000000000000060405181815284600482015260208160088389617530fa935080519250505092509290505600a165627a7a72305820b424185958879a1eef1cb7235bfd8ed607a7402b46853860e5343340925f028e00291ba079be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798a00aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
0xf908b78085174876e800830c35008080b90864608060405234801561001057600080fd5b50610844806100206000396000f30060806040526004361061008d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166329965a1d81146100925780633d584063146100bf578063571a1f66146100fc5780635df8122f1461012a57806365ba36c11461015157806390e47957146101bc578063aabbb8ca146101fe578063ddc23ddd14610222575b600080fd5b34801561009e57600080fd5b506100bd600160a060020a036004358116906024359060443516610250565b005b3480156100cb57600080fd5b506100e0600160a060020a0360043516610402565b60408051600160a060020a039092168252519081900360200190f35b34801561010857600080fd5b506100bd600160a060020a0360043516600160e060020a03196024351661044e565b34801561013657600080fd5b506100bd600160a060020a03600435811690602435166104d8565b34801561015d57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101aa9436949293602493928401919081908401838280828437509497506105a09650505050505050565b60408051918252519081900360200190f35b3480156101c857600080fd5b506101ea600160a060020a0360043516600160e060020a031960243516610604565b604080519115158252519081900360200190f35b34801561020a57600080fd5b506100e0600160a060020a036004351660243561067a565b34801561022e57600080fd5b506101ea600160a060020a0360043516600160e060020a0319602435166106f4565b6000600160a060020a038416156102675783610269565b335b90503361027582610402565b600160a060020a03161461028857600080fd5b610291836107a9565b1561029b57600080fd5b600160a060020a038216158015906102bc5750600160a060020a0382163314155b1561039157604080517f4552433832305f4143434550545f4d4147494300000000000000000000000000815281519081900360130181207ff0083250000000000000000000000000000000000000000000000000000000008252600160a060020a038481166004840152602483018790529251909285169163f00832509160448083019260209291908290030181600087803b15801561035b57600080fd5b505af115801561036f573d6000803e3d6000fd5b505050506040513d602081101561038557600080fd5b50511461039157600080fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03808216600090815260016020526040812054909116151561042c575080610449565b50600160a060020a03808216600090815260016020526040902054165b919050565b61045882826106f4565b610463576000610465565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b6000600160a060020a038316156104ef57826104f1565b335b9050336104fd82610402565b600160a060020a03161461051057600080fd5b80600160a060020a031682600160a060020a03161461052f5781610532565b60005b600160a060020a03828116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519185169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a3505050565b6000816040518082805190602001908083835b602083106105d25780518252601f1990920191602091820191016105b3565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff16151561064557610645838361044e565b50600160a060020a03918216600090815260208181526040808320600160e060020a0319949094168352929052205416151590565b60008080600160a060020a038516156106935784610695565b335b91506106a0846107a9565b156106c55750826106b18282610604565b6106bc5760006106be565b815b92506106ec565b600160a060020a038083166000908152602081815260408083208884529091529020541692505b505092915050565b60008080610722857f01ffc9a7000000000000000000000000000000000000000000000000000000006107cb565b9092509050811580610732575080155b1561074057600092506106ec565b61075285600160e060020a03196107cb565b909250905081158061076357508015155b1561077157600092506106ec565b61077b85856107cb565b90925090506001821480156107905750806001145b1561079e57600192506106ec565b506000949350505050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160088189617530fa9051909690955093505050505600a165627a7a72305820ba6e246cbdcaf97334eb3dd1ac11e6490103d5ead3f963b5f312a729e88cf9db00291ba079be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798a00aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

You can see the string of `a`s at the end of the transaction. This is the `s` of the signature, meaning that its a deterministic by hand forced signature.
Expand Down Expand Up @@ -222,15 +224,15 @@ This operation can be done in any chain, guaranteed that the contract address is
### Special registry deployment account

```
0x91c2b265ece9442ed28e3c4283652b1894dcdabb
0xe515e6d0e6b09a60e3cb50c6a8d51d3009ad18af
```

This account is generated by reverse engineering it from it's signature for the transaction, in this way no one knows the private key, but it is known that it's the valid signer of the deployment transaction.

### Deployed contract

```
0x991a1bcb077599290d7305493c9a630c20f8b798
0xbe78655dff872d22b95ae366fb3477d977328ade
```

The contract will have this address for every chain it is deployed to.
Expand Down

0 comments on commit deeb2db

Please sign in to comment.