Last commit before tests
Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
parent
19f7d15c6f
commit
a8e09194ec
@ -45,10 +45,9 @@ contract CRVUSDInstancesProposal {
|
||||
FeeOracleManager public constant feeOracleManager =
|
||||
FeeOracleManager(0x5f6c97C6AD7bdd0AE7E0Dd4ca33A4ED3fDabD4D7);
|
||||
|
||||
/* @dev This is the address of the Uniswap V3 Oracle which we will use for all of our traditional
|
||||
instances, but it will also help the Curve instances, the former must have been deployed with the address
|
||||
of this */
|
||||
address public immutable deployedUniswapV3FeeOracleAddress;
|
||||
/* @dev This is the Uniswap V3 Oracle which we will use for all of our traditional instances, but it will
|
||||
also help the Curve instances, the former must have been deployed with the address of this */
|
||||
UniswapV3FeeOracle public immutable v3FeeOracle;
|
||||
|
||||
/* @dev This is the CurveFeeOracle contract which will be deployed beforehand and which will be able to
|
||||
use multiple Curve pools as oracles, at once. */
|
||||
@ -58,7 +57,7 @@ contract CRVUSDInstancesProposal {
|
||||
|
||||
constructor(address _deployedCurveFeeOracleAddress, address _deployedUniswapV3FeeOracleAddress) public {
|
||||
curveFeeOracle = CurveFeeOracle(_deployedCurveFeeOracleAddress);
|
||||
deployedUniswapV3FeeOracleAddress = _deployedUniswapV3FeeOracleAddress;
|
||||
v3FeeOracle = UniswapV3FeeOracle(_deployedUniswapV3FeeOracleAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,7 +74,7 @@ contract CRVUSDInstancesProposal {
|
||||
|
||||
// Ok, first add the Uniswap V3 Oracle to the contract
|
||||
|
||||
curveFeeOracle.setUniswapV3FeeOracle(UniswapV3FeeOracle(deployedUniswapV3FeeOracleAddress));
|
||||
curveFeeOracle.setUniswapV3FeeOracle(v3FeeOracle);
|
||||
|
||||
// Then, add necessary oracles for the CRVUSD price, to the CurveFeeOracle
|
||||
|
||||
@ -118,7 +117,7 @@ contract CRVUSDInstancesProposal {
|
||||
* (...pool contracts as oracles) ===(`price_oracle`)===> CurveFeeOracle ===(`getFee()`)===>
|
||||
* FeeOracleManager ===(`instanceFeeWithUpdate`)===> RelayerRegistry
|
||||
*/
|
||||
function _setCurveFeeChainedOracleForInstance(CurveFeeOracle feeOracle, ITornadoInstance _instance)
|
||||
function _setCurveFeeChainedOracleForInstance(CurveFeeOracle _feeOracle, ITornadoInstance _instance)
|
||||
internal
|
||||
{
|
||||
// Add the oracles which are the USDC/CRVUSD stableswap and tricryptoUSDC pools
|
||||
@ -143,10 +142,10 @@ contract CRVUSDInstancesProposal {
|
||||
_coins[1] = 1; // ETHER
|
||||
|
||||
// In order to receive the CRVUSD price, its price in USDC must be read out (the USDC price in crvUSD
|
||||
// is worthless because we do not have a common denominator then) and then the second price must be
|
||||
// inverted to receive the accurate ETH/CRVUSD price, meaning ETH per CRVUSD, which will then be
|
||||
// divided by ETH per TORN, and then (ETH/CRVUSD)/(ETH/TORN) = (ETH/CRVUSD)*(TORN/ETH) = (TORN/CRVUSD)
|
||||
// which is the price that the oracle should be supplying
|
||||
// is worthless because we do not have a common denominator in the oracle then) and then the second
|
||||
// price must be inverted to receive the accurate ETH/CRVUSD price, meaning ETH per CRVUSD, which will
|
||||
// then be divided by ETH per TORN, and then (ETH/CRVUSD)/(ETH/TORN) = (ETH/CRVUSD)*(TORN/ETH) =
|
||||
// (TORN/CRVUSD) which is the price that the oracle should be supplying
|
||||
|
||||
bool[] memory _invert = new bool[](2);
|
||||
|
||||
@ -155,7 +154,7 @@ contract CRVUSDInstancesProposal {
|
||||
|
||||
// (USDC/CRVUSD)*(ETH/USDC) = (ETH/CRVUSD)
|
||||
|
||||
feeOracle.modifyChainedOracleForInstance(
|
||||
_feeOracle.modifyChainedOracleForInstance(
|
||||
_instance, _oracles, _selectors, _coins, _invert, "ETH/CRVUSD"
|
||||
);
|
||||
}
|
||||
|
@ -37,6 +37,9 @@ contract InfrastructureUpgradeProposal {
|
||||
/* @dev The address of the current InstanceRegistry proxy, this will also be upgraded */
|
||||
address payable public constant instanceRegistryProxyAddress = 0xB20c66C4DE72433F3cE747b58B86830c459CA911;
|
||||
|
||||
/* @dev The address of the current RelayerRegistry proxy, this won't be upgraded */
|
||||
address payable public constant relayerRegistryProxyAddress = 0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2;
|
||||
|
||||
/* @dev This is the Uniswap V3 Oracle which we will use for all of our traditional instances, but it will
|
||||
also help the CurveFeeOracle, the former must have been deployed witht the address of this */
|
||||
address public immutable deployedUniswapV3FeeOracleAddress;
|
||||
@ -68,6 +71,15 @@ contract InfrastructureUpgradeProposal {
|
||||
* @dev This function also executes further internal functions inlined below.
|
||||
*/
|
||||
function executeProposal() external {
|
||||
// We need to prepare the new TornadoRouter contract by setting the instance registry and relayer
|
||||
// registry addresses.
|
||||
|
||||
TornadoRouter router = TornadoRouter(deployedTornadoRouterAddress);
|
||||
|
||||
router.initialize(instanceRegistryProxyAddress, relayerRegistryProxyAddress);
|
||||
|
||||
// We also now need to upgrade the InstanceRegistry proxy and the FeeManager proxy
|
||||
|
||||
// Upgrade FeeManager (V1) Proxy to FeeOracleManager (V2)
|
||||
|
||||
AdminUpgradeableProxy(feeManagerProxyAddress).upgradeTo(deployedFeeOracleManagerImplementationAddress);
|
||||
@ -97,9 +109,7 @@ contract InfrastructureUpgradeProposal {
|
||||
// instances which isn't mutable for them, instead only determined for each. The new Tornado Router is
|
||||
// also set.
|
||||
|
||||
InstanceRegistry(instanceRegistryProxyAddress).initialize(
|
||||
_getAllInstances(), TornadoRouter(deployedTornadoRouterAddress)
|
||||
);
|
||||
InstanceRegistry(instanceRegistryProxyAddress).initialize(_getAllInstances(), router);
|
||||
|
||||
// The Uniswap V3 Fee Oracle also needs global data like the old FeeManager (Uniswap V3 functionality
|
||||
// has now been split out) did, the legacy data will be used and in this version also the minimum
|
||||
|
@ -165,10 +165,14 @@ contract FeeOracleManager is FeeManagerLegacyStorage, Initializable {
|
||||
|
||||
// Now update if we do not respect the interval or we respect it and are in the interval
|
||||
if (!_respectFeeUpdateInterval || (feeUpdateInterval < -feeData.lastUpdated + now)) {
|
||||
IFeeOracle oracle = instanceFeeOracles[_instance];
|
||||
|
||||
// Check whether the instance is registered
|
||||
require(address(oracle) != address(0), "FeeOracleManager: instance has no oracle");
|
||||
|
||||
// There must a be a fee set otherwise it's just 0
|
||||
if (feeData.feePercent != 0) {
|
||||
// This will revert if no contract is set
|
||||
feeData.feeAmount = instanceFeeOracles[_instance].getFee(
|
||||
feeData.feeAmount = oracle.getFee(
|
||||
torn,
|
||||
_instance,
|
||||
instanceRegistry.getInstanceData(_instance),
|
||||
|
Loading…
Reference in New Issue
Block a user