Class: Solace::SquadsSmartAccounts::Proposal
- Inherits:
-
Data
- Object
- Data
- Solace::SquadsSmartAccounts::Proposal
- Defined in:
- lib/solace/squads_smart_accounts/types/proposal.rb
Overview
Immutable value object for a deserialized Proposal account — the vote tracker created alongside a Transaction. A proposal collects approvals and rejections; once approved (and past the settings time lock) the associated Transaction may be executed.
Layout (state/proposal.rs, matches the IDL):
settings(32), transaction_index(u64), rent_collector(32),
status(ProposalStatus: u8 variant + i64 timestamp — except the unit-only
Executing variant, which carries no timestamp), bump(u8),
approved(Vec<Pubkey>), rejected(Vec<Pubkey>), cancelled(Vec<Pubkey>).
Constant Summary collapse
- STATUSES =
ProposalStatus enum variants, in Borsh variant-index order. Every variant wraps an i64 timestamp except the unit-only :executing (index 4).
%i[draft active rejected approved executing executed cancelled].freeze
Instance Attribute Summary collapse
-
#approved ⇒ Object
readonly
Returns the value of attribute approved.
-
#bump ⇒ Object
readonly
Returns the value of attribute bump.
-
#cancelled ⇒ Object
readonly
Returns the value of attribute cancelled.
-
#rejected ⇒ Object
readonly
Returns the value of attribute rejected.
-
#rent_collector ⇒ Object
readonly
Returns the value of attribute rent_collector.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#status_timestamp ⇒ Object
readonly
Returns the value of attribute status_timestamp.
-
#transaction_index ⇒ Object
readonly
Returns the value of attribute transaction_index.
Class Method Summary collapse
-
.deserialize(io) ⇒ Proposal
Deserializes a Proposal account from a stream of Borsh-encoded account data.
Instance Attribute Details
#approved ⇒ Object (readonly)
Returns the value of attribute approved
20 21 22 |
# File 'lib/solace/squads_smart_accounts/types/proposal.rb', line 20 def approved @approved end |
#bump ⇒ Object (readonly)
Returns the value of attribute bump
20 21 22 |
# File 'lib/solace/squads_smart_accounts/types/proposal.rb', line 20 def bump @bump end |
#cancelled ⇒ Object (readonly)
Returns the value of attribute cancelled
20 21 22 |
# File 'lib/solace/squads_smart_accounts/types/proposal.rb', line 20 def cancelled @cancelled end |
#rejected ⇒ Object (readonly)
Returns the value of attribute rejected
20 21 22 |
# File 'lib/solace/squads_smart_accounts/types/proposal.rb', line 20 def rejected @rejected end |
#rent_collector ⇒ Object (readonly)
Returns the value of attribute rent_collector
20 21 22 |
# File 'lib/solace/squads_smart_accounts/types/proposal.rb', line 20 def rent_collector @rent_collector end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings
20 21 22 |
# File 'lib/solace/squads_smart_accounts/types/proposal.rb', line 20 def settings @settings end |
#status ⇒ Object (readonly)
Returns the value of attribute status
20 21 22 |
# File 'lib/solace/squads_smart_accounts/types/proposal.rb', line 20 def status @status end |
#status_timestamp ⇒ Object (readonly)
Returns the value of attribute status_timestamp
20 21 22 |
# File 'lib/solace/squads_smart_accounts/types/proposal.rb', line 20 def @status_timestamp end |
#transaction_index ⇒ Object (readonly)
Returns the value of attribute transaction_index
20 21 22 |
# File 'lib/solace/squads_smart_accounts/types/proposal.rb', line 20 def transaction_index @transaction_index end |
Class Method Details
.deserialize(io) ⇒ Proposal
Deserializes a Proposal account from a stream of Borsh-encoded account data.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/solace/squads_smart_accounts/types/proposal.rb', line 41 def deserialize(io) io.read(8) # skip 8-byte Anchor discriminator settings = Solace::Utils::Codecs.decode_pubkey(io) transaction_index = Solace::Utils::Codecs.decode_le_u64(io) rent_collector = Solace::Utils::Codecs.decode_pubkey(io) status, = decode_status(io) bump = Solace::Utils::Codecs.decode_u8(io) approved = Solace::Utils::Codecs.decode_vec_pubkeys(io) rejected = Solace::Utils::Codecs.decode_vec_pubkeys(io) cancelled = Solace::Utils::Codecs.decode_vec_pubkeys(io) new( settings:, transaction_index:, rent_collector:, status:, status_timestamp:, bump:, approved:, rejected:, cancelled: ) end |