Skip to content

Commit e67c9f3

Browse files
committed
add gai-stablecoin(pegged with USD)
1 parent fd3b7b8 commit e67c9f3

File tree

5 files changed

+84
-1
lines changed

5 files changed

+84
-1
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const sdk = require("@defillama/sdk");
2+
import { sumSingleBalance } from "../helper/generalUtil";
3+
4+
import {
5+
ChainBlocks,
6+
PeggedIssuanceAdapter,
7+
Balances,
8+
} from "../peggedAsset.type";
9+
10+
type ChainContracts = {
11+
[chain: string]: {
12+
[contract: string]: string[];
13+
};
14+
};
15+
16+
const chainContracts: ChainContracts = {
17+
manta: {
18+
issued: ["0xcd91716ef98798A85E79048B78287B13ae6b99b2"],
19+
},
20+
};
21+
22+
async function chainMinted(chain: string, decimals: number) {
23+
return async function (
24+
_timestamp: number,
25+
_ethBlock: number,
26+
_chainBlocks: ChainBlocks
27+
) {
28+
let balances = {} as Balances;
29+
for (let issued of chainContracts[chain].issued) {
30+
const totalSupply = (
31+
await sdk.api.abi.call({
32+
abi: "erc20:totalSupply",
33+
target: issued,
34+
block: _chainBlocks?.[chain],
35+
chain: chain,
36+
})
37+
).output;
38+
sumSingleBalance(balances, "peggedUSD", totalSupply / 10 ** decimals);
39+
}
40+
return balances;
41+
};
42+
}
43+
44+
const adapter: PeggedIssuanceAdapter = {
45+
manta: {
46+
minted: chainMinted("manta", 18),
47+
unreleased: async () => ({}),
48+
},
49+
};
50+
51+
export default adapter;

src/adapters/peggedAssets/helper/chains.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,6 @@
140140
"concordium",
141141
"pulse",
142142
"sui",
143-
"q"
143+
"q",
144+
"manta"
144145
]

src/adapters/peggedAssets/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import usd from "./usd";
4848
import dei from "./dei-token";
4949
import usn from "./usn";
5050
import bai from "./bai-stablecoin";
51+
import gai from "./gai-stablecoin";
5152
import eurt from "./tether-eurt";
5253
import eurc from "./euro-coin";
5354
import stasis from "./stasis-eurs";
@@ -217,6 +218,7 @@ export default {
217218
usd,
218219
"dei-token": dei,
219220
"bai-stablecoin": bai,
221+
"gai-stablecoin": gai,
220222
usn,
221223
"tether-eurt": eurt,
222224
"euro-coin": eurc,

src/adapters/peggedAssets/llama-helper/portedTokens.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,14 @@ function fixAstarBalances(balances) {
770770
return fixBalances(balances, mapping)
771771
}
772772

773+
function fixMantaBalances(balances) {
774+
const mapping = {
775+
'0xcd91716ef98798A85E79048B78287B13ae6b99b2': { coingeckoId: 'goku-money-gai', decimals: 18, },
776+
}
777+
778+
return fixBalances(balances, mapping)
779+
}
780+
773781
function fixHPBBalances(balances) {
774782
const mapping = {
775783
'0xBE05Ac1FB417c9EA435b37a9Cecd39Bc70359d31': { coingeckoId: 'high-performance-blockchain', decimals: 18, },
@@ -1012,6 +1020,7 @@ const fixBalancesMapping = {
10121020
avax: fixAvaxBalances,
10131021
evmos: b => fixBalances(b, evmosFixMapping, { removeUnmapped: false }),
10141022
astar: fixAstarBalances,
1023+
manta: fixMantaBalances,
10151024
shiden: fixShidenBalances,
10161025
cronos: b => fixBalances(b, cronosFixMapping, { removeUnmapped: false }),
10171026
tezos: fixTezosBalances,

src/peggedData/peggedData.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3381,4 +3381,24 @@ export default [
33813381
twitter: "https://twitter.com/protocol_fx",
33823382
wiki: null,
33833383
},
3384+
{
3385+
id: "169",
3386+
name: "GAI Stablecoin",
3387+
address: "manta:0xcd91716ef98798A85E79048B78287B13ae6b99b2",
3388+
symbol: "GAI",
3389+
url: "https://www.goku.money/",
3390+
description:
3391+
"Goku Money is a decentralized borrowing protocol on Manta that allows you to draw interest-free loans against multiple collateral assets (e.g. MANTA, TIA, USDT, and etc.). Loans are paid out in GAI (a USD pegged stablecoin).",
3392+
mintRedeemDescription:
3393+
"Using the Goku Money app, users mint GAI by depositing an accepted collateral asset into a vault. When the loan is repaid to retrieve the collateral, the paid back GAI is burned.",
3394+
onCoinGecko: "true",
3395+
gecko_id: "goku-money-gai",
3396+
cmcId: null,
3397+
pegType: "peggedUSD",
3398+
pegMechanism: "crypto-backed",
3399+
priceSource: "coingecko",
3400+
auditLinks: null,
3401+
twitter: "https://twitter.com/goku_stable",
3402+
wiki: null,
3403+
},
33843404
] as PeggedAsset[];

0 commit comments

Comments
 (0)