From 48f34146481d0c737fb630f3897bb1b742fbfbfb Mon Sep 17 00:00:00 2001 From: rinchan01 Date: Mon, 2 Dec 2024 14:33:19 +0700 Subject: [PATCH] update files and apis for tokens with treasuryOnChain --- README.md | 9 ++++++--- src/adapters/blockFrostAdapter.ts | 4 ---- src/adapters/types.ts | 9 --------- src/apis/marketcapApi.ts | 8 ++++---- src/tokenSchema.ts | 2 +- ...87c819f1056206e879a1cd61446a65644d6963726f555344.yaml | 5 ++--- ...87c819f1056206e879a1cd615368656e4d6963726f555344.yaml | 5 ++--- 7 files changed, 15 insertions(+), 27 deletions(-) mode change 100644 => 100755 README.md mode change 100644 => 100755 src/adapters/blockFrostAdapter.ts mode change 100644 => 100755 src/adapters/types.ts mode change 100644 => 100755 src/apis/marketcapApi.ts mode change 100644 => 100755 src/tokenSchema.ts mode change 100644 => 100755 src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344.yaml mode change 100644 => 100755 src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344.yaml diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 77f76bb..cf2db6b --- a/README.md +++ b/README.md @@ -8,21 +8,24 @@ As of latest update, we consider `circulating = maxSupply - treasury - burn` and In cases where `circulatingOnChain` is provided directly according to the asset's quantity on-chain or through external APIs, the `circulating` is the value of `circulatingOnChain`. -For tokens providing with `treasuryNft`, the `circulating` is the quantity of the address containing the assets. In default, the amount is retrieved from the oldest address from the blockchain's point of view. +For tokens providing with `treasuryOnChain`, the `circulating` is the quantity of the address containing the assets. In default, the amount is retrieved from the oldest address from the blockchain's point of view. ## How to add my token + ### Requirements + As token verification prerequisites, ensure your token has: + - A pool with at least **1000 ADA TVL**, - A post of your policy ID on Twitter or your policy ID displayed on your landing page, - A logo added in the [Cardano Token Registry](https://github.com/cardano-foundation/cardano-token-registry) or CIP-68 metadata. For tokens to be verified: + 1. Create a transaction transfer **100 ADA** to Minswap wallet receiving token verification fee below. This fee appears as the cost for lifetime maintain this repository. 2. Metadata includes: **the last 4 numbers of asset's policyId and asset's ticker** (for example, Verify 70c6 MIN). 3. Attach the transaction hash to a comment in the yaml file pull request (instructions below). - Minswap wallet receiving token verification fee: `addr1q85g6fkwzr2cf984qdmntqthl3yxnw4pst4mpgeyygdlnehqlcgwvr6c9vmajz96vnmmset3earqt5wl0keg0kw60eysdgwnej` Any token that has been verified does **not** meet the requirements in the future would still be unverified. @@ -77,7 +80,7 @@ circulatingOnChain: - https://... - assetId -treasuryNft: addr... +treasuryOnChain: addr... ``` Alternatively, create an issue with above information and our team will update accordingly. However, please note that the pull request will be processed faster. diff --git a/src/adapters/blockFrostAdapter.ts b/src/adapters/blockFrostAdapter.ts old mode 100644 new mode 100755 index 3650a5c..587e52e --- a/src/adapters/blockFrostAdapter.ts +++ b/src/adapters/blockFrostAdapter.ts @@ -25,8 +25,4 @@ export class BlockFrostAdapter implements Adapter { const assetInfo = await this.blockFrost.assetsById(assetId); return BigInt(assetInfo?.quantity); } - - async getAmountInFirstAddressHoldingAsset(address: string, tokenId: string): Promise { - return await this.getAmountInAddress(address, tokenId); - } } diff --git a/src/adapters/types.ts b/src/adapters/types.ts old mode 100644 new mode 100755 index f8a4614..36d1ba4 --- a/src/adapters/types.ts +++ b/src/adapters/types.ts @@ -15,13 +15,4 @@ export type Adapter = { * @param assetId The concatenation of token's policy ID and the hex-coded token name. */ getOnchainAmountOfAsset(assetId: string): Promise; - - /** - * Get the amount held in the address holding a specific asset by the asset's ID. - * After obtaining a list of addresses possessing a specific asset in ascending order from the blockchain's point of view, this retrieve the amount associated with the first address returned. - * This function currently supports Shen and DJED. - * @param address The first address holding the asset returned in ascending order from the blockchain's point of view. - * @param tokenId The concatenation of token's policy ID and hex-coded token name. - */ - getAmountInFirstAddressHoldingAsset(address: string, tokenId: string): Promise; }; diff --git a/src/apis/marketcapApi.ts b/src/apis/marketcapApi.ts old mode 100644 new mode 100755 index d1ea0cc..fa7d56b --- a/src/apis/marketcapApi.ts +++ b/src/apis/marketcapApi.ts @@ -40,16 +40,16 @@ export class MarketCapAPI { return nullResponse; } - if (!tokenInfo.circulatingOnChain && !tokenInfo.burn && !tokenInfo.treasury && !tokenInfo.treasuryNft) { + if (!tokenInfo.circulatingOnChain && !tokenInfo.burn && !tokenInfo.treasury && !tokenInfo.treasuryOnChain) { return { total: formatNumber(total, decimals), }; } - if (tokenInfo.treasuryNft) { - const treasuryRaw = tokenInfo.treasuryNft; + if (tokenInfo.treasuryOnChain) { + const treasuryRaw = tokenInfo.treasuryOnChain; - const treasury = await this.adapter.getAmountInFirstAddressHoldingAsset(treasuryRaw, tokenId); + const treasury = await this.adapter.getAmountInAddress(treasuryRaw, tokenId); return { total: formatNumber(total - treasury, decimals), circulating: formatNumber(total - treasury, decimals), diff --git a/src/tokenSchema.ts b/src/tokenSchema.ts old mode 100644 new mode 100755 index a701790..aa41467 --- a/src/tokenSchema.ts +++ b/src/tokenSchema.ts @@ -128,7 +128,7 @@ export const tokenSchema: JSONSchemaType = { }, nullable: true, }, - treasuryNft: { + treasuryOnChain: { type: "string", nullable: true, }, diff --git a/src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344.yaml b/src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344.yaml old mode 100644 new mode 100755 index 2f14082..b9157fe --- a/src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344.yaml +++ b/src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344.yaml @@ -9,9 +9,8 @@ socialLinks: verified: true -maxSupply: '1000000000000000000' +maxSupply: "1000000000000000000" decimals: 6 -treasuryNft: addr1zx82ru5f7p8ewhhdvahueg2s4gxs3gxl66fkygdekkjs74sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q4vpw0l - +treasuryOnChain: addr1zx82ru5f7p8ewhhdvahueg2s4gxs3gxl66fkygdekkjs74sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q4vpw0l diff --git a/src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344.yaml b/src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344.yaml old mode 100644 new mode 100755 index 62f4f0a..df48143 --- a/src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344.yaml +++ b/src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344.yaml @@ -9,9 +9,8 @@ socialLinks: verified: true -maxSupply: '1000000000000000000' +maxSupply: "1000000000000000000" decimals: 6 -treasuryNft: addr1zx82ru5f7p8ewhhdvahueg2s4gxs3gxl66fkygdekkjs74sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q4vpw0l - +treasuryOnChain: addr1zx82ru5f7p8ewhhdvahueg2s4gxs3gxl66fkygdekkjs74sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q4vpw0l