arb-knox-dollar

This commit is contained in:
0xTomSawyer
2024-04-30 19:41:43 -05:00
parent dfb4cc362a
commit a12fe339fe
2 changed files with 57 additions and 0 deletions

View File

@@ -105,6 +105,7 @@ import dsu from "./digital-standard-unit";
import electronicusd from "./electronic-usd";
import hyusd from "./high-yield-usd";
import usd3 from "./web-3-dollar";
import knox from "./knox-dollar";
import eure from "./monerium-eur-money";
import anonusd from "./offshift-anonusd";
import nxusd from "./nxusd";

View File

@@ -0,0 +1,56 @@
const sdk = require("@defillama/sdk");
import { sumSingleBalance } from "../helper/generalUtil";
import {
ChainBlocks,
PeggedIssuanceAdapter,
Balances,
} from "../peggedAsset.type";
type ChainContracts = {
[chain: string]: {
[contract: string]: string[];
};
};
const chainContracts: ChainContracts = {
arbitrum: {
issued: ["0x0BBF664D46becc28593368c97236FAa0fb397595"],
},
};
async function chainMinted(chain: string, decimals: number) {
return async function (
_timestamp: number,
_ethBlock: number,
_chainBlocks: ChainBlocks
) {
let balances = {} as Balances;
for (let issued of chainContracts[chain].issued) {
const totalSupply = (
await sdk.api.abi.call({
abi: "erc20:totalSupply",
target: issued,
block: _chainBlocks?.[chain],
chain: chain,
})
).output;
sumSingleBalance(
balances,
"peggedUSD",
totalSupply / 10 ** decimals,
"issued",
false
);
}
return balances;
};
}
const adapter: PeggedIssuanceAdapter = {
arbitrum: {
minted: chainMinted("arbitrum", 18),
unreleased: async () => ({}),
},
};
export default adapter;