Browse Source

Fix setting allowance.

patch-3
Artem Pikulin 7 years ago
parent
commit
7ccf068a32
  1. 6
      iguana/exchanges/etomicswap/etomiclib.cpp

6
iguana/exchanges/etomicswap/etomiclib.cpp

@ -53,15 +53,11 @@ char *approveErc20(ApproveErc20Input input)
tx.gasPrice = getGasPriceFromStation() * boost::multiprecision::pow(u256(10), 9);
tx.nonce = getNonce(input.owner);
uint8_t decimals = getErc20Decimals(input.tokenAddress);
u256 amount = jsToU256(input.amount);
if (decimals < 18) {
amount /= boost::multiprecision::pow(u256(10), 18 - decimals);
}
std::stringstream ss;
ss << "0x095ea7b3"
<< "000000000000000000000000"
<< toHex(jsToAddress(input.spender))
<< toHex(toBigEndian(amount));
<< toHex(toBigEndian(jsToU256(input.amount)));
tx.data = jsToBytes(ss.str());
char* rawTx = signTx(tx, input.secret);
char* result = sendRawTx(rawTx);

Loading…
Cancel
Save