From 4e3c2d953b51f63dc547061063d6ebeae1dd4167 Mon Sep 17 00:00:00 2001 From: esteblock Date: Tue, 17 Dec 2024 19:35:22 -0300 Subject: [PATCH] set up soroswap --- .../soroswap/soroswap_aggregator.wasm | Bin 0 -> 23275 bytes apps/contracts/soroswap/soroswap_factory.wasm | Bin 0 -> 9894 bytes apps/contracts/soroswap/soroswap_pair.wasm | Bin 0 -> 27410 bytes apps/contracts/soroswap/soroswap_router.wasm | Bin 0 -> 34253 bytes apps/contracts/vault/src/test.rs | 72 +++++++--- .../vault/src/test/soroswap_setup.rs | 125 +++++++++++++++++ .../vault/src/test/vault/rebalance.rs | 128 +++++++++++++++++- 7 files changed, 300 insertions(+), 25 deletions(-) create mode 100644 apps/contracts/soroswap/soroswap_aggregator.wasm create mode 100644 apps/contracts/soroswap/soroswap_factory.wasm create mode 100644 apps/contracts/soroswap/soroswap_pair.wasm create mode 100644 apps/contracts/soroswap/soroswap_router.wasm create mode 100644 apps/contracts/vault/src/test/soroswap_setup.rs diff --git a/apps/contracts/soroswap/soroswap_aggregator.wasm b/apps/contracts/soroswap/soroswap_aggregator.wasm new file mode 100644 index 0000000000000000000000000000000000000000..86a3ae0d6eb62af3d73ae361c94101b61481f0aa GIT binary patch literal 23275 zcmeI4dyHJydDzc=%wy;7K zW;ruUQU$rYiYQtw4A*fS#4X%HL0!{m%`|OVxM}~0j3j`A*nu0Qu3WgaQoCv5rmoQd zZO|G}f8ROx-kn)4Daug`qwSD)&b{aHo$q|_^PM}ZD$Nx~Ddqe_=iV82W5d~)apcS0 z+;lc)yiHT^ps3kUGm0i}!*r7#^y7Y0hRByr&E_sW@dYUW;QmYpfS zFF5n&d%}F5QCX)Fj~X>&r} z%>5T9%&t^d>WybzRj94jTD8h@?XOnVgMI63^OaWhOl7{Z)~Ys|>Y?5S{Vt?6>O@zw z+B&mVS#MU=!{)v+zfxOOkL1?Z&NeFZRrTI`n-?on!js%*VRzeT>Vgf;^h3=hfqZJX`?BT76YL0SP}+ICB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rmlvlN=gB_YmuIkY14|!y#H|y+ z+g*b{O= zdvdscYG`a~YHIBGz`(J-f$6C!o^cqN9-BHgIyp8rYRm^V=cY>%WZihSsE7X#IcB22 literal 0 HcmV?d00001 diff --git a/apps/contracts/soroswap/soroswap_router.wasm b/apps/contracts/soroswap/soroswap_router.wasm new file mode 100644 index 0000000000000000000000000000000000000000..bd621c598d44b4598630127899219bb73b02dd51 GIT binary patch literal 34253 zcmeI5e{fvab>H8Q{e@kCe3EFJCTZ*KN{&E>qyUfvKw7r&Rw5j(LL+9l+kz1)V<_BN67}Y zGJH>&?@3bT-6g&+xW_1YnUbQc?@R7^Qs$wcc13^Qt&_fBQdZoWDRb7eD>|1bZL zQMxyuD-`m>`H}l}?9A=l^`7BUFjN?MZ{~eN#og~8%HG4j9F&W0(Q&*zzUO&6_Ig1+ zn5cjqqDFEm?M zJg3-LZFCy7mB#ngog*W)#l^ELjf?Az#YX3fb2MmC>QcQY>Da#Z^R>0J^~<$|&e=|L zxxU&yd#>4vZ=FYMc27ocN#|pw=jxra=cr5D&dknMbG=h=R))kWVe zojrTLj!frk?Yi#`jkr$amhz{*`xCRDoPE0ZE7zYm;c3c+j(06|Z$)po7b{-$n)5_v zCiJ2lm#SO#t1o`>#*G{9uvZG*YT=b(muujZru;(ag#MK8l!{L1+&Yn&aZ05RaXacc z5a5!D{>Wc`wHm%$eGv+;f9&ecQt0gW3#Egm*$12`Sgtq^QYCuj^RGEkJ_rrfsIU~d zL7C)W=|QLT&s`6NyXMV=ZZ!1q5hsMH&?#s98SlC`L$aTliQF)A&~ae@zd0vI{5|kL zwyX|C#Zx0LPe1F}$33S;JRW}|d3kADA4Rp%LQ5S4yrUZ}ni|2St_nQJN(?8s^iUappITKQKU$^S>)M4sVt#YLWO z=p6MN2_B}n&Dh((rL-~`0|Xs8Wyfdmqu^xbnt7PfgGS#)@}a~3&|TW^s}XVvOJxV4 zF#P039s}e?Ap-{6{;c`~WfTnDmCZ2uCKp0(XU_ z;K9%jAu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#`wha9qSQs7`wR-_znteyBgH9ahQs_ z)eR?FFzNrZECk?Uj7j#_Ydj~mZ77kB5;seq@1`gEMBO*VsQ+s9N$TCRJ*eT@j!tR( z66Y)S-0niLx(mWV9z=hmX4&$C8WPu)4)-fak50m)OvGT-g!PSe-%jP)RB(5rVEt0- zQL`AIHvXNS)OAXAZmTs_G0{5{P44PrDM?3mi9X(m-u-f_cZu**P}z>+)qpj#W3{+J zZ>2Na!n0TzPOE(HK6`>yf4vlMQ+eHuwhhQ?K;1U~8&X|t+sb!;yY%ehEQhI@tqZuW z=h+m(q1Lgg*rL&u^e7jbNd)fkka4C2;{&xxLQ>u}5U=K6Xdeu9k$p=xLADvwdi9Q#p+3FdOzr3qGwK z+Uk#nDL3(rw!)mjwOWiT$vLSvwP~%}jX7RN($%+i$hU%%|9=L3qn$B-m(3_dGUi*& z|G&(b_ntM{l`J-U7Y%TrJsp8bk>9pI!o)}?pkDwrs(l{9p^i5&s!gGi{S0flIeWu2R5PC zo#>)~KM)_Ho@MIu=#KOC(GB%XOy?}8>sX%H`+1@jI+Kg zC2@Q&(WWHa7i(3I3U!y!@#a3pS3c|8rEsaf4a~}SW;mt$mqNQf93 zfj^brhi6-@x8E)u`{CQgUfzay+cx~FcSCY$#LjNmvz-7@fr^i;MfxFx3$X3{L_d4>ydy?}Q97VWL@6^oiISbHs8B}YgzXaWv znQgWCooQ3T$&DYHI(kUqEBjMuwcCr!Hv8d;u|pGw#vYigj~|( client } -// DeFindex Factory Contract -// pub mod defindex_factory { -// soroban_sdk::contractimport!(file = "../target/wasm32-unknown-unknown/release/defindex_factory.optimized.wasm"); -// pub type DeFindexFactoryClient<'a> = Client<'a>; -// } -// use defindex_factory::DeFindexFactoryClient; - -// fn create_defindex_factory<'a>( -// e: & Env -// ) -> DeFindexFactoryClient<'a> { -// let address = &e.register_contract_wasm(None, defindex_factory::WASM); -// let client = DeFindexFactoryClient::new(e, address); -// client -// } - // Create Test Token pub(crate) fn create_token_contract<'a>(e: &Env, admin: &Address) -> SorobanTokenClient<'a> { SorobanTokenClient::new( @@ -102,6 +92,31 @@ pub(crate) fn create_strategy_params_token1(test: &DeFindexVaultTest) -> Vec { env: Env, defindex_factory: Address, @@ -146,6 +161,20 @@ impl<'a> DeFindexVaultTest<'a> { let strategy_client_token0 = create_hodl_strategy(&env, &token0.address); let strategy_client_token1 = create_hodl_strategy(&env, &token1.address); + // Soroswap Setup + let soroswap_admin = Address::generate(&env); + + mock_mint(&env, &token0_admin_client, &token0_admin, &soroswap_admin, &10000_0_000_000); + mock_mint(&env, &token1_admin_client, &token1_admin, &soroswap_admin, &10000_0_000_000); + + let soroswap_factory = create_soroswap_factory(&env, &soroswap_admin); + let soroswap_router = create_soroswap_router(&env, &soroswap_factory.address); + + env.budget().reset_unlimited(); + + create_soroswap_pool(&env, &soroswap_router, &soroswap_admin, &token0.address, &token1.address, &10000_0_000_000, &10000_0_000_000); + // let soroswap_pair = soroswap_factory.get_pair(&token0.address, &token1.address); + env.budget().reset_unlimited(); DeFindexVaultTest { @@ -162,7 +191,7 @@ impl<'a> DeFindexVaultTest<'a> { defindex_protocol_receiver, manager, strategy_client_token0, - strategy_client_token1, + strategy_client_token1, } } @@ -176,3 +205,4 @@ impl<'a> DeFindexVaultTest<'a> { } mod vault; +mod soroswap_setup; \ No newline at end of file diff --git a/apps/contracts/vault/src/test/soroswap_setup.rs b/apps/contracts/vault/src/test/soroswap_setup.rs new file mode 100644 index 00000000..21d7f42d --- /dev/null +++ b/apps/contracts/vault/src/test/soroswap_setup.rs @@ -0,0 +1,125 @@ +use soroban_sdk::{ + vec, Address, BytesN, Env, String, + testutils::{Address as _, AuthorizedFunction, AuthorizedInvocation, MockAuth, MockAuthInvoke}, + IntoVal, +}; + +fn pair_contract_wasm(e: &Env) -> BytesN<32> { + soroban_sdk::contractimport!( + file = "../soroswap/soroswap_pair.wasm" + ); + e.deployer().upload_contract_wasm(WASM) +} + +// SoroswapFactory Contract +mod factory { + soroban_sdk::contractimport!(file = "../soroswap/soroswap_factory.wasm"); + pub type SoroswapFactoryClient<'a> = Client<'a>; +} +pub use factory::SoroswapFactoryClient; + +pub fn create_soroswap_factory<'a>(e: &Env, setter: &Address) -> SoroswapFactoryClient<'a> { + let pair_hash = pair_contract_wasm(&e); + let factory_address = &e.register(factory::WASM, ()); + let factory = SoroswapFactoryClient::new(e, factory_address); + factory.initialize(&setter, &pair_hash); + factory +} + +// SoroswapRouter Contract +mod router { + soroban_sdk::contractimport!(file = "../soroswap/soroswap_router.wasm"); + pub type SoroswapRouterClient<'a> = Client<'a>; +} +pub use router::SoroswapRouterClient; + +// SoroswapRouter Contract +pub fn create_soroswap_router<'a>(e: &Env, factory: &Address) -> SoroswapRouterClient<'a> { + let router_address = &e.register(router::WASM, ()); + let router = SoroswapRouterClient::new(e, router_address); + router.initialize(factory); + router +} + +pub fn create_soroswap_pool<'a>(e: &Env, router: &SoroswapRouterClient, to: &Address, token_a: &Address, token_b: &Address, amount_a: &i128, amount_b: &i128) -> (i128, i128, i128) { + + let pair_address = router.router_pair_for(token_a, token_b); + router.mock_auths(&[ + MockAuth { + address: &to, + invoke: &MockAuthInvoke { + contract: &router.address.clone(), + fn_name: "add_liquidity", + args: vec![ + &e, + token_a.into_val(e), + token_b.into_val(e), + amount_a.into_val(e), + amount_b.into_val(e), + 0i128.into_val(e), + 0i128.into_val(e), + to.into_val(e), + (e.ledger().timestamp() + 3600).into_val(e), + ], + sub_invokes: &[ + MockAuthInvoke { + contract: &token_a.clone(), + fn_name: "transfer", + args: vec![ + &e, + to.into_val(e), + pair_address.into_val(e), + amount_a.into_val(e) + ], + sub_invokes: &[], + }, + MockAuthInvoke { + contract: &token_b.clone(), + fn_name: "transfer", + args: vec![ + &e, + to.into_val(e), + pair_address.into_val(e), + amount_b.into_val(e) + ], + sub_invokes: &[], + }, + ], + }, + }, + ]) + .add_liquidity( + token_a, + token_b, + &amount_a, + &amount_b, + &0i128, + &0i128, + &to, + &(e.ledger().timestamp() + 3600) + ) +} + +// SoroswapRouter Contract +mod aggregator { + soroban_sdk::contractimport!(file = "../soroswap/soroswap_aggregator.wasm"); + pub type SoroswapAggregatorClient<'a> = Client<'a>; +} +pub use aggregator::{SoroswapAggregatorClient, Adapter}; + +pub fn create_soroswap_aggregator<'a>(e: &Env, admin: &Address, router: &Address) -> SoroswapAggregatorClient<'a> { + let aggregator_address = &e.register(aggregator::WASM, ()); + let aggregator = SoroswapAggregatorClient::new(e, aggregator_address); + + let adapter_vec = vec![ + e, + Adapter { + protocol_id: String::from_str(e, "soroswap"), + address: router.clone(), + paused: false, + } + ]; + + aggregator.initialize(&admin, &adapter_vec); + aggregator +} \ No newline at end of file diff --git a/apps/contracts/vault/src/test/vault/rebalance.rs b/apps/contracts/vault/src/test/vault/rebalance.rs index d3c26f5b..cf14b8bf 100644 --- a/apps/contracts/vault/src/test/vault/rebalance.rs +++ b/apps/contracts/vault/src/test/vault/rebalance.rs @@ -1,9 +1,11 @@ -use soroban_sdk::{vec as sorobanvec, InvokeError, String, Vec}; +use soroban_sdk::{vec as sorobanvec, InvokeError, String, Vec, Map}; use crate::test::{ - create_defindex_vault, create_strategy_params_token0, defindex_vault::{ - ActionType, AssetInvestmentAllocation, AssetStrategySet, Instruction, OptionalSwapDetailsExactIn, OptionalSwapDetailsExactOut, StrategyAllocation - }, DeFindexVaultTest + create_defindex_vault, create_strategy_params_token0, create_strategy_params_token1, + defindex_vault::{ + ActionType, AssetInvestmentAllocation, AssetStrategySet, Instruction, OptionalSwapDetailsExactIn, + OptionalSwapDetailsExactOut, StrategyAllocation, DexDistribution, SwapDetailsExactIn, CurrentAssetInvestmentAllocation}, + DeFindexVaultTest }; use crate::test::defindex_vault::ContractError; @@ -421,5 +423,123 @@ fn insufficient_balance(){ } } +#[test] +fn swap_exact_in() { + let test = DeFindexVaultTest::setup(); + test.env.mock_all_auths(); + let strategy_params_token0 = create_strategy_params_token0(&test); + let strategy_params_token1 = create_strategy_params_token1(&test); + // initialize with 2 assets + let assets: Vec = sorobanvec![ + &test.env, + AssetStrategySet { + address: test.token0.address.clone(), + strategies: strategy_params_token0.clone() + }, + AssetStrategySet { + address: test.token1.address.clone(), + strategies: strategy_params_token1.clone() + } + ]; + + let defindex_contract = create_defindex_vault( + &test.env, + assets, + test.manager.clone(), + test.emergency_manager.clone(), + test.vault_fee_receiver.clone(), + 2000u32, + test.defindex_protocol_receiver.clone(), + test.defindex_factory.clone(), + String::from_str(&test.env, "dfToken"), + String::from_str(&test.env, "DFT"), + ); + let amount0 = 123456789i128; + let amount1 = 987654321i128; + + let users = DeFindexVaultTest::generate_random_users(&test.env, 2); + + test.token0_admin_client.mint(&users[0], &amount0); + test.token1_admin_client.mint(&users[0], &amount1); + + let deposit_result=defindex_contract.deposit( + &sorobanvec![&test.env, amount0, amount1], + &sorobanvec![&test.env, amount0, amount1], + &users[0], + &false, + ); + + // check total managed funds + let mut total_managed_funds_expected = Map::new(&test.env); + let strategy_investments_expected_token_0 = sorobanvec![&test.env, StrategyAllocation { + strategy_address: test.strategy_client_token0.address.clone(), + amount: 0, // funds have not been invested yet! + }]; + let strategy_investments_expected_token_1 = sorobanvec![&test.env, StrategyAllocation { + strategy_address: test.strategy_client_token1.address.clone(), + amount: 0, // funds have not been invested yet! + }]; + total_managed_funds_expected.set(test.token0.address.clone(), + CurrentAssetInvestmentAllocation { + asset: test.token0.address.clone(), + total_amount: amount0, + idle_amount: amount0, + invested_amount: 0i128, + strategy_allocations: strategy_investments_expected_token_0, + } + ); + total_managed_funds_expected.set(test.token1.address.clone(), + CurrentAssetInvestmentAllocation { + asset: test.token1.address.clone(), + total_amount: amount1, + idle_amount: amount1, + invested_amount: 0i128, + strategy_allocations: strategy_investments_expected_token_1, + } + ); + let total_managed_funds = defindex_contract.fetch_total_managed_funds(); + assert_eq!(total_managed_funds, total_managed_funds_expected); + + todo!(); + + // let mut distribution_vec = Vec::new(&test.env); + // // add one with part 1 and other with part 0 + // let mut path: Vec
= Vec::new(&test.env); + // path.push_back(test.token_0.address.clone()); + // path.push_back(test.token_1.address.clone()); + + // let distribution_0 = DexDistribution { + // protocol_id: String::from_str(&test.env, "soroswap"), + // path, + // parts: 1, + // }; + // distribution_vec.push_back(distribution_0); + + // test.token_0_admin_client.mint(&test.defindex_vault.address.clone(), &100000000); + + // // Rebalance from here on + // let instructions = sorobanvec![ + // &test.env, + // Instruction { + // action: ActionType::SwapExactIn, + // strategy: None, + // amount: None, + // swap_details_exact_in: OptionalSwapDetailsExactIn::Some(SwapDetailsExactIn { + // token_in: test.token_0.address.clone(), + // token_out: test.token_1.address.clone(), + // amount_in: 100, + // amount_out_min: 0, + // distribution: distribution_vec, + // deadline: test.env.ledger().timestamp() + 3600u64, + // router: test.soroswap_router.address.clone(), + // pair: test.soroswap_pair.clone(), + // }), + // swap_details_exact_out: OptionalSwapDetailsExactOut::None, + // } + // ]; + + // test.defindex_vault.rebalance(&instructions); + +}