Skip to content

Add fee instruction to claim transactions #280

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

Merged
merged 2 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "7.5.0",
"version": "7.5.1",
"$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": "7.5.0",
"version": "7.5.1",
"description": "Common utilities and types used by streamflow packages.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "./dist/esm/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": "7.5.0",
"version": "7.5.1",
"description": "JavaScript SDK to interact with Streamflow Airdrop protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/esm/index.js",
Expand Down
18 changes: 17 additions & 1 deletion packages/distributor/solana/clients/BaseDistributorClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ import {
} from "@solana/spl-token";
import bs58 from "bs58";

import { DISTRIBUTOR_ADMIN_OFFSET, DISTRIBUTOR_MINT_OFFSET, DISTRIBUTOR_PROGRAM_ID } from "../constants";
import {
AIRDROP_CLAIM_FEE,
DISTRIBUTOR_ADMIN_OFFSET,
DISTRIBUTOR_MINT_OFFSET,
DISTRIBUTOR_PROGRAM_ID,
STREAMFLOW_TREASURY_PUBLIC_KEY,
} from "../constants";
import {
IClaimData,
IClawbackData,
Expand Down Expand Up @@ -298,6 +304,8 @@ export default abstract class BaseDistributorClient {
ixs.push(claimLocked(accounts, this.programId));
}

ixs.push(this.prepareClaimFeeInstruction(extParams.invoker.publicKey));

return ixs;
}

Expand Down Expand Up @@ -462,6 +470,14 @@ export default abstract class BaseDistributorClient {
}));
}

protected prepareClaimFeeInstruction(payer: PublicKey): TransactionInstruction {
return SystemProgram.transfer({
fromPubkey: payer,
toPubkey: STREAMFLOW_TREASURY_PUBLIC_KEY,
lamports: AIRDROP_CLAIM_FEE,
});
}

protected getNewDistributorArgs(data: ICreateDistributorData): NewDistributorArgs {
const args = {
version: new BN(data.version),
Expand Down
4 changes: 4 additions & 0 deletions packages/distributor/solana/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PublicKey } from "@solana/web3.js";
import { ICluster } from "@streamflow/common";

export const ANCHOR_DISCRIMINATOR_OFFSET = 8;
Expand All @@ -10,6 +11,9 @@ export const TEST_ORACLE_PREFIX = Buffer.from("test-oracle", "utf-8");
export const CLAIM_STATUS_PREFIX = Buffer.from("ClaimStatus", "utf-8");
export const ALIGNED_PRECISION_FACTOR_POW = 9;

export const AIRDROP_CLAIM_FEE = BigInt(5_200_000);
export const STREAMFLOW_TREASURY_PUBLIC_KEY = new PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");

export const ONE_IN_BASIS_POINTS = BigInt(10_000);

export const ALIGNED_DISTRIBUTOR_PROGRAM_ID = {
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": "7.5.0",
"version": "7.5.1",
"license": "ISC",
"main": "index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/launchpad/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/launchpad",
"version": "7.5.0",
"version": "7.5.1",
"description": "JavaScript SDK to interact with Streamflow Launchpad protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/staking/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/staking",
"version": "7.5.0",
"version": "7.5.1",
"description": "JavaScript SDK to interact with Streamflow Staking protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/esm/index.js",
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": "7.5.0",
"version": "7.5.1",
"description": "JavaScript SDK to interact with Streamflow protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "./dist/esm/index.js",
Expand Down
Loading