Tutorial on building a Soroban smart contract implementing a call option using XLM and USDC tokens. Covers option mechanics, contract code structure, unit testing with time simulation, and deployment to testnet.
This video tutorial demonstrates how to build a Soroban smart contract that implements a financial derivative: a call option on XLM tokens. The presenter explains option mechanics (call vs put options, strike price, premium, expiry), then walks through the contract code written in Rust. Key functions include sell_option where the seller locks XLM collateral, buy_option where the buyer pays a USDC premium, and exercise where the buyer can purchase the underlying XLM at the strike price before expiry. The tutorial covers unit testing using Soroban's mock token client and ledger utilities to simulate time progression, then compiles the contract to WebAssembly and deploys it to testnet using Stellar contract deploy commands.