DeFi 协议
为什么选择在 Rome 上进行 DeFi?
模式 1:使用 Solana 预言机的借贷协议
import {IAggregatorV3Interface} from "@rome-protocol/solidity-sdk/contracts/oracle/IAggregatorV3Interface.sol";
contract RomeLending {
IAggregatorV3Interface public priceFeed;
constructor(address _priceFeed) {
priceFeed = IAggregatorV3Interface(_priceFeed);
}
function getCollateralValue(uint256 amount) public view returns (uint256) {
(, int256 price,,,) = priceFeed.latestRoundData();
// 通过 Oracle Gateway 获取 Pyth/Switchboard 价格
// 与以太坊上的 Chainlink 接口相同
return (amount * uint256(price)) / 1e8;
}
}模式 2:通过 CPI 的 DEX 聚合器
模式 3:收益金库
模式 4:跨协议套利
相关内容
最后更新于
这有帮助吗?