Skip to main content

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
4 votes
5 answers
14k views

How do I inject Web3 into Remix IDE?

when going on to the remix IDE, i get the error No injected Web3 provider found. Make sure your provider (e.g. MetaMask) is active and running (when recently activated you may have to reload the page)....
4 votes
3 answers
2k views

Foundry expectRevert on Custom Error with Multiple Errors

I am attempting to expectRevert on a custom error with MULTIPLE parameters by following the example in the office Foundry. I am able to get it to work with a single parameter. But as soon as I add a ...
1 vote
2 answers
325 views

Why I'm getting the error [FAIL. Reason: EvmError: Revert]?

I am getting these 2 errors (both are EvmError: Revert errors),from my fuzz test contrac for my NFTMarketplace contract. I think it might be that the fuzz test contract isin't interacting with the ...
0 votes
1 answer
437 views

Token holders not showing on mainnet

I got a problem which i can’t understand the reason. Made a erc20 token, and deployed on testnet Here everything goes fine and work as expected, But when i deployed it on mainnet, the block explorer ...
1 vote
1 answer
1k views

Problem with truffle console : Cannot read property 'call' of undefined

I have a problem when executing the code HelloWorld.deployed().balance.call().then(console.log) This error introduced: Cannot read property 'call' of undefined This problem is similar to this ...
0 votes
2 answers
12 views

Decompiled Smart Contract Code - Language Identification?

I recently decompiled a smart contract using Etherscan and encountered the following code snippets: def _fallback(): // not payable, default function require calldata.size - 4 >= 0 if caller!= ...
0 votes
0 answers
24 views

I'm working on a NFT Marketplace and help me with BUY function. It's not working?

I'm new to smart contracts and testing some functions. I'm trying on buy nft function. it's not working somehow. Even though I've enough balance, the crypto transfer is not happening. Please find the ...
0 votes
1 answer
10 views

Small space appearing before string in remix

Hello I saw that type casting from bytes to string gave the same result whether the bytes are a string encoded or encodePacked. So I am trying some small contract in remix, to see how that works and ...
0 votes
0 answers
9 views

Request for Goerli/Sepolia Testnet Ether

I'm currently developing a blockchain application for my internship and need some Goerli or Sepolia testnet Ether to deploy and test my smart contracts. Unfortunately, I don’t have any previous ...
0 votes
0 answers
10 views

Fraudulent contract or valid?

What do you think about this code and BOT recommendation? I am attaching the video. In the description of the video, the code. I suspect it's a scam. In lines 109 and 113 of the code, there is a ...
2 votes
1 answer
539 views

on the implicit type conversion rules in Solidity

Question in one sentence: Are there seperate implicit type conversion rules for function call resolution (other than the conversion rules for the remaining cases)? Regarding the array type ...
0 votes
2 answers
634 views

Prevent ERC721 metadata from being updated

I have a ERC721 token and the TokenURI gets set to a IPFS JSON link. The JSON contains metadata such as name, color, image ect about the NFT. The problem is I have a function which allows the TokenURI ...
0 votes
1 answer
375 views

Is there any way to upload a list or array of addresses on ipfs, and access it from a smart contract?

I am planning to make a decentralized voting application. The addresses of eligible voters should be uploaded on IPFS for anyone to access. This file on IPFS will be used in the contract to make sure ...
0 votes
2 answers
2k views

signing a transaction on web3js with private key and broadcasting to nodes

I am having an issue with ethereum based project. I made web3 API to communicate to the blockchain. I did this two ways. both call the same function on same address: METHOD 1 (Using Unlocked ...
0 votes
1 answer
427 views

Uncaught (in promise) TypeError: work.methods.workCount is not a function

Describe the bug I am trying to call the public variable "workCount" from a smart contract using web3 Steps to reproduce: const work = new web3.eth.Contract(ABI,Address) const workCount = ...
1 vote
4 answers
323 views

Address as name of an array in solidity?

How to make an array with its name as address of user? For example string[] public 0x7v77wfr349C9864De0119E94c3f8d.
0 votes
0 answers
14 views

How to Ensure Custom Tax is Applied on Token Swaps in Solidity Smart Contract?

I'm developing a smart contract for a token (FMYNT) using Solidity on the Binance Smart Chain testnet, integrated with PancakeSwap testnet. I've implemented a custom 5% tax feature for buy and sell ...
1 vote
1 answer
952 views

How to call a delegate function from web3js

I am trying to call a delegate function from web3 but, everytime its saying its not var myContract = new web3.eth.Contract(abi,add); myContract.methods.enterMarkets(['cadd']).send({from:ethereum....
0 votes
1 answer
575 views

ParserError: Identifier-start is not allowed at end of a number. 0x0

I am migrating the following smart contract to local Blockchain (Ganache). however when I run migrate it's giving me an error: ParserError: Identifier-start is not allowed at end of a number.0X0 how ...
1 vote
1 answer
845 views

How to set the receiver of ETH in a contract to send ETH from one address to another with solidity usign call() in remix IDE

I'm starting to learn solidity, and I'm trying to build a sendEther contract where some address sends an amount of ether to another address. I'm building it on remix, and I'm having trouble while ...
0 votes
0 answers
8 views

Clone of a uups proxy contract is not working

i have a factory contract which is creating clones of an NFT contract. if the NFT contract is not a proxy everything is ok and cloning works just fine. but since i need to have a upgradable UUPS NFT ...
1 vote
1 answer
775 views

Solidity - Ballot Example

I have this following Ballot contract: pragma solidity ^0.4.11; /// @title Voting with delegation. contract Ballot { // This declares a new complex type which will // be used for variables later. // ...
0 votes
1 answer
13 views

Why msg.value is not transferred to the owner?

I've deployed a simple wallet contract. The withdraw function goes like this.. function withdraw() external payable { require(msg.sender == owner, "Only Owner can withdraw"); ...
1 vote
1 answer
36 views

Ethereum (Istanbul, PoA private network) automated contract deployment and interactions

Heres my contract deployer: const { ethers } = require('ethers'); const { fstat } = require('fs'); const fs = require('fs'); // Define the ABI and bytecode of the contract const abi = [ { ...
2 votes
1 answer
688 views

Fail to "buy" from Crowdsale contract wrapping an already deployed contract

Hi I am a newbie to the Ethereum development. I have successfully deployed a burnable, pausable, capped token contract (TC) on rinkeby test network, and was able to interact with it - minted and ...
1 vote
1 answer
1k views

How to reduce size of contract?

I am getting the below message: ,Warning: Contract code size is 28837 bytes and exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on Mainnet. Consider ...
0 votes
1 answer
1k views

How do i import my ethereum wallet just using private key?

Help me out how do i resolve the issue of ethereum smartcontract for getting my wallet when i enter my private key in the text area Use WalletUtils functionality The WalletUtils class can be used to ...
1 vote
2 answers
435 views

Error - reverted with reason string 'LOK'

i got "reverted with reason string 'LOK'" error when executing this code (on the 'router.exactInputSingle(params)' exactly ) , why and how to fix this error ?; contract UniswapV3FlashSwap { ...
1 vote
1 answer
45 views

Facing File Import error in Foundry

I am trying to run a forge test. I see the file is in place. But still facing this error. Compiler run failed: Error (6275): Source "src/oracles/reserve/EthxReserveOracle.sol" not found: ...
1 vote
1 answer
3k views

TypeError: Type uint256 is not implicitly convertible to expected type bool

function allowance (address _owner, address _spender) constant returns (uint remaining ) if **(__allowances[_owner][msg.sender])**{ **^-------------------------------^** ...
2 votes
1 answer
1k views

How to call & use ERC20 airdrop smartcontract

I'm using remix solidity browser compiler. I deployed this code for an AirDrop smart contract: https://pastebin.com/kzYxmEab I used the same address to create/deploy the Airdrop contract as was used ...
0 votes
1 answer
701 views

Time Specified calls in Solidity using Oraclize

I have started learning coding in Solidity and I have written the below contract using the official Oraclize guidelines. My aim is to: Make the update() function be called on its own on the ...
0 votes
1 answer
11 views

Automate the use of approve() without having to do it manually

I'm taking my first steps on Solidity. I would like the user to be able to use their funds by calling the dapp functions, but without having to use the approve() function manually on the token ...
0 votes
2 answers
443 views

I am getting this error everytime i test my contract using hardhat

This is the error i am getting while testing my contract with hardhat pls help me to get this PS E:\vs code files> npx hardhat test npm WARN config global `--global`, `--local` are deprecated. Use `...
0 votes
2 answers
586 views

UniswapV3 Quoter throws error: contract runner does not support sending transactions (operation="sendTransaction", code=UNSUPPORTED_OPERATION)

I am working with the Quoter from Uniswap V3, here is the part of the function that challenges me: ... // Reformat Amount In if (!isNaN(amtIn)) {amtIn = amtIn.toString()} let amountIn = ethers....
0 votes
0 answers
14 views

Simple code example to implement tax on sell/buy transactions for a token on Uniswap DEX causing "Your swap is expected to fail.." error

I am trying to implement a sell/buy tax on transactions for my token when users trade on Uniswap DEX. My token's smart contract includes a tax deduction mechanism that functions correctly on EtherScan ...
1 vote
1 answer
470 views

Invalid number of parameters for "undefined". Got 3 expected 5!

I am using truffle 5.5.5 with Ganache as my dev blockchain. When I run truffle migrate I get the following error: > Compiled successfully using: - solc: 0.8.13+commit.abaa5c0e.Emscripten.clang ...
2 votes
1 answer
289 views

How can I send an NFT automatically when someone clicks on the claim NFT button?

I am working on a quiz site but I want the winners and participants to receive NFT at the end of the quiz. But I do not want to manually sign the transactions. I understand I can use ethers.js and use ...
0 votes
0 answers
9 views

call function uniswapv2 swapExactETHForTokensSupportingFeeOnTransferTokens return UniswapV2: INVALID_TO

i call the following function in js : function swapForShare(uint amountOut) public { uint ethBalanceBefore = address(this).balance; require(ethBalanceBefore > 0, "Contract ...
0 votes
2 answers
652 views

No events where emmited. Why?

This is not a duplicate question. The other one doesn't answer the problem in any way. Can anyone explain to me why do I get No Events where emmited when running truffle test? Ganache is listening in ...
0 votes
1 answer
329 views

update state mapping from a different contract

I am pretty new to Solidity so here goes. I was wondering if it is possible to update a state mapping present in a contract from another contract. Like so contract A { mapping(uint => uint) ...
0 votes
1 answer
473 views

How can i verify more params with _hashTypedDataV4 from openzeppelin?

i'm trying to implement a 712 typed signature with openzeppelin: The contract has two functions: struct ProofData { address user; } bytes32 constant TYPE_HASH_EASY = keccak256("ProofData(...
3 votes
1 answer
404 views

What's the difference between unlinked_binary and bytecode?

I have two different projects. In one, the build/token.json file contains an unlinked_binary field. In the other, there's no unlinked_binary, but there's bytecode. What's the difference between the ...
0 votes
3 answers
359 views

Send Transaction to smart contract using web3 ^1.0.0-beta.41 throws parsing error

I want to send to smart contract using this code : this.myContract.methods.addData(declaration).send({ from: '0x3b0282D31174B927e102bA71d80dF34F4e596Fc4', gas: 12000 ...
0 votes
1 answer
792 views

On using Web3Modal to connect the metamask it shows error: " Error: No CLV Wallet found" on Opera GX Browser

But it works fine in Brave and Chrome. If anyone faces this problem use other browsers.
1 vote
1 answer
716 views

pass storage through interface to library

Here is what am i doing: There is a library, accept storage argument as parameter, then do some math and return the result. And there is a contract to call the function in the library, and an extra ...
2 votes
2 answers
2k views

Testing Uniswap V3 FlashSwap reverts with TF error code

I'm testing a simple example of flash swap v3 on a mainnet fork using Ganache and Truffle. All tests passed successfully except the "swap" function executed on the UniswapV3Pool. Before ...
0 votes
2 answers
327 views

How do I compile a smart contract written in pure yul using Foundry?

Basically I want to do a written tutorial on how to compile and deploy this CREATE2 proxy contract, written in pure Yul. https://github.com/Arachnid/deterministic-deployment-proxy/blob/master/source/...
0 votes
1 answer
340 views

How do I burn coins with this function? And general question on "burning" ECR-20 tokens

/** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * ...
0 votes
1 answer
27 views

why is my loop not working in below solidity code

What's happening here in the code and why is my loop not working? And one more thing, should I remove all the warnings from my code before deploying? function sub(uint n, uint a) external pure returns(...

1
2 3 4 5
357