Install Hardhat
npm install --save-dev hardhat
Initiate a new Hardhat project (in empty directory)
npx hardhat
pragma solidity ^0.7.0; | |
// Each mining pool that intends to provide flash loans deploys a Loaner contract and transfers ETH to it | |
// When testing each bundle, the diff in balance in this contract is taking into account for calculating effective gas price | |
// The contract loans funds only on blocks mined by the miner and on zero-gasprice txs | |
contract Loaner { | |
address immutable owner; | |
constructor(address _owner) { | |
owner = _owner; |
I recently stumbled upon Falsehoods programmers believe about time zones, which got a good laugh out of me. It reminded me of other great lists of falsehoods, such as about names or time, and made me look for an equivalent for Ethereum. Having found none, here is my humble contribution to this set.
estimateGas
will return the gas required by my transactionCalling estimateGas
will return the gas that your transaction would require if it were mined now. The current state of the chain may be very different to the state in which your tx will get mined. So when your tx i
export async function tryGetRevertReason(to: string, from: string, data: string): Promise<string | undefined> { | |
const provider = ethers.getDefaultProvider(); | |
const tx = { to, from, data }; | |
try { | |
await provider.estimateGas(tx); | |
} catch { | |
const value = await provider.call(tx); | |
return hexDataLength(value) % 32 === 4 && hexDataSlice(value, 0, 4) === '0x08c379a0' | |
? defaultAbiCoder.decode(['string'], hexDataSlice(value, 4)) | |
: undefined; |
;; overflow checking words vs. checking explicit bounds | |
;; x * y / y == x <==> | |
;; x * y does not overflow | |
;; max value of (_ BitVec 256) | |
(define-fun pow256 () Int | |
115792089237316195423570985008687907853269984665640564039457584007913129639936) | |
;; x * y / y == x |
pragma solidity ^0.4.24; | |
// ---------------------------------------------------------------------------- | |
// Sample token contract | |
// | |
// Symbol : LCST | |
// Name : LCS Token | |
// Total supply : 100000 | |
// Decimals : 2 | |
// Owner Account : 0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe |
// Grammar for parsing of the Fabric Endorsment Policies | |
// | |
// Defined in the documentation at | |
// https://hyperledger-fabric.readthedocs.io/en/latest/endorsement-policies.html#endorsement-policy-syntax | |
// The expression will be an operator with arguments, each of the arguments can be an expression | |
// The OutOf operator is a bit different as that demands the first agument be a number | |
Expression | |
= op:Operator '(' _ args:Some_Expression_Args _ ')' | |
{ |
behaviour init of Token | |
interface constructor(string _symbol, string _name, string _version, uint _totalSupply) | |
creates Token | |
string name := _name | |
string symbol := _symbol | |
uint256 totalSupply := _totalSupply | |
mapping(address => uint) balanceOf := [CALLER := _totalSupply] | |
mapping(address=>mapping(address=>uint)) allowance := [] |
You should not use the Open SSH client that comes with Git for Windows. Instead, Windows 10 has its own implementation of Open SSH that is integrated with the system. To achieve this:
ssh-agent
from Windows Services:Services
in the Start Menu
or Win+R
and then type services.msc
to launch the Services window;OpenSSH Authentication Agent
in the list and double click on it;OpenSSH Authentication Agent Properties
window that appears, choose Automatic
from the Startup type:
dropdown and click Start
from Service status:
. Make sure it now says Service status: Running
.git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe