Skip to content

Commit

Permalink
added tests for grant objective and disperse grant
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmaymunjal committed Nov 15, 2023
1 parent 8c901a7 commit 2df60d8
Show file tree
Hide file tree
Showing 8 changed files with 3,205 additions and 3,736 deletions.
2 changes: 1 addition & 1 deletion programs/defios/src/event.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::state::{ObjectiveDeliverable, RoadmapOutlook, Schedule};
use crate::state::{ObjectiveDeliverable, RoadmapOutlook};
use anchor_lang::prelude::*;
#[event]
pub struct PullRequestSent {
Expand Down
3 changes: 2 additions & 1 deletion programs/defios/src/instructions/create_name_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use anchor_lang::prelude::*;
pub struct CreateNameRouter<'info> {
#[account(mut)]
pub router_creator: Signer<'info>,

#[account(
init,
payer = router_creator,
Expand Down Expand Up @@ -36,9 +35,11 @@ pub fn handler(
name_router_account.signing_domain = signing_domain;
name_router_account.signature_version = signature_version;
name_router_account.total_verified_users = 0;

emit!(NameRouterCreated {
router_creator: router_creator.key(),
name_router_account: name_router_account.key(),
});

Ok(())
}
9 changes: 5 additions & 4 deletions programs/defios/src/instructions/grant_money.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct GrantMoney<'info> {
#[account(mut)]
pub grantee: Signer<'info>,
#[account(
constraint = TRUSTED_NAME_ROUTERS.contains(&grantee_verified_user.name_router),
// constraint = TRUSTED_NAME_ROUTERS.contains(&grantee_verified_user.name_router),
seeds = [
grantee_verified_user.user_name.as_bytes(),
grantee.key().as_ref(),
Expand All @@ -28,7 +28,7 @@ pub struct GrantMoney<'info> {
constraint = objective.objective_repository == repository.key()
)]
pub objective: Account<'info, Objective>,
pub repository: Account<'info, Repository>,
pub repository: Box<Account<'info, Repository>>,
#[account(constraint = token_mint.key() == repository.repo_token.unwrap())]
pub token_mint: Account<'info, Mint>,
#[account(
Expand All @@ -44,7 +44,8 @@ pub struct GrantMoney<'info> {
)]
pub grantee_account: Account<'info, Grantee>,
///CHECK: The account checks are done in function, unchecked as it might not exist and will be created in that case
pub objective_stake_account: UncheckedAccount<'info>,
#[account(mut)]
pub objective_stake_account: AccountInfo<'info>,
#[account(
mut,
constraint = grantee_stake_account.owner.eq(&grantee.key()),
Expand All @@ -64,7 +65,7 @@ pub fn handler(
) -> Result<()> {
let grantee_account = &mut ctx.accounts.grantee_account;
let grantee = &ctx.accounts.grantee;
let grantee_stake_account = &mut ctx.accounts.grantee_stake_account;
let grantee_stake_account = &ctx.accounts.grantee_stake_account;
let objective = &mut ctx.accounts.objective;
let objective_stake_account = &mut ctx.accounts.objective_stake_account;
let associated_token_program = &ctx.accounts.associated_token_program;
Expand Down
2 changes: 1 addition & 1 deletion programs/defios/src/instructions/stake_issue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub struct StakeIssue<'info> {
)]
pub issue_staker_account: Account<'info, IssueStaker>,

#[account(mut,constraint = rewards_mint.key()==issue_account.issue_token)]
#[account(constraint = rewards_mint.key()==issue_account.issue_token)]
pub rewards_mint: Account<'info, Mint>,
#[account(
seeds = [
Expand Down
2 changes: 1 addition & 1 deletion programs/defios/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::state::{ObjectiveDeliverable, RoadmapOutlook, Schedule};
use crate::state::{ObjectiveDeliverable, RoadmapOutlook};
use anchor_lang::prelude::*;
use instructions::*;

Expand Down
5 changes: 4 additions & 1 deletion tests/DefiOS/Test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ extends = ["../Test.base.toml"]
[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/DefiOS/*.ts"

[test]
startup_wait = 10000

[test.validator]
url = "https://api.devnet.solana.com"

[[test.validator.clone]]
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" # implicitly also clones PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" # implicitly also clones PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT
Loading

0 comments on commit 2df60d8

Please sign in to comment.