Hi,
I’m trying exchange dollars using golang. I’m sure my issue lies with the callOpts arguments but maybe missing an additional call. The transaction for StableToken::Approve succeeds but the tx for Exchange::Exchange shows no logs and status 0x0 - It keeps getting reverted by the vm.
auth = bind.NewKeyedTransactor(key.PrivateKey)
auth.FeeCurrency = nil
auth.GatewayFeeRecipient = &c.GatewayFeeRecipient // validator address with attestations
auth.GatewayFee = big.NewInt(3000000)
auth.GasLimit = uint64(3000000)
auth.GasPrice = gasPrice // 5000000000
tx, err = exchangeInstance.Exchange(auth, erc20Amount, big.NewInt(0), false)
Here is the json rpc request data that is being sent for Exchange::exchange
{"jsonrpc":"2.0","id":11,"method":"eth_sendRawTransaction","params":["0xf8e581ac85012a05f200832dc6c08094f327386ef9d6be057d1c720fef633938743660f3832dc6c094c8fd77490a12f46709bffbcc0fce35740da8d86080b8642bc7d67a0000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001ba031fd4d209008438e5e0a5a924a5b312cd31f46fd65e3a4f21d2288ea16bdaa03a0058c1b55e83701159a77b89a23801192e29878685bc5d664af4dce249408a21a"]}
Here is the code I’m using cherry picked from our package: https://play.golang.org/p/yJuj_byuArn
Tx for StableToken::Approve (success) 0xd516362a0a7bbcbfbe4c45770c3452e2575ddfc667948b5df2d5082ef93a5f22
Tx for Exchange::Exchange (evm revert)
0x26aed1ec5c2db1f3342f0841f2eef03c2859b9fd1fcba6aa950240e4dd8f8c50
Lost here as well because 1st approve tx doesn’t require Celo’s implementation of callOpts (feeCurency, gatewayFeeRecipient, gatewayFee) but the 2nd exchange tx does (or it will fail for not enough gas).
I’ve also tried setting FeeCurrency
, GatewayFeeRecipient
and GatewayFee
all to nil
but get same result.