Skip to content
Closed
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
6 changes: 6 additions & 0 deletions contracts/governance-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ impl GovernanceCoreContract {
.set(&DataKey::RoleCount(role), &(count - 1));
}
}

env.events()
.publish((symbol_short!("role"), symbol_short!("revoked")), account);
}

pub fn has_role(env: Env, account: Address, role: Role) -> bool {
Expand Down Expand Up @@ -222,6 +225,9 @@ impl GovernanceCoreContract {
env.storage()
.instance()
.set(&DataKey::GovernanceParams, &params);

env.events()
.publish((symbol_short!("params"), symbol_short!("updated")), admin);
}

pub fn get_params(env: Env) -> GovernanceParams {
Expand Down
5 changes: 4 additions & 1 deletion contracts/kyc-registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,16 @@ impl KycRegistryContract {
.expect("kyc not found");

record.verified = false;
let _ttl_key = DataKey::KycRecord(account);
let _ttl_key = DataKey::KycRecord(account.clone());
env.storage().persistent().set(&_ttl_key, &record);
env.storage().persistent().extend_ttl(
&_ttl_key,
PERSISTENT_LIFETIME_THRESHOLD,
PERSISTENT_BUMP_AMOUNT,
);

env.events()
.publish((symbol_short!("kyc"), symbol_short!("revoked")), account);
}

pub fn is_kyc_valid(env: Env, account: Address) -> bool {
Expand Down
15 changes: 15 additions & 0 deletions contracts/liquidity-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ impl LiquidityPoolContract {
let token_client = token::Client::new(&env, &token_addr);
token_client.transfer(&env.current_contract_address(), &provider, &amount);

env.events().publish(
(symbol_short!("pool"), symbol_short!("withdraw")),
(provider, shares, amount),
);

amount
}

Expand Down Expand Up @@ -311,6 +316,11 @@ impl LiquidityPoolContract {
.unwrap();
let token_client = token::Client::new(&env, &token_addr);
token_client.transfer(&env.current_contract_address(), &borrower, &amount);

env.events().publish(
(symbol_short!("pool"), symbol_short!("borrow")),
(borrower, campaign_id, amount),
);
}

/// Calculate interest accrued on a borrow position
Expand Down Expand Up @@ -370,6 +380,11 @@ impl LiquidityPoolContract {
PERSISTENT_BUMP_AMOUNT,
);

env.events().publish(
(symbol_short!("pool"), symbol_short!("accrue")),
(campaign_id, new_interest),
);

new_interest
}

Expand Down
16 changes: 13 additions & 3 deletions contracts/multisig-treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl MultisigTreasuryContract {
}

tx.approvals += 1;
let _ttl_key = DataKey::TxApproval(tx_id, signer);
let _ttl_key = DataKey::TxApproval(tx_id, signer.clone());
env.storage().persistent().set(&_ttl_key, &true);
env.storage().persistent().extend_ttl(
&_ttl_key,
Expand All @@ -219,6 +219,11 @@ impl MultisigTreasuryContract {
PERSISTENT_LIFETIME_THRESHOLD,
PERSISTENT_BUMP_AMOUNT,
);

env.events().publish(
(symbol_short!("tx"), symbol_short!("approved")),
(tx_id, signer),
);
}

pub fn execute_transaction(env: Env, caller: Address, tx_id: u64) {
Expand Down Expand Up @@ -338,7 +343,7 @@ impl MultisigTreasuryContract {
.persistent()
.set(&DataKey::TxRejection(tx_id, signer.clone()), &true);
env.storage().persistent().extend_ttl(
&DataKey::TxRejection(tx_id, signer),
&DataKey::TxRejection(tx_id, signer.clone()),
PERSISTENT_LIFETIME_THRESHOLD,
PERSISTENT_BUMP_AMOUNT,
);
Expand All @@ -350,6 +355,11 @@ impl MultisigTreasuryContract {
PERSISTENT_LIFETIME_THRESHOLD,
PERSISTENT_BUMP_AMOUNT,
);

env.events().publish(
(symbol_short!("tx"), symbol_short!("rejected")),
(tx_id, signer),
);
}

pub fn get_transaction(env: Env, tx_id: u64) -> Option<TreasuryTx> {
Expand Down Expand Up @@ -460,7 +470,7 @@ impl MultisigTreasuryContract {
}
env.storage().instance().set(&DataKey::Paused, &paused);
env.events()
.publish((symbol_short!("pause"), symbol_short!("set")), paused);
.publish((symbol_short!("pause"), symbol_short!("set")), (admin, paused));
}

/// Whether the contract is currently paused.
Expand Down