Skip to content

Commit

Permalink
Merge pull request #363 from ElliotFriend/add-stellar-vnx
Browse files Browse the repository at this point in the history
Add relevant VNX assets on the Stellar network
  • Loading branch information
realdealshaman authored Jul 18, 2024
2 parents c8f3e6f + 061e2c1 commit bbc220b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/adapters/peggedAssets/vnx-euro/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
PeggedIssuanceAdapter, ChainContracts,
} from "../peggedAsset.type";
import { getTotalSupply as tezosGetTotalSupply } from "../helper/tezos";
import { getTotalSupply as stellarGetTotalSupply } from "../helper/stellar";


const chainContracts: ChainContracts = {
Expand All @@ -28,6 +29,9 @@ const chainContracts: ChainContracts = {
tezos: {
issued: ["KT1FenS7BCUjn1otfFyfrfxguiGnL4UTF3aG"],
},
stellar: {
issued: ["VEUR:GDXLSLCOPPHTWOQXLLKSVN4VN3G67WD2ENU7UMVAROEYVJLSPSEWXIZN"],
},
};

async function chainMinted(chain: string, decimals: number) {
Expand Down Expand Up @@ -71,6 +75,19 @@ async function tezosMinted(contract: string) {
};
}

async function stellarMinted(assetID: string) {
return async function (
_timestamp: number,
_ethBlock: number,
_chainBlocks: ChainBlocks
) {
let balances = {} as Balances;
const totalSupply = await stellarGetTotalSupply(assetID);
sumSingleBalance(balances, "peggedEUR", totalSupply, "issued", false);
return balances;
};
}

const adapter: PeggedIssuanceAdapter = {
ethereum: {
minted: chainMinted("ethereum", 18),
Expand All @@ -90,6 +107,9 @@ const adapter: PeggedIssuanceAdapter = {
tezos: {
minted: tezosMinted(chainContracts.tezos.issued[0]),
},
stellar: {
minted: stellarMinted(chainContracts.stellar.issued[0]),
},
};

export default adapter;
20 changes: 20 additions & 0 deletions src/adapters/peggedAssets/vnx-swiss-franc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
PeggedIssuanceAdapter, ChainContracts,
} from "../peggedAsset.type";
import { getTotalSupply as tezosGetTotalSupply } from "../helper/tezos";
import { getTotalSupply as stellarGetTotalSupply } from "../helper/stellar";


const chainContracts: ChainContracts = {
Expand All @@ -28,6 +29,9 @@ const chainContracts: ChainContracts = {
tezos: {
issued: ["KT1LssxZqfQtRFv1CRkzX9E9gzap9iFrtWmq"],
},
stellar: {
issued: ["VCHF:GDXLSLCOPPHTWOQXLLKSVN4VN3G67WD2ENU7UMVAROEYVJLSPSEWXIZN"],
},
};

async function chainMinted(chain: string, decimals: number) {
Expand Down Expand Up @@ -71,6 +75,19 @@ async function tezosMinted(contract: string) {
};
}

async function stellarMinted(assetID: string) {
return async function (
_timestamp: number,
_ethBlock: number,
_chainBlocks: ChainBlocks
) {
let balances = {} as Balances;
const totalSupply = await stellarGetTotalSupply(assetID);
sumSingleBalance(balances, "peggedCHF", totalSupply, "issued", false);
return balances;
};
}

const adapter: PeggedIssuanceAdapter = {
ethereum: {
minted: chainMinted("ethereum", 18),
Expand All @@ -90,5 +107,8 @@ const adapter: PeggedIssuanceAdapter = {
tezos: {
minted: tezosMinted(chainContracts.tezos.issued[0]),
},
stellar: {
minted: stellarMinted(chainContracts.stellar.issued[0]),
},
};
export default adapter;

0 comments on commit bbc220b

Please sign in to comment.