Code Examples
Production-ready templates and reference implementations. Fork, customize, and deploy.
Cross-VM DeFi Protocol
Live DemoAtomic swap between EVM and SVM with shared liquidity pool
Tech Stack
SolidityRust (Anchor)TypeScript
Features
- Atomic bundles
- Price oracles
- LP tokens
Multi-VM NFT Marketplace
NFTs minted on any VM, tradeable across all VMs
Tech Stack
Solidity (ERC-721)MoveInk!
Features
- Cross-VM transfers
- Royalties
- Auctions
Native Asset Bridge
Deposit BTC/ETH and use natively in any VM
Tech Stack
RustSubstrate PalletsMPC Signatures
Features
- Reserve proofs
- Solvency tracking
- Instant withdrawals
Governance DAO
Multi-VM governance with weighted voting
Tech Stack
SolidityCosmWasm
Features
- Proposal system
- Treasury management
- Timelock
Cross-VM Stablecoin
Algorithmic stablecoin with multi-VM collateral
Tech Stack
SolidityRust (SVM)PolkaVM
Features
- Overcollateralization
- Liquidations
- Price stability
On-Chain Order Book DEX
Central limit order book with cross-VM settlements
Tech Stack
Rust (SVM)Solidity
Features
- Limit orders
- Market making
- Trade execution
Quick Snippets
Cross-VM Function Call(Solidity → SVM)
// SPDX-License-Identifier: MIT
pragma solidity
^0.8.20;import
"@interlayer/contracts/MEL.sol";contract
CrossVMBridge {function
transferToSVM( address recipient, uint256 amount ) external {// Call SVM program atomically
MEL.crossVMCall(
VmType.SVM,
svmProgramId,
abi.encodeWithSignature(
"transfer(address,uint256)",
recipient,
amount
)
);
}
}
Atomic Bundle (TypeScript SDK)
import
{ InterLayerClient, VmType } from '@interlayer/sdk';const
client = new InterLayerClient(config);// Create atomic bundle
const
bundle = await client.createBundle({atomic: true, // All-or-nothing
calls: [
{ vm: VmType.EVM, to: evmContract, data: callData1 },
{ vm: VmType.SVM, to: svmProgram, data: callData2 }
]
});await
bundle.send();