Skip to content

Commit

Permalink
Merge branch 'giannis/check-on-init-rwd-dist' of github.com:cardinal-…
Browse files Browse the repository at this point in the history
…labs/cardinal-rewards-center into giannis/check-on-init-rwd-dist
  • Loading branch information
Giannis Chatziveroglou committed Jan 3, 2023
2 parents b5c45b2 + fc5083e commit 2bae855
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub struct InitRewardDistributorCtx<'info> {
bump,
)]
reward_distributor: Box<Account<'info, RewardDistributor>>,
#[account(constraint = authority.key() != stake_pool.authority.key() @ ErrorCode::InvalidAuthority)]
#[account(constraint = authority.key() == stake_pool.authority.key() @ ErrorCode::InvalidAuthority)]
stake_pool: Box<Account<'info, StakePool>>,
#[account(mut)]
reward_mint: Box<Account<'info, Mint>>,
Expand Down
18 changes: 9 additions & 9 deletions tests/reward-distribution/claim-rewards-sol.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ import {
getAssociatedTokenAddressSync,
} from "@solana/spl-token";
import type { PublicKey } from "@solana/web3.js";
import {
Keypair,
LAMPORTS_PER_SOL,
SystemProgram,
Transaction,
} from "@solana/web3.js";
import { Keypair, SystemProgram, Transaction } from "@solana/web3.js";
import { BN } from "bn.js";

import {
Expand Down Expand Up @@ -43,8 +38,6 @@ const REWARD_AMOUNT = 2;
let mintId: PublicKey;
let rewardMintId: PublicKey;

const PAYMENT_AMOUNT = 0.005 * LAMPORTS_PER_SOL;

beforeAll(async () => {
provider = await getProvider();
const mintKeypair = Keypair.generate();
Expand Down Expand Up @@ -346,5 +339,12 @@ test("Claim rewards", async () => {
const balanceAfter = await provider.connection.getBalance(
provider.wallet.publicKey
);
expect(balanceBefore - PAYMENT_AMOUNT).toBeGreaterThan(balanceAfter);
const defaultPaymentInfo = await fetchIdlAccount(
provider.connection,
DEFAULT_PAYMENT_INFO,
"paymentInfo"
);
expect(balanceBefore - balanceAfter).toBeGreaterThan(
defaultPaymentInfo.parsed.paymentAmount.toNumber()
);
});

0 comments on commit 2bae855

Please sign in to comment.