mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
feat: Load default ERC20 Tokens for existing ETH and Polygon Wallets (#2274)
This commit is contained in:
parent
bc52cf485e
commit
c12daced40
8 changed files with 24 additions and 9 deletions
|
@ -31,6 +31,13 @@ class DefaultPolygonErc20Tokens {
|
|||
decimal: 6,
|
||||
enabled: true,
|
||||
),
|
||||
Erc20Token(
|
||||
name: "Decentralized Euro",
|
||||
symbol: "DEURO",
|
||||
contractAddress: "0xC2ff25dD99e467d2589b2c26EDd270F220F14E47",
|
||||
decimal: 18,
|
||||
enabled: true,
|
||||
),
|
||||
Erc20Token(
|
||||
name: "Avalanche Token",
|
||||
symbol: "AVAX",
|
||||
|
|
|
@ -41,11 +41,14 @@ class PolygonWallet extends EVMChainWallet {
|
|||
}
|
||||
|
||||
@override
|
||||
void addInitialTokens() {
|
||||
void addInitialTokens([bool isMigration = false]) {
|
||||
final initialErc20Tokens = DefaultPolygonErc20Tokens().initialPolygonErc20Tokens;
|
||||
|
||||
for (var token in initialErc20Tokens) {
|
||||
evmChainErc20TokensBox.put(token.contractAddress, token);
|
||||
for (final token in initialErc20Tokens) {
|
||||
if (!evmChainErc20TokensBox.containsKey(token.contractAddress)) {
|
||||
if (isMigration) token.enabled = false;
|
||||
evmChainErc20TokensBox.put(token.contractAddress, token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ class PolygonWalletService extends EVMChainWalletService<PolygonWallet> {
|
|||
);
|
||||
|
||||
await wallet.init();
|
||||
wallet.addInitialTokens(true);
|
||||
await wallet.save();
|
||||
saveBackup(name);
|
||||
return wallet;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue