Search Apps Documentation Source Content File Folder Download Copy Actions Download

proxy.gno

4.71 Kb · 161 lines
  1package position
  2
  3// Mint creates a new liquidity position NFT.
  4//
  5// Parameters:
  6//   - token0: path of the first token
  7//   - token1: path of the second token
  8//   - fee: pool fee tier
  9//   - tickLower: lower tick boundary
 10//   - tickUpper: upper tick boundary
 11//   - amount0Desired: desired amount of token0
 12//   - amount1Desired: desired amount of token1
 13//   - amount0Min: minimum amount of token0
 14//   - amount1Min: minimum amount of token1
 15//   - deadline: transaction deadline
 16//   - mintTo: recipient of the position NFT
 17//   - referrer: referrer address for reward tracking
 18//
 19// Returns:
 20//   - uint64: position ID
 21//   - string: liquidity amount
 22//   - string: amount of token0 added
 23//   - string: amount of token1 added
 24func Mint(
 25	cur realm,
 26	token0 string,
 27	token1 string,
 28	fee uint32,
 29	tickLower int32,
 30	tickUpper int32,
 31	amount0Desired string,
 32	amount1Desired string,
 33	amount0Min string,
 34	amount1Min string,
 35	deadline int64,
 36	mintTo address,
 37	referrer string,
 38) (uint64, string, string, string) {
 39	return getImplementation().Mint(0, cur, token0, token1, fee, tickLower, tickUpper, amount0Desired, amount1Desired, amount0Min, amount1Min, deadline, mintTo, referrer)
 40}
 41
 42// IncreaseLiquidity adds liquidity to an existing position.
 43//
 44// Parameters:
 45//   - positionId: ID of the position
 46//   - amount0DesiredStr: desired amount of token0
 47//   - amount1DesiredStr: desired amount of token1
 48//   - amount0MinStr: minimum amount of token0
 49//   - amount1MinStr: minimum amount of token1
 50//   - deadline: transaction deadline
 51//
 52// Returns:
 53//   - uint64: position ID
 54//   - string: new liquidity amount
 55//   - string: amount of token0 added
 56//   - string: amount of token1 added
 57//   - string: pool path
 58func IncreaseLiquidity(
 59	cur realm,
 60	positionId uint64,
 61	amount0DesiredStr string,
 62	amount1DesiredStr string,
 63	amount0MinStr string,
 64	amount1MinStr string,
 65	deadline int64,
 66) (uint64, string, string, string, string) {
 67	return getImplementation().IncreaseLiquidity(0, cur, positionId, amount0DesiredStr, amount1DesiredStr, amount0MinStr, amount1MinStr, deadline)
 68}
 69
 70// DecreaseLiquidity removes liquidity from a position.
 71//
 72// Parameters:
 73//   - positionId: ID of the position
 74//   - liquidityStr: amount of liquidity to remove
 75//   - amount0MinStr: minimum amount of token0
 76//   - amount1MinStr: minimum amount of token1
 77//   - deadline: transaction deadline
 78//
 79// Returns:
 80//   - uint64: position ID
 81//   - string: removed liquidity amount
 82//   - string: amount of token0 removed
 83//   - string: amount of token1 removed
 84//   - string: pool path
 85//   - string: net amount of token0 after fees
 86//   - string: net amount of token1 after fees
 87func DecreaseLiquidity(
 88	cur realm,
 89	positionId uint64,
 90	liquidityStr string,
 91	amount0MinStr string,
 92	amount1MinStr string,
 93	deadline int64,
 94) (uint64, string, string, string, string, string, string) {
 95	return getImplementation().DecreaseLiquidity(0, cur, positionId, liquidityStr, amount0MinStr, amount1MinStr, deadline)
 96}
 97
 98// Reposition changes the tick range of a position.
 99//
100// Parameters:
101//   - positionId: ID of the position
102//   - tickLower: new lower tick boundary
103//   - tickUpper: new upper tick boundary
104//   - amount0DesiredStr: desired amount of token0
105//   - amount1DesiredStr: desired amount of token1
106//   - amount0MinStr: minimum amount of token0
107//   - amount1MinStr: minimum amount of token1
108//   - deadline: transaction deadline
109//
110// Returns:
111//   - uint64: position ID
112//   - string: new liquidity amount
113//   - int32: new lower tick
114//   - int32: new upper tick
115//   - string: amount of token0 used
116//   - string: amount of token1 used
117func Reposition(
118	cur realm,
119	positionId uint64,
120	tickLower int32,
121	tickUpper int32,
122	amount0DesiredStr string,
123	amount1DesiredStr string,
124	amount0MinStr string,
125	amount1MinStr string,
126	deadline int64,
127) (uint64, string, int32, int32, string, string) {
128	return getImplementation().Reposition(0, cur, positionId, tickLower, tickUpper, amount0DesiredStr, amount1DesiredStr, amount0MinStr, amount1MinStr, deadline)
129}
130
131// CollectFee collects accumulated fees from a position.
132//
133// Parameters:
134//   - positionId: ID of the position
135//
136// Returns:
137//   - uint64: position ID
138//   - string: amount of token0 collected
139//   - string: amount of token1 collected
140//   - string: pool path
141//   - string: token0 path
142//   - string: token1 path
143func CollectFee(
144	cur realm,
145	positionId uint64,
146) (uint64, string, string, string, string, string) {
147	return getImplementation().CollectFee(0, cur, positionId)
148}
149
150// SetPositionOperator sets an operator for a position.
151//
152// Parameters:
153//   - positionId: ID of the position
154//   - operator: address of the operator
155func SetPositionOperator(
156	cur realm,
157	positionId uint64,
158	operator address,
159) {
160	getImplementation().SetPositionOperator(0, cur, positionId, operator)
161}