I hereby claim:
- I am tomiohl on github.
- I am tomi_ohl (https://keybase.io/tomi_ohl) on keybase.
- I have a public key ASCWqP1y1QIRqknZOl6ZaPet89RAPhIj1o1W-bS_iR0rugo
To claim this, I am signing this object:
// eslint-disable-next-line import/no-extraneous-dependencies, node/no-extraneous-import | |
import axios from "axios"; | |
import { ethers } from "hardhat"; | |
const payloads = [ | |
{ | |
jsonrpc: "2.0", | |
id: 2, | |
method: "eth_chainId", | |
params: [] |
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.4; | |
// Testing the gas cost of two identical functions with array parameters supplied in different data locations | |
// Costs only apply when called from another contract function | |
contract ArrayParameterTest { | |
// Transaction cost 22978 gas (length 1), 28639 gas (length 10), 85249 gas (length 100) | |
// Execution cost 1130 gas (length 1), 5063 gas (length 10), 44393 gas (length 100) | |
function addNumbersFromCalldata(uint256[] calldata numbers) external pure returns (uint256) { | |
uint256 sum; |
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.4; | |
// A simple contract to test the differences of gas usage between accessing a storage variable and using a return value of a function. | |
// Result: more than 2000 less gass consumed by getFromInline() and getFromImmutable() than getFromStorage() (if called in a transaction). | |
// Conclusion: it's better not to use storage variables for constants. | |
contract StorageVsFunctionTest { | |
address internal uniAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; | |
address internal immutable uniAddressImmutable; |
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.4; | |
interface IUniSwapRouter02 { | |
function WETH() external pure returns (address); | |
} | |
contract ExternalPureTest { | |
address internal uniAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; | |
address public addr = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; |
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.4; | |
interface IERC20 { | |
function decimals() external view returns (uint8); | |
} | |
contract DecimalsTest { | |
function changeDecimals(address _fromToken, address _desToken, uint _amount) external view returns (uint) { |
I hereby claim:
To claim this, I am signing this object:
A timelock is used in smart contracts as a way to restrict the spending of some tokens until a specified future time or block number.
Some solutions to the problem are described below, from the most primitive to the best we came up with. Note that the term expiration time is used, but it can also refer to block numbers.