Build a dual-lane app
A step-by-step walkthrough of a dual-lane app — one Solidity contract used by both a MetaMask user and a Phantom (Solana) user, with exactly what happens at each step.
What you write — a standard ERC-20 vault
interface IERC20 {
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
contract Vault {
IERC20 public immutable token; // the wUSDC wrapper
mapping(address => uint256) public balanceOf;
constructor(IERC20 _token) { token = _token; }
function deposit(uint256 amount) external {
require(token.transferFrom(msg.sender, address(this), amount));
balanceOf[msg.sender] += amount;
}
function withdraw(uint256 amount) external {
balanceOf[msg.sender] -= amount;
require(token.transfer(msg.sender, amount));
}
}The two lanes
Lane
Wallet
How the app calls it
The key idea: the synthetic is a pass-through
One-time: Activate (provision the synthetic)
What each side needs
Needs
Why
Value IN — deposit (step by step)
Value OUT — withdraw (step by step)
The gotchas — all handled by the SDK
The same app from MetaMask
What's next
Last updated
Was this helpful?