Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Add IntermediaryMedianizer for Ropsten
Browse files Browse the repository at this point in the history
So that new system deployments don't require new contract authorizations
on the Maker side, an intermediate medianizer has already been deployed
to Ropsten for Maker to authorize. It is designed to have an updatable
reference to the Maker medianizer, and pass through reads to that
instance.

The already-deployed address is added to the externals file, while the
code is checked in to the price-feed directory, but not migrated as part
of the system migrations.
  • Loading branch information
Shadowfiend committed Apr 15, 2020
1 parent 2f47be1 commit 7f3b274
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
36 changes: 36 additions & 0 deletions solidity/contracts/price-feed/IntermediaryMedianizer.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
pragma solidity 0.5.17;

import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "../external/IMedianizer.sol";

/// @title IntermediaryMedianizer is an updatable intermediary between a real
/// medianizer and IMedianizer users.
/// @dev This is used in Keep testnets where Maker has deployed a Medianizer
/// instance that needs to authorize a single consumer, to enable multiple
/// tBTC deployments to happen in the background and be pointed at a stable
/// medianizer instance that is authorized on the Maker contract. It allows
/// the updating of the backing medianizer and therefore is NOT suitable
/// for mainnet deployment.
contract IntermediaryMedianizer is Ownable, IMedianizer {
IMedianizer private _realMedianizer;

constructor(IMedianizer realMedianizer) public {
_realMedianizer = realMedianizer;
}

function getMedianizer() external view returns (IMedianizer) {
return _realMedianizer;
}

function peek() external view returns (uint256, bool) {
return _realMedianizer.peek();
}

function read() external view returns (uint256) {
return _realMedianizer.read();
}

function setMedianizer(IMedianizer realMedianizer) public onlyOwner {
_realMedianizer = realMedianizer;
}
}
11 changes: 9 additions & 2 deletions solidity/migrations/3_initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ const TBTCDepositToken = artifacts.require("TBTCDepositToken")
const FeeRebateToken = artifacts.require("FeeRebateToken")
const VendingMachine = artifacts.require("VendingMachine")

const {BondedECDSAKeepVendorAddress, BTCETHMedianizer} = require("./externals")
const {
BondedECDSAKeepVendorAddress,
BTCETHMedianizer,
RopstenETHBTCPriceFeed,
} = require("./externals")

module.exports = async function(deployer, network) {
// Don't enact this setup during unit testing.
Expand Down Expand Up @@ -52,7 +56,10 @@ module.exports = async function(deployer, network) {
const btcEthPriceFeed = await BTCETHPriceFeed.deployed()
if (network === "mainnet") {
// Inject mainnet price feeds.
await btcEthPriceFeed.initialize(tbtcSystem.address, BTCETHMedianizer)
await btcEthPriceFeed.initialize(BTCETHMedianizer)
} else if (network === "ropsten") {
// Inject medianizer intermediary.
await btcEthPriceFeed.initialize(RopstenETHBTCPriceFeed)
} else {
// Inject mock price feeds.
const mockBtcEthPriceFeed = await MockBTCETHPriceFeed.deployed()
Expand Down
3 changes: 3 additions & 0 deletions solidity/migrations/externals.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ const BondedECDSAKeepVendorAddress = "0xZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
// See: https://github.com/makerdao/oracles-v2#live-mainnet-oracles
const BTCETHMedianizer = "0xABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE"

const RopstenETHBTCPriceFeed = "0xb60844D3C84C4Db77d240bC38241C93Df5f4fbF7"

module.exports = {
BondedECDSAKeepVendorAddress,
BTCETHMedianizer,
RopstenETHBTCPriceFeed,
}

0 comments on commit 7f3b274

Please sign in to comment.