Skip to content
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

Check whether claim has started in claim #153

Merged
merged 9 commits into from
Mar 28, 2024
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"packages": [
"packages/*"
],
"version": "6.0.0-alpha.9",
"version": "6.0.0-alpha.10",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/common",
"version": "6.0.0-alpha.9",
"version": "6.0.0-alpha.10",
"description": "Common utilities and types used by streamflow packages.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/distributor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/distributor",
"version": "6.0.0-alpha.9",
"version": "6.0.0-alpha.10",
"description": "JavaScript SDK to interact with Streamflow Airdrop protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/index.js",
Expand Down
10 changes: 9 additions & 1 deletion packages/distributor/solana/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ export default class SolanaDistributorClient {
ixs.push(...(await prepareWrappedAccount(this.connection, invoker.publicKey, data.maxTotalClaim)));
}

const nowTs = new BN(Math.floor(Date.now() / 1000));
const endVestingTs = args.endVestingTs.eqn(0) ? nowTs : args.endVestingTs;
const startVestingTs = args.startVestingTs.eqn(0) ? nowTs : args.startVestingTs;
if (endVestingTs.gt(startVestingTs) && endVestingTs.sub(startVestingTs).lt(args.unlockPeriod)) {
throw new Error("Unlock Period can not be less than total Vesting duration!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you mean vice verse unlock period can't be longer than duration

Suggested change
throw new Error("Unlock Period can not be less than total Vesting duration!");
throw new Error("The unlock period cannot be longer than the total vesting duration!");

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dam, you're right. 🌚

}

ixs.push(newDistributor(args, accounts, this.programId));
ixs.push(
createTransferCheckedInstruction(
Expand Down Expand Up @@ -180,7 +187,8 @@ export default class SolanaDistributorClient {
ixs.push(newClaim(args, accounts, this.programId));
}

if (data.amountLocked.gtn(0)) {
const nowTs = new BN(Math.floor(Date.now() / 1000));
if (claimStatus || (data.amountLocked.gtn(0) && nowTs.sub(distributor.startTs).gte(distributor.unlockPeriod))) {
ixs.push(claimLocked(accounts, this.programId));
}

Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/eslint-config",
"version": "6.0.0-alpha.9",
"version": "6.0.0-alpha.10",
"license": "ISC",
"main": "index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/stream/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/stream",
"version": "6.0.0-alpha.9",
"version": "6.0.0-alpha.10",
"description": "JavaScript SDK to interact with Streamflow protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/index.js",
Expand Down