Purpose: User wants to move [(s)frxUSD, (s)frxETH, FXS, FPI] from chain A to chain B via LZ.
- User sends OFT to RemoteHop on Chain A
- If
Chain B == Fraxtal- Chain A RemoteHop sends OFT to recipient on Fraxtal
- If
Chain B != Fraxtal- Chain A RemoteHop sends OFT to Fraxtal Remotehop
- Fraxtal Remotehop sends OFT to recipient on chain B.
- If
Purpose: User wants to convert their frxUSD to sfrxUSD (or vise versa) on chain A at the best provided rate
- User sends OFT to MintRedeemHop on chain A
- Chain A MintRedeemHop sends OFT to Fraxtal MintRedeemHop
- Fraxtal MintRedeemHop either deposits or redeems (depending if the OFT is frxUSD or sfrxUSD) to the alternate OFT
- Fraxtal MintRedeemHop sends newly received token back to user on chain A
interface IERC20 {
function approve(address spender, uint256 amount) external;
}
interface IOFT {
function token() external view returns (address);
}
struct MessagingFee {
uint256 nativeFee;
uint256 lzTokenFee;
}
interface IRemoteHop {
function quote(address oft, uint32 dstEid, bytes32 toAsBytes32, uint256 amount) external view returns (MessagingFee memory fee);
function sendOFT(address oft, uint32 dstEid, bytes32 toAsBytes23, uint256 amount) external payable;
}
interface IMintRedeemHop {
function quote(address oft, bytes32 toAsBytes32, uint256 amount) external view returns (MessagingFee memory fee);
function mintRedeem(address oft, uint256 amount) external payable;
}// Ethereum WFRAX => (Fraxtal) => Sonic WFRAX
// OFT address found @ https://docs.frax.com/protocol/crosschain/addresses
address oft = 0x04ACaF8D2865c0714F79da09645C13FD2888977f; // WFRAX OFT
address remoteHop = 0x3ad4dC2319394bB4BE99A0e4aE2AbF7bCEbD648E; // See deployed contracts below
uint256 amount = 1e18;
uint32 dstEid = 30332; // Sonic
bytes32 to = bytes32(uint256(uint160(0xb0E1650A9760e0f383174af042091fc544b8356f))); // example
// 1. Quote cost of send
MessagingFee memory fee = IRemoteHop(remoteHop).quote(oft, dstEid, to, amount);
// 2. Approve OFT underlying token to be transferred to the remoteHop
IERC20(IOFT(oft).token()).approve(remoteHop, amount);
// 3. Send the OFT to destination
IRemoteHop(remoteHop).sendOFT{value: fee.nativeFee}(oft, dstEid, to, amount);// Sonic frxUSD => (Fraxtal) => Sonic sfrxUSD
// OFT address found @ https://docs.frax.com/protocol/crosschain/addresses
address oft = 0x80Eede496655FB9047dd39d9f418d5483ED600df; // frxUSD OFT
address mintRedeemHop = 0xf6115Bb9b6A4b3660dA409cB7afF1fb773efaD0b; // see deployed contracts below
uint256 amount = 1e18;
bytes32 to = bytes32(uint256(uint160(0xb0E1650A9760e0f383174af042091fc544b8356f))); // example
// 1. Quote cost of send
MessagingFee memory fee = IMintRedeemHop(mintRedeemHop).quote(oft, to, amount);
// 2. Approve OFT underlying token to be transferred to the mintRedeemHop
IERC20(IOFT(oft).token()).approve(mintRedeemHop, amount);
// 3. Convert the frxUSD to sfrxUSD
IMintRedeemHop(mintRedeemHop).mintRedeem{value: fee.nativeFee}(oft, amount);| Chain | RemoteHop |
|---|---|
| Fraxtal | 0xd593Df4E2E3156C5707bB6AE4ba26fd4A9A04586 |
| Eth Sepolia | 0xa46A266dCBf199a71532c76967e200994C5A0D6d |
| Arb Sepolia | 0x7a07D606c87b7251c2953A30Fa445d8c5F856C7A |