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
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)
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
GatewayFee all to
nil but get same result.