Locker V3.1

Functions Write

Lock

function lock(LockParams calldata params) external payable   returns (uint256)

Converts nft to full range and collects fees and sends them back to collector.

Parameters:

Type
Description

LockParams

An object that contains: nftPositionManager (address), nft_id (uint256), dustRecipient (address), owner (address), additionalCollector (address), collectAddress (address), unlockDate (uint256), countryCode (string), r (bytes[]), and feeName (string).

Return Values:

Type
Description

uint256

The ID of the newly created lock.


Collects

function collect(    uint256 _lockId,     address _recipient,     uint128 _amount0Max,     uint128 _amount1Max) external   returns (    uint256 amount0,     uint256 amount1,     uint256 fee0,     uint256 fee1)

Collect fees to _recipient if msg.sender is the owner of _lockId.

Parameters:

Name
Type
Description

_lockId

uint256

The ID of the lock from which to collect fees.

_recipient

address

The address to which collected fees will be sent.

_amount0Max

uint128

Maximum amount of token0 to collect.

_amount1Max

uint128

Maximum amount of token1 to collect.

Return Values:

Type
Description

uint256

Amount of token0 collected.

uint256

Amount of token1 collected.

uint256

Fee associated with token0.

uint256

Fee associated with token1.


IncreaseLiquidity

Increases liquidity.

Parameters:

Name
Type
Description

_lockId

uint256

The ID of the lock.

params

INonfungiblePositionManager.IncreaseLiquidityParams

Object containing parameters for increasing liquidity.

Return Values:

Name
Type
Description

liquidity

uint128

Amount of liquidity added.

amount0

uint256

Amount of token0 added.

amount1

uint256

Amount of token1 added.


DecreaseLiquidity

Decrease liquidity if a lock has expired

Parameters:

Name
Type
Description

_lockId

uint256

The ID of the lock.

params

INonfungiblePositionManager.DecreaseLiquidityParams

Object containing parameters for decreasing liquidity.

Return Values:

Name
Type
Description

amount0

uint256

Amount of token0 returned after decreasing liquidity.

amount1

uint256

Amount of token1 returned after decreasing liquidity.


Relock

Set the unlock date further in the future.

Parameters:

Name
Type
Description

_lockId

uint256

The ID of the lock.

_unlockDate

uint256

The new unlock date timestamp. It must be greater than the current unlock date and the current block timestamp.

Return Values:

Name
Type
Description

_lockId

uint256

The ID of the lock.

_unlockDate

uint256

The new unlock date timestamp. It must be greater than the current unlock date and the current block timestamp.


Withdraw

Withdraw a UniV3 liquidity NFT and send it to _receiver.

Parameters:

Name
Type
Description

_lockId

uint256

The ID of the lock. The caller must be an admin of this lock.

_receiver

address

The address to which the UniV3 liquidity NFT will be sent after the withdrawal.


Migrate

Migrate a lock to a new amm version (Uniswap V4).

Parameters:

Name
Type
Description

_lockId

uint256

The ID of the lock. The caller must be an admin of this lock.


SetAdditionalCollector

Allow a lock owner to add an additional address, usually a contract, to collect fees. Useful for bots.

Parameters:

Name
Type
Description

_lockId

uint256

The ID of the lock. The caller must be an admin of this lock.

_additionalCollector

address

The address designated as an additional collector for the fees from the lock.


SetCollectAddress

Set the adress to which fees are automatically collected.

Parameters:

Name
Type
Description

_lockId

uint256

The ID of the lock. The caller must be an admin of this lock.

_collectAddress

address

The address to which the fees from the lock are automatically collected.


TransferLockOwnership

Transfer ownership of a lock to _newOwner.

Parameters:

Name
Type
Description

_lockId

uint256

The ID of the lock. The caller must be an admin of this lock.

_newOwner

address

The address of the new owner to whom the lock's ownership is being transferred.


AcceptLockOwnership

Parameters:

Name
Type
Description

_lockId

uint256

The ID of the lock for which ownership is being accepted.

Functions View

GetFee

Retrieves the fee details associated with a given name.

Parameters:

Type
Description

string

The name used to lookup the associated fee structure.

Return Values:

Type
Description

FeeStruct

An object that contains: name (string), lpFee (uint256), collectFee (uint256), flatFee (uint256), and flatFeeToken (address).


GetFeeOptionAtIndex

Fetches the fee details based on its position.

Parameters:

Type
Description

uint256

Index of the fee option to be retrieved.

Return Values:

Type
Description

FeeStruct

An object that contains: name (string), lpFee (uint256), collectFee (uint256), flatFee (uint256), and flatFeeToken (address).


GetFeeOptionLength

Returns the total amount of fee options available.

Return Values:

Type
Description

uint256

The total amount of fee options available.


GetLock

Returns a Lock struct for _lockId.

Parameters:

Name
Type
Description

_lockId

uint256

The ID of the lock to be retrieved.

Return Values:

Type
Description

Lock

An object that contains: lock_id (uint256), nftPositionManager (INonfungiblePositionManager), pool (address), nft_id (uint256), owner (address), pendingOwner (address), additionalCollector (address), collectAddress (address), unlockDate (uint256), countryCode (uint16), and ucf (uint256).


GetLocksLength

Return Values:

Type
Description

uint256

The unique nonce representing the amount of locks in the contract.


GetNumUserLocks

Parameters:

Type
Description

address

The address of the user.

Return Values:

Type
Description

uint256

The number of locks associated with the user.


GetUserLockAtIndex

Parameters:

Type
Description

address

The address of the user.

uint256

The index of the lock for the given user.

Return Values:

Type
Description

Lock

A struct that contains details of the lock including lock_id, nftPositionManager, pool, nft_id, owner, pendingOwner, additionalCollector, collectAddress, unlockDate, countryCode, and ucf.


TickSpacingToMaxTick

Parameters:

Type
Description

int24

The tick spacing used to calculate the maximum possible tick.

Return Values:

Type
Description

int24

The maximum tick value calculated for the spacing.


GetAmountsForLiquidity

Parameters:

Type
Description

int24

The current tick of the liquidity range.

int24

The lower tick boundary of the liquidity range.

int24

The higher tick boundary of the liquidity range.

uint128

The liquidity amount to be used for calculations.

Return Values:

Type
Description

uint256

The amount of token0 calculated based on the provided parameters.

uint256

The amount of token1 calculated based on the provided parameters.


OnERC721Received

Parameters:

Type
Description

address

The address of the sender invoking this function (the operator).

address

The address from which the ERC721 token originates.

uint256

The unique identifier (ID) of the ERC721 token being transferred.

bytes

Additional calldata sent with the transfer.

Return Values:

Type
Description

bytes4

The function selector for the onERC721Received function.

Events

OnAddFee

Emitted on addOrEditFee.

Parameters:

Name
Type
Description

nameHash

bytes32

The unique hash representing the name of the fee.

name

string

The name of the fee.

lpFee

uint256

The liquidity provider fee amount.

collectFee

uint256

The fee amount to be collected.

flatFee

uint256

The flat fee amount.

flatFeeToken

address

The address of the token in which the flat fee is denominated.


OnEditFee

Emitted on addOrEditFee.

Parameters:

Name
Type
Description

nameHash

bytes32

The unique hash representing the name of the fee.

name

string

The name of the fee.

lpFee

uint256

The liquidity provider fee amount.

collectFee

uint256

The fee amount to be collected.

flatFee

uint256

The flat fee amount.

flatFeeToken

address

The address of the token in which the flat fee is denominated.


OnRemoveFee

Emitted on removeFee.

Parameters:

Name
Type
Description

nameHash

bytes32

The unique hash representing the name of the fee.


OnLock

Emitted ont Lock.

Parameters:

Name
Type
Description

lock_id

uint256

The unique nonce per lock.

nftPositionManager

INonfungiblePositionManager

The NFT position manager of the Uniswap fork.

nft_id

uint256

The NFT token ID of the NFT belonging to the nftPositionManager.

owner

address

The owner who can collect and withdraw.

additionalCollector

address

An additional address allowed to call collect.

collectAddress

address

The address to which automatic collections are sent.

unlockDate

uint256

The unlock date of the lock in seconds.

countryCode

uint16

The country code of the locker/business.

collectFee

uint256

The collect fee.

poolAddress

address

The pool address.

position

IUniswapV3Pool.Position

Represents a unique position in a Uniswap V3 Pool. Contains details about the liquidity provided.


OnIncreaseLiquidity

Emitted on IncreaseLiquidity.

Parameters:

Name
Type
Description

lockId

uint256

The ID of the lock for which liquidity was increased.


OnDecreaseLiquidity

Emitted on DecreaseLiquidity.

Parameters:

Name
Type
Description

lockId

uint256

The ID of the lock for which liquidity was decreased.


OnRelock

Emitted on Relock.

Parameters:

Name
Type
Description

lockId

uint256

The ID of the lock that is being relocked.

unlockDate

uint256

The new unlock date for the relocked lock.


OnWithdraw

Emitted on Withdraw.

Parameters:

Name
Type
Description

lock_id

uint256

The ID of the lock being withdrawn.

owner

address

The owner of the lock.

receiver

address

The address receiving the withdrawal.


OnMigrate

Emitted on Migrate.

Parameters:

Name
Type
Description

lockId

uint256

The ID of the lock that is being migrated.


OnSetAdditionalCollector

Emitted on SetAdditionalCollector.

Parameters:

Name
Type
Description

lockId

uint256

The ID of the lock setting an additional collector.

additionalCollector

address

The address being set as the additional collector.


OnSetCollectAddress

Emitted on SetCollectAddress.

Parameters:

Name
Type
Description

lockId

uint256

The ID of the lock where the collection address is being set.

collectAddress

address

The new collection address being set.


OnLockOwnershipTransferStarted

Emitted on TransferLockOwnership.

Parameters:

Name
Type
Description

lockId

uint256

The ID of the lock initiating ownership transfer.

currentOwner

address

The current owner initiating the transfer.

pendingOwner

address

The proposed new owner.


OnTransferLockOwnership

Emitted on AcceptLockOwnership.

Parameters:

Name
Type
Description

lockId

uint256

The ID of the lock finalizing ownership transfer.

oldOwner

address

The address of the previous owner.

newOwner

address

The address of the new owner.


OnSetMigrator

Emitted on SetMigrator.

Parameters:

Name
Type
Description

migrator

address

The address of the migrator being set.


OnSetUCF

Emitted on setUCF.

Parameters:

Name
Type
Description

lockId

uint256

The ID of the lock where the UCF is being set.

ucf

uint256

The new UCF value being set.

Last updated