Skip to main content

WarrenToken

WarrenToken is an ERC20 token contract that represents a user's Liquidity Provider (LP) position in the Warren ecosystem. It extends the standard ERC20 functionality with additional features such as account locking and metadata management.

Inheritance​

WarrenToken inherits from the following interfaces:

  • IERC20: Standard ERC20 interface
  • IERC20Lockable: Interface for account locking, which is useful for implementing transferless staking contracts
  • IOwnable: Interface for ownership management
  • IUnlockCallback: Uniswap V4 unlock callback interface

State Variables​

metadataURI​

string public metadataURI;

A URI pointing to the metadata associated with this token.

Functions​

hub​

function hub() external view returns (IWarrenHub);

Returns the address of the WarrenHub contract associated with this token.

token0​

function token0() external view returns (Currency);

Returns the address of the first token in the pair.

token1​

function token1() external view returns (Currency);

Returns the address of the second token in the pair.

poolManager​

function poolManager() external view returns (IPoolManager);

Returns the address of the Uniswap V4 PoolManager contract associated with this token.

mint​

function mint(address to, uint256 amount) external;

Mints new tokens to the specified address. Can only be called by the WarrenHub contract.

ParameterTypeDescription
toaddressThe address to receive the minted tokens
amountuint256The amount of tokens to mint

burn (from WarrenHub)​

function burn(address from, uint256 amount) external;

Burns tokens from a specified address. Can only be called by the WarrenHub contract.

ParameterTypeDescription
fromaddressThe address to burn tokens from
amountuint256The amount of tokens to burn

burn (from user)​

function burn(uint256 amount) external;

Burns tokens from the caller's address.

ParameterTypeDescription
amountuint256The amount of tokens to burn

initialize​

function initialize(address owner_, string calldata metadataURI_) external;

Initializes the WarrenToken contract. Can only be called once, typically by the WarrenHub contract during deployment.

ParameterTypeDescription
owner_addressThe initial owner of the contract
metadataURI_stringThe initial metadata URI for the token

setMetadataURI​

function setMetadataURI(string calldata metadataURI_) external;

Sets the metadata URI for the token. Can only be called by the contract owner.

ParameterTypeDescription
metadataURI_stringThe new URI for token metadata

lock​

function lock(IERC20Unlocker unlocker, bytes calldata data) external;

Locks the caller's account, preventing any transfers from the account until it's unlocked.

ParameterTypeDescription
unlockerIERC20UnlockerThe address that will be able to unlock the account
databytesAdditional data with no specified format

unlock​

function unlock(address account) external;

Unlocks a previously locked account. Can only be called by the designated unlocker for the account.

ParameterTypeDescription
accountaddressThe account to unlock

isLocked​

function isLocked(address account) external view returns (bool);

Checks if an account is locked.

ParameterTypeDescription
accountaddressThe account to check

Returns:

  • bool: True if the account is locked, false otherwise

unlockerOf​

function unlockerOf(address account) external view returns (IERC20Unlocker unlocker);

Returns the unlocker of an account.

ParameterTypeDescription
accountaddressThe account whose unlocker is to be returned

Returns:

  • unlocker: The unlocker of the account

Events​

SetMetadataURI​

event SetMetadataURI(string newURI);

Emitted when the metadata URI is updated.

ParameterTypeDescription
newURIstringThe new metadata URI

Lock​

event Lock(address indexed account, IERC20Unlocker indexed unlocker);

Emitted when an account is locked.

ParameterTypeIndexedDescription
accountaddressYesThe account that was locked
unlockerIERC20UnlockerYesThe address designated as the unlocker for the account

Unlock​

event Unlock(address indexed account, IERC20Unlocker indexed unlocker);

Emitted when an account is unlocked.

ParameterTypeIndexedDescription
accountaddressYesThe account that was unlocked
unlockerIERC20UnlockerYesThe address that performed the unlock operation