Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions contracts/FtmFeed.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//SPDX-License-Identifier: None

pragma solidity ^0.5.16;

import "./SafeMath.sol";

interface IFeed {
function decimals() external view returns (uint8);
function latestAnswer() external view returns (uint);
}

contract FtmFeed is IFeed {
using SafeMath for uint;

IFeed public ftmFeed;
IFeed public ethFeed;

constructor(IFeed _ftmFeed, IFeed _ethFeed) public {
ftmFeed = _ftmFeed;
ethFeed = _ethFeed;
}

function decimals() public view returns (uint8) {
return 18;
}

function latestAnswer() public view returns (uint) {
uint ftmEthPrice = ftmFeed.latestAnswer();
return ftmEthPrice
.mul(ethFeed.latestAnswer())
.div(10**uint256(ethFeed.decimals()));
}
}
18 changes: 18 additions & 0 deletions deploy/35_ftmFeed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = async ({
deployments,
getNamedAccounts
}) => {
console.log("35. Deploy Ftm Feed")
const {deploy} = deployments;
const {deployer, ftmEthFeed, ethFeed} = await getNamedAccounts();

await deploy('FtmFeed', {
from: deployer,
args:[
ftmEthFeed,
ethFeed
]
});
};

module.exports.tags = ['FtmFeed'];
139 changes: 139 additions & 0 deletions deployments/mainnet/FtmFeed.json

Large diffs are not rendered by default.

185 changes: 185 additions & 0 deletions deployments/mainnet/solcInputs/171aa0e285966923bd7e6058afec666b.json

Large diffs are not rendered by default.

139 changes: 139 additions & 0 deletions deployments/rinkeby/FtmFeed.json

Large diffs are not rendered by default.

185 changes: 185 additions & 0 deletions deployments/rinkeby/solcInputs/171aa0e285966923bd7e6058afec666b.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ module.exports = {
},
stethEthFeed: {
1:"0xAb55Bf4DfBf469ebfe082b7872557D1F87692Fe6"
},
},
ftmEthFeed: {
1:"0x2de7e4a9488488e0058b95854cc2f7955b35dc9b",
4:"0xc751E86208F0F8aF2d5CD0e29716cA7AD98B5eF5"
},
deployer:{
default:0
},
Expand Down