Skip to content

somnus0x/terra-crashcourse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

🛰️ Terra Crash Course

Beginner Tutorial and Resource for Terra Developer

Beginner Resource

How to ตกเขา By Somnus

Useful Command Line

Generate New Project Template

cargo generate --git https://github.com/CosmWasm/cosmwasm-template.git --branch 0.16 --name your-project-name

Building Project (Run in the file that has cargo.toml)

cargo build

Compile to WASM

docker run --rm -v "$(pwd)":/code \
  --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
  cosmwasm/workspace-optimizer:0.11.5

Pitfall

Memory Limit in Array (128 bits) 💻

Array in Cosmwasm has hard limit of 128bits or 10,000 element.

/// Max key length for db_write/db_read/db_remove/db_scan (when VM reads the key argument from Wasm memory)
const MAX_LENGTH_DB_KEY: usize = 64 * KI;
/// Max value length for db_write (when VM reads the value argument from Wasm memory)
const MAX_LENGTH_DB_VALUE: usize = 128 * KI;

Terra Read Limit (1000 Element) 💻

Keep in mind the terra blockchain has gas limit for read so that pose limitation for reading/writing large element.

Terra has tax for moving native asset that are not LUNA so contracts shouldn't move native asset in many hops or it will incur an loss.

Audit Report (Oaks & Halborn)

VSCODE Setup (Useful Extension)

Code Example (Good One IMO)

About

Beginner Tutorial and Resource for Terra Developer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published