Token
Looking up Tokens
//WETH token metadata
let tokenIn = sdk.token.lookup("0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2");
let orderInputAmount = ethers.utils.parseUnits("20", tokenIn.decimals);
if(tokenIn.balance && tokenIn.balance.lt(orderInputAmount)) {
throw new Error("I don't have enough funds to trade!");
}
if(tokenIn.allowance.lt(orderInputAmount)) {
await sdk.token.increaseSpending({
token: tokenIn,
amount: orderInputAmount.mul(10) //or whatever you want >= orderInputAmount
});
}token_in = asyncio.run(sdk.token.lookup("0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"))
order_input_amount = dexible.common.as_units(20, token_in.decimals)
if token_in.balance < order_input_amount:
raise Exception("I don't have enough funds to trade!")
if token_in.allowance < order_input_amount:
asyncio.run(sdk.token.increase_spending(token=token_in, amount=order_input_amount*2))
Increase Spending
Verifying Tokens
Last updated