I am familiarizing myself with smart contract development using the brownie framework and solidity. To start of I was using the brownie console
to deploy some standard OpenZeppelin token contracts.
I did this by copying the code right from their documentation and adjusting the imports to work with brownie, like in this page: https://docs.openzeppelin.com/contracts/3.x/erc777
It works fine for the ERC20 and the ERC721 contracts. The ERC777 however always get reverted and gives me a transaction without error message, where none of the tracing methods work, because they are not implemented for a deployment transaction.
Code For ERC777 Token (Not Working)
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "OpenZeppelin/openzeppelin-contracts@3.0.0/contracts/token/ERC777/ERC777.sol";
contract GLDToken is ERC777 {
constructor(uint256 initialSupply, address[] memory defaultOperators)
public
ERC777("Gold", "GLD", defaultOperators)
{
_mint(msg.sender, initialSupply, "", "");
}
}
Code For ERC20 Token (Working)
// contracts/TestToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "OpenZeppelin/openzeppelin-contracts@3.0.0/contracts/token/ERC20/ERC20.sol";
contract TestToken is ERC20 {
constructor(uint256 initialSupply) public ERC20("Gold", "GLD") {
_mint(msg.sender, initialSupply);
}
}
Output In Brownie Console
>>> t1 = TestToken.deploy(1e21, {'from': accounts[0]})
Transaction sent: 0x33de3fadb7ccf2dd8b3841365ad88190c3486a803f6ea30c04ef8c0111ec9cbd
Gas price: 0.0 gwei Gas limit: 6721975 Nonce: 2
TestToken.constructor confirmed Block: 4 Gas used: 721166 (10.73%)
TestToken deployed at: 0x8c81630387e9507739fCeB6cbB14Ea1Da11D2339
>>> t2 = GLDToken.deploy(1e21, [], {'from': accounts[1]})
Transaction sent: 0xca91d510e7a54099182fe218ff0ec55c62ccb06227afbe9d9497790e35776651
Gas price: 0.0 gwei Gas limit: 6721975 Nonce: 0
GLDToken.constructor confirmed (reverted) Block: 5 Gas used: 260948 (3.88%)
I have also tried to enter a valid address (of deployed operator contract) in the list for a default token operator, that is passed as the second parameter to the deploy function of the GLDToken. Unfortunately it made no difference.
I have exhausted all possibilities with the deploy function and am getting no further debugging information. Has anyone experienced a similar problem, or knows how to debug this further? Any help would be much appreciated!