Linked Questions

0 votes
2 answers
25 views

Contract verify [duplicate]

I get such error of compilation in Optimism Sepolia testnet network.The contract succesfully compiles using hardhat with needed configuration.What should I do to get verified the contract ?
Nerses Asaturyan's user avatar
0 votes
1 answer
20 views

Foundry Compile Error [duplicate]

Error: Compiler error (C:\Users\circleci\project\libsolidity\codegen\CompilerUtils.cpp:1459):Stack too deep. Try compiling with --via-ir (cli) or the equivalent viaIR: true (standard JSON) while ...
seojunchian's user avatar
0 votes
1 answer
381 views

Mint and Create a Struct give me give me error "Stack too deep try removing local variables"

I have an issue with my code, I want to create a function to be able to Mint a token, and add a struct to represent all attributes of this token. The issue is, I have lot's of args on my function (8) ...
Arthur's user avatar
  • 194
4 votes
0 answers
563 views

Block scoping in Solidity to avoid "Stack too deep error"

I have a quite big function with 16+ local variables which produces the infamous Stack too deep error. To handle this bad boy I have searched for the possible solutions and ended up using scopes. ...
rihekopo's user avatar
  • 316
0 votes
0 answers
38 views

CompilingError: Stack too deep, try removing local variables [duplicate]

I have a function that lists an NFT on a marketplace for sale. In the process, it keeps records by saving data in a struct inside nested maps represented by the NFT address and token ID. I am running ...
Weivy's user avatar
  • 1
0 votes
1 answer
57 views

"now"this key word can use.how can i do

pragma solidity >0.4.0 ; pragma experimental ABIEncoderV2; // 代币系统 contract Token { uint tokenTotal; // 代币总和 uint tokenPrice; // 代币价格 uint balanceTokens; // 合约余额 // ...
yao yu's user avatar
  • 11
0 votes
1 answer
950 views

Stack Too Deep Compiling Error on Remix -- Solidity [duplicate]

first off I’d like to say that I’m a noob in Solidity so this issue might sound so trivial, pls bear with me. I’m running into a compiler error on line 61 (Stack too deep). I suppose an easy fix would ...
user96723's user avatar
0 votes
1 answer
39 views

InternalCompilerError: Stack too deep, try using fewer variables [duplicate]

Here is my code // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; contract GeoSpatialData{ uint public SpatialDataCount = 0; struct GeoData{ uint id; ...
sarangkkl's user avatar
  • 129
0 votes
1 answer
502 views

How do I parse a bytes32 in solidty?

I have a bytes32 object in memory or storage and I want to parse it into little chunks, for example into one uint8, followed by a bool, followed by uint10, followed by address. How can one do that? I ...
Marlo's user avatar
  • 349
0 votes
1 answer
1k views

CompilerError: Stack too deep, try removing local variables. How to solve the problem? [duplicate]

I'm having problems with this part of the code. Can you tell me how to solve this problem? I have read various documentation, but maybe someone knows the solution function _getValues(uint256 tAmount)...
Dmitry's user avatar
  • 1
0 votes
0 answers
25 views

Stack too deep, try removing local variables when using remix [duplicate]

while compiling in remix i get the above error: CompilerError: Stack too deep, try removing local variables. --> work/youkie.sol:1015:80: | 1015 | (uint256 rAmount, uint256 ...
stofu's user avatar
  • 93
2 votes
0 answers
1k views

Stack too deep when compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack [duplicate]

I tried to add another parameter to my constructor and I get the following error when compiling with hardtest to test. If I remove one parameter it compiles again, so clearly it's related to the ...
Tom's user avatar
  • 123
1 vote
0 answers
15 views

Stack too deep error when trying to calculate two charity fees [duplicate]

How can I fix the below functions? I'm getting CompilerError: Stack too deep, try removing local variables. (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee,...
William's user avatar
  • 113
0 votes
1 answer
62 views

Stack too deep error - need help fixing it! [duplicate]

I keep getting the 'stack too deep' error on solidity. I was wondering if anyone can help me fix this with in following code: function _getTValues(uint256 tAmount) private view returns (uint256, ...
GandalfTheGrey's user avatar
0 votes
0 answers
24 views

CompilerError: Stack too deep, try removing local variables. - [duplicate]

i am trying to compile my contract and running into this issue: CompilerError: Stack too deep, try removing local variables. I am not really sure how to fix it. Below is my code that is throwing the ...
AndG's user avatar
  • 1
1 vote
0 answers
30 views

Stack too deep, try removing local variables. _tOwned[sender] = _tOwned[sender].sub(tAmount); [duplicate]

I need help, i don't understand this Error... Code: function _transferFromExcluded(address sender, address recipient, uint256 tAmount, bool lottery, bool updateWinner) private { uint256 ...
Raphael Cibulka's user avatar
0 votes
1 answer
38 views

Stack too deep error [duplicate]

Not sure what the best approach is to get around this. New to solidity. I've read the complicated 'answers' to this that suggest using structs, arrays, etc. but I can't figure out how to address this. ...
Ash's user avatar
  • 1
1 vote
1 answer
510 views

Uniswap V2 Contract question: Stack too deep [duplicate]

Could someone explain how this line of code (linked below) properly circumvents the "stack too deep" error? I was under the assumption that the "stack too deep" error meant the ...
uma's user avatar
  • 13
1 vote
1 answer
735 views

CompilerError: Stack too deep, try removing local variables [duplicate]

While trying to fetch more than 6 variables I am having an issue. /** * Get data based on report id */ function getData(uint256 id) public view returns ( ...
NinjaMAN's user avatar
  • 419
7 votes
1 answer
7k views

Stack too deep when compiling inline assembly

I'm running into a YulException: Stack too deep when compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack. using a smart contract that has this function. I took this ...
João Quintanilha's user avatar
0 votes
0 answers
41 views

How to fix CompilerError: Stack too deep, try using fewer variables? [duplicate]

When attempting to compile the following contract I am receiving the following error: InternalCompilerError: Stack too deep, try using fewer variables. How can I fix this?I want the getPerson function ...
Jaylukmann's user avatar
0 votes
2 answers
3k views

Stack too deep, try using fewer variables [duplicate]

Seems like I'm passing a lot of arguments in a struct creation, this message error showed up "stack too deep , try using fewer variables" I tried to get rid of it by using bytes32 instead of string, ...
Fahmy Chaabane's user avatar
1 vote
0 answers
23 views

Error while compiling a function [duplicate]

Below function is showing error while compilation that "stack is too deep, try removing local variables mapping (address => mapping (uint => Exam)) public exams; function getExamQuestion( ...
Suman Raj's user avatar
0 votes
1 answer
1k views

Convert bytes to uint256[]

I am writing an implementation of ERC777TokensRecipient. So that means a function function tokensReceived(address operator, address from, address to, uint256 amount, bytes data, bytes operatorData) ...
Maarten Dhondt's user avatar
1 vote
0 answers
108 views

Error on contract constructor - CompilerError: Stack too deep, try removing local variables [duplicate]

I have the following constructor on a contract: constructor( string name, string symbol, uint8 tokenResolution, string defaultUnderlying, uint maturityTimestamp, uint rate, ...
Lucas Yamamoto's user avatar
1 vote
1 answer
2k views

InternalCompilerError: Stack too deep, try removing local variables [duplicate]

I want add and store more than 16 variables value in in my private blockchain, I am unable to define the variable in Struct {}, I got Error "InternalCompilerError: Stack too deep, try removing ...
Sam's user avatar
  • 11
0 votes
1 answer
1k views

Getting this ---- Error: Stack too deep, try removing local variables [duplicate]

Hi Ethereum Developer's, Need your precious time.. I know this question is asked and solutions is given for the same I have a smart contract--------- pragma solidity ^0.4.18; contract myContract ...
Muddassar Shaikh's user avatar
7 votes
3 answers
4k views

Function with more than 16 arguments

At some point in my contract I have a public, not Constant function that has more than 16 arguments (24 to be exact). I'm getting an error saying Stack too deep. Try removing local variables I can't ...
Anthony Silva's user avatar
324 votes
9 answers
114k views

`external` vs `public` best practices

Apart from the public modifier Ethereum introduces the external one. Both may be called outside of the contract and inside (the later one by this.f() pattern). Moreover, according to the docs: ...
Jakub Wojciechowski's user avatar
0 votes
4 answers
2k views

How many variables/ rows can contracts handle?

From the article: Are there well-solved and simple storage patterns for Solidity? Ignoring costs, does anyone know how many variables/rows a solidity contract using each of the types can handle? ...
thefett's user avatar
  • 3,910
1 vote
2 answers
3k views

public struct showing stack overflow error

I'm trying to add more then 9 data in public struct it's showing me below error Internal compiler error: Stack too deep, try removing local variables. if I remove the public keyword from User ...
comeback4you's user avatar
4 votes
1 answer
190 views

Setting a struct once cause error while compiling: Stack too deep

See my smart contract below : contract Test { struct MyBool { bool initialized; // /!\ if false then 'NA' else fetch value's property bool value; } struct Patient { ...
onepix's user avatar
  • 283
3 votes
1 answer
282 views

Structure with 16 elements

I have created structure with 16 elements and received solidity compiler error. Exception during compilation: /src/libsolidity/../libevmasm/Instruction.h(217): Throw in function dev::solidity::...
Bogdan's user avatar
  • 397
29 votes
1 answer
31k views

Stack too deep, try removing local variables [duplicate]

When I set more than eight values as function’s return , the following error occurred. ( When the num of values is less than seven, the error didn’t occur) Could you tell me how can I get more than ...
Toshi's user avatar
  • 2,357
3 votes
1 answer
145 views

Stack to deep workaround for object " instantiation "

I'm have an object with around 25 fields in it. int idOfObjectTracker; mapping (uint => object)listofobjects; struct object { string _1; string _2; ... string _25; } i'm trying to " modifiy ...
solinooby's user avatar
  • 261