Build your First Smart Contract on L1X VM
Create L1X Project using cargo-l1x
Initiate a new L1X project creation process with Cargo's L1X plugin. The Fungible Token template is utilized here.
This command initiates the creation of a new project named "project_name" while applying the template labeled "ft". Templates offer pre-configured project structures or boilerplate code, streamlining the initial setup of your project.
Compile L1X Project
Navigate to the project directory and compile the L1X project using cargo-l1x build.
You will get object file for the compiled contract, at the location target/l1x/release/l1x_ft.o in cargo.
Create Wallet
Create your own wallet to generate a new keypair.
Import Wallet
Import you existing wallet using the l1x-cli-beta tool, by providing a private key. If you don't have one, Create Wallet.
Set Default Wallet
After Importing your wallet set it to be the default interaction account.
-- Check Endpoints for TestNet Faucet
Deploy L1X Project
Deploy the compiled L1X project to the L1X blockchain.
Example
You will get deployed contract address (DEPLOY_CONTRACT_ADDRESS) as the response of the above command. Use it to initialize your L1X project.
Initialize L1X Project
Initialize your deployed L1X project by setting up its base contract address.
Example
On successful initialization of the project, you will get initialized contract address (INIT_CONTRACT_ADDRESS) as the response of the init command. Use it for further Readonly and State Changing Function calls.
Call Readonly Function
Execute any readonly function of an L1X smart contract.
Example
Call State Changing Function
Invoke a state-changing function of an L1X smart contract using l1x-cli-beta, potentially altering the contract's state
Last updated