kasper
kasper

Reputation: 301

Pass array of addresses manually to function as argument

how can i pass array of 4 addresses manually to function is it possible? What should be syntax in remix function caller [address1,address2,address3,address4]?

[x0100000000000000000000000000000000000000000000000000000000,x0100000000000000000000000000000000000000000000000000000000,x0100000000000000000000000000000000000000000000000000000000,x0100000000000000000000000000000000000000000000000000000000]

function examplefunction(address[] memory array) public onlyOwner{

}

and i get in remix error: transact to Absorber.setTopTransactionsWinners errored: Error encoding arguments: Error: types/values length mismatch

Upvotes: 5

Views: 2531

Answers (1)

Petr Hejda
Petr Hejda

Reputation: 43521

Your addresses are too long and incorrectly structured. Ethereum address is 20 bytes, so that's 40 hex characters after the 0x.

Example value that is accepted as address[] type in Remix:

["0x1000000000000000000000000000000000000000","0x1000000000000000000000000000000000000000","0x1000000000000000000000000000000000000000","0x1000000000000000000000000000000000000000"]

Upvotes: 3

Related Questions