🚀 Build and Deploy
-
Install LDK and start a local devnet by following Quick Start.
-
The hello Lyquid example code is already inside LDK:
~/.shakenup/ldk/lyquid-examples/hello. -
Build and deploy your Lyquid to the local devnet:
shaker deploy ~/.shakenup/ldk/lyquid-examples/hello/Cargo.toml --input $(cast abi-encode "constructor(string)" "Hello, World!")
# --input passes the ABI encoded "Hello, World!" string to Lyquid's constructor.
You'll see something like
created Lyquid-Adm8r3j64FbzRjwcBK4ZZRFcgLQjTqtt => 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
printed to the console. The Lyquid-* is the human-readable form of Lyquid's ID, which uniquely identifies the Lyquid you just created, whereas the hex address is the current sequencer on the chain.
Let's try to interact with the Lyquid you just deployed, click here to continue.
Notes
-
If you want to creat a new Lyquid from the template, use
# If you don't have cargo-generate installed, try `cargo install cargo-generate`
cargo generate --git https://github.com/lyquor-labs/ldk.git lyquid-template --name <lyquid_name>This will generate a lyquid project named
helloin your current directory. Then to deploy useshaker deploy ./<lyquid_name>/Cargo.toml --input <constructor input if any>. -
The
--inputflag specifies the encoded input to the hello Lyquid's constructor in an Ethereum ABI style. (Here it encodes "Hello, World!" string as the argument to the constructor). The option can be ignored if Lyquid's constructor does not take parameters. -
Because in Lyquor, a Lyquid can update its code without changing the ID, this hex sequencer address may also change in the future once you update the code with
--updatewith the deploy command. -
To get the lastest deployed contract address if you lose such an info: you can run
curl -X POST --data '{"id":0,"jsonrpc":"2.0","method": "lyquor_getLatestLyquidInfo","params": ["Lyquid-Adm8r3j64FbzRjwcBK4ZZRFcgLQjTqtt"]}' http://localhost:10087/api
-
You'll also notice the lyquor-tools generates a
./lyquid_tools_targetfolder by default (you can specify a different path). This folder is the work directory for building everything that's need for your Lyquid's deployment. If you're working with multiple Lyquid projects, you can use the same foler so their shared dependencies (such aslyquidcrate for the SDK) will be downloaded/built only once. Inside this folder:/wasm32-unknown-unknown/release/*.wasmare all Lyquid's compiled WASM code for node execution./solidity/*.solare the sequencer contract that's deployed to the sequencer chain.