infrastructure-upgrade/lib/v3-core/contracts/test/NoDelegateCallTest.sol
T-Hax 735546619e
init
Signed-off-by: T-Hax <>
2023-04-08 18:46:18 +00:00

33 lines
954 B
Solidity

// 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 {}
}