[Request] Guide to deploy ERC1820

Hi,

I am trying to deploy ERC777 on a private chain and i’m trying to use the tokensReceived feature. I notice that in order to do this with _send I need to register with the ERC1820 contract, which doesn’t exist on my private chain yet. Is there any example I can use to deploy the ERC1820 contract to the exact address that is required?

I notice in the docs this is coming soon but I would like to use this now.

Thanks

2 Likes

Hi @mrwillis welcome to the community.

I wrote a simple ERC777 token example which includes deploying the ERC1820 registry to a local test network:

Let me know if you need more information.

1 Like

Thank you. I am interested in the tokensReceived feature as well. If I understand correctly I need to register my contracts that implement tokensReceived in the ERC1820 registry on my test chain. Is there any example for this?

Thanks

2 Likes

Hi @mrwillis

You are correct, contracts that implement tokensReceived need to setInterfaceImplementer

The tests for the OpenZeppelin ERC777 implementation show this process.

I am working on an update to my Simple ERC777 token example to include a contract recipient.

1 Like

Hi @mrwillis

I have updated my Simple ERC777 token example to include a recipient contract.

The recipient contract needs to implement the tokensReceived function from IERC777Recipient.sol.

The recipient contract also needs to register with the ERC1820 registry that it is an interface implementer of ERC777TokensRecipient
_erc1820.setInterfaceImplementer(address(this), TOKENS_RECIPIENT_INTERFACE_HASH, address(this));

1 Like

Hi @mrwillis

Have you been able to deploy as you wanted? Please ask further questions if you need to.

I have marked my reply as the solution.