-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add base chain #1579
Merged
Merged
Add base chain #1579
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c42bd24
Ignore small differences of amounts when matching draft donation for …
mohammadranjbarz 39c3e59
Release Integrate QF with super fluid streamed donations (#1555)
mohammadranjbarz 4799551
WIP add base network
mohammadranjbarz f03ab1f
Continue on integrating with base chain
mohammadranjbarz 197f7ea
Resolve merge conflicts
mohammadranjbarz bfcff65
Fix migrations
mohammadranjbarz 933111e
Fix migrations
mohammadranjbarz b48c030
Add test cases about filteriing base network
mohammadranjbarz e00842a
Add BASE node http urls for rpc
mohammadranjbarz 8895529
Add BASE node http urls for rpc
mohammadranjbarz 28cf3eb
Add missing things for integrating with base
mohammadranjbarz 38ac33f
Fix creating new token with coingeckoId
mohammadranjbarz dc7e7fb
Fill base mainnet tokens
mohammadranjbarz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,55 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
import { Token } from '../src/entities/token'; | ||
import seedTokens from './data/seedTokens'; | ||
import config from '../src/config'; | ||
import { NETWORK_IDS } from '../src/provider'; | ||
|
||
export class AddBaseChainTokens1716367359560 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const environment = config.get('ENVIRONMENT') as string; | ||
|
||
const networkId = | ||
environment === 'production' | ||
? NETWORK_IDS.BASE_MAINNET | ||
: NETWORK_IDS.BASE_SEPOLIA; | ||
|
||
await queryRunner.manager.save( | ||
Token, | ||
seedTokens | ||
.filter(token => token.networkId === networkId) | ||
.map(token => { | ||
const t = { | ||
...token, | ||
}; | ||
t.address = t.address?.toLowerCase(); | ||
delete t.chainType; | ||
return t; | ||
}), | ||
); | ||
const tokens = await queryRunner.query(` | ||
SELECT * FROM token | ||
WHERE "networkId" = ${networkId} | ||
`); | ||
const givethOrganization = ( | ||
await queryRunner.query(`SELECT * FROM organization | ||
WHERE label='giveth'`) | ||
)[0]; | ||
|
||
const traceOrganization = ( | ||
await queryRunner.query(`SELECT * FROM organization | ||
WHERE label='trace'`) | ||
)[0]; | ||
|
||
for (const token of tokens) { | ||
// Add all Base tokens to Giveth organization | ||
await queryRunner.query(`INSERT INTO organization_tokens_token ("tokenId","organizationId") VALUES | ||
(${token.id}, ${givethOrganization.id}), | ||
(${token.id}, ${traceOrganization.id}) | ||
;`); | ||
} | ||
} | ||
|
||
public async down(_queryRunner: QueryRunner): Promise<void> { | ||
// | ||
} | ||
Comment on lines
+52
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider implementing a rollback mechanism in the |
||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure proper transaction handling in the
up
method.Consider wrapping the database operations within a transaction to ensure atomicity. This is crucial for maintaining data integrity, especially in production environments.