-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fn to expose max expiration available (#1106)
### What Add fn to expose max expiration available. ### Why It came up in the Discord meeting today that it would be helpful if contracts can access the max expiration as they may wish to simply bump to that. The host fn exists, but it isn't exposed in the SDK.
- Loading branch information
1 parent
3db7a43
commit 05d5332
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use crate::{self as soroban_sdk, testutils::Ledger as _}; | ||
use soroban_sdk::{contract, Env}; | ||
|
||
#[contract] | ||
pub struct Contract; | ||
|
||
#[test] | ||
fn max() { | ||
let e = Env::default(); | ||
let contract_id = e.register_contract(None, Contract); | ||
|
||
let mut ledger_info = e.ledger().get(); | ||
ledger_info.sequence_number = 1; | ||
ledger_info.max_entry_expiration = 5; | ||
e.ledger().set(ledger_info); | ||
|
||
e.as_contract(&contract_id, || { | ||
assert_eq!(e.storage().max_expiration(), 5); | ||
}); | ||
} |