Skip to content
Open
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
7 changes: 7 additions & 0 deletions contracts/market/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,13 @@ impl MarketContract {
/// time in [`Self::set_fee_rate`]) so a cap lowered by the admin while a
/// change is in flight cannot let a stale, now-excessive rate through.
pub fn execute_fee_rate_change(env: Env) -> Result<i128, ContractError> {
// Guard: contract must be fully initialized before a pending fee-rate
// change can be applied. Without this check a caller could observe a
// PendingFeeRate entry that was somehow written before initialization
// completed and apply it, writing FeeRateBps storage before the admin
// is set and leaving the contract in an inconsistent state.
validation::require_initialized(&env)?;

let pending = storage::get_pending_fee_rate_change(&env)
.ok_or(ContractError::NoPendingFeeChange)?;
if env.ledger().timestamp() < pending.effective_at {
Expand Down