How to pass array of structs as argument on etherscan (tuple[])?
Asked Answered
C

1

6

I'm trying to pass the format of array of structs as argument on smart contract write function on etherscan,

This is solidity example:

Info[] public info;

struct Info { 
    address userAddress;
    uint256 amount;   
    bool active; 
} 

enter image description here Javascript example:

const data = [{0x0000, 10000000000, false},{0x11111, 20000000000, true}]

Can anyone convert this data example to tuple[] and provide it? Thanks in advance

Caithness answered 24/1, 2022 at 5:44 Comment(0)
H
5

You must add the value in Etherscan input like this:

[["0x0000", "10000000000", false],["0x11111", "20000000000", true]]
Handmade answered 4/2, 2022 at 13:56 Comment(1)
I have a struct struct PricingOption { uint208 price; uint40 numberOfEntries; } I tried to pass params the same way as you wrote and it didn't work for me: invalid tuple valueMolding

© 2022 - 2024 — McMap. All rights reserved.