/
export.go
92 lines (79 loc) · 2.19 KB
/
export.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package coinswap
import (
sdk "github.com/irisnet/irishub-sdk-go/types"
"github.com/irisnet/irishub-sdk-go/types/query"
)
// expose Record module api for user
type Client interface {
sdk.Module
AddLiquidity(request AddLiquidityRequest,
baseTx sdk.BaseTx) (*AddLiquidityResponse, error)
RemoveLiquidity(request RemoveLiquidityRequest,
baseTx sdk.BaseTx) (*RemoveLiquidityResponse, error)
SwapCoin(request SwapCoinRequest,
baseTx sdk.BaseTx) (*SwapCoinResponse, error)
BuyTokenWithAutoEstimate(paidTokenDenom string, boughtCoin sdk.Coin,
deadline int64,
baseTx sdk.BaseTx,
) (res *SwapCoinResponse, err error)
SellTokenWithAutoEstimate(gotTokenDenom string, soldCoin sdk.Coin,
deadline int64,
baseTx sdk.BaseTx,
) (res *SwapCoinResponse, err error)
QueryPool(lptDenom string) (*QueryPoolResponse, error)
QueryAllPools(pageReq sdk.PageRequest) (*QueryAllPoolsResponse, error)
EstimateTokenForSoldBase(tokenDenom string,
soldBase sdk.Int,
) (sdk.Int, error)
EstimateBaseForSoldToken(soldToken sdk.Coin) (sdk.Int, error)
EstimateTokenForSoldToken(boughtTokenDenom string,
soldToken sdk.Coin) (sdk.Int, error)
EstimateTokenForBoughtBase(soldTokenDenom string,
boughtBase sdk.Int) (sdk.Int, error)
EstimateBaseForBoughtToken(boughtToken sdk.Coin) (sdk.Int, error)
EstimateTokenForBoughtToken(soldTokenDenom string,
boughtToken sdk.Coin) (sdk.Int, error)
}
type AddLiquidityRequest struct {
MaxToken sdk.Coin
BaseAmt sdk.Int
MinLiquidity sdk.Int
Deadline int64
}
type AddLiquidityResponse struct {
TokenAmt sdk.Int
BaseAmt sdk.Int
Liquidity sdk.Int
TxHash string
}
type RemoveLiquidityRequest struct {
MinTokenAmt sdk.Int
MinBaseAmt sdk.Int
Liquidity sdk.Coin
Deadline int64
}
type RemoveLiquidityResponse struct {
TokenAmt sdk.Int
BaseAmt sdk.Int
Liquidity sdk.Coin
TxHash string
}
type SwapCoinRequest struct {
Input sdk.Coin
Output sdk.Coin
Receiver string
Deadline int64
IsBuyOrder bool
}
type SwapCoinResponse struct {
InputAmt sdk.Int
OutputAmt sdk.Int
TxHash string
}
type QueryPoolResponse struct {
Pool sdk.PoolInfo
}
type QueryAllPoolsResponse struct {
Pools []sdk.PoolInfo
Pagination *query.PageResponse
}