Search Apps Documentation Source Content File Folder Download Copy Actions Download

proposal_schedule_status.gno

2.30 Kb ยท 71 lines
 1package governance
 2
 3// ProposalScheduleStatus represents the pre-calculated time schedule for a proposal.
 4// This structure defines all the important timestamps in a proposal's lifecycle,
 5// from creation through voting to execution and expiration.
 6type ProposalScheduleStatus struct {
 7	createTime     int64 // When the proposal was created
 8	activeTime     int64 // When voting starts (CreateTime + VotingStartDelay)
 9	votingEndTime  int64 // When voting ends (ActiveTime + VotingPeriod)
10	executableTime int64 // When execution window starts (VotingEndTime + ExecutionDelay)
11	expiredTime    int64 // When execution window ends (ExecutableTime + ExecutionWindow)
12}
13
14func NewProposalScheduleStatus(
15	createTime int64,
16	activeTime int64,
17	votingEndTime int64,
18	executableTime int64,
19	expiredTime int64,
20) *ProposalScheduleStatus {
21	return &ProposalScheduleStatus{
22		createTime:     createTime,
23		activeTime:     activeTime,
24		votingEndTime:  votingEndTime,
25		executableTime: executableTime,
26		expiredTime:    expiredTime,
27	}
28}
29
30/* Getter methods */
31func (p *ProposalScheduleStatus) CreateTime() int64     { return p.createTime }
32func (p *ProposalScheduleStatus) ActiveTime() int64     { return p.activeTime }
33func (p *ProposalScheduleStatus) VotingEndTime() int64  { return p.votingEndTime }
34func (p *ProposalScheduleStatus) ExecutableTime() int64 { return p.executableTime }
35func (p *ProposalScheduleStatus) ExpiredTime() int64    { return p.expiredTime }
36
37/* Setter methods */
38func (p *ProposalScheduleStatus) SetCreateTime(createTime int64) {
39	p.createTime = createTime
40}
41
42func (p *ProposalScheduleStatus) SetActiveTime(activeTime int64) {
43	p.activeTime = activeTime
44}
45
46func (p *ProposalScheduleStatus) SetVotingEndTime(votingEndTime int64) {
47	p.votingEndTime = votingEndTime
48}
49
50func (p *ProposalScheduleStatus) SetExecutableTime(executableTime int64) {
51	p.executableTime = executableTime
52}
53
54func (p *ProposalScheduleStatus) SetExpiredTime(expiredTime int64) {
55	p.expiredTime = expiredTime
56}
57
58// Clone creates a deep copy of the ProposalScheduleStatus.
59func (p *ProposalScheduleStatus) Clone() *ProposalScheduleStatus {
60	if p == nil {
61		return nil
62	}
63
64	return &ProposalScheduleStatus{
65		createTime:     p.createTime,
66		activeTime:     p.activeTime,
67		votingEndTime:  p.votingEndTime,
68		executableTime: p.executableTime,
69		expiredTime:    p.expiredTime,
70	}
71}