Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [solidity-0.8.x]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
14 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" ...
jose celis's user avatar
0 votes
1 answer
31 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 ...
pigfox's user avatar
  • 71
0 votes
0 answers
44 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 ...
dNyrM's user avatar
  • 908
0 votes
1 answer
23 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-...
pigfox's user avatar
  • 71
1 vote
1 answer
25 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 ...
pigfox's user avatar
  • 71
1 vote
0 answers
16 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 ...
Wheatley's user avatar
0 votes
1 answer
14 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 ...
pigfox's user avatar
  • 71
1 vote
1 answer
22 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 ...
Bohn Bohn's user avatar
0 votes
1 answer
46 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 ...
Zeeshan Sayeed's user avatar
0 votes
1 answer
40 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 ...
SolTester's user avatar
1 vote
1 answer
37 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 [⠊] ...
pigfox's user avatar
  • 71
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 ...
Robert Downey Jr.'s user avatar
0 votes
1 answer
30 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 ...
pigfox's user avatar
  • 71
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 ...
ndrb's user avatar
  • 1
1 vote
1 answer
26 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 ...
Saucy's user avatar
  • 23
2 votes
0 answers
43 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 ...
Radek_pl's user avatar
  • 791
1 vote
0 answers
338 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 ...
Mila A's user avatar
  • 1,219
0 votes
1 answer
60 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. //...
Átila Ferreira's user avatar
0 votes
2 answers
15 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 ...
Kappa's user avatar
  • 1
0 votes
2 answers
73 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 ...
pigfox's user avatar
  • 71
0 votes
0 answers
17 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 ...
Risavdeb Patra's user avatar
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 ...
Trakshan Mishra's user avatar
0 votes
0 answers
21 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 ...
Trakshan Mishra's user avatar
0 votes
1 answer
46 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}("");...
amelongo's user avatar
0 votes
1 answer
165 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)...
Biruk Damte's user avatar
1 vote
0 answers
30 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 ...
Suka Kasu's user avatar
1 vote
2 answers
67 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 ...
PraveenMatheesha's user avatar
1 vote
1 answer
73 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....
NeoRusI's user avatar
  • 11
0 votes
1 answer
387 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 ...
Russo's user avatar
  • 1,784
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 ...
Ashraile's user avatar
  • 125
1 vote
1 answer
45 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 ...
Zartaj Afser's user avatar
  • 4,036
0 votes
1 answer
37 views

local initialization

I was working in this solidity code. here is the code sample from my project interface customeInterface { function token0() external view returns (address); function token1() external view ...
Biruk Damte's user avatar
0 votes
1 answer
127 views

can eth_call simulate approve and transfer?

I have a solidity contract that contains a logic to approve and transfer balance, swap and flashloan. But when i use eth_call to call my function that perform swap, it reverts. I tried by ...
Biruk Damte's user avatar
0 votes
1 answer
33 views

transaction fails when i use address[] memory

i was practicing on BSC testnet and my solidity code is // SPDX-License-Identifier: MIT pragma solidity 0.8.0; interface IUniswapV2Pair { function factory() external view returns (address); ...
Biruk Damte's user avatar
0 votes
1 answer
41 views

Hardhat deploy same contract to multiple addresses fails

I need to deploy the same contract to multiple wallets and I have this shell script. #!/bin/bash set -x contractName=MyContract network=sepolia npm cache clean --force yarn hardhat clean yarn hardhat ...
pigfox's user avatar
  • 71
1 vote
1 answer
32 views

how to revert transaction excuted by low level call

Hello ethereum community. I'm experimenting with low level calls and i want to revert the transaction made by low level call, if i didn't get the desired result. Is it possible? (bool success, ) = ...
Biruk Damte's user avatar
0 votes
3 answers
313 views

Despite calculation I get contract creation code storage out of gas

My smart contract is deployed on https://sepolia.etherscan.io/tx/0x1b1742a3ff2ac160d5f245ab91828fcc56a803cb3826b6cbdb9f3cb2f293ba66 Once deployed I get contract creation code storage out of gas error ...
pigfox's user avatar
  • 71
0 votes
1 answer
30 views

Creating a local variable in an if statement?

I'm looking at a function that creates a local variable in an if statement. If someone called that function and the condition to the if statement was not triggered, that local variable wouldn't exist, ...
auditor_chick's user avatar
0 votes
1 answer
195 views

Tick range of negative tick - Uniswap v3

I am looking for a formula to calculate the tick range for a negative tick. Ex1: tick: -15 tickSpacing: 10 range: [-20, -10) Ex2: tick: -20 tickSpacing: 10 range: [-20, -10) I was ...
KunLun's user avatar
  • 197
2 votes
1 answer
79 views

Where in the code of this unstake function is ETH actually transferred?

I am looking at this repo, which is contracts for a decentralized pegged asset issuance system backed by liquid staking tokens like rETH. Specifically, I have a question about the functions unstake in ...
auditor_chick's user avatar
0 votes
1 answer
74 views

Smart contract deployment pending forever

I have a smart contract that is compiled and deployed using Remix and verified on Sepolia testnet. https://sepolia.etherscan.io/verifyContract-solc?a=0xA3Bc4ac115CF4C57b507797731F43c14Ff6A2A6c&c=...
pigfox's user avatar
  • 71
0 votes
0 answers
20 views

Treating two assets as equal in a smart contract that aren't equal

I am auditing a protocol that creates a token yETH representing a basket of liquid staking tokens such as rETH and stETH. I noticed that the protocol treats yETH as if it is 1:1 with ETH when it's ...
auditor_chick's user avatar
0 votes
1 answer
19 views

Can you refer to a contract inside itself?

Sorry this is a very minor question but the following is part of a contract called LibOrders.sol. The function below calls LibOrders.cancelOrder....normally I think you would just put "...
auditor_chick's user avatar
0 votes
0 answers
22 views

What happens if you divide a uint256 by a uint88 using divU64?

I am looking at the following function. It takes a uint256 (ercDebtSocialized) and uses safemath divU64 to divide it by a uint88. I assume this would just throw an error? I unfortunately cannot test ...
auditor_chick's user avatar
1 vote
1 answer
62 views

Two people calling this function at exactly the same time

I was looking at Rocket Pool's docs on interacting with other contracts and they included a simple example function that another protocol could use to accept deposits of ETH, forward it to RP, and get ...
auditor_chick's user avatar
0 votes
2 answers
59 views

Can a function call itself?

Can a function call itself...specifically, I am looking at this code and I can't figure out how this could work properly...the parameter vault would be the first parameter in the line that calls ...
auditor_chick's user avatar
1 vote
1 answer
19 views

Can you return something only some of the time with a function in solidity?

I am looking at a function that says it returns two uints, but the return statement is inside an else statement, so obviously there are conditions under which nothing would be returned. Can you have ...
auditor_chick's user avatar
0 votes
1 answer
42 views

Revert inside a for loop

If there is a revert inside a for loop that is inside a function, and the revert is triggered, will the whole function revert?
auditor_chick's user avatar
0 votes
0 answers
16 views

How to find issue with a bare bone token bridge

Basically, I want to setup a very simple token bridge try to bridge some custom tokens between BSC testnet & Goerli testnet. For BSC testnet, I created 2 solidity code: TokenBSC.sol & ...
Yong Dong Zhang's user avatar
0 votes
0 answers
122 views

How to import code into a contract

I have a contract that needs to be compiled with solc so I can get Go bindings. $ tree . ├── openzeppelin ├── Swap.sol └── @uniswap pragma solidity >0.7.0 < 0.9.0; import { IUniswapV2Pair } ...
pigfox's user avatar
  • 71

1
2 3 4 5
8