New answers tagged

0

The expression type(A) is used to retrieve information about A. In this case type(I).interfaceId A bytes4 value containing the EIP-165 interface identifier of the given interface I. This identifier is defined as the XOR of all function selectors defined within the interface itself - excluding all inherited functions. For other properties available see the ...


0

They’re not visible from METoken because they’re private to ERC20.


0

You probably want to use ERC721URIStorage, which is an extension of ERC721 that implements _setTokenURI(tokenId, _tokenURI)


0

As you’re already extending OpenZeppelin’s ERC721 contract, simply extend ERC721Enumerable too, and you may then enumerate user’s tokens by calling tokenOfOwnerByIndex(user, index) for index = 0, 1, 2, …, balanceOf(user) - 1.


0

This can be achieved by the following: Declare storage variables at the contract level mapping(address => uint256[]) public userOwnedTokens; mapping(uint256 => int256) public tokenIsAtIndex; mint(tokenId) { // Prior minting logic from OpenZeppelin userOwnedTokens[msg.sender].push(tokenId); uint256 arrayLength = userOwnedTokens[msg.sender]....


0

Seems the fix for this is similar to this post: https://forum.openzeppelin.com/t/erc20-decimals-specifying-a-big-number/2047/4 Where I needed to use big number libraries multiply and power functions to do the calculation as the number is too big for JavaScript. The test is now working with: const { BN, expectEvent, constants } = require('@openzeppelin/test-...


0

Try this it('expected event is emitted', async function() { const receipt = await this.mycontract.function1(); expectEvent(receipt, 'THIS_EVENT', { message: 'This event has happened.', }); });


1

In your brownie.config.yaml, you are importing OpenZeppelin/openzeppelin-contracts@3.4.0, but in your .sol you are importing @oppenzeppelin/contracts/etc.... You should import the dependency as it says in your config. import "OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/token/ERC721/ERC721.sol


2

The following line in your contract is triggering the error. uint x = IERC20(0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa).balanceOf(address(this)); Looking at your hardhat config, you using a fresh local development network where 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa is likely an empty account, since I couldn't see any other logic that deploys an ERC20 ...


0

You have to inherit from it and implement its abstract functions withdrawalAllowed. Take a look at RefundEscrow that uses ConditionEscrow to implement its functionality.


1

Since you are using the call functionality, you are not sending a real transaction (https://web3js.readthedocs.io/en/v1.2.11/web3-eth-contract.html#methods-mymethod-call). A call can't alter contract state and can't emit events. You have to send a real transaction with send (https://web3js.readthedocs.io/en/v1.2.11/web3-eth-contract.html#methods-mymethod-...


0

try downgrade openzepplin, i think you are trying some very old tutorial. i meet same case. $npm install openzeppelin-solidity@v2.0.0


Top 50 recent answers are included