Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIP-16: Moving main LP pool and oracle from Uniswap to Sushiswap 🍣 #2

Merged
merged 14 commits into from Mar 31, 2021
Merged
3 changes: 2 additions & 1 deletion contracts/dao/Implementation.sol
Expand Up @@ -42,9 +42,10 @@ contract Implementation is State, Bonding, Market, Regulator, Govern {

// add SushiSwap pool
_state.provider.oracle = new Oracle(address(dollar()), Constants.getPairAddress());
oracle().setup(); // setup oracle
devnulldsd marked this conversation as resolved.
Show resolved Hide resolved
oracle().capture(); // capture for pool price on sushi pool

_state.provider.pool = address(new Pool());
_state.provider.pool = 0xf929fc6eC25850ce00e457c4F28cDE88A94415D8;

mintToAccount(0x437cb43D08F64AF2aA64AD2525FE1074E282EC19, 2000e18); // 2000 DSD to gus
mintToAccount(0x35F32d099fb9E08b706A6fa41D639EEB69F8A906, 2000e18); // 2000 DSD to degendegen9
Expand Down
9 changes: 4 additions & 5 deletions contracts/oracle/Oracle.sol
Expand Up @@ -31,7 +31,7 @@ contract Oracle is IOracle {
using Decimal for Decimal.D256;

bytes32 private constant FILE = "Oracle";
address private constant UNISWAP_FACTORY = address(0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac); // Sushi Factory Address
address private constant SUSHISWAP_FACTORY = address(0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac); // Sushi Factory Address

address internal _dao;
address internal _dollar;
Expand All @@ -50,14 +50,13 @@ contract Oracle is IOracle {
_pair = IUniswapV2Pair(pair);
}

// Not used for sushiswap pool as pair is already created
function setup() public onlyDao {
_pair = IUniswapV2Pair(IUniswapV2Factory(UNISWAP_FACTORY).createPair(_dollar, usdc()));
_pair = IUniswapV2Pair(IUniswapV2Factory(SUSHISWAP_FACTORY).getPair(_dollar, usdc()));

(address token0, address token1) = (_pair.token0(), _pair.token1());
_index = _dollar == token0 ? 0 : 1;

Require.that(_index == 0 || _dollar == token1, FILE, "Døllar not found");
Require.that(_index == 0 || _dollar == token1, FILE, "DSD not found");
}

/**
Expand Down Expand Up @@ -141,7 +140,7 @@ contract Oracle is IOracle {
}

modifier onlyDao() {
Require.that(msg.sender == _dao, FILE, "Not dao");
Require.that(msg.sender == _dao, FILE, "Not DAO");

_;
}
Expand Down