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
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ members = [
exclude = [
"contracts/compound_fees",
"contracts/flash_loan_guard",
"contracts/yield_vault",

]
default-members = ["contracts/*"]

Expand Down
12 changes: 10 additions & 2 deletions contracts/yield_vault/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,24 @@ name = "bc-forge-yield-vault"
version = "0.1.0"
edition = "2021"
publish = false
description = "Yield vault helpers for slippage and share-balance guards"
description = "Yield vault for bc-forge contracts — deposit/withdraw with guards and rate limiting"
license = "MIT"
repository = "https://github.com/BCPathway/bc-forge"
homepage = "https://github.com/BCPathway/bc-forge"

[lib]
crate-type = ["rlib"]
crate-type = ["cdylib", "rlib"]

[dependencies]
soroban-sdk = "22.0.11"
bc-forge-admin = { path = "../admin" }
bc-forge-lifecycle = { path = "../lifecycle" }
bc-forge-rate-limit = { path = "../rate-limit" }
bc-forge-ttl = { path = "../ttl" }

[dev-dependencies]
soroban-sdk = { version = "22.0.11", features = ["testutils"] }
bc-forge-token = { path = "../token", features = ["testutils"] }

[features]
testutils = ["soroban-sdk/testutils"]
35 changes: 35 additions & 0 deletions contracts/yield_vault/src/events.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//! # bc-forge Yield Vault Events
//!
//! Structured event emission for all yield vault operations.

use soroban_sdk::{symbol_short, Address, Env};

/// Emitted when the yield vault is initialized.
pub fn emit_initialized(env: &Env, admin: &Address, token: &Address) {
env.events()
.publish((symbol_short!("init"),), (admin.clone(), token.clone()));
}

/// Emitted when assets are deposited and shares are minted.
pub fn emit_deposit(env: &Env, caller: &Address, assets: i128, shares: i128) {
env.events().publish(
(symbol_short!("deposit"),),
(caller.clone(), assets, shares),
);
}

/// Emitted when shares are withdrawn for underlying tokens.
pub fn emit_withdraw(env: &Env, caller: &Address, shares: i128, tokens_out: i128) {
env.events().publish(
(symbol_short!("withdraw"),),
(caller.clone(), shares, tokens_out),
);
}

/// Emitted when non-underlying tokens are rescued by an admin.
pub fn emit_rescue_tokens(env: &Env, admin: &Address, token: &Address, to: &Address, amount: i128) {
env.events().publish(
(symbol_short!("rescue"),),
(admin.clone(), token.clone(), to.clone(), amount),
);
}
Loading
Loading