Search Apps Documentation Source Content File Folder Download Copy Actions Download

proxy.gno

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