Skip to content

Commit a63441e

Browse files
committed
feat: gating some tokens for singapore and dubai - win-5323
TICKET: WIN-5323
1 parent 9428e27 commit a63441e

File tree

4 files changed

+87
-7
lines changed

4 files changed

+87
-7
lines changed

modules/statics/src/account.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ export class AccountCoin extends BaseCoin {
6565
protected disallowedFeatures(): Set<CoinFeature> {
6666
return new Set<CoinFeature>([CoinFeature.UNSPENT_MODEL]);
6767
}
68+
69+
public static getFeaturesExcluding(excludedFeatures: CoinFeature[]): CoinFeature[] {
70+
return AccountCoin.DEFAULT_FEATURES.filter((feature) => !excludedFeatures.includes(feature));
71+
}
6872
}
6973

7074
export interface GasTankAccountConstructorOptions extends AccountConstructorOptions {

modules/statics/src/coins/avaxTokens.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { avaxErc20, tavaxErc20, AccountCoin } from '../account';
2-
import { UnderlyingAsset } from '../base';
1+
import { AccountCoin, avaxErc20, tavaxErc20 } from '../account';
2+
import { CoinFeature, UnderlyingAsset } from '../base';
33

44
export const avaxTokens = [
55
avaxErc20(
@@ -642,7 +642,8 @@ export const avaxTokens = [
642642
'NEXPACE',
643643
18,
644644
'0x5e0e90e268bc247cc850c789a0db0d5c7621fb59',
645-
UnderlyingAsset['avaxc:nxpc']
645+
UnderlyingAsset['avaxc:nxpc'],
646+
AccountCoin.getFeaturesExcluding([CoinFeature.CUSTODY_BITGO_CUSTODY_MENA_FZE, CoinFeature.CUSTODY_BITGO_MENA_FZE])
646647
),
647648
// End FTX missing AVAXC tokens
648649
tavaxErc20(

modules/statics/src/coins/erc20Coins.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10394,15 +10394,25 @@ export const erc20Coins = [
1039410394
'DecentralizedEURO',
1039510395
18,
1039610396
'0xba3f535bbcccca2a154b573ca6c5a49baae0a3ea',
10397-
UnderlyingAsset['eth:deuro']
10397+
UnderlyingAsset['eth:deuro'],
10398+
AccountCoin.getFeaturesExcluding([
10399+
CoinFeature.CUSTODY_BITGO_SINGAPORE,
10400+
CoinFeature.CUSTODY_BITGO_CUSTODY_MENA_FZE,
10401+
CoinFeature.CUSTODY_BITGO_MENA_FZE,
10402+
])
1039810403
),
1039910404
erc20(
1040010405
'ad73ed49-cbce-4809-a2e1-9d66c7f7a8d8',
1040110406
'eth:usdf',
1040210407
'Falcon USD',
1040310408
18,
1040410409
'0xfa2b947eec368f42195f24f36d2af29f7c24cec2',
10405-
UnderlyingAsset['eth:usdf']
10410+
UnderlyingAsset['eth:usdf'],
10411+
AccountCoin.getFeaturesExcluding([
10412+
CoinFeature.CUSTODY_BITGO_SINGAPORE,
10413+
CoinFeature.CUSTODY_BITGO_CUSTODY_MENA_FZE,
10414+
CoinFeature.CUSTODY_BITGO_MENA_FZE,
10415+
])
1040610416
),
1040710417
erc20(
1040810418
'f3ae12cd-6181-46af-9444-6acd605f123e',
@@ -10418,7 +10428,8 @@ export const erc20Coins = [
1041810428
'Gaia Token',
1041910429
18,
1042010430
'0x2ee7097bfdd98fce2ac08a1896038a7cd9aaed81',
10421-
UnderlyingAsset['eth:gaia']
10431+
UnderlyingAsset['eth:gaia'],
10432+
AccountCoin.getFeaturesExcluding([CoinFeature.CUSTODY_BITGO_CUSTODY_MENA_FZE, CoinFeature.CUSTODY_BITGO_MENA_FZE])
1042210433
),
1042310434
erc20(
1042410435
'5d3311f4-2f92-450a-9b7f-ac9a8fc62765',

modules/statics/test/unit/coins.ts

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,63 @@ const custodyFeatures: Record<string, { features: CoinFeature[] }> = {
586586
tbsc: { features: [CoinFeature.CUSTODY_BITGO_FRANKFURT, CoinFeature.BULK_TRANSACTION] },
587587
};
588588

589+
const coinsWithExcludedFeatures: Record<string, { features: CoinFeature[] }> = {
590+
'eth:deuro': {
591+
features: [
592+
CoinFeature.ACCOUNT_MODEL,
593+
CoinFeature.REQUIRES_BIG_NUMBER,
594+
CoinFeature.VALUELESS_TRANSFER,
595+
CoinFeature.TRANSACTION_DATA,
596+
CoinFeature.CUSTODY,
597+
CoinFeature.CUSTODY_BITGO_TRUST,
598+
CoinFeature.CUSTODY_BITGO_KOREA,
599+
CoinFeature.CUSTODY_BITGO_EUROPE_APS,
600+
CoinFeature.CUSTODY_BITGO_FRANKFURT,
601+
],
602+
},
603+
'eth:usdf': {
604+
features: [
605+
CoinFeature.ACCOUNT_MODEL,
606+
CoinFeature.REQUIRES_BIG_NUMBER,
607+
CoinFeature.VALUELESS_TRANSFER,
608+
CoinFeature.TRANSACTION_DATA,
609+
CoinFeature.CUSTODY,
610+
CoinFeature.CUSTODY_BITGO_TRUST,
611+
CoinFeature.CUSTODY_BITGO_KOREA,
612+
CoinFeature.CUSTODY_BITGO_EUROPE_APS,
613+
CoinFeature.CUSTODY_BITGO_FRANKFURT,
614+
],
615+
},
616+
'eth:gaia': {
617+
features: [
618+
CoinFeature.ACCOUNT_MODEL,
619+
CoinFeature.REQUIRES_BIG_NUMBER,
620+
CoinFeature.VALUELESS_TRANSFER,
621+
CoinFeature.TRANSACTION_DATA,
622+
CoinFeature.CUSTODY,
623+
CoinFeature.CUSTODY_BITGO_TRUST,
624+
CoinFeature.CUSTODY_BITGO_SINGAPORE,
625+
CoinFeature.CUSTODY_BITGO_KOREA,
626+
CoinFeature.CUSTODY_BITGO_EUROPE_APS,
627+
CoinFeature.CUSTODY_BITGO_FRANKFURT,
628+
],
629+
},
630+
'avaxc:nxpc': {
631+
features: [
632+
CoinFeature.ACCOUNT_MODEL,
633+
CoinFeature.REQUIRES_BIG_NUMBER,
634+
CoinFeature.VALUELESS_TRANSFER,
635+
CoinFeature.TRANSACTION_DATA,
636+
CoinFeature.CUSTODY,
637+
CoinFeature.CUSTODY_BITGO_TRUST,
638+
CoinFeature.CUSTODY_BITGO_SINGAPORE,
639+
CoinFeature.CUSTODY_BITGO_KOREA,
640+
CoinFeature.CUSTODY_BITGO_EUROPE_APS,
641+
CoinFeature.CUSTODY_BITGO_FRANKFURT,
642+
],
643+
},
644+
};
645+
589646
describe('CoinMap', function () {
590647
const btc = utxo(
591648
'5c1691c5-c9cc-49ed-abe0-c433dab2edaa',
@@ -687,7 +744,14 @@ coins.forEach((coin, coinName) => {
687744
coin.baseUnit.should.be.not.empty();
688745
});
689746

690-
if (featureList) {
747+
if (coinsWithExcludedFeatures.hasOwnProperty(coin.name)) {
748+
const features = coinsWithExcludedFeatures[coin.name].features;
749+
features.forEach((feature: CoinFeature) => {
750+
it(`should return true for ${feature} ${coin.family} coin feature`, () => {
751+
coin.features.includes(feature).should.eql(true);
752+
});
753+
});
754+
} else if (featureList) {
691755
featureList.features.forEach((feature: CoinFeature) => {
692756
it(`should return true for ${feature} ${coin.family} coin feature`, () => {
693757
coin.features.includes(feature).should.eql(true);

0 commit comments

Comments
 (0)