github.com/filecoin-project/specs-actors/v4@v4.0.2/actors/migration/nv10/paych.go (about) 1 package nv10 2 3 import ( 4 "context" 5 6 paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych" 7 cid "github.com/ipfs/go-cid" 8 cbor "github.com/ipfs/go-ipld-cbor" 9 10 builtin3 "github.com/filecoin-project/specs-actors/v4/actors/builtin" 11 paych3 "github.com/filecoin-project/specs-actors/v4/actors/builtin/paych" 12 ) 13 14 type paychMigrator struct{} 15 16 func (m paychMigrator) migrateState(ctx context.Context, store cbor.IpldStore, in actorMigrationInput) (*actorMigrationResult, error) { 17 var inState paych2.State 18 if err := store.Get(ctx, in.head, &inState); err != nil { 19 return nil, err 20 } 21 22 laneStatesOut, err := migrateAMTRaw(ctx, store, inState.LaneStates, paych3.LaneStatesAmtBitwidth) 23 if err != nil { 24 return nil, err 25 } 26 27 outState := paych3.State{ 28 From: inState.From, 29 To: inState.To, 30 ToSend: inState.ToSend, 31 SettlingAt: inState.SettlingAt, 32 MinSettleHeight: inState.MinSettleHeight, 33 LaneStates: laneStatesOut, 34 } 35 newHead, err := store.Put(ctx, &outState) 36 return &actorMigrationResult{ 37 newCodeCID: m.migratedCodeCID(), 38 newHead: newHead, 39 }, err 40 } 41 42 func (m paychMigrator) migratedCodeCID() cid.Cid { 43 return builtin3.PaymentChannelActorCodeID 44 }