Skip to content

Instantly share code, notes, and snippets.

"TypeError: Illegal invocation
at Proxy.<anonymous> (chrome-extension://fiehkmibgflegdmkikebaapmcblepmgm/background.js:27800:29)
at eval (eval at <anonymous> (eval at createScopedEvaluatorFactory (chrome-extension://fiehkmibgflegdmkikebaapmcblepmgm/background.js:354494:12)), <anonymous>:798:209428)
at new Promise (<anonymous>)
at c.S [as constructor] (eval at <anonymous> (eval at createScopedEvaluatorFactory (chrome-extension://fiehkmibgflegdmkikebaapmcblepmgm/background.js:354494:12)), <anonymous>:798:209402)
at new c (eval at <anonymous> (eval at createScopedEvaluatorFactory (chrome-extension://fiehkmibgflegdmkikebaapmcblepmgm/background.js:354494:12)), <anonymous>:798:210951)
at addAccount (eval at <anonymous> (eval at createScopedEvaluatorFactory (chrome-extension://fiehkmibgflegdmkikebaapmcblepmgm/background.js:354494:12)), <anonymous>:41:18)
at eval (eval at <anonymous> (eval at createScopedEvaluatorFactory (chrome-extension://fiehkmibgflegdmkikebaapmcblepmgm/background.js:35
@tommyz7
tommyz7 / predict_address.py
Created January 20, 2019 16:14
Predict an address of newly deployed smart contract
import rlp
from eth_utils import keccak, to_checksum_address, to_bytes
def predict_address(sender: str, nonce: int) -> str:
sender_bytes = to_bytes(hexstr=sender)
raw = rlp.encode([sender_bytes, nonce])
h = keccak(raw)
address_bytes = h[12:]
return to_checksum_address(address_bytes)
@tommyz7
tommyz7 / README.md
Created December 28, 2018 17:40
Simple documentation reference for ERC1404 & R-Token

ERC1404 Security Token

Implementation of Regulated Token Standard (R-Token) and ERC 1404 with Regulator Service and Service Registry

RegulatedTokenERC1404

It's ERC20 compatible token. It will work with any wallet that can interact with ERC20 standard.

RegulatorService

Stores permissions for the token. It has similar features to whitelist. Features:

1. Lock the token (disallow all transfers) - in case of emergency or needed transfer freeze to calculate dividents

@tommyz7
tommyz7 / ProxyFactory.sol
Created November 19, 2018 13:02 — forked from GNSPS/ProxyFactory.sol
Improved `delegatecall` proxy contract factory (Solidity) [v0.0.5]
/***
* Shoutouts:
*
* Bytecode origin https://www.reddit.com/r/ethereum/comments/6ic49q/any_assembly_programmers_willing_to_write_a/dj5ceuw/
* Modified version of Vitalik's https://www.reddit.com/r/ethereum/comments/6c1jui/delegatecall_forwarders_how_to_save_5098_on/
* Credits to Jorge Izquierdo (@izqui) for coming up with this design here: https://gist.github.com/izqui/7f904443e6d19c1ab52ec7f5ad46b3a8
* Credits to Stefan George (@Georgi87) for inspiration for many of the improvements from Gnosis Safe: https://github.com/gnosis/gnosis-safe-contracts
*
* This version has many improvements over the original @izqui's library like using REVERT instead of THROWing on failed calls.
* It also implements the awesome design pattern for initializing code as seen in Gnosis Safe Factory: https://github.com/gnosis/gnosis-safe-contracts/blob/master/contracts/ProxyFactory.sol
@tommyz7
tommyz7 / forwarder.sol
Created November 19, 2018 13:00 — forked from izqui/forwarder.sol
Very cheap to deploy (66k gas) forwarder contracts that can clone any contract and still have their own storage
// Bytecode origin https://www.reddit.com/r/ethereum/comments/6ic49q/any_assembly_programmers_willing_to_write_a/dj5ceuw/
// Modified version of Vitalik's https://www.reddit.com/r/ethereum/comments/6c1jui/delegatecall_forwarders_how_to_save_5098_on/
// Credits to Jordi Baylina for this way of deploying contracts https://gist.github.com/jbaylina/e8ac19b8e7478fd10cf0363ad1a5a4b3
// Forwarder is slightly modified to only return 256 bytes (8 normal returns)
// Deployed Factory in Kovan: https://kovan.etherscan.io/address/0xaebc118657099e2110c90494f48b3d21329b23eb
// Example of a Forwarder deploy using the Factory: https://kovan.etherscan.io/tx/0xe995dd023c8336685cb819313d933ae8938009f9c8c0e1af6c57b8be06986957
// Just 66349 gas per contract

Answers to Deep Questions about Solidity

The following list of questions was taken from https://www.reddit.com/r/ethereum/comments/72reba/do_you_have_deep_questions_about_solidity_or_the/

An updated summary on the different ways one could have two contracts interact (DELEGATECALL, STATICCALL, libraries, all that stuff) with clear pros/cons for each (gas cost, whether it requires EVM assembly directives, etc)

Question by /u/drcode

I won't talk about low-level opcodes here because of the brevity of the answer. In general, there are four ways functions can be called in Solidity: