This file contains hidden or 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
// In https://solidity-by-example.org/sending-ether/ | |
// They say: call in combination with re-entrancy guard is the recommended method to use after December 2019. | |
// (see https://consensys.github.io/smart-contract-best-practices/recommendations/#dont-use-transfer-or-send for an explanation) | |
// and compare the gas fees of the 3 methods: | |
// transfer (2300 gas, throws error) | |
// send (2300 gas, returns bool) | |
// call (forward all gas or set gas, returns bool) | |
// I tested all 3 methods, by sending 10 eth to a contract and then withdrawing using these functions: |
This file contains hidden or 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
// hardhat task | |
task('blockTimestamp', 'Prints the block timestamp', async (_, { ethers }) => { | |
const currentBlock = await ethers.provider.getBlockNumber(); | |
const blockTimestamp = (await ethers.provider.getBlock(currentBlock)).timestamp; | |
console.log(blockTimestamp); | |
const date = new Date(blockTimestamp * 1000); // Date requires ms, whereas block.timestamp is in s | |
console.log(date) | |
}); |
This file contains hidden or 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
import { Layout, plot, Plot } from 'nodeplotlib'; | |
import { readFileSync } from 'fs'; | |
(async () => { | |
let readVal = readFileSync('eips.json', { | |
encoding: "utf-8" | |
}); | |
const eips = JSON.parse(readVal); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder