diff --git a/README.md b/README.md old mode 100644 new mode 100755 index e0bd145..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. @@ -50,7 +53,7 @@ socialLinks: verified: true # default true, if a token violate verification policy then switch to false # the following fields are not required -# for `big number`, it's a big number with no decimals. For example, if your token has a max supply of 50,000,000 tokens and 6 decimals, the value needs to be 50000000 × 10^6 = 50000000000000 +# for `big number`, it's a big number with no decimals. For example, if your token has a max supply of 50,000,000 tokens with 6 decimals, the value needs to be 50000000 × 10^6 = 50000000000000 # for `URIs`, currently only URI which returns a big number (no decimals) are supported maxSupply: big number # or @@ -77,10 +80,10 @@ circulatingOnChain: - https://... - assetId -treasuryNft: assetId +treasuryOnChain: addr... ``` -Alternatively, create an issue with above information and our team will update accordingly. The pull request will be processed faster. +Alternatively, create an issue with above information and our team will update accordingly. However, please note that the pull request will be processed faster. Our team will verify and approve in first-in-first-out order. ## Usage diff --git a/src/adapters/blockFrostAdapter.ts b/src/adapters/blockFrostAdapter.ts old mode 100644 new mode 100755 index 457c019..587e52e --- a/src/adapters/blockFrostAdapter.ts +++ b/src/adapters/blockFrostAdapter.ts @@ -25,9 +25,4 @@ export class BlockFrostAdapter implements Adapter { const assetInfo = await this.blockFrost.assetsById(assetId); return BigInt(assetInfo?.quantity); } - - async getAmountInFirstAddressHoldingAsset(tokenId: string, nftId: string): Promise { - const addresses = await this.blockFrost.assetsAddresses(nftId); - return await this.getAmountInAddress(addresses[0]["address"], tokenId); - } } diff --git a/src/adapters/types.ts b/src/adapters/types.ts old mode 100644 new mode 100755 index 112c3ff..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 blockchain's point of view ascending order, this retrieve the amount associated with the first address returned. - * This function currently supports Shen and DJED. - * @param tokenId The token's policy ID. - * @param nftId The concatenation of token's policy ID and hex-coded token name. - */ - getAmountInFirstAddressHoldingAsset(tokenId: string, nftId: string): Promise; }; diff --git a/src/apis/marketcapApi.ts b/src/apis/marketcapApi.ts old mode 100644 new mode 100755 index f357cc6..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(tokenId, treasuryRaw); + const treasury = await this.adapter.getAmountInAddress(treasuryRaw, tokenId); return { total: formatNumber(total - treasury, decimals), circulating: formatNumber(total - treasury, decimals), diff --git a/src/apis/tokenApi.ts b/src/apis/tokenApi.ts index 7fcd6f6..4f6d1d1 100644 --- a/src/apis/tokenApi.ts +++ b/src/apis/tokenApi.ts @@ -14,7 +14,7 @@ export class TokenAPI { public async getToken(tokenId: string) { try { const __dirname = import.meta.dirname; - const filePath = path.join(__dirname, `${TOKENS_DIR}/${tokenId}.yaml`); + const filePath = path.join(__dirname, `../${TOKENS_DIR}/${tokenId}.yaml`); const tokenFileData = fs.readFileSync(filePath, "utf-8"); const tokenData: TokenMetadata = { tokenId, 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 4eb8bf3..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: 8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a6564537461626c65436f696e4e4654 - +treasuryOnChain: addr1zx82ru5f7p8ewhhdvahueg2s4gxs3gxl66fkygdekkjs74sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q4vpw0l diff --git a/src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344.yaml b/src/tokens/8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344.yaml old mode 100644 new mode 100755 index 4cd3ba2..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: 8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a6564537461626c65436f696e4e4654 - +treasuryOnChain: addr1zx82ru5f7p8ewhhdvahueg2s4gxs3gxl66fkygdekkjs74sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q4vpw0l