Skip to content

Commit 6b4b5b0

Browse files
Rename allowance expiration argument to live_until_ledger (#1932)
### What Renames the `approve` allowance-expiration argument from `expiration_ledger` to `live_until_ledger` in both the `TokenInterface` and `StellarAssetInterface` traits, aligning the SDK with the SEP-41 spec. The `Approve` event's data field doc is left as `expiration_ledger` to preserve on-chain event compatibility. ### Why The argument name is part of the generated contract spec XDR. `TokenInterface` had been updated to `live_until_ledger` (matching SEP-41), but `StellarAssetInterface` still used `expiration_ledger`, so the two `approve` spec entries no longer matched and `test_stellar_asset_spec_includes_token_spec` failed. Aligning both traits to the SEP-41 name fixes the mismatch. All ten SEP-41 functions and their argument names were checked; `approve` was the only discrepancy. ### Known limitations N/A --------- Co-authored-by: Leigh <351529+leighmcculloch@users.noreply.github.com>
1 parent e5cb4b5 commit 6b4b5b0

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

soroban-sdk/src/token.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,16 @@ pub trait TokenInterface {
114114
/// * `spender` - The address being authorized to spend the tokens held by
115115
/// `from`.
116116
/// * `amount` - The tokens to be made available to `spender`.
117-
/// * `expiration_ledger` - The ledger number where this allowance expires. Cannot
117+
/// * `live_until_ledger` - The ledger number where this allowance expires. Cannot
118118
/// be less than the current ledger number unless the amount is being set to 0.
119-
/// An expired entry (where expiration_ledger < the current ledger number)
119+
/// An expired entry (where live_until_ledger < the current ledger number)
120120
/// should be treated as a 0 amount allowance.
121121
///
122122
/// # Events
123123
///
124124
/// Emits an event with topics `["approve", from: Address,
125125
/// spender: Address], data = [amount: i128, expiration_ledger: u32]`
126-
fn approve(env: Env, from: Address, spender: Address, amount: i128, expiration_ledger: u32);
126+
fn approve(env: Env, from: Address, spender: Address, amount: i128, live_until_ledger: u32);
127127

128128
/// Returns the balance of `id`.
129129
///
@@ -276,16 +276,16 @@ pub trait StellarAssetInterface {
276276
/// * `spender` - The address being authorized to spend the tokens held by
277277
/// `from`.
278278
/// * `amount` - The tokens to be made available to `spender`.
279-
/// * `expiration_ledger` - The ledger number where this allowance expires. Cannot
279+
/// * `live_until_ledger` - The ledger number where this allowance expires. Cannot
280280
/// be less than the current ledger number unless the amount is being set to 0.
281-
/// An expired entry (where expiration_ledger < the current ledger number)
281+
/// An expired entry (where live_until_ledger < the current ledger number)
282282
/// should be treated as a 0 amount allowance.
283283
///
284284
/// # Events
285285
///
286286
/// Emits an event with topics `["approve", from: Address,
287287
/// spender: Address], data = [amount: i128, expiration_ledger: u32]`
288-
fn approve(env: Env, from: Address, spender: Address, amount: i128, expiration_ledger: u32);
288+
fn approve(env: Env, from: Address, spender: Address, amount: i128, live_until_ledger: u32);
289289

290290
/// Returns the balance of `id`.
291291
///

0 commit comments

Comments
 (0)