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
0 votes
0 answers
3 views

Calls to self failing when passing structs

When a contract calls itself using the .call method and attempts to pass a struct, it results in a revert with the following error output: "error": "Failed to decode output: Error: data ...
Riley's user avatar
  • 1
1 vote
1 answer
70 views

Is the sum of hashes cryptographically secure for a set of addresses?

In a smart contract, I want to maintain a set of addresses independent of the order. Would the sum of the hashes for each of the addresses be a cryptographically secure approach? If I do: root = ...
wolf dun's user avatar
0 votes
1 answer
16 views

How to accessing Smart Contract write function from the frontend (React Js ) without any private key?

Currently, when I try to write a function on Solidity Smart Contract from ReactJS, it is not working and throws an error called "unknown account." for the below code. await contractMethods....
AIT DEV's user avatar
  • 13
0 votes
0 answers
14 views

How to foundry test a function which uses 1Inch Swapping functionality?

I'm working on a protocol's Adapter contract. The Adapter contract have a function, which let users sell their PortalEnergy (assume tokens) to get ETH. They use 1Inch Swapping functionality to get ...
DevABDee's user avatar
  • 451
0 votes
0 answers
7 views

Does `call` opcode panic if less size data is returned?

I was reading the zksync documentation and found the following in the differences section here For calls, you specify a memory slice to write the return data to, e.g. out and outsize arguments for ...
Neo's user avatar
  • 93
0 votes
1 answer
11 views

"ContractExecutionError: Error happened while trying to execute a function inside a smart contract" after calling it via mint button

Contract Code: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/...
Lucky Rajput's user avatar
0 votes
1 answer
21 views

Very High gas fee in my staking contract

I am trying to implement my staking contract, for some reason calling stake() or claimRewards() costs 2MATIC ~ 4MATIC. I know my code is kind of complex since I loop and use data structures but still ...
Mohamed Wael's user avatar
0 votes
1 answer
9 views

how to verify contracts in contract (created with contract ) polygon

i have a following structure for my contracts : 1 - OpenZeppelin v 4.9 2 - safepool 3 - safepoolfactory i have a single file that this code : pragma solidity ^0.8.0; import "https://github.com/...
Hosein In jast's user avatar
0 votes
1 answer
17 views

Invalid API key sepolia network blockscout

I deployed a contract on sepolia network and I would like to verify my coin using hardhat. npx hardhat verify --network sepolia 0x44ED9AB9F4Ab72e4b1aBfEBaDf5A942617B90D18 I created an API key on ...
SolidityNewbie's user avatar
0 votes
0 answers
5 views

Scripts directory not installed

I am creating a smart contract where I have to run the script directory. But even after installing all the dependencies the directory is not getting added to the root folder.
Shravani Sawant's user avatar
1 vote
1 answer
25 views

Insufficient Liquidity after adding liquidity on Sepolia Uniswap V2

I created a token "TestMe" with 2 million tokens (18dec), minting the deployer address the whole stack. I used the "addLiquidityETH" function provided by uniswap router to add 500k ...
SolidityNewbie's user avatar
0 votes
0 answers
4 views

Use a smart contract as signer in hardhat test

I have two smart contracts depend on each other contract A { function isOK() external bool view {...} } contract B { address _contractA; modifier onlyContractA() { if (msg.sender ...
seven7e's user avatar
  • 101
0 votes
1 answer
18 views

Why is the function throwing an error when called from another contract but not when called independently?

I have 3 solidity contracts, main.sol, provider.sol and allowance.sol Now from main.sol, I am calling a function "Transact", which calls another function "Transact" in provider.sol ...
Shreyansh Tiwari's user avatar
0 votes
1 answer
23 views

Solidity fundamentals

sometimes I am confused of how solidity works. For example in this case: function claimAssetsFromBridge( bytes calldata message, bytes calldata attestation ) public { IMessageTransmitter(...
Agustin Gonzalez Ribas's user avatar
0 votes
1 answer
26 views

Insufficient Allowance ERC20 when adding liquidity to Uniswap V2 Pool

I am trying to create a contract with a Uniswap V2 Pair for my TestMe Token on Sepolia Testnet. Smart Contract: // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "lib/openzeppelin-...
SolidityNewbie's user avatar
0 votes
0 answers
5 views

SeatMap.js:21 Error fetching seats: Error: no matching fragment (operation="fragment", info={ "args": [ null ], "key": "seatsTaken" },

I have been try to see the values in my array from a function i created with solidity in my APP.js: mapping(uint256 => uint256[]) public seatsTaken; function getSeatsTaken(uint256 _matchID) public ...
jesse bonsu's user avatar
0 votes
2 answers
22 views

Gas estimation error when trying to send ERC 20 to multiple addresses

I was trying to programmatically send ERC 20 tokens from one wallet to multiple other wallets Here is the code from Disperse App that I referenced to: //SPDX-License-Identifier: UNLICENSED pragma ...
duyanhhz's user avatar
1 vote
1 answer
35 views

Foundry script: balance mismatch of tx caller

Found a balance mismatch (between actual & shown) for the caller's address when used as vm.startBroadcast(caller) in foundry script: You can reproduce the error using this foundry script: contract ...
abhi3700's user avatar
  • 219
1 vote
1 answer
19 views

How do I properly call the transferTokens() function?

This first contract creates a liqudity pool for the two tokens on sepolia test net // SPDX-License-Identifier: MIT pragma solidity 0.8.25; // Using npm package imports for a Hardhat or Truffle ...
vectorizedaynon's user avatar
1 vote
1 answer
71 views

Transaction got reverted Uniswap Universal Router

I want to programmatically swap using Uniswap Universal Router, but the transaction always gets reverted Here is my code: const ethers = require("ethers"); const { abi: V3SwapRouterABI } = ...
duyanhhz's user avatar
0 votes
1 answer
7 views

Error import : "File import callback not supported" (using remappings) [Pyth Network]

Im following the "create a contract" part in the tutorial of Pyth Network (https://docs.pyth.network/price-feeds/create-your-first-pyth-app/evm/part-1) and i have this error in the import. ...
Ibizaz's user avatar
  • 1
0 votes
1 answer
14 views

Would small integers saving gas in a struct?

I have a mapping to structs which contain multiple timestamp struct Entry { uint256 createdAt; uint256 solvedAt; uint256 canceledAt; ... } mapping(address => Entry) _entries; ...
seven7e's user avatar
  • 101
1 vote
1 answer
16 views

Getting method hardhat_impersonateAccount not supported when impersonating a WETH whale account on Arbitrum

Attempting to impersonate a WETH whale account on arbitrum and getting: ProviderError: method hardhat_impersonateAccount not supported The code is being run from a script using the following command ...
Ian Forsyth 's user avatar
1 vote
1 answer
21 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
0 answers
24 views

Created a erc20 contract, using openzzeplin. Token total supply not showing up at ether scan

Created token using openzzeplin Name: Souzacoin, SOOZ Version: 0.8.20 Features: mintable, burnable, Pausable, permit. Votes: block number Control: ownable Upgradability: uups Contract was deployed ...
Primetime's user avatar
1 vote
0 answers
31 views

Contract bytecode generated by Hardhat is two times larger than generated by Foundry

I'm developing a contract using both hardhat and foundry. For some reason hardhat generates bytecode that is two times larger than the one generated in foundry. Why may it happen? Source code: // SPDX-...
Sergey Makovkin's user avatar
0 votes
1 answer
26 views

Callable contract's function not exists in ABI

I want to programmatically mint a NFT on Sea Drop on OpenSea. Here is a sample contract that I deployed to test out mint function Sepolia Etherscan Here is the mint page OpenSea If I switch to Write ...
duyanhhz's user avatar
1 vote
1 answer
24 views

Gas estimation error when interacting with smart contract

I wrote a simple smart contract for bulk sending eth to multiple addresses on Remix pragma solidity ^0.4.21; contract PayMultiple { function pay(address[] payees, uint values) public payable{ ...
duyanhhz's user avatar
0 votes
0 answers
13 views

web3.exceptions.ContractLogicError: execution reverted: STF (I approved)

amount_in_max,path,uniswap_contract_address,uniswap_router_abi=self.preview_swap(uniswap_router,token1,token2,amountin) deadline = int(time.time()) + (60 * 20) w3 = Web3(Web3.HTTPProvider(...
Sheipi's user avatar
  • 1
0 votes
1 answer
34 views

Why the method _castToPure in hardhat/console.sol can convert a view method to a pure one?

I have a question when read the console.sol. There is a method named _castToPure that can convert a view method _sendLogPayloadImplementation into a pure method. I cant understand the reason and ...
Alvan's user avatar
  • 11
1 vote
0 answers
15 views

Truffle deployment Failed " hit an invalid opcode while deploying."

This is a token maker code, so its failing to deploy with the following reason: > *** Deployment Failed *** "TokenMaker" hit an invalid opcode while deploying. Try: * Verifying that ...
emkiddo's user avatar
  • 21
0 votes
1 answer
44 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
1 vote
1 answer
14 views

Accidentally removed "/usr/bin/solc" after installation, now no command work

Unfortunatly, meanwhile I was trying to get the latest solidity version, i deleted the /usr/bin/solc folder, and now I can non longer run any script (i.e. solc --version or --help) Can someone help ...
Marco9631's user avatar
0 votes
1 answer
29 views

verify if a token is not a honeypot

automatically, via code, what is the best way to verify if a token is a honeypot or not. I tried: contract verified or not some external APIs (not very reliable) lint the contract
Record413123's user avatar
0 votes
1 answer
25 views

Verifying the contents of a linked list

In my contract, I need to keep track of an ordered list of addresses based on some parameter. To avoid excessive use of storage I have opted for a linked list where each address records in a mapping ...
wolf dun's user avatar
0 votes
0 answers
22 views

addLiquidityETH reverts even after token approval

I am trying to deploy liquidity on a testnet using this code. However, it reverts with no explanation given other than that error. According to the UniswapV2 docs, I am using the correct router (...
Bobby Bee's user avatar
0 votes
0 answers
5 views

How can I let a user know the newly created token address?

I have a smart contract that acts as a factory to create new ERC-20 tokens. A user can creates tokens through my website. When a user sends a transaction and interacts with my create function, how can ...
OSF's user avatar
  • 1
0 votes
0 answers
13 views

unable to sell token despite seeing other wallets selling

I bought this token on base network and the contract looks perfect to me, but i realize i was unable to sell/swap the token after increasing the slippage to 50%, i can see other wallets selling and i ...
Job Toni's user avatar
0 votes
1 answer
26 views

what is the best way to get the amount of token1 i can get for 1 token0 in a pool

async function getPoolData() { const provider = await new ethers.JsonRpcProvider("http://127.0.0.1:8545/"); const signers = await provider.getSigner(); console.log("Pass 1"); ...
unni krishnan's user avatar
0 votes
1 answer
30 views

error staging test on sepolia testnet(1) Uncaught error outside test suite)

I'm trying to deploy a smart contract on the sepolia testnet ,so the contract is deployed successfully as seen on the etherscan ,but when im trying to test the contract with staging test by running ...
Divyanshu Madhav's user avatar
0 votes
1 answer
16 views

What is the best way to monitor all token balances of wallet address?

Context I'm developing a personal project to monitor token balances of all wallet addresses in my service . I can monitor token balances of several addresses by multicall. I designed my workflow of ...
CT95's user avatar
  • 396
0 votes
2 answers
17 views

How multiplication and division works in solidity?

How is this calculated? According to solidity precedence, multiplication has precedence against division Amount= (15- 10) * 10 / 15 * (10_000 - 5_000) / 10_000; So Shouldn't it be 5 * 10 / 15 * ...
anonauditor's user avatar
0 votes
1 answer
15 views

Compiler run failed

So a bit of a N00b problem, Error (6275): Source "/root/solidity-course/src/SimpleStorage.sol" not found: File not found. Searched the following locations: "/root/solidity-course"....
neo_maredi's user avatar
0 votes
2 answers
32 views

Approve does not increase the allowences

I'm encountering an issue with my Solidity smart contract where the allowance values for token transfers are not changing even after I've approved them. Here's the scenario: When I call the ...
Ferda-Ozdemir-Sonmez's user avatar
1 vote
1 answer
30 views

Payable multi-delegatecall

I have a code of multi-delegatecall like this: function multicall(bytes[] calldata _data) external payable returns(bytes[] memory _results) { _results = new bytes[](data.length); for (uint256 ...
zkYan's user avatar
  • 11
1 vote
2 answers
20 views

Does anyone know any stablecoins that has more than 18 decimals?

Does anyone know of any stablecoins that have more than 18 decimals? I only see fewer than 18 decimals, not more.
anonauditor's user avatar
0 votes
2 answers
37 views

Is it possible to manipulate V2 getAmountOut() or V3 sqrtPriceX96 using Uniswap flash swaps or any kind of flash loan

I use this calls: IUniswapV2Router(uniswapV2Router).getAmountOut(tokenAmount, reserve1, reserve0) // Uniswap V2 token price (uint160 sqrtPriceX96, , , , , , ) = uniswapV3Pool.slot0(); // Uniswap V3 ...
blockson's user avatar
0 votes
1 answer
16 views

How to prevent division before multiplication precision loss?

In the else statement, where the Boolean is false, the amount has more than 18 decimals. In this example I used a 24 decimal amount, 123456789123456789123456. Now, it will return 123456789123456789. ...
anonauditor's user avatar
0 votes
4 answers
32 views

A public variable when called returns an object instead of an address in solidity

My Lottery contract code: contract Lottery { address public manager; address[] public players; constructor () { manager = msg.sender; } In the above code, I declared a ...
DarkL's user avatar
  • 3
0 votes
0 answers
26 views

i got "Expected '(' but got identifier"

function addAdmin(address _adminAddress) public onlyAdmin { require(msg.sender == administrateur || isAdmin(msg.sender), "Vous devez être l'administrateur ou un administrateur pour appeler ...
manal's user avatar
  • 1

1
2 3 4 5
355