add gamebitAdapter
This commit is contained in:
28
contracts/SmartRoute/adapter/GambitAdapter.sol
Normal file
28
contracts/SmartRoute/adapter/GambitAdapter.sol
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
|
||||
Copyright 2020 DODO ZOO.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.6.9;
|
||||
|
||||
import {IGambit} from "../intf/IGambit.sol";
|
||||
import {IDODOAdapter} from "../intf/IDODOAdapter.sol";
|
||||
|
||||
contract GambitAdapter is IDODOAdapter {
|
||||
|
||||
function _gambitSwap(address to, address pool, bytes memory moreInfo) internal {
|
||||
(address tokenIn, address tokenOut) = abi.decode(moreInfo, (address, address));
|
||||
|
||||
IGambit(pool).swap(tokenIn, tokenOut, to);
|
||||
}
|
||||
|
||||
function sellBase(address to, address pool, bytes memory moreInfo) external override {
|
||||
_gambitSwap(to, pool, moreInfo);
|
||||
}
|
||||
|
||||
function sellQuote(address to, address pool, bytes memory moreInfo) external override {
|
||||
_gambitSwap(to, pool, moreInfo);
|
||||
}
|
||||
}
|
||||
6
contracts/SmartRoute/intf/IGambit.sol
Normal file
6
contracts/SmartRoute/intf/IGambit.sol
Normal file
@@ -0,0 +1,6 @@
|
||||
pragma solidity 0.6.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
interface IGambit {
|
||||
function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256);
|
||||
}
|
||||
Reference in New Issue
Block a user