mirror of
https://github.com/alexgo-io/peggedassets-server.git
synced 2026-04-29 04:05:15 +08:00
arb-knox-dollar
This commit is contained in:
@@ -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";
|
||||
|
||||
56
src/adapters/peggedAssets/knox-dollar/index.ts
Normal file
56
src/adapters/peggedAssets/knox-dollar/index.ts
Normal 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;
|
||||
Reference in New Issue
Block a user