@gooddollar/goodprotocol 2.0.25-beta.4 → 2.0.25-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddollar/goodprotocol",
3
- "version": "2.0.25-beta.4",
3
+ "version": "2.0.25-beta.5",
4
4
  "description": "GoodDollar Protocol",
5
5
  "engines": {
6
6
  "node": ">=16.x"
@@ -354,7 +354,11 @@ describe("InvitesV2", () => {
354
354
  .connect(invitee1)
355
355
  .join(ethers.utils.hexZeroPad(invitee1.address, 32), ethers.utils.formatBytes32String("test"));
356
356
  const { events } = await tx.wait();
357
+
357
358
  const bountyEvent = events.find(_ => _.event === "InviterBounty");
359
+ const bounty = (await invites.levels(0)).bounty;
360
+
361
+ expect(await gd.balanceOf(invitee1.address)).eq(bounty.div(2));
358
362
  expect(bountyEvent).not.empty;
359
363
  });
360
364
 
@@ -377,6 +381,28 @@ describe("InvitesV2", () => {
377
381
  const bountyEvent2 = events2.find(_ => _.event === "InviterBounty");
378
382
  expect(bountyEvent2).not.undefined;
379
383
  });
384
+
385
+ it("should collect bounty with campaignCode after first join without being whitelisted", async () => {
386
+ await loadFixture(initialState);
387
+ await invites.setCampaignCode(ethers.utils.formatBytes32String("test"));
388
+
389
+ const tx = await invites
390
+ .connect(invitee1)
391
+ .join(ethers.utils.hexZeroPad(invitee1.address, 32), ethers.utils.formatBytes32String("test"));
392
+ const { events } = await tx.wait();
393
+ const bountyEvent = events.find(_ => _.event === "InviterBounty");
394
+ expect(bountyEvent).undefined;
395
+
396
+ await id.addWhitelistedWithDID(invitee1.address, Math.random() + "").catch(e => e);
397
+
398
+ expect(await invites.canCollectBountyFor(invitee1.address)).to.be.true;
399
+
400
+ const tx2 = await invites.connect(invitee1).bountyFor(invitee1.address);
401
+
402
+ const { events: events2 } = await tx2.wait();
403
+ const bountyEvent2 = events2.find(_ => _.event === "InviterBounty");
404
+ expect(bountyEvent2).not.undefined;
405
+ });
380
406
  });
381
407
 
382
408
  it("should end contract by owner", async () => {