teether
teether copied to clipboard
Usage instructions are slightly defective (at README.md)
Hi,
The extract code commands don't work:
(base) mojtabaeshghie@mojtabaeshghie-mbp teether % python bin/extract_contract_code.py test.code > test.contract.code
WARNING:root:No CODECOPY in this contract!!
Traceback (most recent call last):
File "bin/extract_contract_code.py", line 48, in <module>
contract = extract_contract_code(code)
File "bin/extract_contract_code.py", line 18, in extract_contract_code
p.cfg.trim()
File "/Users/mojtabaeshghie/.pyenv/versions/3.8.13/lib/python3.8/site-packages/teether-0.1.10-py3.8.egg/teether/project.py", line 45, in cfg
File "/Users/mojtabaeshghie/.pyenv/versions/3.8.13/lib/python3.8/site-packages/teether-0.1.10-py3.8.egg/teether/cfg/cfg.py", line 12, in __init__
KeyError: 0
My contract source is:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Test {
struct Transaction {
address to;
uint amount;
}
mapping(bytes32 => Transaction) transactions;
address owner;
constructor() {
owner = msg.sender;
}
function setOwner(address newOwner) public {
owner = newOwner;
}
function newTransaction(address to, uint amount) public returns (bytes32) {
bytes32 token = keccak256(abi.encodePacked(to, amount));
Transaction storage t = transactions[token];
t.to = to;
t.amount += amount;
return token;
}
function approve(bytes32 token) public {
require(owner == msg.sender, "Only the owner can approve transactions");
Transaction storage t = transactions[token];
payable(t.to).transfer(t.amount);
delete transactions[token];
}
// Fallback function to receive ether
receive() external payable {}
}