From c8c7f3ea3b87950084164534282b40ac5a3c184d Mon Sep 17 00:00:00 2001 From: toteki <63419657+toteki@users.noreply.github.com> Date: Mon, 11 Sep 2023 01:08:22 -0600 Subject: [PATCH] shorten functions --- tests/e2e/e2e_leverage_test.go | 88 ++++++++++------------------------ 1 file changed, 24 insertions(+), 64 deletions(-) diff --git a/tests/e2e/e2e_leverage_test.go b/tests/e2e/e2e_leverage_test.go index 0ed70de8d5..f80672434d 100644 --- a/tests/e2e/e2e_leverage_test.go +++ b/tests/e2e/e2e_leverage_test.go @@ -6,86 +6,46 @@ import ( leveragetypes "github.com/umee-network/umee/v6/x/leverage/types" ) -func (s *E2ETest) executeSupply(addr string, asset sdk.Coin) { - msg := &leveragetypes.MsgSupply{ - Supplier: addr, - Asset: asset, - } - s.executeTx(msg) +func (s *E2ETest) executeSupply(addr sdk.AccAddress, asset sdk.Coin) { + s.executeTx(leveragetypes.NewMsgSupply(addr, asset)) } -func (s *E2ETest) executeWithdraw(addr string, asset sdk.Coin) { - msg := &leveragetypes.MsgWithdraw{ - Supplier: addr, - Asset: asset, - } - s.executeTx(msg) +func (s *E2ETest) executeWithdraw(addr sdk.AccAddress, asset sdk.Coin) { + s.executeTx(leveragetypes.NewMsgWithdraw(addr, asset)) } -func (s *E2ETest) executeMaxWithdraw(addr, denom string) { - msg := &leveragetypes.MsgMaxWithdraw{ - Supplier: addr, - Denom: denom, - } - s.executeTx(msg) +func (s *E2ETest) executeMaxWithdraw(addr sdk.AccAddress, denom string) { + s.executeTx(leveragetypes.NewMsgMaxWithdraw(addr, denom)) } -func (s *E2ETest) executeCollateralize(addr string, asset sdk.Coin) { - msg := &leveragetypes.MsgCollateralize{ - Borrower: addr, - Asset: asset, - } - s.executeTx(msg) +func (s *E2ETest) executeCollateralize(addr sdk.AccAddress, asset sdk.Coin) { + s.executeTx(leveragetypes.NewMsgCollateralize(addr, asset)) } -func (s *E2ETest) executeDecollateralize(addr string, asset sdk.Coin) { - msg := &leveragetypes.MsgDecollateralize{ - Borrower: addr, - Asset: asset, - } - s.executeTx(msg) +func (s *E2ETest) executeDecollateralize(addr sdk.AccAddress, asset sdk.Coin) { + s.executeTx(leveragetypes.NewMsgDecollateralize(addr, asset)) } -func (s *E2ETest) executeSupplyCollateral(addr string, asset sdk.Coin) { - msg := &leveragetypes.MsgSupplyCollateral{ - Supplier: addr, - Asset: asset, - } - s.executeTx(msg) +func (s *E2ETest) executeSupplyCollateral(addr sdk.AccAddress, asset sdk.Coin) { + s.executeTx(leveragetypes.NewMsgSupplyCollateral(addr, asset)) } -func (s *E2ETest) executeBorrow(addr string, asset sdk.Coin) { - msg := &leveragetypes.MsgBorrow{ - Borrower: addr, - Asset: asset, - } - s.executeTx(msg) +func (s *E2ETest) executeBorrow(addr sdk.AccAddress, asset sdk.Coin) { + s.executeTx(leveragetypes.NewMsgBorrow(addr, asset)) } -func (s *E2ETest) executeRepay(addr string, asset sdk.Coin) { - msg := &leveragetypes.MsgRepay{ - Borrower: addr, - Asset: asset, - } - s.executeTx(msg) +func (s *E2ETest) executeMaxBorrow(addr sdk.AccAddress, denom string) { + s.executeTx(leveragetypes.NewMsgMaxBorrow(addr, denom)) } -func (s *E2ETest) executeLiquidate(addr, target, reward string, repay sdk.Coin) { - msg := &leveragetypes.MsgLiquidate{ - Liquidator: addr, - Borrower: target, - Repayment: repay, - RewardDenom: reward, - } - s.executeTx(msg) +func (s *E2ETest) executeRepay(addr sdk.AccAddress, asset sdk.Coin) { + s.executeTx(leveragetypes.NewMsgRepay(addr, asset)) } -func (s *E2ETest) executeLeveragedLiquidate(addr, target, repay, reward string) { - msg := &leveragetypes.MsgLeveragedLiquidate{ - Liquidator: addr, - Borrower: target, - RepayDenom: repay, - RewardDenom: reward, - } - s.executeTx(msg) +func (s *E2ETest) executeLiquidate(addr, target sdk.AccAddress, reward string, repay sdk.Coin) { + s.executeTx(leveragetypes.NewMsgLiquidate(addr, target, repay, reward)) +} + +func (s *E2ETest) executeLeveragedLiquidate(addr, target sdk.AccAddress, repay, reward string) { + s.executeTx(leveragetypes.NewMsgLeveragedLiquidate(addr, target, repay, reward)) }