forked from Uniswap/v3-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NoDelegateCallTest.sol
32 lines (25 loc) · 954 Bytes
/
NoDelegateCallTest.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
import '../NoDelegateCall.sol';
contract NoDelegateCallTest is NoDelegateCall {
function canBeDelegateCalled() public view returns (uint256) {
return block.timestamp / 5;
}
function cannotBeDelegateCalled() public view noDelegateCall returns (uint256) {
return block.timestamp / 5;
}
function getGasCostOfCanBeDelegateCalled() external view returns (uint256) {
uint256 gasBefore = gasleft();
canBeDelegateCalled();
return gasBefore - gasleft();
}
function getGasCostOfCannotBeDelegateCalled() external view returns (uint256) {
uint256 gasBefore = gasleft();
cannotBeDelegateCalled();
return gasBefore - gasleft();
}
function callsIntoNoDelegateCallFunction() external view {
noDelegateCallPrivate();
}
function noDelegateCallPrivate() private view noDelegateCall {}
}