mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
restructured files
This commit is contained in:
parent
f55e0abeb1
commit
10c1872885
|
@ -4,10 +4,17 @@ pragma solidity ^0.7.0;
|
||||||
contract Events {
|
contract Events {
|
||||||
event LogSupply(
|
event LogSupply(
|
||||||
address token,
|
address token,
|
||||||
|
uint256 vTokenAmt,
|
||||||
uint256 amt,
|
uint256 amt,
|
||||||
address to,
|
address to,
|
||||||
uint256 getId,
|
uint256 getId,
|
||||||
uint256 setId
|
uint256 setId
|
||||||
);
|
);
|
||||||
event LogWithdraw(uint256 amt, address to, uint256 getId, uint256 setId);
|
event LogWithdraw(
|
||||||
|
uint256 amt,
|
||||||
|
uint256 vTokenAmt,
|
||||||
|
address to,
|
||||||
|
uint256 getId,
|
||||||
|
uint256 setId
|
||||||
|
);
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
//SPDX-License-Identifier: MIT
|
//SPDX-License-Identifier: MIT
|
||||||
pragma solidity ^0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
import { DSMath } from "../../common/math.sol";
|
|
||||||
import { Basic } from "../../common/basic.sol";
|
import { Basic } from "../../common/basic.sol";
|
||||||
import { instaLiteInterface } from "./interface.sol";
|
import { instaLiteInterface } from "./interface.sol";
|
||||||
|
|
|
@ -3,7 +3,7 @@ pragma solidity ^0.7.0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title InstaLite Connector
|
* @title InstaLite Connector
|
||||||
* @dev
|
* @dev Supply and Withdraw
|
||||||
|
|
||||||
*/
|
*/
|
||||||
import { TokenInterface } from "../../common/interfaces.sol";
|
import { TokenInterface } from "../../common/interfaces.sol";
|
||||||
|
@ -12,7 +12,7 @@ import { Basic } from "../../common/basic.sol";
|
||||||
import { Events } from "./events.sol";
|
import { Events } from "./events.sol";
|
||||||
import { Helpers } from "./helpers.sol";
|
import { Helpers } from "./helpers.sol";
|
||||||
|
|
||||||
abstract contract Resolver is Events, DSMath, Basic, Helpers {
|
abstract contract InstaLiteConnector is Events, Basic, Helpers {
|
||||||
/**
|
/**
|
||||||
* @dev Supply
|
* @dev Supply
|
||||||
* @notice Supply eth/weth/stEth tokens into instalite.
|
* @notice Supply eth/weth/stEth tokens into instalite.
|
||||||
|
@ -35,10 +35,10 @@ abstract contract Resolver is Events, DSMath, Basic, Helpers {
|
||||||
{
|
{
|
||||||
uint256 _amt = getUint(getId, amt);
|
uint256 _amt = getUint(getId, amt);
|
||||||
bool isEth = token == ethAddr;
|
bool isEth = token == ethAddr;
|
||||||
|
uint256 vTokenAmt;
|
||||||
if (isEth) {
|
if (isEth) {
|
||||||
_amt = _amt == uint256(-1) ? address(this).balance : _amt;
|
_amt = _amt == uint256(-1) ? address(this).balance : _amt;
|
||||||
uint256 vTokenAmt = instaLite.supplyEth{ value: amt }(to);
|
vTokenAmt = instaLite.supplyEth{ value: amt }(to);
|
||||||
} else {
|
} else {
|
||||||
TokenInterface tokenContract = TokenInterface(token);
|
TokenInterface tokenContract = TokenInterface(token);
|
||||||
|
|
||||||
|
@ -47,13 +47,13 @@ abstract contract Resolver is Events, DSMath, Basic, Helpers {
|
||||||
: _amt;
|
: _amt;
|
||||||
|
|
||||||
approve(tokenContract, address(instaLite), _amt);
|
approve(tokenContract, address(instaLite), _amt);
|
||||||
uint256 vTokenAmt = instaLite.supply(token, _amt, to);
|
vTokenAmt = instaLite.supply(token, _amt, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
setUint(setId, _amt);
|
setUint(setId, _amt);
|
||||||
|
|
||||||
_eventName = "LogSupply(address,uint256,address,uint256,uint256)";
|
_eventName = "LogSupply(address,uint256,uint256,address,uint256,uint256)";
|
||||||
_eventParam = abi.encode(token, _amt, to, getId, setId);
|
_eventParam = abi.encode(token, vTokenAmt, _amt, to, getId, setId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,15 +76,15 @@ abstract contract Resolver is Events, DSMath, Basic, Helpers {
|
||||||
{
|
{
|
||||||
uint256 _amt = getUint(getId, amt);
|
uint256 _amt = getUint(getId, amt);
|
||||||
|
|
||||||
instaLite.withdraw(_amt, to);
|
unit256 vTokenAmt = instaLite.withdraw(_amt, to);
|
||||||
|
|
||||||
setUint(setId, _amt);
|
setUint(setId, _amt);
|
||||||
|
|
||||||
_eventName = "LogWithdraw(uint256,address,uint256,uint256)";
|
_eventName = "LogWithdraw(uint256,uint256,address,uint256,uint256)";
|
||||||
_eventParam = abi.encode(_amt, to, getId, setId);
|
_eventParam = abi.encode(_amt, vTokenAmt, to, getId, setId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract ConnectV2InstaLite is Resolver {
|
contract ConnectV2InstaLiteVault1 is Resolver {
|
||||||
string public constant name = "instaLite-v1";
|
string public constant name = "instaLite-v1";
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user