Category "solidity"

Getting TransferHelper: TRANSFER_FROM_FAILED from TransferHelper.sol. Why?

I'm new to solidity. I'm currently getting the following error TransferHelper: TRANSFER_FROM_FAILED from the safeTransferFrom function. Can someone tell me why?

list all token IDs by owner at ERC721

I have a simple ERC721 smart contract used for testing purposes, I was wondering if it is possible to query the token IDs a specific wallet owns in that smart c

how can i call a function in a smart contract from an abi json file smart contract

i have the abi json file for a contract and i want to use its functions in my smart contract. is there any way to do it? for example i have a contractA.sol and

running into decleration error in solidity course

just started a solidity coding course and ran into this issue with this code: //SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import "./simplestora

Solidity mapping not returns an array in a struct

The Solidity's mapping not returns an array inside a struct (when call mapping_data(), the data variable is undefined). Just be able to read it from read() func

deploy Openzeppelin ERC20 contract with web3JS

The openzeppelin codes of ERC20 token give error in deploying directly. Even after flattern the codes, i am unable to select contract MyToken out of many contra

ParserError: Expected '{' but got reserved keyword 'override' function _mint(address to, uint256 tokenId) internal override(ERC721) {

I keep getting this error, Does anyone know the solution? the code its inheriting, function _mint(address to, uint256 tokenId) internal virtual { // req

Implementing fixtures with @nomiclabs/hardhat-waffle

In the official waffle documentation you may find the next way to implement fixtures: import {expect} from 'chai'; import {loadFixture, deployContract} from 'et

Error: TypeError [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException` cannot be used in the REPL at Object.compile

I am new to truffle and I work on blockchain project so when I "migrate" in truffle develop, this error occurs. Why ? I change the version of my compiler by 4.2

Paying with ERC20 token

I want to build an NFT that I can paid with an ERC-20 token to mint it. I'm using currently the Mumbai testnet on polygon, and I'm using the Dummy ERC20 token t

Must all nodes on the blockchain execute every smart contract function cal?

I understand why it's important that all nodes on the Ethereum mainnet must execute any smart contract function call which changes the internal state of the con

Error trailing semicolon in smart contract on solidity?

I am trying to write a smart contract and line 1 is bringing up an error : ParserError: Found version pragma, but failed to parse it. Please ensure there is a

The transaction declared chain ID 5777, but the connected node is on 1337

I am trying to deploy my SimpleStorage.sol contract to a ganache local chain by making a transaction using python. It seems to have trouble connecting to the ch

How to initialize a static string array in solidity?

I want to declare an array to store my strings as follows. bytes32[3] verifiedResult; verifiedResult = ["verified successfully", "verified failed", "not clear"]

My dapp doesn't detect when an user change their Metamask Account

I am in the process of building a dapp for a project. I have one last thing to adjust: detect when a user changes metamask account to reset the state but it doe

How to initialize a static string array in solidity?

I want to declare an array to store my strings as follows. bytes32[3] verifiedResult; verifiedResult = ["verified successfully", "verified failed", "not clear"]

TypeError: Cannot read properties of undefined (reading 'getContractFactory') when testing contract

First question so bare with me if it is not very clear, but I'll try my best. I am currently running through a youtube video to test my contract with hardhat, e

sign and verify message with solidity and python

I am trying to perform a certain action say like selling a token only when the message sent to a contract is signed by the contract owner. I knew how I would do

Can smart contracts deploy other smart contracts?

If a smart contract has the compiled bytecode for a contract can the first deploy a subsequent contract? According to Ethereum.org: "To deploy a smart contract,

Error: VM Exception while processing transaction: reverted with reason string 'ERC721: transfer caller is not owner nor approved'

i try to write NFT marketplace and i have problem with reselling items from user that buy item from owner and new, third user. I use next.js + openzeppelin + ha