Skip to content

Commit

Permalink
shorten functions
Browse files Browse the repository at this point in the history
  • Loading branch information
toteki committed Sep 11, 2023
1 parent 3963af5 commit c8c7f3e
Showing 1 changed file with 24 additions and 64 deletions.
88 changes: 24 additions & 64 deletions tests/e2e/e2e_leverage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

0 comments on commit c8c7f3e

Please sign in to comment.