Skip to content

Commit

Permalink
update files and apis for tokens with treasuryOnChain
Browse files Browse the repository at this point in the history
  • Loading branch information
rinchan01 committed Dec 2, 2024
1 parent 0621244 commit 48f3414
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 27 deletions.
9 changes: 6 additions & 3 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions src/adapters/blockFrostAdapter.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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<bigint> {
return await this.getAmountInAddress(address, tokenId);
}
}
9 changes: 0 additions & 9 deletions src/adapters/types.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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<bigint>;

/**
* 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<bigint>;
};
8 changes: 4 additions & 4 deletions src/apis/marketcapApi.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/tokenSchema.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const tokenSchema: JSONSchemaType<TokenMetadata> = {
},
nullable: true,
},
treasuryNft: {
treasuryOnChain: {
type: "string",
nullable: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ socialLinks:

verified: true

maxSupply: '1000000000000000000'
maxSupply: "1000000000000000000"

decimals: 6

treasuryNft: addr1zx82ru5f7p8ewhhdvahueg2s4gxs3gxl66fkygdekkjs74sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q4vpw0l

treasuryOnChain: addr1zx82ru5f7p8ewhhdvahueg2s4gxs3gxl66fkygdekkjs74sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q4vpw0l
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ socialLinks:

verified: true

maxSupply: '1000000000000000000'
maxSupply: "1000000000000000000"

decimals: 6

treasuryNft: addr1zx82ru5f7p8ewhhdvahueg2s4gxs3gxl66fkygdekkjs74sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q4vpw0l

treasuryOnChain: addr1zx82ru5f7p8ewhhdvahueg2s4gxs3gxl66fkygdekkjs74sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q4vpw0l

0 comments on commit 48f3414

Please sign in to comment.