If this codebase is production, handles money, or touches sensitive data: treat this audit loop as a high-risk operation. Run with least privilege, avoid exporting long-lived credentials in your shell, and keep the agent in read-only mode.
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
| 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.
Calling estimateGas will return the gas required by my transaction
Calling 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
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
| 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; |
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
| ;; 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 |
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
| pragma solidity ^0.4.24; | |
| // ---------------------------------------------------------------------------- | |
| // Sample token contract | |
| // | |
| // Symbol : LCST | |
| // Name : LCS Token | |
| // Total supply : 100000 | |
| // Decimals : 2 | |
| // Owner Account : 0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe |
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
| // 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 _ ')' | |
| { |
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
| 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 := [] |
NewerOlder