This repository contains interfaces, clients, and WASM blobs for the Blend Protocol as implemented in the Blend Contracts repository.
To learn more about the Blend Protocol, visit the the docs:
The Blend Contract SDK uses a modified versioning system to control what version of the Stellar protocol the package supports.
[blend-protocol-version].[stellar-protocol-version].[sdk-version]
IE - 1.22.0
is the first version of the contract-sdk with v1 Blend Contracts and the protocol 22 Soroban SDK.
The Blend Contract SDK generates modules from the contractimport
Soroban SDK macro. Each module exposes a Client, WASM, and the respective types needed to interact with the Blend Protocol. The following Blend contracts are exposed as a module:
backstop
- Contract import for the backstop contractemitter
- Contract import for the emitter contractpool
- Contract import for the pool contractpool_factory
- Contract import for the pool factory contract
The Blend Contract SDK includes contractimport
's of the Comet Contracts when compiled for test purposes via the testutils
feature.
This includes:
comet
- Contract import for the comet pool contractcomet_factory
- Contract import for the comet pool factory contract
NOTE: These contracts were used for testing the Blend Protocol and should not be considered to be the latest version of the Comet Protocol. Please verify any non-test usage of the Comet contracts against the Comet GitHub.
The testutils
module allows for easy deployment of Blend Contracts to be used in a unit test. The following example shows how to use the testutils
to deploy a set of Blend Contracts and set up a pool.
If you require using the pool, please look at the following sep-41-oracle crate to deploy a mock oracle contract:
use soroban_sdk::{symbol_short, testutils::{Address as _, BytesN as _}, Address, BytesN, Env};
use blend_contract_sdk::{pool, testutils::{default_reserve_config, BlendFixture}};
let env = Env::default();
let deployer = Address::generate(&env);
let blnd = env.register_stellar_asset_contract_v2(deployer.clone()).address();
let usdc = env.register_stellar_asset_contract_v2(deployer.clone()).address();
let blend = BlendFixture::deploy(&env, &deployer, &blnd, &usdc);
let token = env.register_stellar_asset_contract_v2(deployer.clone()).address();
let pool = blend.pool_factory.mock_all_auths().deploy(
&deployer,
&symbol_short!("test"),
&BytesN::<32>::random(&env),
&Address::generate(&env),
&0_1000000, // 10%
&4, // 4 max positions
);
let pool_client = pool::Client::new(&env, &pool);
let reserve_config = default_reserve_config();
pool_client.mock_all_auths().queue_set_reserve(&token, &reserve_config);
pool_client.mock_all_auths().set_reserve(&token);
blend.backstop.mock_all_auths().deposit(&deployer, &pool, &50_000_0000000);
pool_client.mock_all_auths().set_status(&3); // remove pool from setup status
pool_client.mock_all_auths().update_status(); // update status based on backstop
The WASM files included will align with the GitHub release the SDK was published with (the version numbers will match).
The WASMs are generated with the Stellar Expert WASM Release Action as part of Blend Protocol Releases
The SHA256 Checksums:
- backstop -
62f61b32fff99f7eec052a8e573c367759f161c481a5caf0e76a10ae4617c3b4
- emitter -
438a5528cff17ede6fe515f095c43c5f15727af17d006971485e52462e7e7b89
- pool_factory -
0287f4ad7350935b83d94e046c0bcabc960b233dbce1531008c021b71d406a1d
- pool -
baf978f10efdbcd85747868bef8832845ea6809f7643b67a4ac0cd669327fc2c