I’ve been having ‘fun’ developing an ERC777 contract setup. I may have it working, but I have a whole bunch of questions about
erc1820.setInterfaceImplementer and the hook
To keep this as brief as possible, I’m going to gloss over much of the pain I’ve been through
First, most of my issues seem to be with who receives newly minted tokens. When minting with msg.sender (i.e. the contract owner):
_mint( msg.sender, msg.sender, _initialSupply, "", "" );, I’ve been unable to set any of my
defaultOperators as a manager of the
msg.sender address, and consequently, I’ve been unable to hook into
tokensToSend (amongst other issues).
Instead, my token constructor gives the minted tokens to itself, i.e.
_mint( address(this), address(this), _initialSupply, "", "" );. Afterwards, I do this:
erc1820.setManager( address(this), _defaultOperators );.
Then my token manager (
_defaultOperators), is passed the
token, and calls
erc1820.setInterfaceImplementer( address(token), TOKENS_SENDER_INTERFACE_HASH, address(this) );. That means it can send tokens,
token.operatorSend( address(token), _recipient, _amount, "", _buyData );, which successfully hooks into
tokensToSend (since my token manager is a
IERC777Sender, and all seems to behave properly. Huzzah!
Is that correct? Can the ERC777 token contract give itself the tokens? Have I called
As I said, it all seems to behave correctly. However, when I deploy my token contracts to
Ganache, I send
an address some of my tokens via my contracts. Unfortunately, after adding the token to
an address under
MetaMask, the account shows 0 tokens, instead of the amount sent. Eek!
Apologies for the (probably) nonsensical posting, but any help/guidance/hugs are much appreciated