-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate.go
35 lines (29 loc) · 993 Bytes
/
migrate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package service
import (
"github.com/tendermint/tendermint/crypto"
sdk "github.com/cosmos/cosmos-sdk/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
servicekeeper "github.com/irisnet/irismod/modules/service/keeper"
servicetypes "github.com/irisnet/irismod/modules/service/types"
)
const (
// TaxAccName is the root string for the service tax account address
TaxAccName = "service_tax_account"
)
func Migrate(ctx sdk.Context, k servicekeeper.Keeper, bk bankkeeper.Keeper) error {
oldAcc := sdk.AccAddress(crypto.AddressHash([]byte(TaxAccName)))
params := servicetypes.NewParams(
k.MaxRequestTimeout(ctx),
k.MinDepositMultiple(ctx),
k.MinDeposit(ctx),
k.ServiceFeeTax(ctx),
k.SlashFraction(ctx),
k.ComplaintRetrospect(ctx),
k.ArbitrationTimeLimit(ctx),
k.TxSizeLimit(ctx),
k.BaseDenom(ctx),
false,
)
k.SetParams(ctx, params)
return bk.SendCoinsFromAccountToModule(ctx, oldAcc, servicetypes.FeeCollectorName, bk.GetAllBalances(ctx, oldAcc))
}