0

I want to send tuple as parameters to contract by using Abi Package

type SingleSwap struct {
    poolId   []byte
    kind     *big.Int
    assetIn  common.Address
    assetOut common.Address
    amount   *big.Int
    userData []byte
}

type Funds struct {
    sender              common.Address
    fromInternalBalance bool
    recipient           common.Address
    toInternalBalance   bool
}

singleSwap := SingleSwap{
    poolId:   []byte("0x115001ccae84cf4435a48497a1bfe187ab561b5c000200000000000000000529"),
    kind:     big.NewInt(0),
    assetIn:  common.HexToAddress("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"),
    assetOut: common.HexToAddress("0x94068ce82b96800a23072c34dbb470a56033be12"),
    amount:   big.NewInt(100000000),
    userData: []byte("0x"),
}

funds := Funds{
    sender:              fromAddr,
    fromInternalBalance: false,
    recipient:           fromAddr,
    toInternalBalance:   false,
}

deadline := &big.Int{}
deadline.SetInt64(time.Now().Add(10 * time.Minute).Unix())

snipABI, err := abi.JSON(strings.NewReader(balancerABI))

data, err := snipABI.Pack("swap", singleSwap, funds, big.NewInt(0), deadline)

but when I run it show me that

field poolld for tuple not found in the given struct
[]

Is there anyone know how to fix that ? Thank you so much!

Zeke Lu
  • 6,349
  • 1
  • 17
  • 23
Mr Wolf
  • 11

1 Answers1

0

It seems that the contract abi want to receive a array of poolID argument.

You can try change this one:

poolId   []byte

to this:

poolId   [][]byte
avelex
  • 1