Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
avery committed Nov 26, 2024
1 parent cc50f23 commit 3b45b68
Show file tree
Hide file tree
Showing 40 changed files with 13,246 additions and 122 deletions.
680 changes: 680 additions & 0 deletions e2e/coinswap/debug_container.dot

Large diffs are not rendered by default.

781 changes: 781 additions & 0 deletions e2e/coinswap/debug_container.log

Large diffs are not rendered by default.

29 changes: 15 additions & 14 deletions e2e/coinswap/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"time"

"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/gogoproto/proto"
Expand Down Expand Up @@ -71,9 +72,9 @@ func (s *QueryTestSuite) TestCoinswap() {
deadline := status.SyncInfo.LatestBlockTime.Add(time.Minute)

msgAddLiquidity := &coinswaptypes.MsgAddLiquidity{
MaxToken: sdk.NewCoin(symbol, sdk.NewInt(1000)),
ExactStandardAmt: sdk.NewInt(1000),
MinLiquidity: sdk.NewInt(1000),
MaxToken: sdk.NewCoin(symbol, math.NewInt(1000)),
ExactStandardAmt: math.NewInt(1000),
MinLiquidity: math.NewInt(1000),
Deadline: deadline.Unix(),
Sender: from.String(),
}
Expand Down Expand Up @@ -101,9 +102,9 @@ func (s *QueryTestSuite) TestCoinswap() {
deadline = status.SyncInfo.LatestBlockTime.Add(time.Minute)

msgAddLiquidity = &coinswaptypes.MsgAddLiquidity{
MaxToken: sdk.NewCoin(symbol, sdk.NewInt(2001)),
ExactStandardAmt: sdk.NewInt(2000),
MinLiquidity: sdk.NewInt(2000),
MaxToken: sdk.NewCoin(symbol, math.NewInt(2001)),
ExactStandardAmt: math.NewInt(2000),
MinLiquidity: math.NewInt(2000),
Deadline: deadline.Unix(),
Sender: from.String(),
}
Expand All @@ -127,7 +128,7 @@ func (s *QueryTestSuite) TestCoinswap() {
msgSellOrder := &coinswaptypes.MsgSwapOrder{
Input: coinswaptypes.Input{
Address: from.String(),
Coin: sdk.NewCoin(symbol, sdk.NewInt(1000)),
Coin: sdk.NewCoin(symbol, math.NewInt(1000)),
},
Output: coinswaptypes.Output{
Address: from.String(),
Expand Down Expand Up @@ -160,7 +161,7 @@ func (s *QueryTestSuite) TestCoinswap() {
},
Output: coinswaptypes.Output{
Address: from.String(),
Coin: sdk.NewCoin(symbol, sdk.NewInt(1000)),
Coin: sdk.NewCoin(symbol, math.NewInt(1000)),
},
Deadline: deadline.Unix(),
IsBuyOrder: true,
Expand All @@ -183,9 +184,9 @@ func (s *QueryTestSuite) TestCoinswap() {

// Test remove liquidity (remove part)
msgRemoveLiquidity := &coinswaptypes.MsgRemoveLiquidity{
WithdrawLiquidity: sdk.NewCoin(lptDenom, sdk.NewInt(2000)),
MinToken: sdk.NewInt(2000),
MinStandardAmt: sdk.NewInt(2000),
WithdrawLiquidity: sdk.NewCoin(lptDenom, math.NewInt(2000)),
MinToken: math.NewInt(2000),
MinStandardAmt: math.NewInt(2000),
Deadline: deadline.Unix(),
Sender: from.String(),
}
Expand All @@ -209,9 +210,9 @@ func (s *QueryTestSuite) TestCoinswap() {

// Test remove liquidity (remove all)
msgRemoveLiquidity = &coinswaptypes.MsgRemoveLiquidity{
WithdrawLiquidity: sdk.NewCoin(lptDenom, sdk.NewInt(1000)),
MinToken: sdk.NewInt(1000),
MinStandardAmt: sdk.NewInt(1000),
WithdrawLiquidity: sdk.NewCoin(lptDenom, math.NewInt(1000)),
MinToken: math.NewInt(1000),
MinStandardAmt: math.NewInt(1000),
Deadline: deadline.Unix(),
Sender: from.String(),
}
Expand Down
679 changes: 679 additions & 0 deletions e2e/farm/debug_container.dot

Large diffs are not rendered by default.

786 changes: 786 additions & 0 deletions e2e/farm/debug_container.log

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions e2e/farm/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"time"

"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -43,9 +44,9 @@ func (s *QueryTestSuite) TestQueryCmd() {
creator := val.Address
description := "iris-atom farm pool"
startHeight := s.latestHeight() + 2
rewardPerBlock := sdk.NewCoins(sdk.NewCoin(s.BondDenom, sdk.NewInt(10)))
rewardPerBlock := sdk.NewCoins(sdk.NewCoin(s.BondDenom, math.NewInt(10)))
lpTokenDenom := "lpt-1"
totalReward := sdk.NewCoins(sdk.NewCoin(s.BondDenom, sdk.NewInt(1000)))
totalReward := sdk.NewCoins(sdk.NewCoin(s.BondDenom, math.NewInt(1000)))
editable := true

globalFlags := []string{
Expand All @@ -54,7 +55,7 @@ func (s *QueryTestSuite) TestQueryCmd() {
fmt.Sprintf(
"--%s=%s",
flags.FlagFees,
sdk.NewCoins(sdk.NewCoin(s.BondDenom, sdk.NewInt(10))).String(),
sdk.NewCoins(sdk.NewCoin(s.BondDenom, math.NewInt(10))).String(),
),
}

Expand Down Expand Up @@ -90,7 +91,7 @@ func (s *QueryTestSuite) TestQueryCmd() {
EndHeight: startHeight + 100,
Editable: editable,
Expired: false,
TotalLptLocked: sdk.NewCoin(lpTokenDenom, sdk.ZeroInt()),
TotalLptLocked: sdk.NewCoin(lpTokenDenom, math.ZeroInt()),
TotalReward: totalReward,
RemainingReward: totalReward,
RewardPerBlock: rewardPerBlock,
Expand All @@ -109,7 +110,7 @@ func (s *QueryTestSuite) TestQueryCmd() {
s.Require().NoError(err)
s.Require().NoError(s.WaitForNextBlock())

lpToken := sdk.NewCoin(lpTokenDenom, sdk.NewInt(100))
lpToken := sdk.NewCoin(lpTokenDenom, math.NewInt(100))
txResult = StakeExec(
s.T(),
s.Network,
Expand All @@ -136,7 +137,7 @@ func (s *QueryTestSuite) TestQueryCmd() {

if farmer.Height-txResult.Height > 0 {
expectFarmer.PendingReward = rewardPerBlock.MulInt(
sdk.NewInt(farmer.Height - txResult.Height),
math.NewInt(farmer.Height - txResult.Height),
)
}
s.Require().EqualValues(expectFarmer, *farmer.List[0])
Expand Down Expand Up @@ -181,9 +182,9 @@ func (s *QueryTestSuite) setup() {
deadline := status.SyncInfo.LatestBlockTime.Add(time.Minute)

msgAddLiquidity := &coinswaptypes.MsgAddLiquidity{
MaxToken: sdk.NewCoin(symbol, sdk.NewInt(1000)),
ExactStandardAmt: sdk.NewInt(1000),
MinLiquidity: sdk.NewInt(1000),
MaxToken: sdk.NewCoin(symbol, math.NewInt(1000)),
ExactStandardAmt: math.NewInt(1000),
MinLiquidity: math.NewInt(1000),
Deadline: deadline.Unix(),
Sender: val.Address.String(),
}
Expand Down
25 changes: 13 additions & 12 deletions e2e/farm/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"time"

"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"

Expand Down Expand Up @@ -32,8 +33,8 @@ func (s *TxTestSuite) TestTxCmd() {
creator := val.Address
description := "iris-atom farm pool"
startHeight := s.latestHeight() + 2
rewardPerBlock := sdk.NewCoins(sdk.NewCoin(s.Network.BondDenom, sdk.NewInt(10)))
totalReward := sdk.NewCoins(sdk.NewCoin(s.Network.BondDenom, sdk.NewInt(1000)))
rewardPerBlock := sdk.NewCoins(sdk.NewCoin(s.Network.BondDenom, math.NewInt(10)))
totalReward := sdk.NewCoins(sdk.NewCoin(s.Network.BondDenom, math.NewInt(1000)))
editable := true
lptDenom := "lpt-1"

Expand All @@ -43,7 +44,7 @@ func (s *TxTestSuite) TestTxCmd() {
fmt.Sprintf(
"--%s=%s",
flags.FlagFees,
sdk.NewCoins(sdk.NewCoin(s.Network.BondDenom, sdk.NewInt(10))).String(),
sdk.NewCoins(sdk.NewCoin(s.Network.BondDenom, math.NewInt(10))).String(),
),
}

Expand Down Expand Up @@ -79,7 +80,7 @@ func (s *TxTestSuite) TestTxCmd() {
EndHeight: startHeight + 100,
Editable: editable,
Expired: false,
TotalLptLocked: sdk.NewCoin(lptDenom, sdk.ZeroInt()),
TotalLptLocked: sdk.NewCoin(lptDenom, math.ZeroInt()),
TotalReward: totalReward,
RemainingReward: totalReward,
RewardPerBlock: rewardPerBlock,
Expand All @@ -88,7 +89,7 @@ func (s *TxTestSuite) TestTxCmd() {
respType := QueryFarmPoolExec(s.T(), s.Network, val.ClientCtx, poolID)
s.Require().EqualValues(expectedContents, respType.Pool)

reward := sdk.NewCoins(sdk.NewCoin(s.Network.BondDenom, sdk.NewInt(1000)))
reward := sdk.NewCoins(sdk.NewCoin(s.Network.BondDenom, math.NewInt(1000)))
args = []string{
fmt.Sprintf("--%s=%v", farmcli.FlagAdditionalReward, reward.String()),
}
Expand All @@ -103,7 +104,7 @@ func (s *TxTestSuite) TestTxCmd() {
)
s.Require().EqualValues(txResult.Code, 0, txResult.Log)

lpToken := sdk.NewCoin(lptDenom, sdk.NewInt(100))
lpToken := sdk.NewCoin(lptDenom, math.NewInt(100))
txResult = StakeExec(
s.T(),
s.Network,
Expand All @@ -116,7 +117,7 @@ func (s *TxTestSuite) TestTxCmd() {
s.Require().EqualValues(txResult.Code, 0, txResult.Log)
beginHeight := txResult.Height

unstakeLPToken := sdk.NewCoin(lptDenom, sdk.NewInt(50))
unstakeLPToken := sdk.NewCoin(lptDenom, math.NewInt(50))
txResult = UnstakeExec(
s.T(),
s.Network,
Expand All @@ -134,7 +135,7 @@ func (s *TxTestSuite) TestTxCmd() {
farmtypes.AttributeValueReward,
txResult.Events,
)
expectedReward := rewardPerBlock.MulInt(sdk.NewInt(endHeight - beginHeight))
expectedReward := rewardPerBlock.MulInt(math.NewInt(endHeight - beginHeight))
s.Require().Equal(expectedReward.String(), rewardGot)

txResult = HarvestExec(
Expand All @@ -153,7 +154,7 @@ func (s *TxTestSuite) TestTxCmd() {
farmtypes.AttributeValueReward,
txResult.Events,
)
expectedReward = rewardPerBlock.MulInt(sdk.NewInt(endHeight1 - endHeight))
expectedReward = rewardPerBlock.MulInt(math.NewInt(endHeight1 - endHeight))
s.Require().Equal(expectedReward.String(), rewardGot)

queryFarmerArgs := []string{
Expand Down Expand Up @@ -217,9 +218,9 @@ func (s *TxTestSuite) setup() {
deadline := status.SyncInfo.LatestBlockTime.Add(time.Minute)

msgAddLiquidity := &coinswaptypes.MsgAddLiquidity{
MaxToken: sdk.NewCoin(symbol, sdk.NewInt(1000)),
ExactStandardAmt: sdk.NewInt(1000),
MinLiquidity: sdk.NewInt(1000),
MaxToken: sdk.NewCoin(symbol, math.NewInt(1000)),
ExactStandardAmt: math.NewInt(1000),
MinLiquidity: math.NewInt(1000),
Deadline: deadline.Unix(),
Sender: val.Address.String(),
}
Expand Down
Loading

0 comments on commit 3b45b68

Please sign in to comment.