-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: claim with nft * fix: after merge
- Loading branch information
1 parent
8049c0d
commit 959a4cb
Showing
7 changed files
with
261 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// SPDX-FileCopyrightText: 2023 Lido <[email protected]> | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity 0.8.21; | ||
|
||
interface IWithdrawalQueue { | ||
function requestWithdrawals( | ||
uint256[] calldata _amounts, | ||
address _owner | ||
) external returns (uint256[] memory requestIds); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
// SPDX-FileCopyrightText: 2023 Lido <[email protected]> | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity 0.8.21; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// SPDX-FileCopyrightText: 2023 Lido <[email protected]> | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity 0.8.21; | ||
|
||
import { IStETH } from "../../../src/interfaces/IStETH.sol"; | ||
|
||
contract WithdrawalQueueMockBase { | ||
/// @dev Contains both stETH token amount and its corresponding shares amount | ||
event WithdrawalRequested( | ||
uint256 indexed requestId, | ||
address indexed requestor, | ||
address indexed owner, | ||
uint256 amountOfStETH, | ||
uint256 amountOfShares | ||
); | ||
} | ||
|
||
contract WithdrawalQueueMock is WithdrawalQueueMockBase { | ||
IStETH public stETH; | ||
|
||
uint256 public constant MIN_STETH_WITHDRAWAL_AMOUNT = 100; | ||
|
||
uint256 public constant MAX_STETH_WITHDRAWAL_AMOUNT = 1000 ether; | ||
|
||
constructor(address _stETH) { | ||
stETH = IStETH(_stETH); | ||
} | ||
|
||
function requestWithdrawals( | ||
uint256[] calldata _amounts, | ||
address _owner | ||
) external returns (uint256[] memory requestIds) { | ||
requestIds = new uint256[](_amounts.length); | ||
for (uint256 i = 0; i < _amounts.length; ++i) { | ||
require( | ||
_amounts[i] <= MAX_STETH_WITHDRAWAL_AMOUNT, | ||
"amount is greater than MAX_STETH_WITHDRAWAL_AMOUNT" | ||
); | ||
require( | ||
_amounts[i] >= MIN_STETH_WITHDRAWAL_AMOUNT, | ||
"amount is less than MIN_STETH_WITHDRAWAL_AMOUNT" | ||
); | ||
stETH.transferFrom(msg.sender, address(this), _amounts[i]); | ||
emit WithdrawalRequested( | ||
i + 1, | ||
msg.sender, | ||
_owner, | ||
_amounts[i], | ||
stETH.getSharesByPooledEth(_amounts[i]) | ||
); | ||
requestIds[i] = i + 1; | ||
} | ||
} | ||
} |