ITTUnlocker
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker
pub trait ITTUnlocker<TContractState>
Trait functions
create_preset
Creates an unlocking schedule Preset.
Arguments
preset_id: Refer toPreset.linear_start_timestamps_relative: Refer toPreset.linear_start_timestamps_relative: Refer toPreset.linear_bips: Refer toPreset.num_of_unlocks_for_each_linear: Refer toPreset.stream: Refer toPreset.recipient_id: Emitted as an event reserved for EthSign frontend use. This parameter has no effect on contract execution.
Panics
INVALID_PRESET_FORMAT: If the preset is not formatted correctly (e.g.linear_bipsfails to add up toBIPS_PRECISION)PRESET_EXISTS: If the inputpreset_idhas already been created.OwnableComponent::Errors::NOT_OWNER: If the caller is not the owner.
Events
PresetCreated
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::create_preset
fn create_preset(
ref self: TContractState,
preset_id: felt252,
linear_start_timestamps_relative: Span<u64>,
linear_end_timestamp_relative: u64,
linear_bips: Span<u64>,
num_of_unlocks_for_each_linear: Span<u64>,
stream: bool,
recipient_id: u64,
extraData: felt252,
)
create_actual
Creates an unlocking schedule Actual.
Arguments
recipient: The initial recipient of the unlocked tokens.preset_id: The unlocking schedule preset that thisActualbuilds on top of.start_timestamp_absolute: Refer toActual.amount_skipped: Refer toActual.total_amount: Refer toActual.unsafe_mint: Usemint(...)instead ofsafe_mint(...).recipient_id: Emitted as an event reserved for EthSign frontend use. This parameter has no effect on contract execution.batch_id: Emitted as an event reserved for EthSign frontend use. This parameter has no effect on contract execution.
Panics
PRESET_DOES_NOT_EXIST: Ifpreset_iddoes not exist.INVALID_SKIP_AMOUNT: If the amount of tokens skipped is greater than or equal to the total unlocked amount.OwnableComponent::Errors::NOT_OWNER: If the caller is not the owner.
Events
ActualCreated
Returns
u256: The createdactual_id, aka the unlocking schedule ID.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::create_actual
fn create_actual(
ref self: TContractState,
recipient: ContractAddress,
preset_id: felt252,
start_timestamp_absolute: u64,
amount_skipped: u256,
total_amount: u256,
unsafe_mint: bool,
recipient_id: u64,
batch_id: u64,
extraData: felt252,
) -> u256
withdraw_deposit
Withdraws any unclaimed deposit held by the Unlocker.
Arguments
amount: The amount of tokens to withdraw.
Panics
NOT_PERMISSIONED: If withdrawing has been disabled.GENERIC_ERC20_TRANSFER_ERROR: If for any reason the token transfer returnsfalse.OwnableComponent::Errors::NOT_OWNER: If the caller is not the owner.
Events
TokensWithdrawn
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::withdraw_deposit
fn withdraw_deposit(ref self: TContractState, amount: u256, extraData: felt252)
claim
Claims your unlocked tokens as a recipient. Any fees charged are not taken from the claimed amount.
Arguments
actual_id: The schedule ID assigned to you.claim_to: The destination address for the claimed tokens. Use Zeroable::zero() to claim to your current address.recipient_id: Emitted as an event reserved for EthSign frontend use. This parameter has no effect on contract execution.
Panics
NOT_PERMISSIONED: If the caller isn’t the recipient of saidactual_id.GENERIC_ERC20_TRANSFER_ERROR: If for any reason the token transfer returnsfalse.ReentrancyGuardComponent::Errors::REENTRANT_CALL: If a reentrant call is detected.
Events
TokensClaimed
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::claim
fn claim(
ref self: TContractState,
actual_id: u256,
claim_to: ContractAddress,
recipient_id: u64,
extraData: felt252,
)
delegate_claim
Claims someone else’s unlocked tokens as an authorized claiming delegate.
Arguments
actual_id: The schedule ID assigned to you.recipient_id: Emitted as an event reserved for EthSign frontend use. This parameter has no effect on contract execution.
Panics
NOT_PERMISSIONED: If the caller isn’t an authorized claiming delegate.GENERIC_ERC20_TRANSFER_ERROR: If for any reason the token transfer returnsfalse.ReentrancyGuardComponent::Errors::REENTRANT_CALL: If a reentrant call is detected.
Events
TokensClaimed
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::delegate_claim
fn delegate_claim(ref self: TContractState, actual_id: u256, recipient_id: u64, extraData: felt252)
cancel
Cancels an existing schedule.
Arguments
actual_id: The schedule ID to cancel.wipe_claimable_balance: Normally when canceling a schedule, calculation is performed to ensure the recipient will receive unlocked tokens until the moment of cancellation. This option prevents such calculation.recipient_id: Emitted as an event reserved for EthSign frontend use. This parameter has no effect on contract execution.
Panics
NOT_PERMISSIONED: If cancellation is disabled.OwnableComponent::Errors::NOT_OWNER: If the caller is not the owner.
Events
ActualCancelled
Returns
u256: The amount claimable by the recipient from the cancelled schedule.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::cancel
fn cancel(
ref self: TContractState,
actual_id: u256,
wipe_claimable_balance: bool,
recipient_id: u64,
extraData: felt252,
) -> u256
set_hook
Sets the external hook contract.
Arguments
hook: The address of an external contract that implements ITTHook.
Panics
NOT_PERMISSIONED: If hooking is disabled.OwnableComponent::Errors::NOT_OWNER: If the caller is not the owner.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::set_hook
fn set_hook(ref self: TContractState, hook: ContractAddress)
set_claiming_delegate
Sets the claiming delegate, who can trigger claim on behalf of recipients.
Arguments
delegate: The address of the claiming delegate.
Panics
OwnableComponent::Errors::NOT_OWNER: If the caller is not the owner.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::set_claiming_delegate
fn set_claiming_delegate(ref self: TContractState, delegate: ContractAddress)
disable_cancel
Permanently disables the ability for the owner to cancel schedules.
Panics
OwnableComponent::Errors::NOT_OWNER: If the caller is not the owner.
Events
CancelDisabled
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::disable_cancel
fn disable_cancel(ref self: TContractState)
disable_hook
Permanently disables the ability for the owner to set external hooks. Also clears the current hook.
Panics
OwnableComponent::Errors::NOT_OWNER: If the caller is not the owner.
Events
HookDisabled
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::disable_hook
fn disable_hook(ref self: TContractState)
disable_withdraw
Permanently disables the ability for the owner to withdraw deposit.
Panics
OwnableComponent::Errors::NOT_OWNER: If the caller is not the owner.
Events
WithdrawDisabled
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::disable_withdraw
fn disable_withdraw(ref self: TContractState)
disable_create
Permanently disables the ability for the owner to create new schedules.
Panics
OwnableComponent::Errors::NOT_OWNER: If the caller is not the owner.
Events
CreateDisabled
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::disable_create
fn disable_create(ref self: TContractState)
deployer
Returns the address of the TokenTable Deployer.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::deployer
fn deployer(self: @TContractState) -> ContractAddress
futuretoken
Returns the address of the FutureToken NFT created alongside this Unlocker instance.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::futuretoken
fn futuretoken(self: @TContractState) -> ContractAddress
hook
Returns the address of the external hook set by the owner.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::hook
fn hook(self: @TContractState) -> ContractAddress
claiming_delegate
Returns the address of the claiming delegate set by the owner.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::claiming_delegate
fn claiming_delegate(self: @TContractState) -> ContractAddress
is_cancelable
Returns if schedules are cancelable.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::is_cancelable
fn is_cancelable(self: @TContractState) -> bool
is_hookable
Returns if external hooks are allowed to be set.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::is_hookable
fn is_hookable(self: @TContractState) -> bool
is_withdrawable
Returns if the owner can withdraw deposited tokens.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::is_withdrawable
fn is_withdrawable(self: @TContractState) -> bool
is_createable
Returns if the owner can create new schedules.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::is_createable
fn is_createable(self: @TContractState) -> bool
get_project_token
Returns the project token that’s being unlocked.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::get_project_token
fn get_project_token(self: @TContractState) -> ContractAddress
get_preset
Returns the requested Preset struct.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::get_preset
fn get_preset(self: @TContractState, preset_id: felt252) -> Preset
get_actual
Returns the requested Actual struct.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::get_actual
fn get_actual(self: @TContractState, actual_id: u256) -> Actual
get_cancelled_amount_claimable
Returns the amount of claimable tokens for a cancelled schedule.
Arguments
actual_id: The cancenlled schedule ID that we are querying.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::get_cancelled_amount_claimable
fn get_cancelled_amount_claimable(self: @TContractState, actual_id: u256) -> u256
calculate_amount_claimable
Calculates the amount of claimable tokens for an ongoing schedule. Internally calls simulate_amount_claimable().
Arguments
actual_id: The ongoing schedule ID that we are querying.
Returns
u256: The claimable amount of tokens this time.u256: The updated total amount of tokens claimed after this claim action.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::calculate_amount_claimable
fn calculate_amount_claimable(self: @TContractState, actual_id: u256) -> (u256, u256)
simulate_amount_claimable
Simulates the amount of claimable tokens for an ongoing schedule. This function exposes more parameters to make testing the calculation logic easier.
Arguments
actual_start_timestamp_absolute: Refer toActual.start_timestamp_absolute.preset_linear_end_timestamp_relative: Refer toPreset.linear_end_timestamp_relative.preset_linear_start_timestamps_relative: Refer toPreset.linear_start_timestamps_relative.claim_timestamp_absolute: The timestamp of when claim() is called. Must be in the future.preset_linear_bips: Refer toPreset.linear_bips.preset_num_of_unlocks_for_each_linear: Refer toPreset.num_of_unlocks_for_each_linear.preset_stream: Refer toPreset.stream.preset_bips_precision: The decimal precision of calculation. Hardcoded to 10000.actual_total_amount: Refer toActual.total_amount.
Returns
u256: The claimable amount of tokens this time.
Fully qualified path: tokentable_v2::components::interfaces::unlocker::ITTUnlocker::simulate_amount_claimable
fn simulate_amount_claimable(
self: @TContractState,
actual_start_timestamp_absolute: u64,
preset_linear_end_timestamp_relative: u64,
preset_linear_start_timestamps_relative: Span<u64>,
claim_timestamp_absolute: u64,
preset_linear_bips: Span<u64>,
preset_num_of_unlocks_for_each_linear: Span<u64>,
preset_stream: bool,
preset_bips_precision: u64,
actual_total_amount: u256,
) -> u256