Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sui Framework] Expose getter for current epoch number #1977

Merged
merged 1 commit into from
May 16, 2022
Merged
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
11 changes: 11 additions & 0 deletions sui_programmability/framework/sources/Governance/SuiSystem.move
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,15 @@ module Sui::SuiSystem {
// remaining balance in `computation_reward`. All of these go to the storage fund.
Balance::join(&mut self.storage_fund, computation_reward)
}

/// Return the current epoch number. Useful for applications that need a coarse-grained concept of time,
/// since epochs are ever-increasing and epoch changes are intended to happen every 24 hours.
public fun epoch(self: &SuiSystemState): u64 {
self.epoch
}

#[test_only]
public fun set_epoch_for_testing(self: &mut SuiSystemState, epoch_num: u64) {
self.epoch = epoch_num
}
}