Questions tagged [solidity-0.8.x]
The solidity-0.8.x tag has no usage guidance.
369
questions
1
vote
1
answer
64
views
Low-level call execution reverted
I have a Solidity contract deployed here.
When I attempt to calculate the gas for the transaction I get an execution reverted error.
According to Etherscan Gas Oracle API called in another routine the ...
0
votes
0
answers
24
views
Low-level call error: insufficient funds for gas * price + value $8099.91
Any ideas about this? I am attempting to make a arbitrage swap using the following contract The error is:
Low-level call error: err: insufficient funds for gas * price + value: address 0x have ...
0
votes
1
answer
23
views
Checkupkeep function is not showing to get called by automation nodes for Chainlink Keepers
https://sepolia.etherscan.io/address/0xc3062430Aa70dABd1e33a702323aB6c4980883fd#code
Question:
The argument for performupkeep(input) is coming from my checkupkeep. So what should I give as input ...
0
votes
1
answer
39
views
why am I getting this <{FAIL. Reason: panic: arithmetic underflow or overflow (0x11)]> error
I have a stablecoin project that is based on the MakerDAO DSS system, now I am getting these errors :
Failing tests:
Encountered 2 failing tests in test/fuzz/failOnRevert/StopOnRevertInvariants.t.sol:...
0
votes
0
answers
10
views
Type C is V .The type C not a pure alias .Why is it designed this way?
Tyep Define in the solidity docs
A user-defined value type is defined using type C is V, where C is the name of the newly introduced type and V has to be a built-in value type (the “underlying type”)....
0
votes
1
answer
50
views
EIP-3855 is not supported in one or more of the RPCs used
I'm trying to run a script in Solidity with pragma solidity 0.8.24 on Anvil with this command:
forge script script/DeploySimpleStorage.s.sol --rpc-url http://127.0.0.1:8545 --broadcast --account ...
0
votes
1
answer
21
views
Is it possible to develop a multifunctions token?
i try to know where the capabilities of smart contract are, is it possible to write a smart contract for a token that will be :
Ownable
Transferable
Burnable
POS Compatible
POW emulated compatible
...
1
vote
0
answers
13
views
Despite having checked the addresses containing verified contracts, no contract code at given address
I have token swapping code. Despite having checked the addresses containing verified contracts I get an no contract code at given address error.
The debug data is:
router0 ...
0
votes
1
answer
7
views
Require Not Working in Test
I am super new to coding so I apologize if this question seems obvious. I have a 30 minute time delay in my contract coded like this
uint creationTime = block.timestamp;
require((block.timestamp >=...
1
vote
2
answers
22
views
How to Correct Arithmetic Underflow Overflow Error
I'm trying to code a 30minute delay in a smart contract and currently it looks like this
uint256 futureTimestamp = block.timestamp + 1800;
uint256 timeDiff = block.timestamp - futureTimestamp;...
0
votes
1
answer
24
views
ERC20 test with chai issue
I am starting my journy with contracts and decided to begin with some ERC20. I used some ready examples but can't get pass one single error.
To state my knowlede level. I am C++ big data programmer. ...
0
votes
1
answer
32
views
import lines are not readable
// SPDX-License-Identifier:MIT
pragma solidity ^0.8.24;
import {IAccount} from "lib/account-abstraction/contracts/interfaces/IAccount.sol";
import {PackedUserOperation} from "lib/...
0
votes
0
answers
27
views
Transaction 0x6a19aa91361ce2b93b7515962821540af2aab0ebff0fcdcb90ee252fbe64c107 is pending: true
Any insight into this?
I am attempting to deploy a smart contract using Go-Ethereum but it is pending forever until my context timeout.
In order to minimize the complexity I use a worthless contract.
/...
0
votes
1
answer
47
views
I want to clone pancakeSwap V3-core-contracts. i need deployment step to run pancakeSwap clone succcessfully. github deployments not working properly
Add Key in .env file. It's a private key of the account that will deploy the contracts and should be gitignored.
bscTestnet KEY_TESTNET or bsc KEY_MAINNET
add ETHERSCAN_API_KEY in .env file. It's an ...
0
votes
0
answers
17
views
Docker compiled bytecode not equal to Remix deployed bytecode
Any ideas to what I can do to fix this?
I am using Go-Ethereum to compile a deploy a smart contract and the deployment just hangs.
The contract compiles and deploys using Remix on Sepolia.
The byte ...
0
votes
0
answers
34
views
The deployed contract bytecode does not match the compiled bytecode
first some context, I am building a Go-Ethereum tool that can compile, deploy, verify and finally run some functions on the deployed contract on Sepolia. It works fine with the exception of the ...
0
votes
1
answer
119
views
Foundry tests fail with `[NotActivated] EvmError: NotActivated` while fork test
The fork tests works perfectly well with Hardhat.
But when I tried with Foundry using different evm_version in foundry.toml file and also tried compiling with different versions solc = "0.8.18&...
0
votes
0
answers
85
views
How to use Forge remappings when the complete backend is in its own folder
I am making a project in Solidity using Foundry for backend and Typescript for frontend. I decided to put the complete backend part in a backend folder and frontend part in frontend folder. The ...
0
votes
1
answer
32
views
Issue with msg.sender. Calling contract B from contract A
There is currently a published contract (contract A), I must use another(contract B) to call withdraw() from contract A.
But the function withdraw() already uses msg.sender as a security check. In ...
0
votes
0
answers
33
views
I have a problem with calling a function from another contract. I don't know why it is not working
I'm trying to solve a CTF challenge and can't seems to call the claim function from the vuln contract.
I must use my "EOA" address to solve task to mark it solved, because my "EOA" ...
0
votes
1
answer
38
views
Runtime ABI-encoded contract method
I am building an application that gets tokens at runtime, I need to transfer some of them and I am attempting to calculate the required gas.
Below is a example of the gas calculation code, but it ...
0
votes
0
answers
95
views
Solc too slow compiling
The solc compiler that I'm using (0.8.21) is taking too much time to compile. It's compiling 20 files for a foundry test campaign in ~90 seconds when it should be milliseconds.
Any ideas on what I ...
0
votes
1
answer
30
views
ABI and BIN Files generated by solc and Etherscan verified code are not identical
I have a file that is composed of multiple imports, too much code to drop here so I will illustrate my question with a very simplified example.
My compilers:
$ abigen --version
abigen version 1.11.7-...
1
vote
1
answer
58
views
Abigen from flattened contract files
I have a file that is composed of 5 imports, too much code to drop here so I will illustrate my question with a very simplified example.
My Test.sol file:
// SPDX-License-Identifier: MIT
pragma ...
1
vote
1
answer
84
views
Implementing BLS Verification using the precompile altbn_128 contract
I am trying to implement BLS using the alt_bn128 curve.
so far my code looks as follows:
function verify(
uint256[2] memory signature,
uint256[4] memory pubkey,
uint256[2] memory ...
0
votes
1
answer
20
views
TypeError: Contract "TestContract" should be marked as abstract
I have issues so I slowly add one library at a time.
This code compiles.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/Ownable.sol";
import ...
1
vote
1
answer
24
views
Contract reverts at deploy when sending 2 ethers
This contract deploys fine when no value is added and get reverted when I try to send 2 ether on the remix VM.......which is exactly the opposite of what I expected or should be happening. I retraced ...
0
votes
1
answer
47
views
Transaction is getting reverted on calling bookRoom() function
I'm deploying my contract by passing these constructor params:
(["Hotel Red","Hotel Radisson"],[1,2],[12,13],[3300000000000000,3500000000000000],[12,13])
The contract is getting ...
0
votes
1
answer
47
views
Large price discrepancy between swapExactTokensForTokens and official swap
I am testing performing swaps using solidity ^0.8.24 smart contracts with hardhat on Polygon and Quickswap exchange. But I am getting relatively large price discrepancies between my swap and one ...
1
vote
1
answer
127
views
No tests to run
I am attempting to run a test on one file with forge test --match-path test/DonutBurger.t.sol but I get No tests to run despite being able to run forge test successfully.
Any ideas?
$ forge test
[⠊] ...
1
vote
0
answers
18
views
Solidity: getStudentNotifications Retrieves notifications to other metamask account instead of one metamask account
I have two metamask accounts, one is Vamshi (student) and Mike(University). I use Vamshi's account to call the function sendRecordsToUniversity and the university address, I use here is Mike's. so the ...
0
votes
1
answer
86
views
Execution reverted - transaction mined but execution failed
I have looked at previous answers for this title but they don't seem to help me.
My contract contract is deployed and verified on the Sepolia test net using Remix.
This is the failed transaction
The ...
0
votes
0
answers
14
views
Smart Contract calling another contract not effecting any changes
I have two smart contracts, a LeaderBoard contract and a Reward contract.
I have the Reward contract call the LeaderBoard contract to add/update values, and I am testing everything using HardHat and ...
1
vote
1
answer
28
views
Try Catch, Function returns x values, but returns clause has x-1 variables
Disclaimer
I came across an not so well documented issue so I decided to share it and show the solution I found.
This is a very simple problem with a very simple solution, I just didn't found any ...
2
votes
0
answers
44
views
Solidity: float causes funds that are stuck on the contract
I'm making my own contract which pays out tokens to its members depending of their shares amount. To calculate payment I'm using the following formula:
function calculatePaymentValue(
uint ...
1
vote
0
answers
433
views
What are examples of high-liquidity ERC777 tokens on ETHEREUM? Any other token standards apply too, as long as there's a beforeTransfer callback
I'm looking to make a list of popular tokens that implement hooks on transferFrom(address owner, address receiver, uint256 amount) and are deployed on the Ethereum blockchain in particular.
For ...
0
votes
1
answer
99
views
How to withdraw funds in foundry test
I want to test a function from an existing smart contract written in solidity 0.4.
I'm using foundry/forge for that and I managed to test all the functions within this contract except the withdraw.
//...
0
votes
2
answers
17
views
Return an array of selected structs or values picked from an array of structs
Lottery time!
At every new lottery initialized, each User is given n tickets.
All the participants tickets are registered in a mapping called "allEntered" which collects tickets from every ...
0
votes
2
answers
82
views
Fail with error 'This pool does not exist on router1'
I was attempting to make a token swap and got an error: This pool does not exist on router1.
This is my transaction: Etherscan link
Any idea how I can prevent this error and verify that the pool ...
0
votes
0
answers
25
views
Error: The called function should be payable if you send value and the value you send should be less than your current balance for view function
I am doing this is Remix
This is my solidity contract. I just have 3 interfaces which are being used to call methods from 3 different contracts.
The ITaco and IDoodle methods work fine and call ...
0
votes
0
answers
13
views
Error in smart contract [duplicate]
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract SupplyChain {
//Smart Contract owner will be the person who deploys the contract only he can authorize various roles ...
0
votes
0
answers
23
views
Error in smart contract
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract SupplyChain {
//Smart Contract owner will be the person who deploys the contract only he can authorize various ...
0
votes
1
answer
56
views
How To Withdraw From A Smart Contract
I have a smart contract with the below method:
function send(address payable _to) public payable isOwner{
(bool sent, bytes memory data) = _to.call{value: msg.value}("");...
0
votes
1
answer
274
views
quoteExactInputSingle is returning error
I'm working on solidity code that uses pancakeswapV3 quoter contract to call quoteExactInputSingle. Here is the code snippet
function AnalyseTnx(address tokenPath0,address tokenPath1,uint256 amtIn)...
1
vote
0
answers
35
views
Calling Mint And Change Balance From Another Smart Contract
My Project is about a Token in which the Holder can disable their token at the Old Address and Receive a New Minted token.
It uses 2 different contacts. I put the functions in the BBB contract and ...
1
vote
2
answers
95
views
Optimizing Gas Costs and Replacing For Loops in Solidity Function with Large Dataset
I have a Solidity smart contract with a function drawLottery that processes a large dataset of potentially 1 million tickets. The function contains several for loops for iterating through the tickets ...
1
vote
1
answer
90
views
Weak RNG vulnerability proving
Hi guys I am auditing a smart contract and I found a WeakRNG
in order to prove it I have written 2 smart contracts which simulate the work of this function( a bit )
here is the 1 a have changed block....
0
votes
1
answer
713
views
Solidity: How to decode / trace / search custom error byte code
I ran into this Custom Error during my Foundry test:
[FAIL. Reason: Custom Error cd786059:(0xF628...)]
and I had no idea about what it means...
then I figured out where it went wrong after tracing ...
1
vote
1
answer
24
views
How to cache the result of an inherited function before overriding it
contract A {
function getUINT() public virtual view returns (uint) {
return 100000;
}
}
contract B is A {
uint trycache;
uint public trycache2 = getUINT(); // still 200000
...
1
vote
1
answer
70
views
Call or assignment expected. Getting this error while upgrading solidity version
I am not aware of the Assembly code. I copied the ERC1820 registry contract from here. This is written in 0.5.3. When I tried to compile it with 0.8.0 it gave me this error :
I know it's because of ...