Skip to content
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ breaking changes bump the **minor** version, and they are called out as such.
accepts an optional `coupon_id` parameter; when provided, the discount is applied
atomically before the token transfer. Added error codes `CouponNotFound` and
`CouponAlreadyRedeemed` to the common Error enum.
- docs: rustdoc for `receipt-shard`'s 4 exported names (#749) and for the 5
public fields of `BuybackConfiguredEvent` (#790). Doc comments only — no
signature, struct layout or behaviour change.

### Added
- **`privacy` (issue #440): Groth16 verification for concealed escrow amounts.**
Expand Down
9 changes: 9 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
- Exchange rate progression and lock-epoch-based redemption
- CHANGELOG.md entry added

## Issue #749: rustdoc for receipt-shard's 4 exported names

- [x] Document `DataKey`, `ReceiptShard`, `get_batch` and `extend_batch_ttl` (#749)
- `contracts/receipt-shard/src/lib.rs` — doc comments only, no signature, body or test changes

## Issue #790: rustdoc for `BuybackConfiguredEvent`'s 5 public fields

- [x] Document the struct's 5 public fields (#790)
- `contracts/treasury/src/buyback.rs` — doc comments only, field/type/order/derives unchanged
## Issue #663: Reconcile immutability claims with refund-vault's upgrade_wasm

- [x] Reconcile immutability claims with refund-vault's upgrade_wasm (#663)
Expand Down
12 changes: 12 additions & 0 deletions contracts/receipt-shard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ contractmeta!(
);
contractmeta!(key = "commit", val = env!("GIT_SHA"));

/// Storage keys for this shard's instance state and its per-batch records.
#[contracttype]
pub enum DataKey {
Router,
Expand Down Expand Up @@ -66,6 +67,9 @@ const TTL_THRESHOLD: u32 = 100;
/// MAX_BATCH_SIZE = 1000 (router constant), that is 10.
const MAX_PROOF_LEN: u32 = 10;

/// A storage shard: holds the batch records for one `[start_batch_id,
/// end_batch_id)` slice of a router's batch stream. Every state-changing
/// entry point authenticates the `router` address recorded at construction.
Comment thread
CHASE3020 marked this conversation as resolved.
#[contract]
pub struct ReceiptShard;

Expand Down Expand Up @@ -140,6 +144,10 @@ impl ReceiptShard {
.extend_ttl(&DataKey::Batch(batch_id), TTL_THRESHOLD, TTL_EXTEND);
}

/// Reads this shard's record for `batch_id`. Read-only and
/// unauthenticated. Returns `Error::BatchNotFound` when the shard holds no
/// record for that id — because it was never anchored, or because
/// `prune_batches` already deleted it.
pub fn get_batch(env: Env, batch_id: u64) -> Result<BatchRecord, Error> {
env.storage()
.persistent()
Expand Down Expand Up @@ -183,6 +191,10 @@ impl ReceiptShard {
computed_hash
}

/// Extends the TTL of the batch record at `batch_id` so an unpruned record
/// stays live. Publicly callable, no auth and no caller precondition except
/// that the shard is still active (an inactive shard panics). Returns
/// `Error::BatchNotFound` when the shard holds no record for that id.
pub fn extend_batch_ttl(env: Env, batch_id: u64) -> Result<(), Error> {
assert!(Self::is_active(env.clone()), "shard is inactive");
if !env.storage().persistent().has(&DataKey::Batch(batch_id)) {
Expand Down
10 changes: 10 additions & 0 deletions contracts/treasury/src/buyback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,22 @@ pub struct BuybackConfig {
#[contractevent]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct BuybackConfiguredEvent {
/// Token the treasury spends; written by `set_buyback_config` and published
/// as an event topic.
#[topic]
pub fee_token: Address,
/// Token the treasury buys back and burns; written by `set_buyback_config`
/// and published as an event topic.
#[topic]
pub governance_token: Address,
/// Router the swap is sent to; written by `set_buyback_config` and carried
/// in the event data.
pub router: Address,
/// Destination the bought governance tokens are sent to; written by
/// `set_buyback_config`.
pub burn_address: Address,
/// Smallest swap `execute_buyback` will perform, in fee-token units;
/// written by `set_buyback_config`.
pub min_amount_in: i128,
}

Expand Down
Loading