Skip to content

Commit

Permalink
Allow to set the matching pool token & amount to be something other t…
Browse files Browse the repository at this point in the history
…han usd (#1517)

* Allow to set the matching pool token & amount to be something other than USD in adminjs

* Allow to set the matching pool token & amount to be something other than USD in QFRound table

* add null to allocatedTokenSymbol and allocatedTokenChainId

* add nullable true to allocatedTokenSymbol and allocatedTokenChainId
  • Loading branch information
RamRamez authored May 2, 2024
1 parent ef98b7a commit b6b4c46
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 22 deletions.
21 changes: 21 additions & 0 deletions migration/1714566501335-addTokenAndChainToQFRound.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddTokenAndChainToQFRound1714566501335
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE IF EXISTS "qf_round"
ADD COLUMN IF NOT EXISTS "allocatedTokenSymbol" text,
ADD COLUMN IF NOT EXISTS "allocatedTokenChainId" integer;
`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE IF EXISTS "qf_round"
DROP COLUMN "allocatedTokenSymbol",
DROP COLUMN "allocatedTokenChainId";
`);
}
}
8 changes: 8 additions & 0 deletions src/entities/qfRound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ export class QfRound extends BaseEntity {
@Column()
allocatedFund: number;

@Field(_type => String, { nullable: true })
@Column({ nullable: true })
allocatedTokenSymbol: string;

@Field(_type => Number, { nullable: true })
@Column({ nullable: true })
allocatedTokenChainId: number;

@Field(_type => Number)
@Column('real', { default: 0.2 })
maximumReward: number;
Expand Down
54 changes: 32 additions & 22 deletions src/server/adminJs/tabs/qfRoundTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,29 @@ const returnAllQfRoundDonationAnalysis = async (
};
};

const availableNetworkValues = [
{ value: NETWORK_IDS.MAIN_NET, label: 'MAINNET' },
{ value: NETWORK_IDS.ROPSTEN, label: 'ROPSTEN' },
{ value: NETWORK_IDS.GOERLI, label: 'GOERLI' },
{ value: NETWORK_IDS.POLYGON, label: 'POLYGON' },
{ value: NETWORK_IDS.OPTIMISTIC, label: 'OPTIMISTIC' },
{ value: NETWORK_IDS.ETC, label: 'ETC' },
{
value: NETWORK_IDS.MORDOR_ETC_TESTNET,
label: 'MORDOR ETC TESTNET',
},
{ value: NETWORK_IDS.OPTIMISM_SEPOLIA, label: 'OPTIMISM SEPOLIA' },
{ value: NETWORK_IDS.CELO, label: 'CELO' },
{
value: NETWORK_IDS.CELO_ALFAJORES,
label: 'ALFAJORES (Test CELO)',
},
{ value: NETWORK_IDS.ARBITRUM_MAINNET, label: 'ARBITRUM MAINNET' },
{ value: NETWORK_IDS.ARBITRUM_SEPOLIA, label: 'ARBITRUM SEPOLIA' },
{ value: NETWORK_IDS.XDAI, label: 'XDAI' },
{ value: NETWORK_IDS.BSC, label: 'BSC' },
];

export const qfRoundTab = {
resource: QfRound,
options: {
Expand Down Expand Up @@ -134,6 +157,14 @@ export const qfRoundTab = {
allocatedFund: {
isVisible: true,
},
allocatedTokenSymbol: {
isVisible: true,
},
allocatedTokenChainId: {
isVisible: true,
type: 'number',
availableValues: availableNetworkValues,
},
minimumPassportScore: {
isVisible: true,
},
Expand All @@ -143,28 +174,7 @@ export const qfRoundTab = {
eligibleNetworks: {
isVisible: true,
type: 'array',
availableValues: [
{ value: NETWORK_IDS.MAIN_NET, label: 'MAINNET' },
{ value: NETWORK_IDS.ROPSTEN, label: 'ROPSTEN' },
{ value: NETWORK_IDS.GOERLI, label: 'GOERLI' },
{ value: NETWORK_IDS.POLYGON, label: 'POLYGON' },
{ value: NETWORK_IDS.OPTIMISTIC, label: 'OPTIMISTIC' },
{ value: NETWORK_IDS.ETC, label: 'ETC' },
{
value: NETWORK_IDS.MORDOR_ETC_TESTNET,
label: 'MORDOR ETC TESTNET',
},
{ value: NETWORK_IDS.OPTIMISM_SEPOLIA, label: 'OPTIMISM SEPOLIA' },
{ value: NETWORK_IDS.CELO, label: 'CELO' },
{
value: NETWORK_IDS.CELO_ALFAJORES,
label: 'ALFAJORES (Test CELO)',
},
{ value: NETWORK_IDS.ARBITRUM_MAINNET, label: 'ARBITRUM MAINNET' },
{ value: NETWORK_IDS.ARBITRUM_SEPOLIA, label: 'ARBITRUM SEPOLIA' },
{ value: NETWORK_IDS.XDAI, label: 'XDAI' },
{ value: NETWORK_IDS.BSC, label: 'BSC' },
],
availableValues: availableNetworkValues,
},
projects: {
type: 'mixed',
Expand Down

0 comments on commit b6b4c46

Please sign in to comment.