Skip to content

Instantly share code, notes, and snippets.

pragma solidity ^0.5.11;
// THIS CONTRACT HAS INTENTIONAL VULNERABILITY, DO NOT COPY
contract Victim {
mapping (address => uint256) public balances;
function deposit() external payable {
balances[msg.sender] += msg.value;
}
@epheph
epheph / 1-contract.json
Created August 5, 2020 00:45
Solidity Standard Json Input Creating Different Bytecode for ZeroXTrade.sol
{
"language": "Solidity",
"settings": {
"remappings": [
"ROOT=/home/achapman/augur/packages/augur-core/src/contracts//"
],
"optimizer": {
"enabled": true,
"runs": 200,
"details": {
function getPrice(
IUniswapV2Pair uniswapV2Pair,
address denominationToken,
uint8 minBlocksBack,
uint8 maxBlocksBack,
ProofData memory proofData)
public view
returns (
// NOTE: Non-functional pseudo code
function verifyBlock(parentBlock, stateRoot, blockNumber, timestamp, ...) returns (bool) {
bytes32 _realBlockHash = blockhash(blockNumber);
bytes32 _proposedBlockHash = keccek256(rlpEncode(parentBlock, stateRoot, blockNumber, timestamp, ...));
return _proposedBlockHash == _realBlockHash;
}
contract UniswapV2Pair {
// Contract Storage Variables:
uint public price0CumulativeLast;
uint public price1CumulativeLast;
...
// The only place these storage variables are updated:
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
uint32 timeElapsed = blockTimestamp - blockTimestampLast;
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
@epheph
epheph / gist:df4258e8b7a6abc02b4a8eafc36cbf80
Created July 26, 2019 17:24
How Uniswap Liquidity affects Price at Volume
| | 1,000 | 10,000 | 100,000 |
|-----|--------|--------|---------|
| 1 | 100.40 | 100.31 | 100.30 |
| 10 | 101.31 | 100.40 | 100.31 |
| 100 | 111.45 | 101.31 | 100.40 |
| 250 | 133.73 | 102.87 | 100.55 |
publicCreateOrder sent: 0xaac996a6d53b2b78052c7c1f6031effcf13aca82f2edef78c265d65dba522086 {"shares":"0.001","price":"750"}
publicCreateOrder sent: 0x87de6f37af6b0df052b1c123cf96a74f29bf2470e585478d1f481594c61b2a4d {"shares":"0.001","price":"500"}
publicCreateOrder sent: 0xfd75d88050d8c00e434630fec5b45d9594e8afa3eba87fd28e8a007d4e314dfe {"shares":"0.001","price":"1000"}
publicCreateOrder success: null {"shares":"0.15","price":"0.1"}
publicCreateOrder success: null {"shares":"0.2","price":"0.12"}
transaction failed: { callReturn: null,
blockHash: '0xcb4a9a25561f7df8ddf5842438e0a110cbc57ac63a8869ea17cf03d537ed88e4',
blockNumber: '0x141',
from: '0x913da4198e6be1d5f5e4a40d0667f70c0b5430eb',
gas: '0x5b8d80',
0xac30a9b6fba02b9c0bc457b68236f09456cb9367
Cmnd_Alias SHELLS = /bin/bash, /bin/csh, /bin/sh, /bin/tcsh
Cmnd_Alias SU = /bin/su
maghis ALL = NOPASSWD:ALL, !SU, !SHELLS
francesco ALL = NOPASSWD:ALL, !SU, !SHELLS
luca ALL = NOPASSWD:ALL, !SU, !SHELLS
#!/bin/sh
# -*- mode: Python -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at