Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vito-kovalione committed Dec 26, 2024
1 parent 888b323 commit ef1d3fb
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 430 deletions.
35 changes: 7 additions & 28 deletions scripts/create_default_vault_with_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,45 +83,35 @@ async function main() {
TOKEN_METADATA_PROGRAM_ID
);

console.log("metadataAddress:", metadataAddress.toBase58());

await vaultProgram.methods.initVault(vaultConfig)
.accounts({
underlyingMint,
signer: admin.publicKey,
})
.signers([admin])
.rpc();

console.log("Vault:", vault.toBase58());

const sharesConfig = {
name: "Share Splyce USD",
symbol: "spvUSD",
uri: "https://gist.githubusercontent.com/vito-kovalione/a3fcf481b0cced2615ae626ebdd04288/raw/f6a648dfebce511448c81ea5b4672bdd9f14c2e2/gistfile1.txt",
};

await vaultProgram.methods.initVaultShares(new BN(vault_index), sharesConfig)
console.log("metadataAddress:", metadataAddress.toBase58());

await vaultProgram.methods.initVault(vaultConfig, sharesConfig)
.accounts({
metadata: metadataAddress,
underlyingMint,
signer: admin.publicKey,
})
.signers([admin])
.rpc();

console.log("shares inited");
console.log("Vault:", vault.toBase58());

let adminSharesAccount = await token.createAccount(provider.connection, admin, sharesMint, admin.publicKey);

await accountantProgram.methods.initAccountant({ generic: {} })
.accounts({
signer: admin.publicKey,
underlyingMint: sharesMint,
mint: sharesMint,
})
.signers([admin])
.rpc();

await accountantProgram.methods.setFee(new BN(500))
await accountantProgram.methods.setPerformanceFee(new BN(500))
.accounts({
accountant: accountant,
signer: admin.publicKey,
Expand All @@ -132,17 +122,6 @@ async function main() {
let genericAccountant = await accountantProgram.account.genericAccountant.fetch(accountant);
console.log("Performance fee:", genericAccountant.performanceFee.toNumber());

await accountantProgram.methods.setFeeRecipient(adminSharesAccount)
.accounts({
accountant: accountant,
signer: admin.publicKey,
})
.signers([admin])
.rpc();

genericAccountant = await accountantProgram.account.genericAccountant.fetch(accountant);
console.log("Fee recipient:", genericAccountant.feeRecipient.toString());

const strategy = anchor.web3.PublicKey.findProgramAddressSync(
[
vault.toBuffer(),
Expand Down
18 changes: 4 additions & 14 deletions scripts/create_vault_with_trade_fi_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,38 +85,28 @@ async function main() {

console.log("metadataAddress:", metadataAddress.toBase58());

await vaultProgram.methods.initVault(vaultConfig)
.accounts({
underlyingMint,
signer: admin.publicKey,
})
.signers([admin])
.rpc();

console.log("Vault:", vault.toBase58());

const sharesConfig = {
name: "Share Splyce USD",
symbol: "spvUSD",
uri: "https://gist.githubusercontent.com/vito-kovalione/a3fcf481b0cced2615ae626ebdd04288/raw/f6a648dfebce511448c81ea5b4672bdd9f14c2e2/gistfile1.txt",
};

await vaultProgram.methods.initVaultShares(new BN(vault_index), sharesConfig)
await vaultProgram.methods.initVault(vaultConfig, sharesConfig)
.accounts({
metadata: metadataAddress,
underlyingMint,
signer: admin.publicKey,
})
.signers([admin])
.rpc();

console.log("shares inited");
console.log("Vault:", vault.toBase58());

let adminSharesAccount = await token.createAccount(provider.connection, admin, sharesMint, admin.publicKey);

await accountantProgram.methods.initAccountant({ generic: {} })
.accounts({
signer: admin.publicKey,
underlyingMint: sharesMint,
mint: sharesMint,
})
.signers([admin])
.rpc();
Expand Down
Loading

0 comments on commit ef1d3fb

Please sign in to comment.