Questions tagged [solidity]

Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed for writing smart contracts in Ethereum to run on the EVM. Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

Filter by
Sorted by
Tagged with
1 vote
0 answers
17 views

Error: invalid contract address or ENS name

Error: ERROR processing /home/hh-fcc/hardhat-smartcontract-lottery-fcc/deploy/01-deploy-raffle.js: Error: invalid contract address or ENS name (argument="addressOrName", value=undefined, ...
user avatar
0 votes
0 answers
21 views

How to set variable of contract from another contract constructor? Solidity [duplicate]

I have a contract // SPDX-License-Identifier: MIT pragma solidity ^ 0.8.15; contract MomContract { bool public failed =false; constructor(){ new Son(address(this)); } ...
user avatar
  • 21
0 votes
1 answer
23 views

How to get all array keys from solidity mapping?

Most of contracts I examine store data in public tables indexed by address, example for balance of ERC20 token is shown below. To get balance of give address balanceOf(address) is called. Which is ...
user avatar
0 votes
1 answer
21 views

Why Solidity assembly mstore(0x40, add(0x40, ....))? [duplicate]

ChainBridge has a piece of solidity code: A: assembly { amount := calldataload(0xC4) // **why get data from 0xC4? recipientAddress := mload(0x40) lenRecipientAddress := ...
user avatar
0 votes
1 answer
14 views

How to show all ERC721 tokens in my page, like opensea or rarible?

i have a question and i think someone can help me. I'm developing an NFT Marketplace, and i already have the Smart contract, but i don't know how Marketplaces like OpenSea or Rarible have ALL the nfts ...
user avatar
0 votes
1 answer
14 views

How get hash for user transaction?

Help me please . if we will using : await provider.getTransaction('0xeed4fadf09e9560f01056f240f86b515dce717087a42c7266bf659edef555861') ---> in this case i will have result for only this hash . ...
user avatar
0 votes
0 answers
10 views

The purpose of 3 variables in the ERC-721 contract [closed]

I am analyzing the contract of one nft collection. The contact has the following variables: uint256 private reserveAtATime = 66; uint256 private reservedCount = 0; uint256 private maxReserveCount = ...
user avatar
0 votes
0 answers
29 views

How opensea smrt contract work in auctions marketplace?

when auction end opensea covers the gass fee and transfer nft to the highest bidder , is it true ? if it is then how smart contract work can you please share the smart contract of auction where tthis ...
user avatar
0 votes
1 answer
27 views

Returned value solidity

I have a function in solidity function calculate() external returns (bool) { return true; } But when I call it with hardhat I get this: { hash: '...
user avatar
  • 104
0 votes
1 answer
22 views

Hardhat get deployed contract

So I am using hardhat-deploy plugin and I have only 2 contracts to deploy. 01 - token 02 - someActionContract 02 - someActionContract is able to mint tokens, so it requires to know the address of a ...
user avatar
  • 104
0 votes
0 answers
13 views

getting error while calling getrandomnumber in my smart contract

error message: Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? execution reverted { "originalError": {...
user avatar
0 votes
0 answers
6 views

Is there any tool, which exports the smart contract ABI and generates the functions in the UI just like remixd

I have started to develop some of the Smart Contras using hardhat. Now I want to test it in my local with some UI (without creating any front-end project). Is there any tool, which exports the ...
user avatar
0 votes
0 answers
6 views

What is the current state of zkEVM development?

What is the current state of zkEVM? That is - a general-purpose (not specialized like Loopring or Immutable), EVM-compatible, Solidity-compatible zk-rollup layer 2. To my knowledge they are still ...
user avatar
0 votes
0 answers
13 views

how to figure out IERC20 token address from javascript

I would like to send some IERC20 tokens from metamask for contract I link an HTML button to following javascript function const placeFunds = async (side, e) => { e.preventDefault(); await ...
user avatar
  • 101
0 votes
1 answer
27 views

Transfer Balance in wei not i [closed]

I have this contract which reads the balance , I'm in BNB test , so it reads the BNB balance and then send to another adress half of the balance. The contract executes ok but the balance is sent in ...
user avatar
0 votes
1 answer
12 views

How to call a function that returns an array by implementing composability

I have two solidity files named SimpleStorage and StorageFactory. SimpleStorage file contains the functions that store and retrieve the users' name and age. The other solidity file StorageFactory ...
user avatar
1 vote
1 answer
20 views

Does the compiler ignore internal functions that are never called?

On inheriting a contract that contains some internal functions that are never used in the child contract. eg. contract Parent { function _someInternalFunction() internal{ } } contract Child ...
user avatar
0 votes
0 answers
27 views

error: Overflow uinit uint256

I have a token with overflow function can you help me use it Now i can't use this function, please anyone can help me??? I will pay 2 BNB salary
user avatar
0 votes
0 answers
8 views

when i Fetch my NFT's in marketplace i got this , please help me out

function fetchMyNFTs () public view returns (MarketItem[] memory) { uint totalItemCount = _tokenIds.currentId(); uint itemCount = 0; for (uint i =0 ; i <totalItemCount ; i++) { ...
user avatar
0 votes
1 answer
19 views

What's wrong with my code? (ERC721: mint to the zero address) calling from Remix is good, calling from my script is failed

I have deploy an contract at: https://goerli.etherscan.io/address/0x39c810abf2fb7f1e6db14db3e9a6f08e2daeab78 it's abi is: [{"inputs":[],"stateMutability":"nonpayable",&...
user avatar
  • 160
0 votes
0 answers
20 views

How to we fetch price of NFT index using chainlink

i was wondering if we can fetch the price of different NFT index using chainlink price oracle, i had done the same earlier to find the pricefeed for ETH to USD , now i want same for NFT collection.
user avatar
0 votes
1 answer
25 views

why i'm Showing this error when i fetch Market items?

function : function fetchMarketItems () public view returns(MarketItem[] memory) { uint itemCount = _tokenIds.current(); uint unsoldItemCount = _tokenIds....
user avatar
0 votes
1 answer
22 views

Getting an Invalid Address error when trying to interact with smart contract in truffle express box

I have a function where I insert patient's info into a mapping and it works perfectly fine on remix and in the truffle console. function createPatient (uint _SecretNum, string memory _name, uint _dob, ...
user avatar
0 votes
0 answers
18 views

Why am I not able to call a pure function accessing an enum from a library?

I'm working on a token-gated NFT distribution site. I've divided up the 256 bits of the token id & I'm using various parts to represent different aspects of a permissioning system. Central to the ...
user avatar
  • 101
0 votes
1 answer
56 views

How to approve or give permission to access your tokens? Solidity /Metamask?

I'm currently creating a Dex which needs 1inch permission to access the users to tokens/funds. e.g The problem is permission doesn't show up but instead shows 'contract deployment': my current is ...
user avatar
0 votes
0 answers
8 views

Solidity event doesn't include args

I'm emitting an event from a Market.sol contract with three indexed args but they aren't showing up in my frontend after calling the contract function. Contract code: event MarketTokenEvent ( ...
user avatar
0 votes
0 answers
8 views

How to interpret return after calling a function which returns bool in smart contract solidity

I have a newbie question about return of function call. The call was made with ethersjs 5.6.x and function is in solidity smart contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; ...
user avatar
0 votes
0 answers
12 views

Why are protocols like Sushiswap using multiplier 1e10 instead of 1e18?

I've been reviewing a protocol that utilizes MULTIPLIER for their calculations which increases the precision because there are no decimal numbers in solidity. That is fine, but I've seen a lot of ...
user avatar
  • 48
0 votes
0 answers
22 views

TransferFrom Error - "not visible after argument-dependent lookup in contract Token"

I'm calling a transfer, transferfrom, approve contract following the open-zeppelin ERC20 source. I got not found issues. Maybe I'm omitting something. My Code: token.sol //SPDX-License-Identifier: MIT ...
user avatar
1 vote
2 answers
39 views

What are the most widely used open source DAO frameworks?

I am currently researching what are the best open-source on-chain Governance Tools out there (for beginners / intermediates). I was researching something similar in 2016 / 2017 but I remember the ...
user avatar
  • 66
0 votes
0 answers
28 views

How to solve "payable" from the code and a new error came "RangeError: Maximum call stack size exceeded" on solidity with truffle?

Disclaimer I am very new to coding and trying my hardest to break into this space. However, I am having issues with msg.value. On my version of solidity, I have had a lot of issues msg.value. I am ...
user avatar
0 votes
1 answer
25 views

Governor: proposal not successful

Sorry, I think it's a basic question but I've been trying to solve it for days. I'm learning to create a DAO. I'm following the OpenZeppelin documentation. I created all my contracts using the OP's ...
user avatar
0 votes
0 answers
15 views

Decode number of tokens and token contract address from msg.data (ERC-20)

I have a smart contract with just a fallback function and some logic. I want users to send their tokens directly to the smart contract to do some smart contract logic on receive. I've implemented ...
user avatar
0 votes
1 answer
13 views

Contract via proxy missing functions

I thought that proxy simply uses delegate call to the implementation contract. So the way I see this, is that I can run the same method in proxy and in implementation. However, I did deploy my ERC20 ...
user avatar
  • 104
0 votes
1 answer
20 views

How to get the last element of an array in solidity?

How do i get the last element? I feel like i should use .length, but then what? PLease help! I'd really appreciate that! Thanks in adnvance pragma solidity 0.8.0; contract Players { address[] ...
user avatar
0 votes
0 answers
12 views

Updated Question - Any alternative to while loop in conditional scenarios in solidity?

Referring to the question already posted here. Hi... The previous answer worked for me as posted above... So extending that now I have an updated scenario for a similar situation. Now I am trying to ...
user avatar
0 votes
0 answers
5 views

Find current owner of Token on Etherscan using API

I am trying to find the current owner of the NFT TOKEN Id using etherscan API. The token has multiple transfers on various users. I want to know who is currently owning that NFT token id. I tried with ...
user avatar
  • 105
0 votes
1 answer
8 views

Fakes on OpenSea

Recently, our team faced a small problem. We made an announcement of the collection and showed several nfts. Soon, fakes of our collection and our profile appeared on OpenSea. How to resist this ? ...
user avatar
0 votes
1 answer
15 views

How to define a constant `bytes32` in Solidity v0.8 and above?

I want to define a constant bytes32 like this: bytes32 internal constant FOO = bytes32(0x01); But I'm getting the following error when compiling the code above: Explicit type conversion not allowed ...
user avatar
0 votes
0 answers
7 views

Deployment of the Open sea contract

I want to host my nft collection on OpenSea, how do I do it? Please share guides, links or your experience) Thank you very much in advance
user avatar
1 vote
0 answers
16 views

Contract verification. How can I check contract already verified or not (with code)?

I use: await hre.run("verify:verify", { address: CONTRACT.address, constructorArguments: [ARGUMENT] }); but sometimes it returns: Reason: Already Verified I want to ...
user avatar
  • 11
0 votes
1 answer
40 views

How can I get the price of NFT on Opensea using chainlink?

I have tried to use the chainlink and contract address of NFT to fetch the price but I am not sure where I am wrong pragma solidity ^0.8.7; import "@chainlink/contracts/src/v0.8/interfaces/...
user avatar
0 votes
1 answer
15 views

Can We Transfer Token to The HighestBidder Automatically in NFT- MARKETPLACE Contract? i want this auto

i have A claim Function , when highest bidder call the function After auction times end , but i want this auto , when auction times end nft automatically transfer to the highest bidder : kindly help ...
user avatar
0 votes
1 answer
26 views

Transfer contract ownership from one contract to another

I'm a newbie here so take it easy. My setup is that I'm trying avoid redundancy. I have 2 contracts: 1 = Factory.sol 2 = Project.sol The factory creates new projects which is initiated by the user. As ...
user avatar
2 votes
1 answer
29 views

How does Solidity implement C3 linearization?

The solidity documentation does not offer a lot of insights into their implementation of the C3 linearization to resolve methods in a multiple inheritance scenario. There it states that You have to ...
user avatar
  • 189
0 votes
0 answers
19 views

Remix is not loading all the methods of my SmartContract

I'm very new to ERC20, ERC1155, SmartContracts, Remix, etc, so please forgive me if my question is quite stupid. I've created an RC1155 SmartContract in Remix, with several methods. When I publish it ...
user avatar
0 votes
0 answers
9 views

Error: The transaction has been reverted to the initial state

Here is My Simple Payable Contract Code: // SPDX-License-Identifier: MIT pragma solidity 0.8.15; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; contract ...
user avatar
0 votes
0 answers
13 views

fetch the event data in the console

please what should I put inside the console.log() to fetch the 2 returned addresses of the event(args[0], args[1])? and thank you! const filter = { address: '0xbc4...', topics: [ ...
user avatar
  • 3
0 votes
0 answers
6 views

how to extend ERC20 Token to ERC20Capped

I have been trying to Update ERC20 Token to ERC20Capped token how can I do this ? I have been using Openzepplin documentation
user avatar
  • 21
0 votes
0 answers
12 views

Can We Transfer Token to The HighestBidder Automatically in NFT- MARKETPLACE Contract?

This is bidding function : function createBidOnItem( uint256 itemId ) public payable nonReentrant { uint price = idToMarketItem[itemId].price; uint tokenId = idToMarketItem[itemId]....
user avatar