mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
added connector
This commit is contained in:
parent
018a1d28cc
commit
ba77087659
5
contracts/mainnet/connectors/lido_stETH/events.sol
Normal file
5
contracts/mainnet/connectors/lido_stETH/events.sol
Normal file
|
@ -0,0 +1,5 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
contract Events {
|
||||
event LogDeposit(uint256 Amt, uint256 getId, uint256 setId);
|
||||
}
|
10
contracts/mainnet/connectors/lido_stETH/helpers.sol
Normal file
10
contracts/mainnet/connectors/lido_stETH/helpers.sol
Normal file
|
@ -0,0 +1,10 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
import { TokenInterface } from "../../common/interfaces.sol";
|
||||
import { ILido } from "./interface.sol";
|
||||
|
||||
abstract contract Helpers {
|
||||
ILido internal constant lidoInterface =
|
||||
ILido(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
|
||||
}
|
||||
//0xC7B5aF82B05Eb3b64F12241B04B2cF14469E39F7
|
7
contracts/mainnet/connectors/lido_stETH/interface.sol
Normal file
7
contracts/mainnet/connectors/lido_stETH/interface.sol
Normal file
|
@ -0,0 +1,7 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
interface ILido {
|
||||
function submit(address _referral) external payable returns (uint256);
|
||||
|
||||
function balanceOf(address owner) external view returns (uint256);
|
||||
}
|
43
contracts/mainnet/connectors/lido_stETH/main.sol
Normal file
43
contracts/mainnet/connectors/lido_stETH/main.sol
Normal file
|
@ -0,0 +1,43 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
/**
|
||||
* @title WETH.
|
||||
* @dev Wrap and Unwrap WETH.
|
||||
*/
|
||||
|
||||
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, Helpers {
|
||||
/**
|
||||
* @dev deposit ETH into Lido.
|
||||
* @notice sends Eth into lido and in return you get equivalent of stEth tokens
|
||||
* @param amt The amount of ETH to deposit. (For max: `uint256(-1)`)
|
||||
* @param getId ID to retrieve amt.
|
||||
* @param setId ID stores the amount of ETH deposited.
|
||||
*/
|
||||
function deposit(
|
||||
uint256 amt,
|
||||
uint256 getId,
|
||||
uint256 setId
|
||||
)
|
||||
public
|
||||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
uint256 _amt = getUint(getId, amt);
|
||||
|
||||
_amt = _amt == uint256(-1) ? address(this).balance : _amt;
|
||||
lidoInterface.submit{ value: amt }(address(0));
|
||||
setUint(setId, _amt);
|
||||
|
||||
_eventName = "LogDeposit(uint256,uint256,uint256)";
|
||||
_eventParam = abi.encode(_amt, getId, setId);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectV2LidoStEth is Resolver {
|
||||
string public constant name = "LidoStEth-v1.0";
|
||||
}
|
Loading…
Reference in New Issue
Block a user