-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Impl for 165 From a code perspective, this entails: FeePool and Issuer are changed to use the chainlink oracle instead of DebtCache and SynthetixDebtShare directly FeePool now closes its fee period across networks (using optimism relay call) to allow for synchronized sharing of close parameters between networks For testing and initial deployment, a dummy oracles SingleNetworkAggregatorDebtRatio and SingleNetworkAggregatorIssuedSynths are utilized to retrieve debt values for this network, meaning most unit tests can work exactly the same as before. Notes: The SC has indicated that inflation should be divided evenly between networks based on amount of debt shares on each network, so this has been implemented. Also, fees will remain on the network they originate from for the time being Dual Integration test was added to verify fee pool closure Tests were removed from DebtCache because the functionality is no longer used within the system, but the actual code from solidity was not removed because there is no need to include DebtCache in an update. Doing so would require more migration complexity and it would be better if we could avoid that, so no changes have been made to DebtCache for the time being. The release process for this SIP is 2 steps: First, we will release as usual with the included SingleNetworkAggregators, which will preserve current functionality while enabling for us to start reading from an oracle interface for debt info Second, we will use the pdao to change the AddressResolver setting for the two aggregators to be the chainlink provided ones, which will effectively complete the debt synthethsis and enable synth fungibility
- Loading branch information
Showing
41 changed files
with
2,911 additions
and
556 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
pragma solidity ^0.5.16; | ||
|
||
//import "@chainlink/contracts-0.0.10/src/v0.5/interfaces/AggregatorV2V3Interface.sol"; | ||
|
||
import "./AddressResolver.sol"; | ||
import "./interfaces/IDebtCache.sol"; | ||
import "./interfaces/ISynthetixDebtShare.sol"; | ||
import "./interfaces/AggregatorV2V3Interface.sol"; | ||
|
||
import "./SafeDecimalMath.sol"; | ||
|
||
// aggregator which reports the data from the system itself | ||
// useful for testing | ||
contract BaseSingleNetworkAggregator is Owned, AggregatorV2V3Interface { | ||
using SafeDecimalMath for uint; | ||
|
||
AddressResolver public resolver; | ||
|
||
uint public overrideTimestamp; | ||
|
||
constructor(AddressResolver _resolver) public Owned(msg.sender) { | ||
resolver = _resolver; | ||
} | ||
|
||
function setOverrideTimestamp(uint timestamp) public onlyOwner { | ||
overrideTimestamp = timestamp; | ||
|
||
emit SetOverrideTimestamp(timestamp); | ||
} | ||
|
||
function latestRoundData() | ||
external | ||
view | ||
returns ( | ||
uint80, | ||
int256, | ||
uint256, | ||
uint256, | ||
uint80 | ||
) | ||
{ | ||
return getRoundData(uint80(latestRound())); | ||
} | ||
|
||
function latestRound() public view returns (uint256) { | ||
return 1; | ||
} | ||
|
||
function decimals() external view returns (uint8) { | ||
return 0; | ||
} | ||
|
||
function getAnswer(uint256 _roundId) external view returns (int256 answer) { | ||
(,answer,,,) = getRoundData(uint80(_roundId)); | ||
} | ||
|
||
function getTimestamp(uint256 _roundId) external view returns (uint256 timestamp) { | ||
(,,timestamp,,) = getRoundData(uint80(_roundId)); | ||
} | ||
|
||
function getRoundData(uint80) | ||
public | ||
view | ||
returns ( | ||
uint80, | ||
int256, | ||
uint256, | ||
uint256, | ||
uint80 | ||
); | ||
|
||
event SetOverrideTimestamp(uint timestamp); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.