Skip to content

Commit

Permalink
add cross selling source tokens to config
Browse files Browse the repository at this point in the history
  • Loading branch information
adityajirafe committed Jun 3, 2024
1 parent 18348de commit 9afca6e
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/markets/pr_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Each json file under the [configs](../../configs) folder correspond to their res
|`perp_pool_banners` |`PerpPoolBanner` |true |List of Objects that indicate the banner content on specific perp pool pages. |
|`demex_points_config` |`DemexPointsConfig` |false |Object that contains the parameters to earn demex points. |This object **must be included** for mainnet.json as demex points is already live on mainnet. |
|`perp_pool_promo` |`PerpPoolPromo` |false |Map of Objects that contains perp pool promo parameters for each pool |If the `perp_pool_promo` property is omitted, no promo will be shown. The key of each entry is the ids of the perp pools with existing promo. |
|`cross_selling_source_tokens` |`string[]` |true |The array of cross selling source tokens. Acquiring these tokens on the spot market will trigger a help wizard, prompting users to borrow USDG and trade perps on Demex. |The token denoms listed here **MUST** match the token denoms listed under the Carbon [Tokens API](https://api.carbon.network/carbon/coin/v1/tokens?pagination.limit=10000). |

## Maintenance Data Structure
|Field |Type |Required |Description |Notes |
Expand Down
14 changes: 13 additions & 1 deletion config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"blacklisted_tokens",
"transfer_options",
"network_fees",
"perp_pool_banners"
"perp_pool_banners",
"cross_selling_source_tokens"
],
"properties": {
"network": {
Expand Down Expand Up @@ -157,6 +158,13 @@
}
}
}
},
"cross_selling_source_tokens": {
"type": "array",
"description": "List of cross selling source token denoms",
"items": {
"$ref": "#/$defs/cross_selling_source_token"
}
}
},
"$defs": {
Expand Down Expand Up @@ -225,6 +233,10 @@
"perpTradingBoost": {
"type": "integer",
"description": "The spin boost multiplier for boosted perp markets trading volume"
},
"cross_selling_source_token": {
"type": "string",
"description": "Cross selling source token denom"
}
}
}
3 changes: 2 additions & 1 deletion configs/devnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"usdc": 1,
"eth": 2
},
"perp_pool_banners": []
"perp_pool_banners": [],
"cross_selling_source_tokens": []
}
3 changes: 2 additions & 1 deletion configs/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,6 @@
"perpPoolDepositBoost": 2,
"perpTradingBoost": 3
}
}
},
"cross_selling_source_tokens": ["swth"]
}
3 changes: 2 additions & 1 deletion configs/testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
"symbol": "1000PEPE"
}
}
}
},
"cross_selling_source_tokens": ["swth"]
}
33 changes: 24 additions & 9 deletions scripts/check_configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ interface ConfigJSON {
demex_points_config: DemexPointsConfig,
perp_pool_promo: {
[perpPoolId: string]: PerpPoolPromo,
}
},
cross_selling_source_tokens: string[];
}

interface InvalidEntry {
Expand Down Expand Up @@ -234,17 +235,31 @@ async function main() {
});
const tokens: string[] = allTokens.tokens.map(token => token.denom);

const hasInvalidTokens = checkValidEntries(jsonData.blacklisted_tokens, tokens);
if (hasInvalidTokens.status && hasInvalidTokens.entry) {
let listOfInvalidTokens: string = hasInvalidTokens.entry.join(', ');
console.error(`ERROR: ${network}.json has the following invalid token denom entries: ${listOfInvalidTokens}. Please make sure to only input valid token denom in ${network}`);
const hasInvalidBlacklistedTokens = checkValidEntries(jsonData.blacklisted_tokens, tokens);
if (hasInvalidBlacklistedTokens.status && hasInvalidBlacklistedTokens.entry) {
let listOfInvalidTokens: string = hasInvalidBlacklistedTokens.entry.join(', ');
console.error(`ERROR: ${network}.json has the following invalid blacklisted token denom entries: ${listOfInvalidTokens}. Please make sure to only input valid token denom in ${network}`);
outcomeMap[network] = false;
}

const hasDuplicateBlacklistedTokens = checkDuplicateEntries(jsonData.blacklisted_tokens);
if (hasDuplicateBlacklistedTokens.status && hasDuplicateBlacklistedTokens.entry) {
let listOfDuplicates: string = hasDuplicateBlacklistedTokens.entry.join(", ");
console.error(`ERROR: ${network}.json has the following duplicated blacklisted token denom entries: ${listOfDuplicates}. Please make sure to input each token denom only once in ${network}`);
outcomeMap[network] = false;
}

const hasInvalidCrossSellingTokens = checkValidEntries(jsonData.cross_selling_source_tokens, tokens);
if (hasInvalidCrossSellingTokens.status && hasInvalidCrossSellingTokens.entry) {
let listOfInvalidTokens: string = hasInvalidCrossSellingTokens.entry.join(', ');
console.error(`ERROR: ${network}.json has the following invalid cross selling source token denom entries: ${listOfInvalidTokens}. Please make sure to only input valid token denom in ${network}`);
outcomeMap[network] = false;
}

const hasDuplicateTokens = checkDuplicateEntries(jsonData.blacklisted_tokens);
if (hasDuplicateTokens.status && hasDuplicateTokens.entry) {
let listOfDuplicates: string = hasDuplicateTokens.entry.join(", ");
console.error(`ERROR: ${network}.json has the following duplicated token denom entries: ${listOfDuplicates}. Please make sure to input each token denom only once in ${network}`);
const hasDuplicateCrossSellingTokens = checkDuplicateEntries(jsonData.cross_selling_source_tokens);
if (hasDuplicateCrossSellingTokens.status && hasDuplicateCrossSellingTokens.entry) {
let listOfDuplicates: string = hasDuplicateCrossSellingTokens.entry.join(", ");
console.error(`ERROR: ${network}.json has the following duplicated cross selling source token denom entries: ${listOfDuplicates}. Please make sure to input each token denom only once in ${network}`);
outcomeMap[network] = false;
}

Expand Down

0 comments on commit 9afca6e

Please sign in to comment.