Skip to content

Commit

Permalink
Merge pull request #149 from Define101/master
Browse files Browse the repository at this point in the history
Draft PR adding support UAH
  • Loading branch information
Define101 authored Oct 4, 2023
2 parents 923d959 + 4d0ce99 commit 7a0e4cc
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/adapters/peggedAssets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ import prismamkusd from './prisma-mkusd';
import lcny from './alternity-cny';
import nexus1 from './nexus';
import usdy from './ondo-us-dollar-yield';
import svusd from './savvy-usd'
import svusd from './savvy-usd';
import uaht from './uaht'

export default {
tether,
Expand Down Expand Up @@ -259,5 +260,6 @@ export default {
"alternity-cny": lcny,
"nexus1": nexus1,
"ondo-us-dollar-yield": usdy,
"savvy-usd": svusd
"savvy-usd": svusd,
uaht
};
2 changes: 1 addition & 1 deletion src/adapters/peggedAssets/peggedAsset.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export type ChainBlocks = {
[x: string]: number;
};

export type PeggedAssetType = "peggedUSD" | "peggedVAR" | "peggedEUR" | "peggedSGD" | "peggedJPY" | "peggedCNY";
export type PeggedAssetType = "peggedUSD" | "peggedVAR" | "peggedEUR" | "peggedSGD" | "peggedJPY" | "peggedCNY" | "peggedUAH";

type StringNumber = string;
type PeggedBalances = {
Expand Down
50 changes: 50 additions & 0 deletions src/adapters/peggedAssets/uaht/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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 = {
polygon: {
issued: ["0x0d9447e16072b636b4a1e8f2b8c644e58f3eaa6a"],
},
};

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, "peggedUAH", totalSupply / 10 ** decimals, "issued", false);
}
return balances;
};
}

const adapter: PeggedIssuanceAdapter = {
polygon: {
minted: chainMinted("polygon", 2),
unreleased: async () => ({}),
},
};

export default adapter;
20 changes: 20 additions & 0 deletions src/peggedData/peggedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2616,4 +2616,24 @@ export default [
twitter: "https://twitter.com/SavvyDefi",
wiki: "https://app.savvydefi.io/dashboard",
},
{
id: "131",
name: "UAHT",
address: "0x0D9447E16072b636b4a1E8f2b8C644e58F3eaA6A",
symbol: "UAHT",
url: "https://uaht.io",
description:
"Welcome to the platform where people matter.",
mintRedeemDescription:
"UAHT is pegged to UAH Ukraine Currency",
onCoinGecko: "true",
gecko_id: "uaht",
cmcId: null,
pegType: "peggedUAH",
pegMechanism: "fiat-backed",
priceSource: "coingecko",
auditLinks: null,
twitter: "https://twitter.com/starscrowding",
wiki: "https://github.com/starscrowding/UAHT#readme",
},
] as PeggedAsset[];
4 changes: 3 additions & 1 deletion src/peggedData/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ type PegType =
| "peggedEUR"
| "peggedSGD"
| "peggedJPY"
| "peggedCNY";
| "peggedCNY"
"peggedUAH";

type PegMechanism = "algorithmic" | "fiat-backed" | "crypto-backed";
export type PriceSource =
| "chainlink"
Expand Down

0 comments on commit 7a0e4cc

Please sign in to comment.