-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from The-Poolz/issue-15
RefundTimeOverride
- Loading branch information
Showing
12 changed files
with
3,262 additions
and
2,245 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,61 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.19; | ||
|
||
/// This policy outlines the procedures for addressing issues detailed in the following document: | ||
/// https://docs.google.com/document/d/1uhbRpDJbSKRSrwvVm-DJNTHlqsEaAG6tUbPAxh400xI | ||
|
||
import "@poolzfinance/poolz-helper-v2/contracts/interfaces/ILockDealNFT.sol"; | ||
import "@ironblocks/firewall-policy/contracts/FirewallPolicyBase.sol"; | ||
|
||
contract RefundTimeOverride is FirewallPolicyBase { | ||
uint256 public immutable validTimeStamp; | ||
uint256 public immutable collateralPoolId; | ||
|
||
bytes4 public constant REFUND_SELECTOR = bytes4(keccak256("handleRefund(uint256,address,uint256)")); | ||
|
||
error InvalidTime(); | ||
error ZeroPoolId(); | ||
|
||
constructor( | ||
uint256 _validTimeStamp, | ||
uint256 _collateralPoolId | ||
) { | ||
if (_collateralPoolId == 0) revert ZeroPoolId(); | ||
validTimeStamp = _validTimeStamp; | ||
collateralPoolId = _collateralPoolId; | ||
} | ||
|
||
function preExecution( | ||
address, | ||
address, | ||
bytes memory data, | ||
uint | ||
) external view override { | ||
bytes4 functionSelector; | ||
assembly { | ||
functionSelector := mload(add(data, 0x20)) | ||
} | ||
if (functionSelector == REFUND_SELECTOR) { | ||
uint256 poolId; | ||
assembly { | ||
poolId := mload(add(data, 0x24)) | ||
} | ||
_check(poolId); | ||
} | ||
} | ||
|
||
function postExecution( | ||
address, | ||
address, | ||
bytes calldata, | ||
uint | ||
) external override { | ||
// do nothing | ||
} | ||
|
||
function _check(uint256 poolId) private view { | ||
if (poolId == collateralPoolId && block.timestamp > validTimeStamp) { | ||
revert InvalidTime(); | ||
} | ||
} | ||
} |
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,4 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import "@poolzfinance/collateral-provider/contracts/CollateralProvider.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import "@poolzfinance/refund-provider/contracts/RefundProvider.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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ const config: HardhatUserConfig = { | |
enabled: true, | ||
runs: 200, | ||
}, | ||
viaIR: true, | ||
}, | ||
}, | ||
], | ||
|
Oops, something went wrong.