AccountV3
Opinionated Account implementation for tokenbound V3
This is an opinionated, flexible, and audited tokenbound account implementation.
The full contract code of the AccountV3 can be found here.
What's new?
The AccountV3 comes with breaking changes as we no longer maintain compatibility with SNIP-6.
It majorly focuses on flexibility and ease with integration, comprising of plug'n'play components which developers can utilize. More on this in the component section.
Functions
Constructor
The constructor function initializes certain parameters on deployment.
Parameters
ACCOUNTV3 IMPLEMENTATION
on_erc721_received
on_erc721_received
This function is called each time an NFT is received. Prevents ownership cycle.
context
context
Context gives deployment details of the TBA. Will be needed for cross-chain compatibility (v4?).
SIGNATORY IMPLEMENTATION
is_valid_signer
is_valid_signer
Checks if the signer is the owner or a permissioned address.
is_valid_signature
is_valid_signature
Validates tokenbound account signatures.
EXECUTABLE IMPLEMENTATION
execute
execute
Executes transactions on the TokenBound account. Checks caller is a valid signer and account is not locked.
UPGRADEABLE IMPLEMENTATION
upgrade
upgrade
It upgrades the Token Bound Account by replacing with a new_class_hash
. An account can only be upgraded by the owner and requires the account to be locked.
LOCKABLE IMPLEMENTATION
lock
lock
Locks an account for a specified period of time which is measured in seconds. the function can only be called by a valid signer.
is_locked
is_locked
Checks if an account is locked and returns true if it is locked and false if it is not. If the account is locked, it also returns the time left until the account is unlocked.
PERMISSIONABLE IMPLEMENTATION
set_permission
set_permission
Gives a set of specified addresses permission to execute from a tokenbound account, lock it etc. (Think guardians). Can also remove permissions by setting permissions to false
.
has_permission
has_permission
Checks if an address passed in is a permissioned_address
. It returns true if permission has been set for the address, else it returns false.
Last updated