Skip to content

Commit

Permalink
working rebalance on testnet deposit and withdraw
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinsoza committed Nov 21, 2024
1 parent 2f504e7 commit 5e553b0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
14 changes: 7 additions & 7 deletions apps/contracts/src/tests/testTwoStrategiesVault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ console.log('πŸš€ Β« investResult:', investResult);

// Step 3: Rebalance Vault
const rebalanceParams: Instruction[] = [
// {
// action: ActionType.Withdraw,
// strategy: addressBook.getContractId("hodl_strategy"),
// amount: BigInt(500_0_000_000),
// swap_details_exact_in: undefined,
// swap_details_exact_out: undefined,
// },
{
action: ActionType.Withdraw,
strategy: addressBook.getContractId("hodl_strategy"),
amount: BigInt(500_0_000_000),
swap_details_exact_in: undefined,
swap_details_exact_out: undefined,
},
{
action: ActionType.Invest,
strategy: addressBook.getContractId("fixed_apr_strategy"),
Expand Down
2 changes: 1 addition & 1 deletion apps/contracts/src/utils/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export async function invokeTransaction(
const prepped_tx = assemble_tx.setSorobanData(sim_tx_data).build();
prepped_tx.sign(source);
const tx_hash = prepped_tx.hash().toString("hex");
console.log('πŸ›‘πŸ›‘πŸ›‘πŸ›‘πŸ›‘:', prepped_tx.toXDR());
console.log('πŸ›‘ SIGNED TX:', prepped_tx.toXDR());

console.log("submitting tx...");
let response: txResponse = await loadedConfig.rpc.sendTransaction(prepped_tx);
Expand Down
3 changes: 2 additions & 1 deletion apps/contracts/vault/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,9 @@ impl VaultManagementTrait for DeFindexVault {
},
ActionType::Invest => match (&instruction.strategy, &instruction.amount) {
(Some(strategy_address), Some(amount)) => {
let asset_address = get_strategy_asset(&e, strategy_address)?;
invest_in_strategy(
&e, strategy_address, strategy_address, amount)?; // TODO THIS WILL FAIUL FOR NOW
&e, &asset_address.address, strategy_address, amount)?;
}
_ => return Err(ContractError::MissingInstructionData),
},
Expand Down

0 comments on commit 5e553b0

Please sign in to comment.