Skip to content

Commit

Permalink
check balance case kawaii milky (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
haunv3 authored Mar 26, 2024
1 parent 16f7c7d commit 4906add
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/universal-swap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oraichain/oraidex-universal-swap",
"version": "1.0.64",
"version": "1.0.65",
"main": "build/index.js",
"files": [
"build/"
Expand Down
7 changes: 6 additions & 1 deletion packages/universal-swap/src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,12 @@ export const checkBalanceIBCOraichain = async (
// always check from token in ibc wasm should have enough tokens to swap / send to destination
const token = getTokenOnOraichain(from.coinGeckoId);
if (!token) return;
const { balance } = await getBalanceIBCOraichain(token, client, ibcWasmContract);
let ibcWasmContractAddr = ibcWasmContract;
// TODO: check balance with kawaii token and milky token
if (["kawaii-islands", "milky-token"].includes(from.coinGeckoId) && ["0x38"].includes(from.chainId)) {
ibcWasmContractAddr = network.converter;
}
const { balance } = await getBalanceIBCOraichain(token, client, ibcWasmContractAddr);
if (balance < fromAmount) {
throw generateError(
`The bridge contract does not have enough balance to process this bridge transaction. Wanted ${fromAmount}, have ${balance}`
Expand Down

0 comments on commit 4906add

Please sign in to comment.