Lumen Loop
All media
VideoYouTubeJames BachiniMay 26, 202511mo ago31:31

Migrating Contracts From Solidity To Soroban

Developer migrates a Solidity perpetual futures contract to Soroban using AI tools, walking through the differences between EVM and Rust/WebAssembly development, contract simplification, and debugging with unit tests.

SorobanDevelopersSmart Contracts
Lumen Loop's take

This tutorial demonstrates migrating a 2022 Solidity perpetual futures contract to Soroban, leveraging AI tools like ChatGPT to automate much of the translation work. The speaker covers key architectural differences: message.sender becomes env.invoker with explicit authorization checks, error handling shifts from require to panic, and storage uses key-value pairs. The contract implements a simplified perpetual futures system with margin requirements, liquidation mechanics, and funding rate concepts. After simplification to remove admin functions and external dependencies, the code is translated to Rust and compiled to WebAssembly. Unit testing reveals critical bugs in token approval flows and type mismatches with SEP-41 token transfers. The final contract compiles successfully with 15 passing tests, though the speaker emphasizes this is not production-ready without formal verification and security audits.

Mentioned projects
2 projects linked
C
Chainlink Oracles RelayerInfrastructure & Services
SCF
OracleNFTsGaming

Provable, Manipulation Resistant Random Numbers From Chainlink Oracles on Soroban.

View →
O
OpenZeppelin
Audited
SecurityDevXSDK

OpenZeppelin is a recognized leader in blockchain security and smart contract development, known for creating widely-used framew…

View →