stRWA Technical

Introduction

stRWA is a wrapped, rebasing version of veRWA. stRWA rebases to account for accrued reETH yield while burning a portion of RWA supply in the process.

stRWA is natively cross-chain, using LZ OFT technology.

Code: https://github.com/re-al-Foundation/rwa-contracts/tree/dev/src/staking

Contracts

stRWA.sol

This token is a cross-chain rebasing token. This token can only be minted in exchange for $RWA tokens. Once minted, the $RWA tokens will be locked into a veRWA position to begin accruing revenue. The revenue will be claimed and used to rebase; Distributing revenue amongst $stRWA holders.

Notable Methods

previewDeposit

function previewDeposit(uint256 assets) external pure returns (uint256)

Takes assets and returns an amount of shares that would be received if the amount assets was deposited.

deposit

function deposit(uint256 assets, address receiver) external nonReentrant returns (uint256 shares)

Allows a user to deposit amount of RWA into this contract to receive shares amount of stRWA.

previewRedeem

function previewRedeem(uint256 shares) external view returns (uint256)

Returns an amount of RWA tokens that would be redeemed if `shares` amount of stRWA tokens were used to redeem. Returns the amount of RWA in the form of a veRWA lock position. It takes the amount of RWA and splits it off from the master lock in the token silo. Takes into account the redemption fee.

redeem

function redeem(uint256 shares, address receiver, address owner) external nonReentrant returns (uint256 tokenId, uint256 assets)

Allows a user to use a specified amount of stRWA to redeem a veRWA lock position of assets amount. Redeem X stRWA for Y RWA: X is provided. The Y RWA returned is in the form a single veRWA lock position.

rebase

function rebase() external

This method will update the rebaseIndex based on the rewards collected in the TokenSilo. The rebase logic will calculate the % increase in the amount of RWA locked. Based on the % increase, we then increase the rebaseIndex by the same percentage.

TokenSilo.sol

This is a periphery contract for stRWA and serves as the token silo for the veRWA token being used as collateral for stRWA holders. This contract contains mechanics for managing the masterTokenId, allowing stRWA holders to deposit more collateral or redeem from the master governance position. This contract also contains a rebaseHelper function to distribute rewards and return an amount used to rebase stRWA.

Notable Methods

depositAndLock

function depositAndLock(uint256 amount) external onlyStakedRWA

This method allows $RWA tokens to be added to the masterTokenId lock position. If there currently is not a token assigned to masterTokenId, a new token is minted with the $RWA tokens provided.

redeemLock

function redeemLock(uint256 amount, address recipient) external onlyStakedRWA returns (uint256 tokenId, uint256 amountLocked));

This method allows a portion of the masterTokenId lock position to be split off and sent to a specified recipient.

claim

function claim() external onlyFundsManager returns (uint256 claimed)

Allows the funds manager to claim any claimable rewards. The ETH rewards claimed will remain in this contract and are wrapped immediately.

convertRewardToken

function convertRewardToken(address, uint256 amount, address target, bytes calldata data) external onlyFundsManager returns (uint256 amountOut)

Converts a specific amount of WETH to RWA. Contains a check to verify that the target address and selector are correct to avoid exploits. Follows the same interface as RevenueDistributor::convertRewardToken to allow for the w3f to be used without major revisions. This method will also trigger a rebase on the stRWARebaseManager.

rebaseHelper

function rebaseHelper() external onlyStakedRWA returns (uint256)

This method is called by stRWA when a rebase occurs. This method will take all RWA in the contract and distribute it. Distribution will perform a burn of raw $RWA tokens and will lock the rest into the master position. The amount locked and designated for rebase will be returned and used to update the stRWA rebaseIndex.

Last updated