diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..d880042b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Stellar Expert WASM Release +on: + push: + tags: + - 'v*' # triggered whenever a new tag (previxed with "v") is pushed to the repository +jobs: + release-contract-backstop: + uses: stellar-expert/soroban-build-workflow/.github/workflows/release.yml@main + with: + release_name: ${{ github.ref_name }} + release_description: 'Blend Backstop Release' + package: 'backstop' + make_target: 'build' + secrets: + release_token: ${{ secrets.GITHUB_TOKEN }} + + release-contract-pool: + uses: stellar-expert/soroban-build-workflow/.github/workflows/release.yml@main + with: + release_name: ${{ github.ref_name }} + release_description: 'Blend Pool Release' + package: 'pool' + make_target: 'build' + secrets: + release_token: ${{ secrets.GITHUB_TOKEN }} + + release-contract-emitter: + uses: stellar-expert/soroban-build-workflow/.github/workflows/release.yml@main + with: + release_name: ${{ github.ref_name }} + release_description: 'Blend Emitter Release' + package: 'emitter' + secrets: + release_token: ${{ secrets.GITHUB_TOKEN }} + + release-contract-pool-factory: + uses: stellar-expert/soroban-build-workflow/.github/workflows/release.yml@main + with: + release_name: ${{ github.ref_name }} + release_description: 'Blend Pool Factory Release' + package: 'pool-factory' + make_target: 'build' + secrets: + release_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Cargo.lock b/Cargo.lock index 3d3bff95..67e4f7bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,7 +106,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "blend-contract-sdk" -version = "0.2.0" +version = "0.3.0" dependencies = [ "soroban-sdk", ] diff --git a/backstop/src/emissions/claim.rs b/backstop/src/emissions/claim.rs index d8f8c665..32186556 100644 --- a/backstop/src/emissions/claim.rs +++ b/backstop/src/emissions/claim.rs @@ -212,7 +212,7 @@ mod tests { assert_eq!(result, 75_3145677 + 6_2904190); assert_eq!( lp_client.balance(&backstop_address), - backstop_lp_balance + 6_5244800 + backstop_lp_balance + 6_4729326 ); assert_eq!( blnd_token_client.balance(&backstop_address), @@ -221,18 +221,18 @@ mod tests { let sam_balance_1 = storage::get_user_balance(&e, &pool_1_id, &samwise); assert_eq!(sam_balance_1.shares, 9_0000000); let frodo_balance_1 = storage::get_user_balance(&e, &pool_1_id, &frodo); - assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_5761820); + assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_5400274); let sam_balance_2 = storage::get_user_balance(&e, &pool_2_id, &samwise); assert_eq!(sam_balance_2.shares, 7_5000000); let frodo_balance_2 = storage::get_user_balance(&e, &pool_2_id, &frodo); - assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 0_3947102); + assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 0_3915917); let pool_balance_1 = storage::get_pool_balance(&e, &pool_1_id); - assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 6_1015761); - assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_5761820); + assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 6_0533699); + assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_5400274); let pool_balance_2 = storage::get_pool_balance(&e, &pool_2_id); - assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 0_4229038); - assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 0_3947102); + assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 0_4195626); + assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 0_3915917); let new_backstop_1_data = storage::get_backstop_emis_data(&e, &pool_1_id).unwrap_optimized(); @@ -371,7 +371,7 @@ mod tests { assert_eq!(result, 75_3145677 + 6_2904190); assert_eq!( lp_client.balance(&backstop_address), - backstop_lp_balance + 6_5244800 + backstop_lp_balance + 6_4729326 ); assert_eq!( blnd_token_client.balance(&backstop_address), @@ -380,18 +380,18 @@ mod tests { let sam_balance_1 = storage::get_user_balance(&e, &pool_1_id, &samwise); assert_eq!(sam_balance_1.shares, 9_0000000); let frodo_balance_1 = storage::get_user_balance(&e, &pool_1_id, &frodo); - assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_5761820); + assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_5400274); let sam_balance_2 = storage::get_user_balance(&e, &pool_2_id, &samwise); assert_eq!(sam_balance_2.shares, 7_5000000); let frodo_balance_2 = storage::get_user_balance(&e, &pool_2_id, &frodo); - assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 0_3947102); + assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 0_3915917); let pool_balance_1 = storage::get_pool_balance(&e, &pool_1_id); - assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 6_1015761); - assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_5761820); + assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 6_0533699); + assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_5400274); let pool_balance_2 = storage::get_pool_balance(&e, &pool_2_id); - assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 0_4229038); - assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 0_3947102); + assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 0_4195626); + assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 0_3915917); let new_backstop_1_data = storage::get_backstop_emis_data(&e, &pool_1_id).unwrap_optimized(); @@ -435,47 +435,47 @@ mod tests { &vec![&e, pool_1_id.clone(), pool_2_id.clone()], &frodo, ); - assert_eq!(result_1, 1005009202); + assert_eq!(result_1, 1005194703); assert_eq!( blnd_token_client.balance(&backstop_address), - 200_0000000 - (75_3145677 + 6_2904190) - (1005009202) + 200_0000000 - (75_3145677 + 6_2904190) - (1005194703) ); assert_eq!( lp_client.balance(&backstop_address), - backstop_lp_balance + 7_9137036 + backstop_lp_balance + 7_7889107 ); let sam_balance_1 = storage::get_user_balance(&e, &pool_1_id, &samwise); assert_eq!(sam_balance_1.shares, 9_0000000); let frodo_balance_1 = storage::get_user_balance(&e, &pool_1_id, &frodo); - assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_3004891); + assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_2609092); let sam_balance_2 = storage::get_user_balance(&e, &pool_2_id, &samwise); assert_eq!(sam_balance_2.shares, 7_5000000); let frodo_balance_2 = storage::get_user_balance(&e, &pool_2_id, &frodo); - assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 2_0344033); + assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 2_0152958); let pool_balance_1 = storage::get_pool_balance(&e, &pool_1_id); - assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 5_7339856); - assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_3004891); + assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 5_6812124); + assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_2609092); let pool_balance_2 = storage::get_pool_balance(&e, &pool_2_id); - assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 2_1797179); - assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 2_0344033); + assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 2_1592456); + assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 2_0152958); let new_backstop_1_data = storage::get_backstop_emis_data(&e, &pool_1_id).unwrap_optimized(); let new_user_1_data = storage::get_user_emis_data(&e, &pool_1_id, &samwise).unwrap_optimized(); assert_eq!(new_backstop_1_data.last_time, block_timestamp_1); - assert_eq!(new_backstop_1_data.index, 164344784); + assert_eq!(new_backstop_1_data.index, 164363961); assert_eq!(new_user_1_data.accrued, 0); - assert_eq!(new_user_1_data.index, 164344784); + assert_eq!(new_user_1_data.index, 164363961); let new_backstop_2_data = storage::get_backstop_emis_data(&e, &pool_2_id).unwrap_optimized(); let new_user_2_data = storage::get_user_emis_data(&e, &pool_2_id, &samwise).unwrap_optimized(); assert_eq!(new_backstop_2_data.last_time, block_timestamp_1); - assert_eq!(new_backstop_2_data.index, 43961378); + assert_eq!(new_backstop_2_data.index, 43963099); assert_eq!(new_user_2_data.accrued, 0); - assert_eq!(new_user_2_data.index, 43961378); + assert_eq!(new_user_2_data.index, 43963099); }); } diff --git a/backstop/src/testutils.rs b/backstop/src/testutils.rs index 8fb8d027..f9ca72a7 100644 --- a/backstop/src/testutils.rs +++ b/backstop/src/testutils.rs @@ -142,21 +142,15 @@ pub(crate) fn create_comet_lp_pool<'a>( let usdc_client = MockTokenClient::new(e, usdc_token); blnd_client.mint(&admin, &1_000_0000000); usdc_client.mint(&admin, &25_0000000); - let exp_ledger = e.ledger().sequence() + 100; - blnd_client.approve(&admin, &contract_address, &2_000_0000000, &exp_ledger); - usdc_client.approve(&admin, &contract_address, &2_000_0000000, &exp_ledger); - client.init(&Address::generate(e), &admin); - client.bundle_bind( + client.init( + admin, &vec![e, blnd_token.clone(), usdc_token.clone()], + &vec![e, 0_8000000, 0_2000000], &vec![e, 1_000_0000000, 25_0000000], - &vec![e, 8_0000000, 2_0000000], + &0_0030000, ); - client.set_swap_fee(&0_0030000, &admin); - client.set_public_swap(&admin, &true); - client.finalize(); - (contract_address, client) } diff --git a/blend-contract-sdk/Cargo.toml b/blend-contract-sdk/Cargo.toml index 79e65847..97dab61d 100644 --- a/blend-contract-sdk/Cargo.toml +++ b/blend-contract-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blend-contract-sdk" -version = "0.2.0" +version = "0.3.0" description = "Traits, clients, types, and WASMs for the Blend Protocol for use in Soroban contract development." homepage = "https://github.com/blend-capital/blend-contracts" repository = "https://github.com/blend-capital/blend-contracts" diff --git a/blend-contract-sdk/README.md b/blend-contract-sdk/README.md index 94389111..4cbf11dd 100644 --- a/blend-contract-sdk/README.md +++ b/blend-contract-sdk/README.md @@ -66,21 +66,12 @@ pool_client.mock_all_auths().update_status(); // update status based on backstop ## WASM Verification -The WASM files included will align with the GitHub release the SDK was published with (the version numbers will match). The WASM files were generated with the Makefile. +The WASM files included will align with the GitHub release the SDK was published with (the version numbers will match). -Since WASM builds can vary based on factors like OS, here are the details of the machine that built the WASMs included in this package: - -* Ubuntu 22.04.4 LTS -* stable-x86_64-unknown-linux-gnu (default) -* rustc 1.77.1 (7cf61ebde 2024-03-27) -* soroban 20.3.1 (ae5446f63ca8a275e61912019199254d598f3bd5) -* soroban-env 20.2.1 (18a10592853d9edf4e341b565b0b1638f95f0393) -* soroban-env interface version 85899345920 -* stellar-xdr 20.1.0 (8b9d623ef40423a8462442b86997155f2c04d3a1) -* xdr curr (b96148cd4acc372cc9af17b909ffe4b12c43ecb6) +The WASMs are generated with the [Stellar Expert WASM Release Action](https://github.com/stellar-expert/soroban-build-workflow) The SHA256 Checksums: -* backstop - `8dfbc6ba300cde6ebe747cf985cf9221bf3594981595b9c26bbd108ff19a5598` -* emitter - `b1555702a4cca7c44e02beb5aa82b0271c0367471c68f2ec9246c31b202e38ee` -* pool_factory - `8bc7894d8a4e46b085d0579e233e3c436bb34e18f9a2a83d4bde8526cde18cb6` -* pool - `76ebcea354d5959c5b0d38818ddf1524c5af16970231b532f5caa63121930861` \ No newline at end of file +* backstop - `8ed2a58d4b71e3d8f15b74bae8287a825f7bb78ba72663a920141d9d1c1d8bb2` +* emitter - `ce85c955b135e08e055b157fc96c371c9107b4f3a16d920668f5529d7c616b9c` +* pool_factory - `0287f4ad7350935b83d94e046c0bcabc960b233dbce1531008c021b71d406a1d` +* pool - `baf978f10efdbcd85747868bef8832845ea6809f7643b67a4ac0cd669327fc2c` \ No newline at end of file diff --git a/blend-contract-sdk/src/testutils.rs b/blend-contract-sdk/src/testutils.rs index 1554491d..01b62d73 100644 --- a/blend-contract-sdk/src/testutils.rs +++ b/blend-contract-sdk/src/testutils.rs @@ -1,4 +1,4 @@ -use soroban_sdk::{testutils::Address as _, token::StellarAssetClient, vec, Address, Env, Map}; +use soroban_sdk::{token::StellarAssetClient, vec, Address, Env, Map}; use crate::{backstop, emitter, pool, pool_factory}; @@ -6,10 +6,6 @@ pub mod comet { soroban_sdk::contractimport!(file = "./wasm/comet.wasm"); } -pub mod comet_factory { - soroban_sdk::contractimport!(file = "./wasm/comet_factory.wasm"); -} - /// Create a "good enough" ReserveConfig for most testing usecases /// /// Can be used when creating reserves for a pool. @@ -70,22 +66,13 @@ impl<'a> BlendFixture<'a> { .mint(deployer, &(25_0000000 * 2001)); let comet_client: comet::Client<'a> = comet::Client::new(env, &comet); - comet_client - .mock_all_auths() - .init(&Address::generate(env), deployer); - - comet_client.mock_all_auths().bundle_bind( + comet_client.mock_all_auths().init( + &deployer, &vec![env, blnd.clone(), usdc.clone()], + &vec![env, 0_8000000, 0_2000000], &vec![env, 1_000_0000000, 25_0000000], - &vec![env, 8_0000000, 2_0000000], + &0_0030000, ); - comet_client - .mock_all_auths() - .set_swap_fee(&30000_i128, deployer); - comet_client - .mock_all_auths() - .set_public_swap(deployer, &true); - comet_client.mock_all_auths().finalize(); comet_client.mock_all_auths().join_pool( &199_900_0000000, // finalize mints 100 diff --git a/blend-contract-sdk/wasm/backstop.wasm b/blend-contract-sdk/wasm/backstop.wasm old mode 100644 new mode 100755 index 8b0bd59f..13fba9ff Binary files a/blend-contract-sdk/wasm/backstop.wasm and b/blend-contract-sdk/wasm/backstop.wasm differ diff --git a/blend-contract-sdk/wasm/comet.wasm b/blend-contract-sdk/wasm/comet.wasm old mode 100644 new mode 100755 index 82118f99..e9493fd7 Binary files a/blend-contract-sdk/wasm/comet.wasm and b/blend-contract-sdk/wasm/comet.wasm differ diff --git a/blend-contract-sdk/wasm/comet_factory.wasm b/blend-contract-sdk/wasm/comet_factory.wasm old mode 100644 new mode 100755 index 3a73646b..9db8020a Binary files a/blend-contract-sdk/wasm/comet_factory.wasm and b/blend-contract-sdk/wasm/comet_factory.wasm differ diff --git a/blend-contract-sdk/wasm/emitter.wasm b/blend-contract-sdk/wasm/emitter.wasm old mode 100644 new mode 100755 index 68bed722..de52228f Binary files a/blend-contract-sdk/wasm/emitter.wasm and b/blend-contract-sdk/wasm/emitter.wasm differ diff --git a/blend-contract-sdk/wasm/pool.wasm b/blend-contract-sdk/wasm/pool.wasm old mode 100644 new mode 100755 index c10913a8..522dcccb Binary files a/blend-contract-sdk/wasm/pool.wasm and b/blend-contract-sdk/wasm/pool.wasm differ diff --git a/blend-contract-sdk/wasm/pool_factory.wasm b/blend-contract-sdk/wasm/pool_factory.wasm old mode 100644 new mode 100755 index 553a632c..cc662d3d Binary files a/blend-contract-sdk/wasm/pool_factory.wasm and b/blend-contract-sdk/wasm/pool_factory.wasm differ diff --git a/comet.wasm b/comet.wasm old mode 100644 new mode 100755 index 82118f99..e9493fd7 Binary files a/comet.wasm and b/comet.wasm differ diff --git a/pool/src/testutils.rs b/pool/src/testutils.rs index 86d4e63f..057bc181 100644 --- a/pool/src/testutils.rs +++ b/pool/src/testutils.rs @@ -145,21 +145,15 @@ pub(crate) fn create_comet_lp_pool<'a>( let usdc_client = MockTokenClient::new(e, usdc_token); blnd_client.mint(&admin, &1_000_0000000); usdc_client.mint(&admin, &25_0000000); - let exp_ledger = e.ledger().sequence() + 100; - blnd_client.approve(&admin, &contract_address, &2_000_0000000, &exp_ledger); - usdc_client.approve(&admin, &contract_address, &2_000_0000000, &exp_ledger); - client.init(&Address::generate(e), &admin); - client.bundle_bind( + client.init( + admin, &vec![e, blnd_token.clone(), usdc_token.clone()], + &vec![e, 0_8000000, 0_2000000], &vec![e, 1_000_0000000, 25_0000000], - &vec![e, 8_0000000, 2_0000000], + &0_0030000, ); - client.set_swap_fee(&0_0030000, &admin); - client.set_public_swap(&admin, &true); - client.finalize(); - (contract_address, client) } diff --git a/test-suites/src/liquidity_pool.rs b/test-suites/src/liquidity_pool.rs index 0afa5c88..3a0df37e 100644 --- a/test-suites/src/liquidity_pool.rs +++ b/test-suites/src/liquidity_pool.rs @@ -30,19 +30,14 @@ pub(crate) fn create_lp_pool<'a>( let token_2_client = MockTokenClient::new(e, token_2); token_1_client.mint(&admin, &1_000_0000000); token_2_client.mint(&admin, &25_0000000); - token_1_client.approve(&admin, &contract_address, &1_000_0000000, &5356700); - token_2_client.approve(&admin, &contract_address, &1_000_0000000, &5356700); - client.init(&Address::generate(e), &admin); - client.bundle_bind( + client.init( + admin, &vec![e, token_1.clone(), token_2.clone()], + &vec![e, 0_8000000, 0_2000000], &vec![e, 1_000_0000000, 25_0000000], - &vec![e, 8_0000000, 2_0000000], + &0_0030000, ); - client.set_swap_fee(&0_0030000, &admin); - client.set_public_swap(&admin, &true); - client.finalize(); - (contract_address, client) } diff --git a/test-suites/tests/test_wasm_happy_path.rs b/test-suites/tests/test_wasm_happy_path.rs index ad9fc1bc..cfc777ee 100644 --- a/test-suites/tests/test_wasm_happy_path.rs +++ b/test-suites/tests/test_wasm_happy_path.rs @@ -391,7 +391,7 @@ fn test_wasm_happy_path() { &vec![&fixture.env, pool_fixture.pool.address.clone()], &frodo, ); - assert_eq!(claim_amount, 420798_0000000); + assert_eq!(claim_amount, 420797_9966204); backstop_blnd_balance -= claim_amount; assert_eq!( fixture.tokens[TokenIndex::BLND].balance(&fixture.backstop.address), @@ -433,8 +433,8 @@ fn test_wasm_happy_path() { &vec![&fixture.env, pool_fixture.pool.address.clone()], &frodo, ); - assert_eq!(claim_amount, 22014719_9998450); //actual amount is 22014720_0000000 but get's rounded down // 22014719_9998450 - backstop_blnd_balance -= 22014719_9998450; + assert_eq!(claim_amount, 22014719_9894996); //actual amount is 22014720_0000000 but get's rounded down + backstop_blnd_balance -= 22014719_9894996; assert_eq!( fixture.tokens[TokenIndex::BLND].balance(&fixture.backstop.address), backstop_blnd_balance