88 "cosmossdk.io/store/prefix"
99 sdk "github.com/cosmos/cosmos-sdk/types"
1010 sdkmodule "github.com/cosmos/cosmos-sdk/types/module"
11- etypes "pkg.akt.dev/go/node/escrow/v1"
11+ etypes "pkg.akt.dev/go/node/escrow/types/ v1"
1212 "pkg.akt.dev/go/node/migrate"
1313
1414 utypes "pkg.akt.dev/node/upgrades/types"
@@ -46,10 +46,12 @@ func (m escrowMigrations) handler(ctx sdk.Context) error {
4646 var accountsOverdrawn uint64
4747
4848 for ; iter .Valid (); iter .Next () {
49- nVal := migrate .AccountFromV1beta3 (cdc , iter .Value ())
49+ key := append (migrate .AccountV1beta3Prefix (), iter .Key ()... )
50+
51+ nVal := migrate .AccountFromV1beta3 (cdc , key , iter .Value ())
5052 bz := cdc .MustMarshal (& nVal )
5153
52- switch nVal .State {
54+ switch nVal .State . State {
5355 case etypes .StateOpen :
5456 accountsActive ++
5557 case etypes .StateClosed :
@@ -60,10 +62,9 @@ func (m escrowMigrations) handler(ctx sdk.Context) error {
6062
6163 accountsTotal ++
6264
63- key := ekeeper .LegacyAccountKey (nVal .ID )
64- oStore .Delete (iter .Key ())
65+ oStore .Delete (key )
6566
66- key = ekeeper .BuildAccountsKey (nVal .State , & nVal .ID )
67+ key = ekeeper .BuildAccountsKey (nVal .State . State , & nVal .ID )
6768 store .Set (key , bz )
6869 }
6970
@@ -80,10 +81,12 @@ func (m escrowMigrations) handler(ctx sdk.Context) error {
8081 var paymentsOverdrawn uint64
8182
8283 for ; iter .Valid (); iter .Next () {
83- nVal := migrate .FractionalPaymentFromV1beta3 (cdc , iter .Value ())
84+ key := append (migrate .PaymentV1beta3Prefix (), iter .Key ()... )
85+
86+ nVal := migrate .PaymentFromV1beta3 (cdc , iter .Key (), iter .Value ())
8487 bz := cdc .MustMarshal (& nVal )
8588
86- switch nVal .State {
89+ switch nVal .State . State {
8790 case etypes .StateOpen :
8891 paymentsActive ++
8992 case etypes .StateClosed :
@@ -94,10 +97,9 @@ func (m escrowMigrations) handler(ctx sdk.Context) error {
9497
9598 paymentsTotal ++
9699
97- key := ekeeper .LegacyPaymentKey (nVal .AccountID , nVal .PaymentID )
98- oStore .Delete (iter .Key ())
100+ oStore .Delete (key )
99101
100- key = ekeeper .BuildPaymentsKey (nVal .State , & nVal .AccountID , nVal . PaymentID )
102+ key = ekeeper .BuildPaymentsKey (nVal .State . State , & nVal .ID )
101103 store .Set (key , bz )
102104 }
103105
0 commit comments