diff --git a/src/adapters/peggedAssets/glo-dollar/index.ts b/src/adapters/peggedAssets/glo-dollar/index.ts index 7fdd46e6..262b8f35 100644 --- a/src/adapters/peggedAssets/glo-dollar/index.ts +++ b/src/adapters/peggedAssets/glo-dollar/index.ts @@ -1,4 +1,13 @@ -const chainContracts = { +import { addChainExports } from "../helper/getSupply"; +import { sumSingleBalance } from "../helper/generalUtil"; +import { + Balances, + ChainBlocks, + PeggedIssuanceAdapter, ChainContracts, +} from "../peggedAsset.type"; +import { getTotalSupply as stellarGetTotalSupply } from "../helper/stellar"; + +const chainContracts: ChainContracts = { ethereum: { issued: ["0x4F604735c1cF31399C6E711D5962b2B3E0225AD3"], }, @@ -19,6 +28,24 @@ const chainContracts = { }, } -import { addChainExports } from "../helper/getSupply"; -const adapter = addChainExports(chainContracts); +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, "peggedUSD", totalSupply, "issued", false); + return balances; + }; +} + +const adapter: PeggedIssuanceAdapter = { + ...addChainExports(chainContracts), + stellar: { + minted: stellarMinted("USDGLO:GBBS25EGYQPGEZCGCFBKG4OAGFXU6DSOQBGTHELLJT3HZXZJ34HWS6XV"), + }, +}; + export default adapter;