I developed RLUSD Guardian to let approved institutional market-makers exchange RLUSD and USDC at a fixed 1:1 dollar value. The contract uses prefunded reserves, with authorization and balance checks around each swap. I wrote the Solidity implementation, supporting tests and deployment tooling, and worked through the audit-remediation process.
Swaps and permissions
The contract separates owner, market-maker and supply-manager capabilities. Approved market-makers can exchange the two tokens, while supply management and administrative operations have their own permissions. Keeping those responsibilities separate makes the permitted actions explicit for each participant.
I implemented reserve checks, SafeERC20 transfers and a reentrancy guard on the swap flows. A swap depends on both the caller’s authorization and the contract’s available liquidity. Those conditions are checked within the contract.
Token accounting and upgrades
RLUSD uses 18 decimal places and USDC uses six in the target configuration. Exchanging equal dollar amounts therefore requires converting between different token units. I implemented the conversion and integral-amount checks alongside the reserve accounting.
Guardian uses a UUPS upgradeable implementation. I wrote an ERC1967 proxy deployment script and included Foundry deployment artifacts for Sepolia. The repository contains the contract, tests, deployment tooling and CI configuration together, so changes can be reviewed with their supporting code.
Testing and audit work
I wrote Foundry unit and fuzz tests and configured GitHub Actions to run formatting, build and test checks. Guardian was audited by OpenZeppelin, and I addressed seven documented audit notes through individual pull requests.
Those changes included handling equal token decimals, removing redundant decimal state, adding a storage gap and caching state reads in swaps. I also updated event documentation, imports and the security-contact declaration. Each pull request records the audit note it addresses.