Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

blocks.gno

0.40 Kb · 14 lines
 1package safe
 2
 3// AvgBlockMs is the measured mainnet average block time (RA §1: 200k blocks
 4// in 708,660 s). Use it only for UI estimates and defaults; every on-chain
 5// rule is stated in blocks.
 6const AvgBlockMs = 3540
 7
 8// BlocksFor converts a duration to blocks, rounding up.
 9func BlocksFor(seconds int64) int64 {
10	if seconds <= 0 {
11		return 0
12	}
13	return (seconds*1000 + AvgBlockMs - 1) / AvgBlockMs
14}