Skip to content

Commit c8a30f1

Browse files
Merge pull request #11 from useLiquidOps/feat--add-wAR/wUSDT
Feat add w ar/w usdt
2 parents a9b7c64 + b9a4d4b commit c8a30f1

4 files changed

Lines changed: 39 additions & 16 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "liquidops",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"author": "Lorimer Jenkins <lorimer@liquidops.io>, Marton Lederer <marton@liquidops.io>",
55
"repository": {
66
"type": "git",

src/ao/utils/tokenAddressData.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,42 @@ export const tokenData: Record<string, TokenData> = {
4444
collateralEnabled: true,
4545
baseDenomination: BigInt(6),
4646
},
47+
WAR: {
48+
name: "Wrapped Arweave",
49+
icon: "ICMLzIKdVMedibwgOy014I4yan_F8h2ZhORhRG5dgzs",
50+
ticker: "WAR",
51+
address: "xU9zFkq3X2ZQ6olwNVvr1vUWIjc3kXTWr7xKQD6dh10",
52+
oTicker: "oWAR",
53+
oAddress: "rAc0aP0g9NXYUXAbvlLjPH_XxyQy6eYmwSuIcf6ukuw",
54+
controllerAddress,
55+
cleanTicker: "wAR",
56+
denomination: BigInt(12),
57+
collateralEnabled: true,
58+
baseDenomination: BigInt(12),
59+
},
60+
WUSDT: {
61+
name: "Wrapped USD Tether",
62+
icon: "JaxupVYerLRZWLd32llz_3CG8sCQaNhn2hAWm51U_7s",
63+
ticker: "WUSDT",
64+
address: "7j3jUyFpTuepg_uu_sJnwLE6KiTVuA9cLrkfOp2MFlo",
65+
oTicker: "oWUSDT",
66+
oAddress: "9B9J1O5FDoMsFZGJUSOa6TwivsH7LYIfiaizPn7fUHs",
67+
controllerAddress,
68+
cleanTicker: "wUSDT",
69+
denomination: BigInt(18),
70+
collateralEnabled: true,
71+
baseDenomination: BigInt(18),
72+
},
4773
};
4874

75+
export function convertTicker(ticker: string): string {
76+
if (ticker === "QAR") return "AR";
77+
if (ticker === "WUSDC") return "USDC";
78+
if (ticker === "WAR") return "AR";
79+
if (ticker === "WUSDT") return "USDT";
80+
return ticker;
81+
}
82+
4983
export type SupportedTokensTickers = keyof typeof tokenData;
5084
export type SupportedTokensAddresses = TokenData["address"];
5185
export type SupportedOTokensTickers = TokenData["oTicker"];

src/functions/liquidations/getLiquidations.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import { redstoneOracleAddress } from "../../ao/utils/tokenAddressData";
1010
import { getAllPositions } from "../protocolData/getAllPositions";
1111
import { dryRunAwait } from "../../ao/utils/dryRunAwait";
12+
import { convertTicker } from "../../ao/utils/tokenAddressData";
1213

1314
export interface GetLiquidationsRes {
1415
liquidations: Map<string, QualifyingPosition>;
@@ -60,12 +61,6 @@ interface GlobalPosition {
6061
};
6162
}
6263

63-
function convertTicker(ticker: string): string {
64-
if (ticker === "QAR") return "AR";
65-
if (ticker === "WUSDC") return "USDC";
66-
return ticker;
67-
}
68-
6964
export async function getLiquidations(
7065
precisionFactor: number,
7166
): Promise<GetLiquidationsRes> {

src/functions/oTokenData/getGlobalPosition.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
import { collateralEnabledTickers } from "../../ao/utils/tokenAddressData";
99
import { getPosition } from "./getPosition";
1010
import { dryRunAwait } from "../../ao/utils/dryRunAwait";
11+
import { convertTicker } from "../../ao/utils/tokenAddressData";
1112

1213
// Base token position with the core metrics
1314
interface TokenPosition {
@@ -56,13 +57,7 @@ export async function getGlobalPosition({
5657
const redstonePriceFeedRes = await getData({
5758
Target: redstoneOracleAddress,
5859
Action: "v2.Request-Latest-Data",
59-
Tickers: JSON.stringify(
60-
collateralEnabledTickers.map((ticker) => {
61-
if (ticker === "QAR") return "AR";
62-
if (ticker === "WUSDC") return "USDC";
63-
return ticker;
64-
}),
65-
),
60+
Tickers: JSON.stringify(collateralEnabledTickers.map(convertTicker)),
6661
});
6762
// add dry run await to not get rate limited
6863
await dryRunAwait(1);
@@ -128,8 +123,7 @@ export async function getGlobalPosition({
128123
globalPosition.tokenPositions[token] = tokenPosition;
129124

130125
// Get token price and denomination for USD conversion
131-
const tokenPrice =
132-
prices[token === "QAR" ? "AR" : token === "WUSDC" ? "USDC" : token].v;
126+
const tokenPrice = prices[convertTicker(token)].v;
133127
const tokenDenomination =
134128
tokenData[token as SupportedTokensTickers].baseDenomination;
135129

0 commit comments

Comments
 (0)