UnlockToken
Inherits: CommitToken, IUnlockToken
Title: UnlockToken
CommitToken subclass that allows a vault to initiate redeem requests on behalf of users
The vault address is immutable and set at construction. The vault can act as an operator for any controller, enabling it to initiate redeem requests automatically.
Like CommitToken, this version is non-transferable for implementation simplicity. Future versions may support transferability or could be implemented as an NFT to enable transferring unlocking positions between users.
Inherits CommitToken's custom async redemption flow, which is inspired by but NOT compliant with ERC-7540.
State Variables
vault
The vault address that can act as an operator (immutable)
address public immutable vault
Functions
constructor
Constructs the UnlockToken contract
constructor(address authority_, address asset_, address vault_, uint48 unlockingDelay_, address denyList_)
CommitToken(authority_, asset_, unlockingDelay_, denyList_, type(uint256).max);
Parameters
| Name | Type | Description |
|---|---|---|
authority_ | address | Address of the AccessManager contract |
asset_ | address | Address of the underlying asset token |
vault_ | address | Address of the vault that can act as an operator (immutable) |
unlockingDelay_ | uint48 | Cooldown period for redeem requests in seconds |
denyList_ | address | Address of the AddressList contract for deny list checking |
onlyVault
Ensures that only the vault can call the function
modifier onlyVault() ;
name
Returns the token name: "{VaultName} Unlock Token"
Overrides CommitToken's name() which returns "{AssetName} Commit Token"
function name() public view override(ERC20, IERC20Metadata) returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The token name |
symbol
Returns the token symbol: "{AssetSymbol}unlock"
Overrides CommitToken's symbol() which returns "CT-{AssetSymbol}"
function symbol() public view override(ERC20, IERC20Metadata) returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The token symbol |
isOperator
Returns true if the operator is the controller or the vault
function isOperator(address controller, address operator)
public
view
override(CommitToken, IERC7540Operator)
returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
controller | address | The controller address |
operator | address | The operator address to check |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | true if operator is controller or vault, false otherwise |
_deposit
Overrides CommitToken _deposit to restrict access to vault only
Only the vault can deposit assets into the UnlockToken
function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal override onlyVault;
Parameters
| Name | Type | Description |
|---|---|---|
caller | address | The address to deposit from |
receiver | address | The address to deposit to |
assets | uint256 | The amount of assets to deposit |
shares | uint256 | The amount of shares to deposit |
_requestRedeem
Overrides CommitToken _requestRedeem to restrict access to vault only
Only the vault can request redeem on behalf of users
function _requestRedeem(Request storage request, address controller, address owner, uint256 assets, uint256 shares)
internal
override
onlyVault;
Parameters
| Name | Type | Description |
|---|---|---|
request | Request | The redeem request storage pointer |
controller | address | Address that will control the request |
owner | address | Address that owns the shares |
assets | uint256 | Amount of assets to redeem |
shares | uint256 | Amount of shares to redeem |