Skip to content

Commit

Permalink
refactor(x/crosschain): native denom and oracle delegate denom (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
zakir-code authored Oct 31, 2023
1 parent e459990 commit 52cae60
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 94 deletions.
12 changes: 6 additions & 6 deletions x/crosschain/keeper/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (suite *KeeperTestSuite) TestABCIEndBlockDepositClaim() {
BridgerAddress: suite.bridgerAddrs[0].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[0].PublicKey),
ValidatorAddress: suite.valAddrs[0].String(),
DelegateAmount: sdk.Coin{Denom: fxtypes.DefaultDenom, Amount: sdkmath.NewInt(10 * 1e3).MulRaw(1e18)},
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt(10 * 1e3).MulRaw(1e18)),
ChainName: suite.chainName,
}
_, err := suite.MsgServer().BondedOracle(sdk.WrapSDKContext(suite.ctx), normalMsg)
Expand Down Expand Up @@ -93,7 +93,7 @@ func (suite *KeeperTestSuite) TestOracleUpdate() {
BridgerAddress: suite.bridgerAddrs[i].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[i].PublicKey),
ValidatorAddress: suite.valAddrs[i].String(),
DelegateAmount: sdk.Coin{Denom: fxtypes.DefaultDenom, Amount: sdkmath.NewInt(10 * 1e3).MulRaw(1e18)},
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt(10 * 1e3).MulRaw(1e18)),
ChainName: suite.chainName,
}
require.NoError(suite.T(), msgBondedOracle.ValidateBasic())
Expand Down Expand Up @@ -209,7 +209,7 @@ func (suite *KeeperTestSuite) TestAttestationAfterOracleUpdate() {
BridgerAddress: suite.bridgerAddrs[i].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[i].PublicKey),
ValidatorAddress: suite.valAddrs[i].String(),
DelegateAmount: sdk.Coin{Denom: fxtypes.DefaultDenom, Amount: sdkmath.NewInt(10 * 1e3).MulRaw(1e18)},
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt(10 * 1e3).MulRaw(1e18)),
ChainName: suite.chainName,
}
_, err := suite.MsgServer().BondedOracle(sdk.WrapSDKContext(suite.ctx), msgBondedOracle)
Expand Down Expand Up @@ -407,7 +407,7 @@ func (suite *KeeperTestSuite) TestOracleDelete() {
BridgerAddress: suite.bridgerAddrs[i].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[i].PublicKey),
ValidatorAddress: suite.valAddrs[i].String(),
DelegateAmount: sdk.Coin{Denom: fxtypes.DefaultDenom, Amount: sdkmath.NewInt(10 * 1e3).MulRaw(1e18)},
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt(10 * 1e3).MulRaw(1e18)),
ChainName: suite.chainName,
}
require.NoError(suite.T(), msgBondedOracle.ValidateBasic())
Expand Down Expand Up @@ -474,7 +474,7 @@ func (suite *KeeperTestSuite) TestOracleSetSlash() {
BridgerAddress: suite.bridgerAddrs[i].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[i].PublicKey),
ValidatorAddress: suite.valAddrs[i].String(),
DelegateAmount: sdk.Coin{Denom: fxtypes.DefaultDenom, Amount: sdkmath.NewInt(10 * 1e3).MulRaw(1e18)},
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt(10 * 1e3).MulRaw(1e18)),
ChainName: suite.chainName,
}
require.NoError(suite.T(), msgBondedOracle.ValidateBasic())
Expand Down Expand Up @@ -532,7 +532,7 @@ func (suite *KeeperTestSuite) TestSlashOracle() {
BridgerAddress: suite.bridgerAddrs[i].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[i].PublicKey),
ValidatorAddress: suite.valAddrs[i].String(),
DelegateAmount: sdk.Coin{Denom: fxtypes.DefaultDenom, Amount: sdkmath.NewInt(10 * 1e3).MulRaw(1e18)},
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt(10 * 1e3).MulRaw(1e18)),
ChainName: suite.chainName,
}
require.NoError(suite.T(), msgBondedOracle.ValidateBasic())
Expand Down
2 changes: 1 addition & 1 deletion x/crosschain/keeper/attestation_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (k Keeper) AttestationHandler(ctx sdk.Context, externalClaim types.External
return errorsmod.Wrap(types.ErrInvalid, "bridge token is exist")
}
k.Logger(ctx).Info("add bridge token claim", "symbol", claim.Symbol, "token", claim.TokenContract, "channelIbc", claim.ChannelIbc)
if claim.Symbol == fxtypes.DefaultDenom {
if claim.Symbol == types.NativeDenom {
// Check if denom exists
metadata, found := k.bankKeeper.GetDenomMetaData(ctx, claim.Symbol)
if !found {
Expand Down
5 changes: 2 additions & 3 deletions x/crosschain/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

"github.com/functionx/fx-core/v6/app"
"github.com/functionx/fx-core/v6/testutil/helpers"
fxtypes "github.com/functionx/fx-core/v6/types"
arbitrumtypes "github.com/functionx/fx-core/v6/x/arbitrum/types"
avalanchetypes "github.com/functionx/fx-core/v6/x/avalanche/types"
bsctypes "github.com/functionx/fx-core/v6/x/bsc/types"
Expand Down Expand Up @@ -67,8 +66,8 @@ func (suite *CrossChainGrpcTestSuite) SetupTest() {
types.RegisterQueryServer(queryHelper, suite.app.CrosschainKeeper)
suite.queryClient = types.NewQueryClient(queryHelper)

suite.oracleAddrs = helpers.AddTestAddrs(suite.app, suite.ctx, types.MaxOracleSize, sdk.NewCoins(sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(300*1e3).MulRaw(1e18))))
suite.bridgerAddrs = helpers.AddTestAddrs(suite.app, suite.ctx, types.MaxOracleSize, sdk.NewCoins(sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(300*1e3).MulRaw(1e18))))
suite.oracleAddrs = helpers.AddTestAddrs(suite.app, suite.ctx, types.MaxOracleSize, sdk.NewCoins(types.NewDelegateAmount(sdkmath.NewInt(300*1e3).MulRaw(1e18))))
suite.bridgerAddrs = helpers.AddTestAddrs(suite.app, suite.ctx, types.MaxOracleSize, sdk.NewCoins(sdk.NewCoin(types.NativeDenom, sdkmath.NewInt(300*1e3).MulRaw(1e18))))
suite.msgServer = keeper.NewMsgServerImpl(suite.Keeper())
}

Expand Down
3 changes: 1 addition & 2 deletions x/crosschain/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/tendermint/tendermint/libs/log"

fxtypes "github.com/functionx/fx-core/v6/types"
"github.com/functionx/fx-core/v6/x/crosschain/types"
)

Expand Down Expand Up @@ -162,7 +161,7 @@ func (k Keeper) UnbondedOracleFromProposal(ctx sdk.Context, oracle types.Oracle)
if err != nil {
return err
}
msgUndelegate := stakingtypes.NewMsgUndelegate(delegateAddr, valAddr, sdk.NewCoin(fxtypes.DefaultDenom, getOracleDelegateToken))
msgUndelegate := stakingtypes.NewMsgUndelegate(delegateAddr, valAddr, types.NewDelegateAmount(getOracleDelegateToken))
if _, err = k.stakingMsgServer.Undelegate(sdk.WrapSDKContext(ctx), msgUndelegate); err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions x/crosschain/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ func (suite *KeeperTestSuite) SetupTest() {
ProposerAddress: valSet.Proposer.Address.Bytes(),
})

suite.oracleAddrs = helpers.AddTestAddrs(suite.app, suite.ctx, valNumber, sdk.NewCoins(sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(300*1e3).MulRaw(1e18))))
suite.bridgerAddrs = helpers.AddTestAddrs(suite.app, suite.ctx, valNumber, sdk.NewCoins(sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(300*1e3).MulRaw(1e18))))
suite.oracleAddrs = helpers.AddTestAddrs(suite.app, suite.ctx, valNumber, sdk.NewCoins(types.NewDelegateAmount(sdkmath.NewInt(300*1e3).MulRaw(1e18))))
suite.bridgerAddrs = helpers.AddTestAddrs(suite.app, suite.ctx, valNumber, sdk.NewCoins(sdk.NewCoin(types.NativeDenom, sdkmath.NewInt(300*1e3).MulRaw(1e18))))
suite.externalPris = helpers.CreateMultiECDSA(valNumber)

suite.valAddrs = make([]sdk.ValAddress, valNumber)
Expand Down
10 changes: 5 additions & 5 deletions x/crosschain/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ func (s MsgServer) AddDelegate(c context.Context, msg *types.MsgAddDelegate) (*t
return nil, errorsmod.Wrapf(types.ErrInvalid, "delegate denom got %s, expected %s", msg.Amount.Denom, threshold.Denom)
}

slashAmount := sdk.NewCoin(fxtypes.DefaultDenom, oracle.GetSlashAmount(s.GetSlashFraction(ctx)))
slashAmount := types.NewDelegateAmount(oracle.GetSlashAmount(s.GetSlashFraction(ctx)))
if slashAmount.IsPositive() && msg.Amount.Amount.LT(slashAmount.Amount) {
return nil, errorsmod.Wrap(types.ErrInvalid, "not sufficient slash amount")
}

delegateCoin := sdk.NewCoin(fxtypes.DefaultDenom, msg.Amount.Amount.Sub(slashAmount.Amount))
delegateCoin := types.NewDelegateAmount(msg.Amount.Amount.Sub(slashAmount.Amount))

oracle.DelegateAmount = oracle.DelegateAmount.Add(delegateCoin.Amount)
if oracle.DelegateAmount.Sub(threshold.Amount).IsNegative() {
Expand Down Expand Up @@ -203,7 +203,7 @@ func (s MsgServer) ReDelegate(c context.Context, msg *types.MsgReDelegate) (*typ
if err != nil {
return nil, err
}
msgBeginRedelegate := stakingtypes.NewMsgBeginRedelegate(delegateAddr, valSrcAddress, valDstAddress, sdk.NewCoin(fxtypes.DefaultDenom, delegateToken))
msgBeginRedelegate := stakingtypes.NewMsgBeginRedelegate(delegateAddr, valSrcAddress, valDstAddress, types.NewDelegateAmount(delegateToken))
if _, err = s.stakingMsgServer.BeginRedelegate(c, msgBeginRedelegate); err != nil {
return nil, err
}
Expand Down Expand Up @@ -302,9 +302,9 @@ func (s MsgServer) UnbondedOracle(c context.Context, msg *types.MsgUnbondedOracl
return nil, errorsmod.Wrap(types.ErrInvalid, "exist unbonding delegation")
}
balances := s.bankKeeper.GetAllBalances(ctx, delegateAddr)
slashAmount := sdk.NewCoin(fxtypes.DefaultDenom, oracle.GetSlashAmount(s.GetSlashFraction(ctx)))
slashAmount := types.NewDelegateAmount(oracle.GetSlashAmount(s.GetSlashFraction(ctx)))
if slashAmount.IsPositive() {
if balances.AmountOf(fxtypes.DefaultDenom).LT(slashAmount.Amount) {
if balances.AmountOf(slashAmount.Denom).LT(slashAmount.Amount) {
return nil, errorsmod.Wrap(types.ErrInvalid, "not sufficient slash amount")
}
if err = s.bankKeeper.SendCoinsFromAccountToModule(ctx, delegateAddr, s.moduleName, sdk.NewCoins(slashAmount)); err != nil {
Expand Down
61 changes: 18 additions & 43 deletions x/crosschain/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

"github.com/functionx/fx-core/v6/testutil/helpers"
fxtypes "github.com/functionx/fx-core/v6/types"
"github.com/functionx/fx-core/v6/x/crosschain/types"
ethtypes "github.com/functionx/fx-core/v6/x/eth/types"
trontypes "github.com/functionx/fx-core/v6/x/tron/types"
Expand Down Expand Up @@ -108,11 +107,8 @@ func (suite *KeeperTestSuite) TestMsgBondedOracle() {
BridgerAddress: suite.bridgerAddrs[oracleIndex].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[oracleIndex].PublicKey),
ValidatorAddress: suite.valAddrs[oracleIndex].String(),
DelegateAmount: sdk.Coin{
Denom: fxtypes.DefaultDenom,
Amount: sdkmath.NewInt((tmrand.Int63n(3) + 1) * 10_000).MulRaw(1e18),
},
ChainName: suite.chainName,
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt((tmrand.Int63n(3) + 1) * 10_000).MulRaw(1e18)),
ChainName: suite.chainName,
}

testCase.preRun(msg)
Expand Down Expand Up @@ -286,11 +282,8 @@ func (suite *KeeperTestSuite) TestMsgAddDelegate() {
BridgerAddress: suite.bridgerAddrs[oracleIndex].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[oracleIndex].PublicKey),
ValidatorAddress: suite.valAddrs[oracleIndex].String(),
DelegateAmount: sdk.Coin{
Denom: fxtypes.DefaultDenom,
Amount: initDelegateAmount,
},
ChainName: suite.chainName,
DelegateAmount: types.NewDelegateAmount(initDelegateAmount),
ChainName: suite.chainName,
})
require.NoError(t, err)

Expand All @@ -300,8 +293,8 @@ func (suite *KeeperTestSuite) TestMsgAddDelegate() {
msg := &types.MsgAddDelegate{
ChainName: suite.chainName,
OracleAddress: suite.oracleAddrs[oracleIndex].String(),
Amount: sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(
tmrand.Int63n(maxDelegateAmount.QuoRaw(1e18).Int64())+1,
Amount: types.NewDelegateAmount(sdkmath.NewInt(
tmrand.Int63n(maxDelegateAmount.QuoRaw(1e18).Int64()) + 1,
).
MulRaw(1e18).
Sub(sdkmath.NewInt(1))),
Expand Down Expand Up @@ -355,11 +348,8 @@ func (suite *KeeperTestSuite) TestMsgEditBridger() {
BridgerAddress: suite.bridgerAddrs[i].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[i].PublicKey),
ValidatorAddress: suite.valAddrs[i].String(),
DelegateAmount: sdk.Coin{
Denom: fxtypes.DefaultDenom,
Amount: delegateAmount,
},
ChainName: suite.chainName,
DelegateAmount: types.NewDelegateAmount(delegateAmount),
ChainName: suite.chainName,
}
_, err := suite.MsgServer().BondedOracle(sdk.WrapSDKContext(suite.ctx), bondedMsg)
suite.NoError(err)
Expand Down Expand Up @@ -436,11 +426,8 @@ func (suite *KeeperTestSuite) TestMsgSetOracleSetConfirm() {
BridgerAddress: suite.bridgerAddrs[0].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[0].PublicKey),
ValidatorAddress: suite.valAddrs[0].String(),
DelegateAmount: sdk.Coin{
Denom: fxtypes.DefaultDenom,
Amount: sdkmath.NewInt((tmrand.Int63n(5) + 1) * 10_000).MulRaw(1e18),
},
ChainName: suite.chainName,
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt((tmrand.Int63n(5) + 1) * 10_000).MulRaw(1e18)),
ChainName: suite.chainName,
}
_, err := suite.MsgServer().BondedOracle(sdk.WrapSDKContext(suite.ctx), normalMsg)
require.NoError(suite.T(), err)
Expand Down Expand Up @@ -562,11 +549,8 @@ func (suite *KeeperTestSuite) TestClaimWithOracleOnline() {
BridgerAddress: suite.bridgerAddrs[0].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[0].PublicKey),
ValidatorAddress: suite.valAddrs[0].String(),
DelegateAmount: sdk.Coin{
Denom: fxtypes.DefaultDenom,
Amount: sdkmath.NewInt((tmrand.Int63n(5) + 1) * 10_000).MulRaw(1e18),
},
ChainName: suite.chainName,
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt((tmrand.Int63n(5) + 1) * 10_000).MulRaw(1e18)),
ChainName: suite.chainName,
}
_, err := suite.MsgServer().BondedOracle(sdk.WrapSDKContext(suite.ctx), normalMsg)
require.NoError(suite.T(), err)
Expand Down Expand Up @@ -763,11 +747,8 @@ func (suite *KeeperTestSuite) TestClaimMsgGasConsumed() {
BridgerAddress: suite.bridgerAddrs[i].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[i].PublicKey),
ValidatorAddress: suite.valAddrs[0].String(),
DelegateAmount: sdk.Coin{
Denom: fxtypes.DefaultDenom,
Amount: sdkmath.NewInt((tmrand.Int63n(5) + 1) * 10_000).MulRaw(1e18),
},
ChainName: suite.chainName,
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt((tmrand.Int63n(5) + 1) * 10_000).MulRaw(1e18)),
ChainName: suite.chainName,
}
_, err := suite.MsgServer().BondedOracle(sdk.WrapSDKContext(suite.ctx), msg)
require.NoError(suite.T(), err)
Expand All @@ -788,11 +769,8 @@ func (suite *KeeperTestSuite) TestClaimTest() {
BridgerAddress: suite.bridgerAddrs[0].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[0].PublicKey),
ValidatorAddress: suite.valAddrs[0].String(),
DelegateAmount: sdk.Coin{
Denom: fxtypes.DefaultDenom,
Amount: sdkmath.NewInt((tmrand.Int63n(5) + 1) * 10_000).MulRaw(1e18),
},
ChainName: suite.chainName,
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt((tmrand.Int63n(5) + 1) * 10_000).MulRaw(1e18)),
ChainName: suite.chainName,
}
_, err := suite.MsgServer().BondedOracle(sdk.WrapSDKContext(suite.ctx), normalMsg)
require.NoError(suite.T(), err)
Expand Down Expand Up @@ -912,11 +890,8 @@ func (suite *KeeperTestSuite) TestRequestBatchBaseFee() {
BridgerAddress: suite.bridgerAddrs[i].String(),
ExternalAddress: suite.PubKeyToExternalAddr(suite.externalPris[i].PublicKey),
ValidatorAddress: suite.valAddrs[0].String(),
DelegateAmount: sdk.Coin{
Denom: fxtypes.DefaultDenom,
Amount: sdkmath.NewInt((tmrand.Int63n(5) + 1) * 10_000).MulRaw(1e18),
},
ChainName: suite.chainName,
DelegateAmount: types.NewDelegateAmount(sdkmath.NewInt((tmrand.Int63n(5) + 1) * 10_000).MulRaw(1e18)),
ChainName: suite.chainName,
}
if len(suite.valAddrs) > i {
normalMsg.ValidatorAddress = suite.valAddrs[i].String()
Expand Down
15 changes: 7 additions & 8 deletions x/crosschain/keeper/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"

fxtypes "github.com/functionx/fx-core/v6/types"
"github.com/functionx/fx-core/v6/x/crosschain/types"
)

Expand All @@ -26,7 +25,7 @@ func (suite *KeeperTestSuite) TestParams() {
SlashFraction: sdk.NewDecWithPrec(8, 1), // 80%
OracleSetUpdatePowerChangePercent: sdk.NewDecWithPrec(1, 1), // 10%
IbcTransferTimeoutHeight: 20_000,
DelegateThreshold: sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateThreshold: types.NewDelegateAmount(sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateMultiple: 10,
Oracles: nil,
},
Expand All @@ -44,7 +43,7 @@ func (suite *KeeperTestSuite) TestParams() {
SlashFraction: sdk.NewDecWithPrec(8, 1), // 80%
OracleSetUpdatePowerChangePercent: sdk.NewDecWithPrec(1, 1), // 10%
IbcTransferTimeoutHeight: 20_000,
DelegateThreshold: sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateThreshold: types.NewDelegateAmount(sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateMultiple: 10,
Oracles: nil,
},
Expand All @@ -62,7 +61,7 @@ func (suite *KeeperTestSuite) TestParams() {
SlashFraction: sdk.NewDecWithPrec(8, 1), // 80%
OracleSetUpdatePowerChangePercent: sdk.NewDecWithPrec(1, 1), // 10%
IbcTransferTimeoutHeight: 20_000,
DelegateThreshold: sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateThreshold: types.NewDelegateAmount(sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateMultiple: 10,
Oracles: nil,
},
Expand All @@ -80,7 +79,7 @@ func (suite *KeeperTestSuite) TestParams() {
SlashFraction: sdk.NewDecWithPrec(8, 1), // 80%
OracleSetUpdatePowerChangePercent: sdk.NewDecWithPrec(1, 1), // 10%
IbcTransferTimeoutHeight: 20_000,
DelegateThreshold: sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateThreshold: types.NewDelegateAmount(sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateMultiple: 10,
Oracles: nil,
},
Expand Down Expand Up @@ -116,7 +115,7 @@ func (suite *KeeperTestSuite) TestParams() {
SlashFraction: sdk.NewDecWithPrec(8, 1), // 80%
OracleSetUpdatePowerChangePercent: sdk.NewDecWithPrec(1, 1), // 10%
IbcTransferTimeoutHeight: 1,
DelegateThreshold: sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateThreshold: types.NewDelegateAmount(sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateMultiple: 10,
Oracles: nil,
},
Expand All @@ -134,7 +133,7 @@ func (suite *KeeperTestSuite) TestParams() {
SlashFraction: sdk.NewDecWithPrec(8, 1), // 80%
OracleSetUpdatePowerChangePercent: sdk.NewDec(2), // 10%
IbcTransferTimeoutHeight: 20_000,
DelegateThreshold: sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateThreshold: types.NewDelegateAmount(sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateMultiple: 10,
Oracles: nil,
},
Expand All @@ -152,7 +151,7 @@ func (suite *KeeperTestSuite) TestParams() {
SlashFraction: sdk.NewDec(2), // 80%
OracleSetUpdatePowerChangePercent: sdk.NewDecWithPrec(1, 1), // 10%
IbcTransferTimeoutHeight: 20_000,
DelegateThreshold: sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateThreshold: types.NewDelegateAmount(sdkmath.NewInt(10_000).MulRaw(1e18)),
DelegateMultiple: 10,
Oracles: nil,
},
Expand Down
Loading

0 comments on commit 52cae60

Please sign in to comment.