Create an Account
Overview
Creating an account is an essential prerequisite for users who wish to participate in trading activities within the Chromatic Protocol. The createAccount
function enables the creation of a new user account, ensuring that each user can have only one account.
ChromaticRouter Interface
The IChromaticRouter
interface serves as the primary interface for interacting with the ChromaticRouter contract. It provides access to the createAccount
function, allowing users to create user accounts.
interface IChromaticRouter {
/**
* @notice Creates a new user account.
* @dev Only one account can be created per user.
* Emits an `AccountCreated` event upon successful creation.
*/
function createAccount() external;
}
Account Creation Process
The account creation process in the Chromatic Protocol involves a single step: calling the createAccount
function. Upon successful execution of this function, an AccountCreated
event is emitted, signifying the successful creation of a new user account.
Step 1: Call the createAccount
Function
To create an account, users need to invoke the createAccount
function of the ChromaticRouter contract. This function does not accept any parameters and can be called directly.
function createAccount() external;
Event: AccountCreated
Upon successfully creating a new user account, the AccountCreated
event is emitted. This event provides information about the account creation, allowing users to track and handle account-related events.
event AccountCreated();