Skip to content

Commit

Permalink
🩹 Fix deposit function
Browse files Browse the repository at this point in the history
  • Loading branch information
MattPoblete committed Dec 2, 2024
1 parent 535b1ac commit 30f39b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/contracts/src/tests/blend/test_vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export async function testBlendVault(user?: Keypair) {
console.log('🚀 « investResult:', investResult);

console.log(green, '---------------------- Invested in strategy ----------------------')
console.log(green, 'Invested: ', scValToNative(investResult.returnValue), ' in the strategy')
console.log(green, 'Invested: ', investResult, ' in the strategy')
console.log(green, '------------------------------------------------------------------')
} catch (error) {
console.log('❌ Error Investing the Vault:', error);
Expand Down
6 changes: 4 additions & 2 deletions apps/contracts/src/tests/vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import { airdropAccount, invokeCustomContract } from "../utils/contract.js";

const network = process.argv[2];

export async function depositToVault(deployedVault: string, amount: number[], user?: Keypair, ) {
export async function depositToVault(deployedVault: string, amount: number[], user?: Keypair, invest?: boolean) {
// Create and fund a new user account if not provided
const newUser = user ? user : Keypair.random();
const investDeposit = invest ? invest : false;
console.log('🚀 ~ depositToVault ~ newUser.publicKey():', newUser.publicKey());
console.log('🚀 ~ depositToVault ~ newUser.secret():', newUser.secret());

Expand All @@ -41,7 +42,8 @@ export async function depositToVault(deployedVault: string, amount: number[], us
const depositParams: xdr.ScVal[] = [
xdr.ScVal.scvVec(amountsDesired.map((amount) => nativeToScVal(amount, { type: "i128" }))),
xdr.ScVal.scvVec(amountsMin.map((min) => nativeToScVal(min, { type: "i128" }))),
(new Address(newUser.publicKey())).toScVal()
(new Address(newUser.publicKey())).toScVal(),
xdr.ScVal.scvBool(investDeposit)
];

try {
Expand Down

0 comments on commit 30f39b9

Please sign in to comment.