Using remix, compiler on 0.6.12 and I keep getting this error when trying to deploy basic erc777 from open zeppelin tutorials. Constructor params are “1000”,[“0x5B38Da6a701c568545dCfcB03FcB875f56beddC4”]
creation of GLDToken errored: VM error: revert. revert The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information.
Alternatively, you can deploy using Remix to a public testnet. I reproduced the error that you saw with a JavaScript VM and then deployed GLDToken to a public testnet. (Kovan)
contract ERC777 is Context, IERC777, IERC20 {
using SafeMath for uint256;
using Address for address;
IERC1820Registry constant internal _ERC1820_REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);
few questions if I may:
How come this contract has same address on mainnet and kovan, how can it be achieved to have same hex on both?
I am still new to solidity so I am trying to get when is something imported and when you can use already deployed contracts. This above uses deployed contract, but couldn’t we also just import this like usually we import .sol contracts? And also could we for example use some deployed SafeMath.sol contract instead of importing it? Maybe I am missing some important info here and experience, but this something I have doubts about.
EIP-1820 Registry Contract Address 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24 is the same on every chain on which it is deployed as the same transaction is used to deploy.
It is achieved by using the keyless deployment method—also known as Nick’s method—which relies on a single-use address. (See Nick’s article for more details).
Thanx on answer, very helpful. Seems I am baffled a bit about when to use library and when to use already deployed contract on blockchain. For example I am thinking wouldn’t it also be possible to have
"EIP-1820 Registry Contract " as library and implemented with import? What would be downside if this was done like that or it wouldnt be even possible and why so?
If each contract used an ERC1820 registry library then the storage would be in each contract, so instead of a single universal registry there would be one for every contract. Does that make sense?
At this point I got it that it is useful that each contract saves data on which interfaces it supports so I guess other contracts using that contract can get info on what functions they can call. I dont get practical part, wouldnt you check manually which functions you can call from other contract before using them in your own? What is the use case here, trying still to fully wrap my mind around that and how does it give benefit?