Skip to content

Commit

Permalink
Merge pull request #905 from Giveth/staging
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
mohammadranjbarz authored Mar 15, 2023
2 parents 313562f + 6e13387 commit 0f1189c
Show file tree
Hide file tree
Showing 32 changed files with 17,150 additions and 22,845 deletions.
7 changes: 7 additions & 0 deletions config/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ XDAI_NODE_HTTP_URL=https://xxxxxx.xdai.quiknode.pro/
ETHERSCAN_MAINNET_API_URL=https://api.etherscan.io/api
ETHERSCAN_ROPSTEN_API_URL=https://api-ropsten.etherscan.io/api
ETHERSCAN_GOERLI_API_URL=https://api-goerli.etherscan.io/api
POLYGON_SCAN_API_URL=https://api.polygonscan.com/api
POLYGON_SCAN_API_KEY=0000000000000000000000000000000000
GNOSISSCAN_API_URL=https://api.gnosisscan.io/api
ETHERSCAN_API_KEY=0000000000000000000000000000000000
GNOSISSCAN_API_KEY=0000000000000000000000000000000000
Expand Down Expand Up @@ -161,3 +163,8 @@ CHAINVINE_API_ENABLE_TEST_MODE=true

# We should not try to verify donaitons after some hours, because checking old donations would make lots of requests to web3 providers
DONATION_VERIFICAITON_EXPIRATION_HOURS=24


# OPTIONAL - This is the name of the service, it should be unique to monitor RPC node usage
# Default: unnamed
SERVICE_NAME=example
1 change: 1 addition & 0 deletions config/test.env
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ INFURA_ID=xxx
ETHERSCAN_MAINNET_API_URL=https://api.etherscan.io/api
ETHERSCAN_ROPSTEN_API_URL=https://api-ropsten.etherscan.io/api
ETHERSCAN_GOERLI_API_URL=https://api-goerli.etherscan.io/api
POLYGON_SCAN_API_URL=https://api.polygonscan.com/api
GNOSISSCAN_API_URL=https://api.gnosisscan.io/api
ETHERSCAN_API_KEY=00000000000000000000000000000000
GNOSISSCAN_API_KEY=0000000000000000000000000000000000
Expand Down
37 changes: 37 additions & 0 deletions migration/1677742523974-addPolygonTokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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';

// tslint:disable-next-line:class-name
export class addGoerliTokens1677742523974 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.manager.save(
Token,
seedTokens
.filter(token => token.networkId === NETWORK_IDS.POLYGON)
.map(t => {
t.address = t.address?.toLowerCase();
return t;
}),
);
const tokens = await queryRunner.query(`
SELECT * FROM token
WHERE "networkId" = ${NETWORK_IDS.POLYGON}
`);
const givethOrganization = (
await queryRunner.query(`SELECT * FROM organization
WHERE label='giveth'`)
)[0];

for (const token of tokens) {
// Add all Polygon tokens to Giveth organization
await queryRunner.query(`INSERT INTO organization_tokens_token ("tokenId","organizationId") VALUES
(${token.id}, ${givethOrganization.id})
;`);
}
}

async down(queryRunner: QueryRunner): Promise<void> {}
}
13 changes: 13 additions & 0 deletions migration/data/seedTokens.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { NETWORK_IDS } from '../../src/provider';

interface ITokenData {
name: string;
symbol: string;
address: string;
mainnetAddress?: string;
decimals: number;
networkId: number;
}
Expand Down Expand Up @@ -1030,6 +1033,16 @@ const seedTokens: ITokenData[] = [
decimals: 18,
networkId: 5,
},

// POLYGON tokens
{
name: 'POLYGON native token',
symbol: 'MATIC',
address: '0x0000000000000000000000000000000000000000',
decimals: 18,
mainnetAddress: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0',
networkId: NETWORK_IDS.POLYGON,
},
];

export default seedTokens;
Loading

0 comments on commit 0f1189c

Please sign in to comment.