fix: Support Multiple Shells (#17)

* fix: Support Multiple Shells

* CHANGEGLOG
This commit is contained in:
Jacob Evans
2020-10-29 17:09:23 +10:00
committed by GitHub
parent 02006118c7
commit 717db99b38
16 changed files with 143 additions and 101 deletions

View File

@@ -89,7 +89,7 @@ contract BridgeAdapter is
MixinMooniswap(addresses)
MixinMStable(addresses)
MixinOasis(addresses)
MixinShell(addresses)
MixinShell()
MixinSushiswap(addresses)
MixinUniswap(addresses)
MixinUniswapV2(addresses)

View File

@@ -44,7 +44,6 @@ contract MixinAdapterAddresses
address uniswapV2Router;
address uniswapExchangeFactory;
address mStable;
address shell;
address dodoHelper;
// Other
address weth;

View File

@@ -44,15 +44,6 @@ contract MixinShell is
{
using LibERC20TokenV06 for IERC20TokenV06;
/// @dev Mainnet address of the `Shell` contract.
IShell private immutable SHELL;
constructor(AdapterAddresses memory addresses)
public
{
SHELL = IShell(addresses.shell);
}
function _tradeShell(
IERC20TokenV06 buyToken,
uint256 sellAmount,
@@ -61,15 +52,15 @@ contract MixinShell is
internal
returns (uint256 boughtAmount)
{
(address fromTokenAddress) = abi.decode(bridgeData, (address));
(address fromTokenAddress, address pool) = abi.decode(bridgeData, (address, address));
// Grant the Shell contract an allowance to sell the first token.
IERC20TokenV06(fromTokenAddress).approveIfBelow(
address(SHELL),
pool,
sellAmount
);
boughtAmount = SHELL.originSwap(
boughtAmount = IShell(pool).originSwap(
fromTokenAddress,
address(buyToken),
// Sell all tokens we hold.

View File

@@ -77,7 +77,6 @@ blockchainTests.resets('FillQuoteTransformer', env => {
mStable: NULL_ADDRESS,
weth: NULL_ADDRESS,
shellBridge: NULL_ADDRESS,
shell: NULL_ADDRESS,
creamBridge: NULL_ADDRESS,
dodoBridge: NULL_ADDRESS,
dodoHelper: NULL_ADDRESS,