Skip to content

Commit 6a43c83

Browse files
update sui: add sui bridge & wormhole
1 parent dbc1c01 commit 6a43c83

File tree

1 file changed

+22
-15
lines changed
  • src/adapters/peggedAssets/tether

1 file changed

+22
-15
lines changed

src/adapters/peggedAssets/tether/index.ts

+22-15
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
import { chainContracts } from "./config";
3333
const axios = require("axios");
3434
const retry = require("async-retry");
35+
import * as sui from "../helper/sui";
3536

3637
// If you are trying to test the adapter locally and it failed, try to comment out the lines related with dogechain and fuse
3738
// any bridgeOnETH contracts are not used and are just for info purposes
@@ -434,30 +435,30 @@ async function nearMint(address: string, decimals: number) {
434435
};
435436
}
436437

437-
async function suiBridged() {
438+
async function suiWormholeBridged() {
438439
return async function (
439440
_timestamp: number,
440441
_ethBlock: number,
441442
_chainBlocks: ChainBlocks
442443
) {
443444
let balances = {} as Balances;
444-
const res = await axios.get(
445-
`https://kx58j6x5me.execute-api.us-east-1.amazonaws.com/sui/usdt`
446-
);
447-
const totalSupply = parseInt(
448-
res.data.find((t: any) => t.coin === "USDT_ETH").cumulative_balance
449-
);
450-
sumSingleBalance(
451-
balances,
452-
"peggedUSD",
453-
totalSupply,
454-
"0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c",
455-
true
456-
);
445+
const res = await axios.get(`https://kx58j6x5me.execute-api.us-east-1.amazonaws.com/sui/usdt`)
446+
const totalSupply = parseInt(res.data.find((t:any)=>t.coin==="USDT_ETH").cumulative_balance);
447+
sumSingleBalance(balances, "peggedUSD", totalSupply, "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c", true);
457448
return balances;
458449
};
459450
}
460451

452+
async function suiBridged(): Promise<Balances> {
453+
let balances = {} as Balances;
454+
const supply = await sui.getTokenSupply(
455+
"0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT",
456+
);
457+
sumSingleBalance(balances, "peggedUSD", supply, 'issued', false);
458+
return balances;
459+
}
460+
461+
461462
async function polyNetworkBridged(
462463
chainID: number,
463464
chainName: string,
@@ -711,7 +712,13 @@ const adapter: PeggedIssuanceAdapter = {
711712
*/
712713
},
713714
sui: {
714-
ethereum: suiBridged(),
715+
ethereum: sumMultipleBalanceFunctions(
716+
[
717+
suiWormholeBridged(),
718+
suiBridged
719+
],
720+
"peggedUSD"
721+
),
715722
},
716723
syscoin: {
717724
ethereum: bridgedSupply(

0 commit comments

Comments
 (0)