Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32v1-none
components: clippy, rustfmt

- name: Cache cargo registry and build output
uses: actions/cache@v6
Expand All @@ -31,6 +32,14 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-

- name: Check formatting
working-directory: soroban
run: cargo fmt --all -- --check

- name: Run clippy
working-directory: soroban
run: cargo clippy --workspace --all-targets -- -D warnings

- name: Run tests
working-directory: soroban
run: cargo test --workspace
Expand Down
2 changes: 1 addition & 1 deletion soroban/contracts/factory/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ fn test_get_pool_bumps_pool_record_ttl() {
advance_ledgers(&t.env, TTL_EXTEND_TO - TTL_THRESHOLD + 1);
assert!(pool_record_ttl(&t.env, &t.factory_addr, id) < TTL_THRESHOLD);

assert_eq!(t.client.try_get_pool(&id).is_ok(), true);
assert!(t.client.try_get_pool(&id).is_ok());
assert_eq!(pool_record_ttl(&t.env, &t.factory_addr, id), TTL_EXTEND_TO);
}

Expand Down
16 changes: 13 additions & 3 deletions soroban/contracts/farming-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ impl FarmingPool {
bump_instance(&env);

env.storage().instance().set(&DataKey::Admin, &new_admin);
#[allow(deprecated)]
env.events().publish(
(symbol_short!("pool"), symbol_short!("adm_xfr")),
(current, new_admin),
Expand Down Expand Up @@ -250,11 +251,12 @@ impl FarmingPool {
let stake_token = get_stake_token(&env)?;
token::TokenClient::new(&env, &stake_token).transfer(
&user,
&env.current_contract_address(),
env.current_contract_address(),
&amount,
);

set_position(&env, &user, &position);
#[allow(deprecated)]
env.events().publish(
(symbol_short!("pool"), symbol_short!("locked")),
(user, amount),
Expand Down Expand Up @@ -295,6 +297,7 @@ impl FarmingPool {
set_position(&env, &user, &position);
}

#[allow(deprecated)]
env.events().publish(
(symbol_short!("pool"), symbol_short!("unlocked")),
(user, amount, total_credits),
Expand Down Expand Up @@ -327,6 +330,7 @@ impl FarmingPool {
get_admin(&env)?.require_auth();
bump_instance(&env);
env.storage().instance().set(&DataKey::Paused, &true);
#[allow(deprecated)]
env.events()
.publish((symbol_short!("pool"), symbol_short!("paused")), ());
Ok(())
Expand All @@ -337,6 +341,7 @@ impl FarmingPool {
get_admin(&env)?.require_auth();
bump_instance(&env);
env.storage().instance().set(&DataKey::Paused, &false);
#[allow(deprecated)]
env.events()
.publish((symbol_short!("pool"), symbol_short!("unpaused")), ());
Ok(())
Expand Down Expand Up @@ -384,6 +389,7 @@ impl FarmingPool {
set_banked_credits(&env, &user, banked_credits);
}

#[allow(deprecated)]
env.events().publish(
(symbol_short!("pool"), symbol_short!("emrg_exit")),
(admin, user, total_returned),
Expand Down Expand Up @@ -427,7 +433,7 @@ impl FarmingPool {
let stake_token = get_stake_token(&env)?;
token::TokenClient::new(&env, &stake_token).transfer(
&from,
&env.current_contract_address(),
env.current_contract_address(),
&amount,
);

Expand Down Expand Up @@ -461,7 +467,7 @@ impl FarmingPool {
assert!(!pool_is_paused(&env), "pool is paused");
require_initialized(&env)?;
assert!(
allocation_pct >= 1 && allocation_pct <= 100,
(1..=100).contains(&allocation_pct),
"allocation_pct must be 1-100"
);
bump_instance(&env);
Expand All @@ -476,6 +482,7 @@ impl FarmingPool {
bump_user(&env, &key);

let multiplier = read_global_multiplier(&env);
#[allow(deprecated)]
env.events().publish(
(symbol_short!("boost"), symbol_short!("applied")),
(user, allocation_pct, multiplier),
Expand Down Expand Up @@ -503,6 +510,7 @@ impl FarmingPool {
env.storage()
.instance()
.set(&DataKey::GlobalMultiplier, &multiplier);
#[allow(deprecated)]
env.events().publish(
(symbol_short!("boost"), symbol_short!("mult_set")),
multiplier,
Expand All @@ -522,6 +530,7 @@ impl FarmingPool {
env.storage()
.instance()
.set(&DataKey::CreditRate, &new_rate);
#[allow(deprecated)]
env.events().publish(
(symbol_short!("pool"), symbol_short!("rate_set")),
(old_rate, new_rate),
Expand All @@ -538,6 +547,7 @@ impl FarmingPool {
env.storage()
.instance()
.set(&DataKey::MinLockPeriod, &new_period);
#[allow(deprecated)]
env.events().publish(
(symbol_short!("pool"), symbol_short!("lock_set")),
(old_period, new_period),
Expand Down