MCPcopy
hub / github.com/canopy-network/canopy / ExportState

Method ExportState

fsm/genesis.go:161–216  ·  view source on GitHub ↗

ExportState() creates a GenesisState object from the current state

()

Source from the content-addressed store, hash-verified

159
160// ExportState() creates a GenesisState object from the current state
161func (s *StateMachine) ExportState() (genesis *GenesisState, err lib.ErrorI) {
162 // create a new genesis state object
163 genesis = new(GenesisState)
164 // populate the accounts from the state
165 genesis.Accounts, err = s.GetAccounts()
166 if err != nil {
167 return nil, err
168 }
169 // populate the pools from the state
170 genesis.Pools, err = s.GetPools()
171 if err != nil {
172 return nil, err
173 }
174 // populate the validators from the state
175 genesis.Validators, err = s.GetValidators()
176 if err != nil {
177 return nil, err
178 }
179 // populate the governance params from the state
180 genesis.Params, err = s.GetParams()
181 if err != nil {
182 return nil, err
183 }
184 // populate the non-signers from the state
185 genesis.NonSigners, err = s.GetNonSigners()
186 if err != nil {
187 return nil, err
188 }
189 // populate the double-signers from the state
190 genesis.DoubleSigners, err = s.GetDoubleSigners()
191 if err != nil {
192 return nil, err
193 }
194 // populate the order books from the state
195 genesis.OrderBooks, err = s.GetOrderBooks()
196 if err != nil {
197 return nil, err
198 }
199 // populate the supply from the state
200 genesis.Supply, err = s.GetSupply()
201 if err != nil {
202 return nil, err
203 }
204 // populate the retired committees from the state
205 genesis.RetiredCommittees, err = s.GetRetiredCommittees()
206 if err != nil {
207 return nil, err
208 }
209 // populate the list of committee data from the state
210 genesis.Committees, err = s.GetCommitteesData()
211 if err != nil {
212 return nil, err
213 }
214 // return the genesis file
215 return genesis, nil
216}
217
218// GENESIS HELPERS BELOW

Callers 5

debugDumpHeaderDiffMethod · 0.80
StateMethod · 0.80
StateDiffMethod · 0.80

Calls 10

GetAccountsMethod · 0.95
GetPoolsMethod · 0.95
GetValidatorsMethod · 0.95
GetParamsMethod · 0.95
GetNonSignersMethod · 0.95
GetDoubleSignersMethod · 0.95
GetOrderBooksMethod · 0.95
GetSupplyMethod · 0.95
GetRetiredCommitteesMethod · 0.95
GetCommitteesDataMethod · 0.95

Tested by 2