Questions tagged [solidity]

Solidity is a language for smart contracts for blockchain technologies like Ethereum. It is designed to compile code for the Ethereum Virtual Machine. Use this tag for questions about programming smart contracts using the Solidity language.

Filter by
Sorted by
Tagged with
0 votes
1 answer
18 views

Deploying to IMX zkEVM Leveraging @imtbl/zkevm-contracts

I'm building a simple NFT to deploy to IMX zkEVM... but am incurring an error during deployment. error: ProviderError: unable to apply transaction even for the highest gas limit 30000000: execution ...
Ronald Moore's user avatar
0 votes
1 answer
31 views

Why does MetaMask only show the gas fee as the transaction when I'm testing my dApp?

I've been working on a presale dApp on the BSC testnet using solidity to deploy the contracts and obtain the ABIs, and using Preact/Ethers.js to build the interface. I'm at the point where there are ...
HAT0ken's user avatar
0 votes
0 answers
8 views

How do you write the withdraw function correctly and what's the best way of storing donations in a Donations Dapp?

I'm having a problem figuring out where to store donations in a donations platform I'm creating. And then later, the campaign owners can withdraw their donations minus a platform fee that is deducted ...
kihiuFrank's user avatar
-3 votes
0 answers
18 views

How can i test gas in foundry solidity [closed]

When i tried to test a contract in the src folder it said no tests were found. How can i test gas in foundry? I tried testing it but it would not get a snapshot because it said no tests found. There ...
ergregrg's user avatar
0 votes
0 answers
10 views

I have a stake contract in solidity which is working well in BSC but in ETH Chain its giving error like infinite gas why?

I have a stake contract in solidity which is working well in BSC but in ETH Chain its giving error like infinite gas why ? my code is below pragma solidity ^0.8.0; library SafeMath { function ...
MRRaja's user avatar
  • 1,093
0 votes
0 answers
8 views

Error: expected array value (argument=null, value="1", code=INVALID_ARGUMENT, version=abi/5.7.0)

I am working on a solidity contract but i seems to always get this error after I have complied and deployed. I try to test the contract by inputting the required parameter for the book seats function ...
Osemu Aimiosior's user avatar
-1 votes
0 answers
10 views

Trying to unpack a truffle box onto my system

Current Directory: CS1226 Blockchain\pet-shop-tutorial>truffle unbox pet-shop Starting unbox... √ Preparing to download box × Downloading Unbox failed! Error: Error connecting to https://raw....
maverick's user avatar
0 votes
1 answer
26 views

CompilerError: Stack too deep. Try compiling

// SPDX-License-Identifier: [` `MIT` pragma solidity >=0.5.0 <0.9.0; contract Record { struct Patients { string ic; string name; string phone; string gender; ...
Thamesh chandravanshi's user avatar
1 vote
1 answer
40 views

Solidity Transaction Reverted by EVM with USDC Interaction

I've created a smart contract in Solidity that interacts with USDC. However, when I try to execute transactions, I'm encountering an EVM revert error. I'd appreciate some assistance in understanding ...
Techie dev's user avatar
-1 votes
0 answers
23 views

Javascript chainlink payment

Is there any easy way to process a Chainlink payment using javascript and metamask? I can't make heads or tails of the chainlink documentation, it seems awfully complicated to me. If there's no easy ...
DubiousTunic's user avatar
0 votes
0 answers
9 views

Basic ERC20 contract - transfer is failing [closed]

I am learning the basics of solidity and have implemented the basic ERC20 contract from OpenZepplin. It compiled and deployed to Goerli without any issues. When I tried to transfer the new token from ...
Snew1212's user avatar
-1 votes
1 answer
18 views

Understanding Potential Security Risks in ERC20 transferFrom and Related Functions

I am on a mission trying to Understand Potential Security Risks in ERC20 transferFrom and Related Functions, this is the first time I really looked into the solidity or smart contracts Context: 2 days ...
riza's user avatar
  • 1
0 votes
1 answer
9 views

is any way to get transactionHash while call function?

I have a payment function in Solidity for example function makePayment(address someAddress) external payable { balances[someAddress] += msg.value; uint256 blockNumber = block.number; ...
Wraith's user avatar
  • 484
0 votes
0 answers
32 views

Ethers function not found

I’ve just been going through the documentation of hardhat and I ran into an issue early on. When I try to deploy using the below hardhat function: async function deployTokenFixture() { const ...
FortuneSeeker's user avatar
2 votes
1 answer
32 views

How can I generate the ABI of my smart contract locally with foundry/forge?

I have a project with multiple smart contracts locally and I want to generate the ABI of my sc.sol smart contract. I do wish to perform this locally using forge or foundry. I know it is possible to do ...
AnastasiaShishkova's user avatar
0 votes
2 answers
13 views

contract address after deploying the smart contract is not matching with the address after running npx hardhat node

When i run npx hardhat node .....there are 20 different accounts but when i run : npx hardhat run scripts/deploy.js --network localhost deployed address is not matching with any of those 20 accounts .....
Hiten Makwana's user avatar
1 vote
0 answers
35 views

Web3js back to basics | Call method ok, Send method not ok

So I am stuck in a really simple point with Web3js and I have no clue what the issue could be, I am starting to think that I have some sort of problem with metamask or maybe chrome, but I first want ...
ccrespoa's user avatar
0 votes
1 answer
23 views

Built-in binary operator * cannot be applied

I have this piece of code: int24 tickSpacing = ... uint8 numTicks = ... for (uint8 i = 0; i < numTicks; i++) { int24 step = tickSpacing * i; ... At this code I receive: Built-in binary ...
KunLun's user avatar
  • 3,129
-2 votes
1 answer
26 views

WEB3 error: Transaction has been reverted by the EVM

I have deployed this simple smart contract using Remix // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; contract Counter { uint256 private count = 0; function setCount(...
Gautam Bansal's user avatar
-1 votes
0 answers
18 views

why can't I make a request from a bat file to the truffle console

I have a sol contract and I want to vote through truffle,but I want to try to do it using a bat file @echo off echo Enter your account address: set /p account="" echo Enter your password: ...
Wizey's user avatar
  • 1
0 votes
1 answer
27 views

Problems with Payable function in Solidity. It is correctly executed in Remix, but it is not executed at all from Web3 Javascript core

I have one of my public functions in a solidity smart contract programmed as a payable function. This one is supposed to receive ETH when it is called from a user perspective, and then execute the ...
ccrespoa's user avatar
0 votes
0 answers
9 views

Why does metamask default to BNB when a custom purchase tokens has been defined?

I'm currently creating a presale dapp for fun on the BSC testnet, and all is going well. Aside from the fact that when I initiate the "buyButton", metamask seems to default to purchasing ...
hat0ken's user avatar
-1 votes
2 answers
20 views

How to send crypto to an upgradeable contract using a UUPS proxy?

We've decided to use the UUPS proxy module offered by OpenZeppelin for our contracts to enable future updates. However, our contract implementation requires users to deposit crypto for some ...
Joshua Blew's user avatar
1 vote
1 answer
27 views

How did this PEPE dev manage to get his contract address to end in "42069"?

Have noticed the trend among a few shtcoin devs of customizing the last digits of your erc20 contract address. Here is an example of one of the tokens (ending in 42069) and for a PEPE coin nonetheless ...
w0nky's user avatar
  • 11
1 vote
0 answers
30 views

How can I decode the input of an ethereum transaction web3js

I have a web3 contract with a connectAndApprove function Here is the relevant solidity code. function connectAndApprove(uint32 secret) external returns (bool) { address owner = _msgSender(); ...
Olayiwola Ayoola's user avatar
-1 votes
0 answers
22 views

Solidity require statement causing Remix to estimate infinite gas?

I am new to solidity, and I have this smart contract code for a class project. pragma solidity ^0.5.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/...
Matt G's user avatar
  • 1
-1 votes
0 answers
30 views

deploy smartcontract with remex ide and intract with deployed contract from inside remix

I want to deploy a contract that I put the code here. I wrote the code in Remix IDE and it was compiled and deployed without any problems, but when I want to interact with the contract through Remix, ...
Rasool arab's user avatar
0 votes
0 answers
18 views

event args array is not available in the transaction receipt

I am trying to access the emitted events of a contract after calling a function. I wrote the following code. const simpleNft = await ethers.getContract("SimpleNFT"); const mintTx = await ...
Plycedes's user avatar
0 votes
0 answers
14 views

Foundry is showing some remappings I'm not aware of source

I have a file called remappings.txt containing only: @openzeppelin/=lib/openzeppelin-contracts/ However, when I prompt forge remappings it returns: @openzeppelin/=lib/openzeppelin-contracts/ ds-test/=...
Atila Ferreira's user avatar
0 votes
0 answers
10 views

how multiple (LP)pairs of a token works, for pricing?

I am working on a token to launch on BSC and we want this token to be traded in multiple pairs For Example : Token Name : GAME Token Pair 1 : GAME/USDT Token Pair 2 : GAME/WBNB Token Pair 3 : GAME/ETH ...
trigOz's user avatar
  • 1
0 votes
1 answer
27 views

Unreadable characters in "Input Data" of a Transaction of an Ethereum smart contract

I am working on a blockchain project and I managed to create contracts on Sepolia Testnet. Besides I can call the function from my contract (=read the contract) as well. Bu - here comes the question - ...
BodeG's user avatar
  • 46
0 votes
1 answer
24 views

ERC20: insufficient allowance --> Approve function is not working for depositing ERC-20 tokens in a smart contact

I'm creating a smart contract to deposit and withdraw USDT token. But I'm getting an error while depositing saying that "ERC20: insufficient allowance". Below is the solidity function I have ...
manichand kondapaka's user avatar
-1 votes
1 answer
31 views

Swapping token with fee in solidity fails on safeTransfer

I want to have a smart contract on Ethereum that does ETH->token swapping. I got that working for 'normal' tokens, but I just can't get it to work with the following token at address ...
NeViXa's user avatar
  • 71
-2 votes
0 answers
19 views

I'm trying to deploy my smart contract on hardhat's local node which works fine but it returns the contract address as undefined

This is the deploy.js file(https://i.stack.imgur.com/sxsCR.png) This is the console(https://i.stack.imgur.com/y6uxW.png) I tried running it through chatGpt but it added the deployed() function and ...
Shubham Soni's user avatar
-3 votes
0 answers
20 views

Smart Contract for PancakeSwap with buy tax/sell tax

PancakeZap contract source code: https://github.com/pancakeswap/pancake-smart-contracts/blob/d8f55093a43a7e8913f7730cfff3589a46f5c014/projects/exchange-protocol/contracts/PancakeZapV1.sol How to add ...
JazzNeurotic's user avatar
0 votes
0 answers
18 views

Issue with compiling contract with OpenZeppelin

I wrote a simple contract using OpenZeppelin for ownership but I got the error message when trying to compile that ownable.sol won't compile because of the "expected pragma, import directive or ...
midas's user avatar
  • 1
0 votes
2 answers
55 views

Simple Smart Contract Deploy Script Not Deploying Properly to Ethereum Sepolia Testnet Blockchain

I have a simple smart contract code for a test ether faucet. It needs 100 wei initially to deploy: pragma solidity ^0.8.21; contract EthRiver { address public owner; uint public drip; ...
Theresa Whynot's user avatar
-2 votes
0 answers
27 views

MetaMask - failed transaction becouse maximum gas rate is low

First of all, clarify that I am just learning to program and I don't know much about programming. I recently bought a code for a coin flip game and I have been modifying it while I learn to program. I ...
VelasTiger's user avatar
-1 votes
2 answers
51 views

Attack function reverting.. Why?

// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; contract GuessTheRandomNumberChallenge { bytes32 answer; constructor() payable { require(msg.value == 1 ether); ...
nebula's user avatar
  • 3
-1 votes
1 answer
24 views

samrt-contract: call payable function through react frontend

I tried to call this function through the React app: function getData(address _userAddress, string [] memory _attribute) public payable returns ( string[] memory, Person[] memory){ Some logic . . . } ...
Abdullah's user avatar
-2 votes
0 answers
34 views

Transfer ETH before making external contract call

I've developed a Solidity contract which is suposed to work as a fee taker for my web3 automation software. Every time a user sends a transaction this transaction will call my contract with the target ...
Oscar's user avatar
  • 37
0 votes
1 answer
27 views

Solidity - Atomic issue impossible to exchange USDT to another token

I have this code : function buy_with_stablecoins(uint _tid, uint _amount) public { // _tid = 1 = usdt, _tid = 2 = usdc require(_tid == 1 || _tid ==2, "Invalid token id"); ...
ChocoMan's user avatar
0 votes
1 answer
40 views

How to implement solidity bitwise in Golang

Code in UniswapV3 Solidity contract TickBitmap uint256 mask = ~((1 << bitPos) - 1); How to implement this solidity caculation in golang? I had founded some example code in Golang: a := new(...
Sylar's user avatar
  • 9
-1 votes
0 answers
31 views

How to execute a call from a contract using another contract, both already published

I own a contract (contract A), which in turn, when published, created a secondary contract (Contract B). I have funds trapped in contract B, contract B, has a function that allows its owner to ...
Leandro Loures's user avatar
0 votes
0 answers
42 views

ECDSA is not verifying my signature transaction

I am facing a problem with my NFT Marketplace contract. I have LibOrder , LibOrderValidator and Marketplace contracts. When I want to create an order, I need to get a signature and I get a ...
0x.MRX's user avatar
  • 1
0 votes
1 answer
29 views

How can I return an array of structs using a Chainlink Direct Request job?

I'm trying to return an array of custom type (struct) MyStruct[] of ambiguous size to my Chainlink consumer contract, and am having trouble developing the appropriate job config (TOML) for it. I'm ...
Donald's user avatar
  • 131
-1 votes
0 answers
26 views

The contract has been reverted by EVM but the contract itself on remix IDE seems to be fine

Hi I'm very new to web3 and frontend development I have deployed a 721 contract on Goerli, link as following: (https://goerli.etherscan.io/address/0x26367e688fa720fe3c0b21b4a51ad07459069efe) and tried ...
Cynthia Lee's user avatar
-1 votes
0 answers
18 views

Fetch Data from the Excel sheet to the ethereum blockchain

I want to fetch data from the excel sheet to the solidity like have to create a contract that takes the roll number as the input from the user and check the roll number in the sheet if its there ...
Saifullah Omar's user avatar
-1 votes
0 answers
13 views

How to Import Custom Minted ERC1155 NFTs into Metamask Wallet from a Hardhat Localhost Node?

I've been working on deploying ERC1155 tokens using Hardhat and a local development node. I successfully connected my Metamask wallet to the Hardhat localhost node. However, I'm now faced with the ...
Tanjin Alam's user avatar
  • 1,766

1
2 3 4 5
134