mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Hardcoded wethContract
This commit is contained in:
parent
32666224cf
commit
667241cf0b
8
contracts/mainnet/connectors/weth/helpers.sol
Normal file
8
contracts/mainnet/connectors/weth/helpers.sol
Normal file
|
@ -0,0 +1,8 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
import { TokenInterface } from "../../common/interfaces.sol";
|
||||
|
||||
|
||||
abstract contract Helpers {
|
||||
TokenInterface wethContract = TokenInterface(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
|
||||
}
|
|
@ -5,13 +5,12 @@ pragma solidity ^0.7.0;
|
|||
* @dev Deposit & Withdraw from DSA.
|
||||
*/
|
||||
|
||||
import { TokenInterface } from "../../common/interfaces.sol";
|
||||
|
||||
import { DSMath } from "../../common/math.sol";
|
||||
import { Basic } from "../../common/basic.sol";
|
||||
import { Events } from "./events.sol";
|
||||
import { Helpers } from "./helpers.sol";
|
||||
|
||||
abstract contract Resolver is Events, DSMath, Basic {
|
||||
abstract contract Resolver is Events, DSMath, Basic, Helpers {
|
||||
|
||||
/**
|
||||
* @dev Deposit ETH into WETH.
|
||||
|
@ -27,9 +26,8 @@ abstract contract Resolver is Events, DSMath, Basic {
|
|||
) public payable returns (string memory _eventName, bytes memory _eventParam) {
|
||||
uint _amt = getUint(getId, amt);
|
||||
|
||||
TokenInterface tokenContract = TokenInterface(wethAddr);
|
||||
_amt = _amt == uint(-1) ? address(this).balance : _amt;
|
||||
tokenContract.deposit{value: _amt}();
|
||||
wethContract.deposit{value: _amt}();
|
||||
|
||||
setUint(setId, _amt);
|
||||
|
||||
|
@ -51,10 +49,9 @@ abstract contract Resolver is Events, DSMath, Basic {
|
|||
) public payable returns (string memory _eventName, bytes memory _eventParam) {
|
||||
uint _amt = getUint(getId, amt);
|
||||
|
||||
TokenInterface tokenContract = TokenInterface(wethAddr);
|
||||
_amt = _amt == uint(-1) ? tokenContract.balanceOf(address(this)) : _amt;
|
||||
tokenContract.approve(wethAddr, _amt);
|
||||
tokenContract.withdraw(_amt);
|
||||
_amt = _amt == uint(-1) ? wethContract.balanceOf(address(this)) : _amt;
|
||||
wethContract.approve(wethAddr, _amt);
|
||||
wethContract.withdraw(_amt);
|
||||
|
||||
setUint(setId, _amt);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user