Skip to content

Commit

Permalink
feat(platforms): update gtc staking levels (#1326)
Browse files Browse the repository at this point in the history
  • Loading branch information
chibie authored Jun 5, 2023
1 parent 64e4ef9 commit 0b7cd32
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 72 deletions.
2 changes: 1 addition & 1 deletion platforms/src/GtcStaking/App-Bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class GTCStakingPlatform implements Platform {

banner = {
heading:
"During a live Gitcoin Grants Round, you can connect your wallet to verify your staked GTC amount. If you haven't staked yet, you can follow this link to do so.",
"You can connect your wallet to verify your staked GTC amount. Using Identity staking your GTC will be locked for up to 90 days and then can be un-staked or re-staked at that time. If you haven't staked yet, you can follow this link to do so.",
cta: {
label: "Go to Identity Staking",
url: "https://www.staking.passport.gitcoin.co/",
Expand Down
12 changes: 6 additions & 6 deletions platforms/src/GtcStaking/Providers-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ export const ProviderConfig: PlatformGroupSpec[] = [
{
platformGroup: "Self GTC Staking",
providers: [
{ title: "1 GTC (Bronze)", name: "SelfStakingBronze" },
{ title: "10 GTC (Silver)", name: "SelfStakingSilver" },
{ title: "100 GTC (Gold)", name: "SelfStakingGold" },
{ title: "5 GTC (Bronze)", name: "SelfStakingBronze" },
{ title: "20 GTC (Silver)", name: "SelfStakingSilver" },
{ title: "125 GTC (Gold)", name: "SelfStakingGold" },
],
},
{
platformGroup: "Community GTC Staking",
providers: [
{ title: "1 GTC (Bronze)", name: "CommunityStakingBronze" },
{ title: "10 GTC (Silver)", name: "CommunityStakingSilver" },
{ title: "100 GTC (Gold)", name: "CommunityStakingGold" },
{ title: "5 GTC (Bronze)", name: "CommunityStakingBronze" },
{ title: "20 GTC (Silver)", name: "CommunityStakingSilver" },
{ title: "125 GTC (Gold)", name: "CommunityStakingGold" },
],
},
];
Expand Down
24 changes: 12 additions & 12 deletions platforms/src/GtcStaking/Providers/communityStaking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function verifyStake(payload: RequestPayload): Promise<StakeResponse> {
}

// Export a Community Staking Bronze Stamp provider
// User's community stake must be greater than or equal to 1 GTC
// User's community stake must be greater than or equal to 5 GTC
export class CommunityStakingBronzeProvider implements Provider {
// Give the provider a type so that we can select it with a payload
type = "CommunityStakingBronze";
Expand All @@ -99,15 +99,15 @@ export class CommunityStakingBronzeProvider implements Provider {
try {
const stakeData = await verifyStake(payload);
const stakeAmount = stakeData.totalAmountStaked;
valid = stakeAmount >= 1.0;
valid = stakeAmount >= 5.0;

return {
valid,
record: valid
? {
address: stakeData.address,
// csgte1 = Community staking greater than or equal to 1
stakeAmount: "csgte1",
// csgte5 = Community staking greater than or equal to 5
stakeAmount: "csgte5",
}
: {},
};
Expand All @@ -121,7 +121,7 @@ export class CommunityStakingBronzeProvider implements Provider {
}

// Export a Community Staking Silver Stamp provider
// User's community stake must be greater than or equal to 10 GTC
// User's community stake must be greater than or equal to 20 GTC
export class CommunityStakingSilverProvider implements Provider {
// Give the provider a type so that we can select it with a payload
type = "CommunityStakingSilver";
Expand All @@ -140,15 +140,15 @@ export class CommunityStakingSilverProvider implements Provider {
const stakeData = await verifyStake(payload);
const stakeAmount = stakeData.totalAmountStaked;

valid = stakeAmount >= 10.0;
valid = stakeAmount >= 20.0;

return {
valid,
record: valid
? {
address: stakeData.address,
// csgte10 = Community staking greater or equal than 10
stakeAmount: "csgte10",
// csgte20 = Community staking greater or equal than 20
stakeAmount: "csgte20",
}
: {},
};
Expand All @@ -162,7 +162,7 @@ export class CommunityStakingSilverProvider implements Provider {
}

// Export a Community Staking Bronze Stamp provider
// User's community stake must be greater than or equal to 100 GTC
// User's community stake must be greater than or equal to 125 GTC
export class CommunityStakingGoldProvider implements Provider {
// Give the provider a type so that we can select it with a payload
type = "CommunityStakingGold";
Expand All @@ -180,15 +180,15 @@ export class CommunityStakingGoldProvider implements Provider {
try {
const stakeData = await verifyStake(payload);
const stakeAmount = stakeData.totalAmountStaked;
valid = stakeAmount >= 100.0;
valid = stakeAmount >= 125.0;

return {
valid: valid,
record: valid
? {
address: stakeData.address,
// csgt100 = Community staking greater than or equal to 100
stakeAmount: "csgte100",
// csgt125 = Community staking greater than or equal to 125
stakeAmount: "csgte125",
}
: {},
};
Expand Down
24 changes: 12 additions & 12 deletions platforms/src/GtcStaking/Providers/selfStaking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function verifyStake(payload: RequestPayload): Promise<StakeResponse> {
}

// Export a Self Staking Bronze Stamp provider
// User's self stake must be greater than 1 GTC
// User's self stake must be greater than 5 GTC
export class SelfStakingBronzeProvider implements Provider {
// Give the provider a type so that we can select it with a payload
type = "SelfStakingBronze";
Expand All @@ -99,15 +99,15 @@ export class SelfStakingBronzeProvider implements Provider {
const stakeData = await verifyStake(payload);
const stakeAmount = stakeData.stakeAmount;

valid = stakeAmount >= 1.0;
valid = stakeAmount >= 5.0;

return {
valid,
record: valid
? {
address: payload.address,
// ssgt1 = Self staking greater than or equal to 1
stakeAmount: "ssgte1",
// ssgt5 = Self staking greater than or equal to 5
stakeAmount: "ssgte5",
}
: {},
};
Expand All @@ -121,7 +121,7 @@ export class SelfStakingBronzeProvider implements Provider {
}

// Export a Self Staking Silver Stamp provider
// User's self stake must be greater than or equal to 10 GTC
// User's self stake must be greater than or equal to 20 GTC
export class SelfStakingSilverProvider implements Provider {
// Give the provider a type so that we can select it with a payload
type = "SelfStakingSilver";
Expand All @@ -140,15 +140,15 @@ export class SelfStakingSilverProvider implements Provider {
const stakeData = await verifyStake(payload);
const stakeAmount = stakeData.stakeAmount;

valid = stakeAmount >= 10.0;
valid = stakeAmount >= 20.0;

return {
valid,
record: valid
? {
address: payload.address,
// ssgt10 = Self staking greater than or equal 10
stakeAmount: "ssgte10",
// ssgt20 = Self staking greater than or equal 20
stakeAmount: "ssgte20",
}
: {},
};
Expand All @@ -162,7 +162,7 @@ export class SelfStakingSilverProvider implements Provider {
}

// Export a Self Staking Gold Stamp provider
// User's self stake must be greater than or equal to 100 GTC
// User's self stake must be greater than or equal to 125 GTC
export class SelfStakingGoldProvider implements Provider {
// Give the provider a type so that we can select it with a payload
type = "SelfStakingGold";
Expand All @@ -181,15 +181,15 @@ export class SelfStakingGoldProvider implements Provider {
const stakeData = await verifyStake(payload);
const stakeAmount = stakeData.stakeAmount;

valid = stakeAmount >= 100.0;
valid = stakeAmount >= 125.0;

return {
valid,
record: valid
? {
address: payload.address,
// ssgt100 = Self staking greater than or equal to 100
stakeAmount: "ssgte100",
// ssgt125 = Self staking greater than or equal to 125
stakeAmount: "ssgte125",
}
: {},
};
Expand Down
42 changes: 21 additions & 21 deletions platforms/src/GtcStaking/__tests__/communityStaking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe("Attempt verification", function () {
valid: true,
record: {
address: MOCK_ADDRESS_LOWER,
stakeAmount: "csgte1",
stakeAmount: "csgte5",
},
});
});
Expand Down Expand Up @@ -166,7 +166,7 @@ describe("should return invalid payload", function () {
beforeEach(() => {
jest.clearAllMocks();
});
it("when stake amount is below 1 GTC for Bronze", async () => {
it("when stake amount is below 5 GTC for Bronze", async () => {
jest.clearAllMocks();
mockedAxiosPost.mockImplementation(async () => {
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "500000000");
Expand All @@ -180,7 +180,7 @@ describe("should return invalid payload", function () {

expect(communitystakingPayload).toMatchObject({ valid: false });
});
it("when stake amount is below 10 GTC for Silver", async () => {
it("when stake amount is below 20 GTC for Silver", async () => {
jest.clearAllMocks();
mockedAxiosPost.mockImplementation(async () => {
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "5000000000000000000");
Expand All @@ -194,7 +194,7 @@ describe("should return invalid payload", function () {

expect(communitystakingPayload).toMatchObject({ valid: false });
});
it("when stake amount is below 100 GTC for Gold", async () => {
it("when stake amount is below 125 GTC for Gold", async () => {
jest.clearAllMocks();
mockedAxiosPost.mockImplementation(async () => {
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "40000000000000000000");
Expand All @@ -212,9 +212,9 @@ describe("should return invalid payload", function () {

// All the positive cases for thresholds are tested
describe("should return valid payload", function () {
it("when stake amount above 1 GTC for Bronze", async () => {
it("when stake amount above 5 GTC for Bronze", async () => {
mockedAxiosPost.mockImplementation(async () => {
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "2000000000000000000");
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "6000000000000000000");
});

const communitystaking = new CommunityStakingBronzeProvider();
Expand All @@ -225,12 +225,12 @@ describe("should return valid payload", function () {

expect(communitystakingPayload).toMatchObject({
valid: true,
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte1" },
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte5" },
});
});
it("when stake amount above 10 GTC for Silver", async () => {
it("when stake amount above 20 GTC for Silver", async () => {
mockedAxiosPost.mockImplementation(async () => {
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "15000000000000000000");
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "25000000000000000000");
});

const communitystaking = new CommunityStakingSilverProvider();
Expand All @@ -241,10 +241,10 @@ describe("should return valid payload", function () {

expect(communitystakingPayload).toMatchObject({
valid: true,
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte10" },
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte20" },
});
});
it("when stake amount above 100 GTC for Gold", async () => {
it("when stake amount above 125 GTC for Gold", async () => {
mockedAxiosPost.mockImplementation(async () => {
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "500000000000000000000");
});
Expand All @@ -257,14 +257,14 @@ describe("should return valid payload", function () {

expect(communitystakingPayload).toMatchObject({
valid: true,
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte100" },
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte125" },
});
});
// All values equal to tier amount
it("when stake amount is equal to 1 GTC for Bronze", async () => {
it("when stake amount is equal to 5 GTC for Bronze", async () => {
jest.clearAllMocks();
mockedAxiosPost.mockImplementation(async () => {
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "1000000000000000000");
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "5000000000000000000");
});

const communitystaking = new CommunityStakingBronzeProvider();
Expand All @@ -275,13 +275,13 @@ describe("should return valid payload", function () {

expect(communitystakingPayload).toMatchObject({
valid: true,
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte1" },
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte5" },
});
});
it("when stake amount is equal to 10 GTC for Silver", async () => {
it("when stake amount is equal to 20 GTC for Silver", async () => {
jest.clearAllMocks();
mockedAxiosPost.mockImplementation(async () => {
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "10000000000000000000");
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "20000000000000000000");
});

const communitystaking = new CommunityStakingSilverProvider();
Expand All @@ -292,13 +292,13 @@ describe("should return valid payload", function () {

expect(communitystakingPayload).toMatchObject({
valid: true,
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte10" },
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte20" },
});
});
it("when stake amount is equal to 100 GTC for Gold", async () => {
it("when stake amount is equal to 125 GTC for Gold", async () => {
jest.clearAllMocks();
mockedAxiosPost.mockImplementation(async () => {
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "100000000000000000000");
return generateSubgraphResponse(MOCK_ADDRESS_LOWER, "125000000000000000000");
});

const communitystaking = new CommunityStakingGoldProvider();
Expand All @@ -309,7 +309,7 @@ describe("should return valid payload", function () {

expect(communitystakingPayload).toMatchObject({
valid: true,
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte100" },
record: { address: MOCK_ADDRESS_LOWER, stakeAmount: "csgte125" },
});
});
});
Loading

0 comments on commit 0b7cd32

Please sign in to comment.