forked from Giveth/impact-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from GeneralMagicio/supportMATICToken
Support matic token
- Loading branch information
Showing
5 changed files
with
72 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
import { NETWORK_IDS } from '../src/provider'; | ||
import { Token } from '../src/entities/token'; | ||
|
||
const tokens = [ | ||
{ | ||
name: 'Matic Token', | ||
symbol: 'MATIC', | ||
decimals: 18, | ||
address: '0xa2036f0538221a77a3937f1379699f44945018d0', | ||
coingeckoId: 'matic-network', | ||
networkId: NETWORK_IDS.ZKEVM_MAINNET, | ||
}, | ||
]; | ||
|
||
export class SeedTokens1725326426460 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.manager.save(Token, tokens); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
for (const token of tokens) { | ||
await queryRunner.query( | ||
` | ||
DELETE FROM "token" | ||
WHERE "address" = $1 | ||
AND "networkId" = $2; | ||
`, | ||
[token.address, token.networkId], | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters