dsa-connectors/contracts/mainnet/connectors/lido_stETH/main.sol

46 lines
1.2 KiB
Solidity
Raw Normal View History

2022-03-22 15:24:40 +00:00
//SPDX-License-Identifier: MIT
2022-03-06 18:46:22 +00:00
pragma solidity ^0.7.0;
/**
* @title Stake Ether.
* @dev Stake ETH and receive stETH while staking.
2022-03-06 18:46:22 +00:00
*/
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 stake Eth in Lido, users receive stETH tokens on a 1:1 basis representing their staked ETH.
2022-03-06 18:46:22 +00:00
* @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;
2022-03-06 19:30:45 +00:00
lidoInterface.submit{ value: amt }(treasury);
2022-03-06 18:46:22 +00:00
setUint(setId, _amt);
2022-03-06 19:30:45 +00:00
_eventName = "LogDeposit(uint256,uint256,uint256)";
_eventParam = abi.encode(_amt, getId, setId);
2022-03-06 18:46:22 +00:00
}
}
contract ConnectV2LidoStEth is Resolver {
2022-03-06 18:51:01 +00:00
string public constant name = "LidoStEth-v1";
2022-03-06 18:46:22 +00:00
}