Questions tagged [abiencoderv2]

The new ABI encoder is able to encode and decode arbitrarily nested arrays and structs. It produces less optimal code (the optimizer for this part of the code is still under development).

Filter by
Sorted by
Tagged with
1
vote
1answer
35 views

how to encode bool variables in solidity

i am trying to encode a bool variable as callback data (bytes). i am doing this by using abi.encodePacked for reduced space and cost and a custom decoding function. The issue is that after decoding, ...
1
vote
0answers
168 views

Encode nested structs using web3

I'm using Solidity 0.8.0 (so I'm using ABIEncoderV2) and web3.js 1.3.4 and I'm trying to call a contract's method passing a nested struct. erc1155.methods.safeBatchTransferFrom( owner, ...
0
votes
0answers
31 views

Get struct from mapping that include another mapping

I have an already deployed contract with a mapping that looks this way: struct Details { address a; address b; } struct Params { uint a; uint b; //..... uint n; mapping(address =&...
0
votes
1answer
208 views

How to encode arrays for solidity function calls

I want to understand how to encode the following arrays in Solidity. Dynamic Arrays For example, the following: function getDynamicUintArray() public pure returns (uint[] memory) { uint[] ...
1
vote
0answers
40 views

Is older web3.js UI code compatible with new contracts that use ABI coder v2?

The solidity 0.8.0 patch notes state: ABI coder v2 is activated by default. You can choose to use the old behaviour using pragma abicoder v1;. The pragma pragma experimental ABIEncoderV2; is still ...
1
vote
1answer
101 views

Are newer solidity versions 'safer'? Should I update my existing code to use a newer version?

I have created a set of contracts that will shortly be undergoing an audit. It's a DeFi platform that is intended to hold real value. The project began as a fork of a fairly old project, that uses ...
0
votes
1answer
73 views

Is it possible to access struct field from in-line assembly (Yul) when using ABIEncoderV2?

Is it possible to access struct field from Yul? Ideally it could look like this: pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; contract Sample { struct S { uint256 n; ...
0
votes
1answer
54 views

Cannot verify source code smart contract on Etherscan! PLEASE help me

Link for the contract on Etherscan: https://ropsten.etherscan.io/address/0x339237da476f50777da2d04b05037a805e46fcdb Arguments Type: String,String, uint8 ~ "FinanceToken", "MYFI", &...
0
votes
1answer
533 views

abi.decode with pragma experimental ABIEncoderV2 reverts with nested array

I have a function with a parameter of bytes calldata that needs to be decoded to a struct, but the call reverts in assembly. I believe the issue has something to do with the nested array. I have ...
0
votes
1answer
34 views

Why do we write ABI before some functions

Why do we write "abi" before abi.encode()? I understand that ABI is a like a JSON file used to help interaction of different applications because the solidity code is stored as bytecode, but ...
0
votes
1answer
81 views

How to use initialize a bytes array with abi data?

To initialize a bytes array with the bool value True encoded as ABI data, I'm attempting to do it like this: bytes memory arr = '0x0000000000000000000000000000000000000000000000000000000000000001'; ...
1
vote
1answer
102 views

How to call an overloaded function in Truffle with ABIEncoderV2?

How do you call an overloaded function in Truffle when passing a struct using pragma experimental ABIEncoderV2;? contract MyContract { struct MyStruct { address param1; address param2; ...
0
votes
0answers
293 views

How can I return string array in solidity?

This is my struct: struct Token { address tokenAddress; uint256 minAmount; bool emergencyUnlock; TokenStatus status; string name; uint256 decimal; string thumbnailUrl; } ...
0
votes
0answers
59 views

Gas-efficient string concatenation

My use-case requires that I feed my contract with a long string (Base64 data), which requires to split it and send it over several transactions so as to not reach gas limit. Then the contract rebuilds ...
1
vote
1answer
109 views

AbiEncoderV2 encoding Tuple algorithm

Where can I find AbiEncoderV2 encoding Tuple algorithm? I would like to add Tuples support to a ruby library.
1
vote
1answer
182 views

ABI encoding with tuples

I don't understand how ABI encoding with tuples work: f(uint8[], uint) with arguments [3], 4 accordingly https://abi.hashex.org produces: ...
0
votes
1answer
802 views

How to encode an object with ABIEncoder V2?

How to encode an object with ABIEncoder V2? For example, this one: { items: [ { str: "str", num: 5, bol: true } ] } Solidity struct: struct Item { string str; ...
1
vote
0answers
693 views

Solidity calldata for an array of structs

I'm trying to create the calldata offchain for an on-chain low-level call to a method that accepts an array of structs as an argument. I'm not sure how to encode the calldata for this. Here's a ...
0
votes
1answer
76 views

Passing more than 20 parameters in solidity

How to pass more than 20 parameters in solidity function? I have tried using array[] parameter that uses pragma ABIENCODERV2 experimental feature. But this feature cannot be used in production purpose....
1
vote
0answers
111 views

UnimplementedFeatureError: Variable inaccessible, too deep inside stack (17)

I'm getting this error, with no indication of which line of code or variable is responsible. I know it goes away when I comment out pragma experimental ABIEncoderV2; …but I need ABIEncoderV2 as I ...
3
votes
1answer
1k views

How to pass struct params in remix ide?

I have this smart contract: pragma solidity 0.5; pragma experimental ABIEncoderV2; contract TestStruct { struct User { string name; uint256 age; } mapping (bytes32 =&...
6
votes
1answer
1k views

Status of ABIEncoderV2 now

Do you know the current status of ABIEncoderV2? I want to know the current status of ABIEncoderV2 Live projects using ABIEncoderV2 right now Restriction on the normal encoder Risks of using ...