Adjust for chainid becoming view in 0.8.0. (#2443)

Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>

Co-authored-by: Daniel Kirchner <daniel@ekpyron.org>
pull/2440/head
Alex Beregszaszi 4 years ago committed by GitHub
parent 6be0b410dc
commit a6a4c042f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      contracts/drafts/EIP712.sol
  2. 3
      contracts/mocks/EIP712External.sol
  3. 3
      contracts/mocks/ERC20PermitMock.sol

@ -96,7 +96,8 @@ abstract contract EIP712 {
return keccak256(abi.encodePacked("\x19\x01", _domainSeparatorV4(), structHash));
}
function _getChainId() private pure returns (uint256 chainId) {
function _getChainId() private view returns (uint256 chainId) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
// solhint-disable-next-line no-inline-assembly
assembly {
chainId := chainid()

@ -22,7 +22,8 @@ contract EIP712External is EIP712 {
require(recoveredSigner == signer);
}
function getChainId() external pure returns (uint256 chainId) {
function getChainId() external view returns (uint256 chainId) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
// solhint-disable-next-line no-inline-assembly
assembly {
chainId := chainid()

@ -14,7 +14,8 @@ contract ERC20PermitMock is ERC20Permit {
_mint(initialAccount, initialBalance);
}
function getChainId() external pure returns (uint256 chainId) {
function getChainId() external view returns (uint256 chainId) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
// solhint-disable-next-line no-inline-assembly
assembly {
chainId := chainid()

Loading…
Cancel
Save