/
CWScriptSeamlessly Compile to Rust
Write smart contracts in CWScript
Fast-track Contract Development
Accelerate development cycles
Unleash the Power of CosmWasm
Leverage CosmWasm without writing Rust
CWScript Features
Optimize your Cosmos development workflow
Build Trust with Formal Verification
Enhance security and testing with Quint integration and formal specification support
A Robust Standard Library
Leverage CWScript's comprehensive standard library for seamless interoperability and advanced functionality
Enhanced Tooling for Productivity
Experience the full potential of CWScript with VS code extension, syntax highlighting, and semantic analysis
Bridging the Gap Between Languages
Break language barriers with CWScript's Rust codegen language runtime and cross-language interoperability
Future-Proofing Smart Contracts
Stay ahead of the curve with CWScript's extensible design and support for alternative codegen engines
Swift Compilation
CWScript's efficient compilation process allows for rapid development cycles and faster deployment of smart contracts
// export.rs
const ADMIN_ADDRESS: Addr = Addr::unchecked( "admin" )
pub fn admin_validation(addr: Addr): bool {
addr == ADMIN_ADDRESS
}
// contract.cws
import * from "./export.rs"
contract AdminVault {
exec #spend_asset(receiver: Addr, amount: U128) {
if !admin_validation($info.sender) {
fail! "Not an admin"
}
send_tokens(receiver, amount)
}
}
Seamless Rust Integration
With seamless integration with Rust, CWScript leverages the Rust ecosystem for audits, compatibility, and access to a wide range of libraries and tools, enhancing the development experience.
// Typescript
class Counter {
private state: {
count: number,
owner: Addr,
}
constructor(count?: number, owner?: Addr) {
this.state.count = count ?? 0
this.state.owner = owner ?? info.sender
}
increment() {
this.state.count += 1
}
decrememt() {
if (this.state.count === 0) {
throw new Error("count is zero")
}
this.state.count -= 1
}
}
// CWScript
contract Counter {
state {
count: U32,
owner: Addr,
}
#instantiate(count: U32?, owner: Addr?) {
$state.count = count ?? 0
$state.owner = owner ?? $info.sender
}
exec #increment() {
$state.count += 1
}
exec #decrement() {
if $state.count == 0 {
fail! "count is zero"
}
$state.count -= 1
}
}
Easy Adaptability for JS Devs
CWScript is designed with easy adaptability for JavaScript developers in mind. JavaScript developers can quickly transition to this new language and leverage their existing knowledge. The language provides a familiar syntax and structure, allowing developers to write code with ease and confidence.
Related Lessons
Learn to optimize your Cosmos development workflow