From 37fac29a5719a9f5e75eabb568365d603c9fc04b Mon Sep 17 00:00:00 2001 From: coderipper Date: Wed, 4 Dec 2024 15:53:55 -0300 Subject: [PATCH] added protocol 22 --- apps/contracts/src/strategies/deploy_blend.ts | 5 +++++ apps/contracts/src/strategies/deploy_fixed.ts | 8 +++++++- apps/contracts/src/tests/testOnlyVault.ts | 10 ++++++++-- docker-compose.yml | 6 +++--- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/apps/contracts/src/strategies/deploy_blend.ts b/apps/contracts/src/strategies/deploy_blend.ts index 7b6db3b5..69ab3591 100644 --- a/apps/contracts/src/strategies/deploy_blend.ts +++ b/apps/contracts/src/strategies/deploy_blend.ts @@ -9,6 +9,11 @@ import { import { config } from "../utils/env_config.js"; export async function deployBlendStrategy(addressBook: AddressBook) { + if (network == "standalone") { + console.log("Blend Strategy can only be tested in testnet or mainnet"); + console.log("Since it requires Blend protocol to be deployed"); + return; + }; if (network != "mainnet") await airdropAccount(loadedConfig.admin); let account = await loadedConfig.horizonRpc.loadAccount( loadedConfig.admin.publicKey() diff --git a/apps/contracts/src/strategies/deploy_fixed.ts b/apps/contracts/src/strategies/deploy_fixed.ts index b84045b0..1e507a84 100644 --- a/apps/contracts/src/strategies/deploy_fixed.ts +++ b/apps/contracts/src/strategies/deploy_fixed.ts @@ -10,6 +10,12 @@ import { import { config } from "../utils/env_config.js"; export async function deployFixedAPRStrategy(addressBook: AddressBook) { + if (network == "standalone") { + console.log("Fixed Strategy can only be tested in testnet or mainnet"); + console.log("Since it requires a custom token, we are currently using soroswap USDC"); + console.log("TODO: Create our own token for standalone testing"); + return; + }; if (network != "mainnet") await airdropAccount(loadedConfig.admin); let account = await loadedConfig.horizonRpc.loadAccount( loadedConfig.admin.publicKey() @@ -48,7 +54,7 @@ export async function deployFixedAPRStrategy(addressBook: AddressBook) { const soroswapUsdc = "CAAFIHB4I7WQMJMKC22CZVQNNX7EONWSOMT6SUXK6I3G3F6J4XFRWNDI" const soroswapScVal = new Address(soroswapUsdc).toScVal(); - + const initialAmount = 100_000_000_0_000_000; // Mint to the admin the initailAmount diff --git a/apps/contracts/src/tests/testOnlyVault.ts b/apps/contracts/src/tests/testOnlyVault.ts index 244a8066..de5c185e 100644 --- a/apps/contracts/src/tests/testOnlyVault.ts +++ b/apps/contracts/src/tests/testOnlyVault.ts @@ -10,8 +10,7 @@ import { randomBytes } from "crypto"; import { AddressBook } from "../utils/address_book.js"; import { airdropAccount, invokeContract, invokeCustomContract } from "../utils/contract.js"; import { config } from "../utils/env_config.js"; -import { depositToVault} from "./vault.js"; -import { checkUserBalance } from "./strategy.js"; +import { depositToVault } from "./vault.js"; const soroswapUSDC = new Address("CAAFIHB4I7WQMJMKC22CZVQNNX7EONWSOMT6SUXK6I3G3F6J4XFRWNDI"); @@ -111,6 +110,13 @@ export async function deployVault(addressBook: AddressBook) { console.log('🚀 « DeFindex Vault created with address:', scValToNative(result.returnValue)); return scValToNative(result.returnValue); } +if (network == "standalone") { + console.log("This can only be tested in testnet or mainnet"); + console.log("Since it requires a custom token, we are currently using soroswap USDC"); + console.log("TODO: Create our own token for standalone testing"); + process.exit(); +}; + const testUser = Keypair.random(); if (network !== "mainnet") await airdropAccount(testUser); const initialAmount = 10000_0_000_000; diff --git a/docker-compose.yml b/docker-compose.yml index 9d939112..7dafa4a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: defindex-soroban: - image: esteblock/soroban-preview:21.0.0_node_20@sha256:d8546f6a3bf75b9fa4a481af6be872e3e69f59896948c537912f2bb0df3cd0d9 + image: esteblock/soroban-preview:22.0.1 container_name: defindex-soroban volumes: - .:/workspace @@ -14,13 +14,13 @@ services: - "3050:3050" stellar: - image: stellar/quickstart:v426-latest-amd64@sha256:274395daab6fa8033b9213f152d56699358917fb01d7c7e95392a37fc00c9d01 + image: stellar/quickstart container_name: stellar networks: - defindex-network ports: - "8000:8000" - command: --local --enable-soroban-rpc --enable-soroban-diagnostic-events + command: --local --protocol-version 22 stdin_open: true tty: true