Skip to content

Instantly share code, notes, and snippets.

@jO-Osko
Created January 13, 2023 14:10
Show Gist options
  • Save jO-Osko/2a2883fb08da0ae59038d37b64c75482 to your computer and use it in GitHub Desktop.
Save jO-Osko/2a2883fb08da0ae59038d37b64c75482 to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import { IFtso } from "@flarenetwork/flare-periphery-contracts/coston/ftso/userInterfaces/IFtso.sol";
import { IPriceSubmitter } from "@flarenetwork/flare-periphery-contracts/coston/ftso/userInterfaces/IPriceSubmitter.sol";
import { IFtsoRegistry } from "@flarenetwork/flare-periphery-contracts/coston/ftso/userInterfaces/IFtsoRegistry.sol";
contract SimpleFtsoExample {
function getPriceSubmitter() public virtual view returns(IPriceSubmitter) {
return IPriceSubmitter(0x1000000000000000000000000000000000000003);
}
function getTokenPriceWei(string memory foreignTokenSymbol) public view returns(uint256 _price, uint256 _timestamp) {
IFtsoRegistry ftsoRegistry = IFtsoRegistry(address(getPriceSubmitter().getFtsoRegistry()));
(_price, _timestamp) = ftsoRegistry.getCurrentPrice(foreignTokenSymbol);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment