Category "solidity"

How to set price for all NFTs in a collection on opensea?

If I mint a collection of n items on my own address (via smart contract) , it'll be publicly visible on my account under the collected / created section like th

How to create a simple swapping contract

I want to create a contract that buys and sells to a fixed price which can be set with a contract interaction onlyOwner basically i need a token vendor with edi

Restrict function access ONLY to one other specific contract in Solidity

I have a security problem in my Solidity contracts and I can't figure out how to fix it. The flow goes like this: First, we create an instance of contract A; Cr

Matic Remix Warning! Error encountered during contract execution [execution reverted]

I forked a contract, it is a Baked Beans fork on MATIC, I deployed the contract through Remix, now when I try to deposit through my website script, Metamask say

Solidity library @openzeppelin/contracts/access/Ownable.sol is not resolving ownerOnly()

I am trying to switch my contract to use the 'import "@openzeppelin/contracts/access/Ownable.sol”’, but I am getting the following error contracts/I

How to send ETH to a contract function with ethers.js?

I am trying to send ETH to a contract function from a web app via metamask and ethers.js. So far I have tried: const provider = new ethers.providers.Web3Provide

The event 'close' is deprecated and may be removed in the future

I want the best method to implement these two lines. Goal: Obtain the object of a smart contract named dev-token. async function ... { ... const web3 =

PancackeswapV2Router swapExactETHForTokensSupportingFeeOnTransferTokens: 'Pancake: TRANSFER_FAILED' when "from" equals to "pancackeSwapV2pair"

PancakeSwap is driving me crazy! I have this simple contract: when the token are transferred from someone different from the owner, instead of making the transe

Contracts do not compile with zksync-solc. Their ABI and bytecode seem to be printed as an error

I am pretty new to development and asking questions on stackoverflow, so if there is something else I could provide, please tell me in comments! I have installe

Getting Promise Object when Calling Solidity Functions

I have a function in my smart contract where I am trying to return some data that has been stored in the blockchain, function showOrg(address org) external

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