12. Quorlin — Smart Contract Language
Quorlin is Kortana's native, capability-secure smart contract language that targets the KVM. It looks like Java but acts as a mathematically strict constraint system.
12.1 Language Philosophy
Every function in Quorlin must declare its effect (reads or writes) before anything else. The compiler strictly enforces this at compile time.
12.2 Quick Start Tutorial
contract Token { map<address, number> balances; number supply; event Transfer(address indexed from, address indexed to, number value); constructor { supply = 1000000000000000000000000; balances[caller] = supply; emit Transfer(nobody, caller, supply); } reads number balanceOf(address owner) { return balances[owner]; } writes truth transfer(address recipient, number amount) { require recipient != nobody, "transfer to the zero address"; number held = balances[caller]; require held >= amount, "transfer amount exceeds balance"; balances[caller] = held - amount; balances[recipient] = balances[recipient] + amount; emit Transfer(caller, recipient, amount); return yes; } }
12.3 Types
number: Equivalent touint256. Arithmetic safely halts the call on overflow/underflow by default.truth: A boolean, specificallyyesorno. Implicit conversions (likeif (balance)) are not allowed.text: A string literal.address: A standard 20-byte address.record: Single-level structs.
12.4 Storage
map<K, V>: Maps usekeccak256(key ‖ slot), exactly mirroring Solidity's layout. Indexers written for Ethereum can read Quorlin state unchanged.- Records: Stored at
keccak256(key ‖ slot) + fieldIndex.
12.5 Functions & Effects
There is no function keyword. The capability comes first:
reads: A view function. The compiler statically lowers any calls to it to aStaticCall. A callee cannot maliciously turn a read into a write.writes: A state-mutating function.
12.7 Events & Error Handling
emit: Broadcasts an event log (compatible with EVM logs).require cond, "reason": Reverts the transaction. It automatically formats the reason as anError(string)so standard wallets and explorers decode it perfectly.
12.9 Composition & Interfaces
Quorlin can call other contracts via interface declarations. These compile down to secure ExternalCall or StaticCall instructions.
12.10 Built-in Context
Variables like caller (msg.sender) and nobody (address(0)) are native keywords, making common token defense patterns explicit.
12.11 Deliberate Omissions (Security by Subtraction)
[!IMPORTANT] The following are deliberately excluded from Quorlin to close severe exploit classes:
- No Inheritance: Prevents diamond-pattern state confusion.
- No Fallback/Receive: Prevents function-selector collisions and silent successes on failed calls.
- No
selfdestruct: Contracts cannot vanish.- No Dynamic Dispatch: Execution paths are highly predictable.
12.12 Standard Library
Quorlin ships with built-in IERC20, IERC165, and IERC721 interfaces hashed directly from the EIPs. Reference standard implementations (ERC20.ql, ERC721.ql, Access.ql) are provided and heavily tested.
12.13 Compiler: quorlinc
The Quorlin compiler (quorlinc) emits KVM bytecode and standard Ethereum ABI JSON files.
quorlinc Token.ql -o build/
12.16 Known Limitations
- No Arrays: Iteration in contracts leads to unbounded gas consumption. Arrays are currently omitted by design to force developers to rely on single-key lookups.
- Limited Text: Dynamic strings (
text) are bounded to 128 bytes.
Part IV — Economics & Governance
This section covers the financial mechanics, security incentives, and protocol governance of the Kortana blockchain.