Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
There are no matching entriesUpdate your filters to view other transactions | |||||||||
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
CreateAndAddModules
Compiler Version
v0.5.0+commit.1d4f565a
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion, Audited
Contract Source Code (Solidity)Audit Report
/**
*Submitted for verification at Etherscan.io on 2019-03-28
*/
pragma solidity ^0.5.0;
contract Enum {
enum Operation {
Call,
DelegateCall,
Create
}
}
contract EtherPaymentFallback {
/// @dev Fallback function accepts Ether transactions.
function ()
external
payable
{
}
}
contract Executor is EtherPaymentFallback {
event ContractCreation(address newContract);
function execute(address to, uint256 value, bytes memory data, Enum.Operation operation, uint256 txGas)
internal
returns (bool success)
{
if (operation == Enum.Operation.Call)
success = executeCall(to, value, data, txGas);
else if (operation == Enum.Operation.DelegateCall)
success = executeDelegateCall(to, data, txGas);
else {
address newContract = executeCreate(data);
success = newContract != address(0);
emit ContractCreation(newContract);
}
}
function executeCall(address to, uint256 value, bytes memory data, uint256 txGas)
internal
returns (bool success)
{
// solium-disable-next-line security/no-inline-assembly
assembly {
success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)
}
}
function executeDelegateCall(address to, bytes memory data, uint256 txGas)
internal
returns (bool success)
{
// solium-disable-next-line security/no-inline-assembly
assembly {
success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)
}
}
function executeCreate(bytes memory data)
internal
returns (address newContract)
{
// solium-disable-next-line security/no-inline-assembly
assembly {
newContract := create(0, add(data, 0x20), mload(data))
}
}
}
contract SelfAuthorized {
modifier authorized() {
require(msg.sender == address(this), "Method can only be called from this contract");
_;
}
}
contract ModuleManager is SelfAuthorized, Executor {
event EnabledModule(Module module);
event DisabledModule(Module module);
address public constant SENTINEL_MODULES = address(0x1);
mapping (address => address) internal modules;
function setupModules(address to, bytes memory data)
internal
{
require(modules[SENTINEL_MODULES] == address(0), "Modules have already been initialized");
modules[SENTINEL_MODULES] = SENTINEL_MODULES;
if (to != address(0))
// Setup has to complete successfully or transaction fails.
require(executeDelegateCall(to, data, gasleft()), "Could not finish initialization");
}
/// @dev Allows to add a module to the whitelist.
/// This can only be done via a Safe transaction.
/// @param module Module to be whitelisted.
function enableModule(Module module)
public
authorized
{
// Module address cannot be null or sentinel.
require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided");
// Module cannot be added twice.
require(modules[address(module)] == address(0), "Module has already been added");
modules[address(module)] = modules[SENTINEL_MODULES];
modules[SENTINEL_MODULES] = address(module);
emit EnabledModule(module);
}
/// @dev Allows to remove a module from the whitelist.
/// This can only be done via a Safe transaction.
/// @param prevModule Module that pointed to the module to be removed in the linked list
/// @param module Module to be removed.
function disableModule(Module prevModule, Module module)
public
authorized
{
// Validate module address and check that it corresponds to module index.
require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided");
require(modules[address(prevModule)] == address(module), "Invalid prevModule, module pair provided");
modules[address(prevModule)] = modules[address(module)];
modules[address(module)] = address(0);
emit DisabledModule(module);
}
/// @dev Allows a Module to execute a Safe transaction without any further confirmations.
/// @param to Destination address of module transaction.
/// @param value Ether value of module transaction.
/// @param data Data payload of module transaction.
/// @param operation Operation type of module transaction.
function execTransactionFromModule(address to, uint256 value, bytes memory data, Enum.Operation operation)
public
returns (bool success)
{
// Only whitelisted modules are allowed.
require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), "Method can only be called from an enabled module");
// Execute transaction without further confirmations.
success = execute(to, value, data, operation, gasleft());
}
/// @dev Returns array of modules.
/// @return Array of modules.
function getModules()
public
view
returns (address[] memory)
{
// Calculate module count
uint256 moduleCount = 0;
address currentModule = modules[SENTINEL_MODULES];
while(currentModule != SENTINEL_MODULES) {
currentModule = modules[currentModule];
moduleCount ++;
}
address[] memory array = new address[](moduleCount);
// populate return array
moduleCount = 0;
currentModule = modules[SENTINEL_MODULES];
while(currentModule != SENTINEL_MODULES) {
array[moduleCount] = currentModule;
currentModule = modules[currentModule];
moduleCount ++;
}
return array;
}
}
contract MasterCopy is SelfAuthorized {
// masterCopy always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.
// It should also always be ensured that the address is stored alone (uses a full word)
address masterCopy;
/// @dev Allows to upgrade the contract. This can only be done via a Safe transaction.
/// @param _masterCopy New contract address.
function changeMasterCopy(address _masterCopy)
public
authorized
{
// Master copy address cannot be null.
require(_masterCopy != address(0), "Invalid master copy address provided");
masterCopy = _masterCopy;
}
}
contract Module is MasterCopy {
ModuleManager public manager;
modifier authorized() {
require(msg.sender == address(manager), "Method can only be called from manager");
_;
}
function setManager()
internal
{
// manager can only be 0 at initalization of contract.
// Check ensures that setup function can only be called once.
require(address(manager) == address(0), "Manager has already been set");
manager = ModuleManager(msg.sender);
}
}
contract CreateAndAddModules {
/// @dev Function required to compile contract. Gnosis Safe function is called instead.
/// @param module Not used.
function enableModule(Module module)
public
{
revert();
}
/// @dev Allows to create and add multiple module in one transaction.
/// @param proxyFactory Module proxy factory contract.
/// @param data Modules constructor payload. This is the data for each proxy factory call concatinated. (e.g. <byte_array_len_1><byte_array_data_1><byte_array_len_2><byte_array_data_2>)
function createAndAddModules(address proxyFactory, bytes memory data)
public
{
uint256 length = data.length;
Module module;
uint256 i = 0;
while (i < length) {
// solium-disable-next-line security/no-inline-assembly
assembly {
let createBytesLength := mload(add(0x20, add(data, i)))
let createBytes := add(0x40, add(data, i))
let output := mload(0x40)
if eq(delegatecall(gas, proxyFactory, createBytes, createBytesLength, output, 0x20), 0) { revert(0, 0) }
module := and(mload(output), 0xffffffffffffffffffffffffffffffffffffffff)
// Data is always padded to 32 bytes
i := add(i, add(0x20, mul(div(add(createBytesLength, 0x1f), 0x20), 0x20)))
}
this.enableModule(module);
}
}
}Contract Security Audit
- Runtime Verification - February 27th, 2020 - Security Audit Report
Contract ABI
API[{"constant":false,"inputs":[{"name":"proxyFactory","type":"address"},{"name":"data","type":"bytes"}],"name":"createAndAddModules","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"module","type":"address"}],"name":"enableModule","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b506102e2806100206000396000f3fe60806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360df7f5814610051578063610b592514610139575b600080fd5b34801561005d57600080fd5b506101376004803603604081101561007457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156100b157600080fd5b8201836020820111156100c357600080fd5b803590602001918460018302840111640100000000831117156100e557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061018a565b005b34801561014557600080fd5b506101886004803603602081101561015c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102b1565b005b600081519050600080600090505b828110156102aa5780840160200151818501604001604051600060208285858c5af414156101c557600080fd5b73ffffffffffffffffffffffffffffffffffffffff8151169450602080601f85010402602001840193505050503073ffffffffffffffffffffffffffffffffffffffff1663610b5925836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561028d57600080fd5b505af11580156102a1573d6000803e3d6000fd5b50505050610198565b5050505050565b600080fdfea165627a7a72305820a7943512efc21328b99b303c8286d1cf65b8862a4e8fdc4fccae06642014b44f0029
Deployed Bytecode
0x60806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360df7f5814610051578063610b592514610139575b600080fd5b34801561005d57600080fd5b506101376004803603604081101561007457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156100b157600080fd5b8201836020820111156100c357600080fd5b803590602001918460018302840111640100000000831117156100e557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061018a565b005b34801561014557600080fd5b506101886004803603602081101561015c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102b1565b005b600081519050600080600090505b828110156102aa5780840160200151818501604001604051600060208285858c5af414156101c557600080fd5b73ffffffffffffffffffffffffffffffffffffffff8151169450602080601f85010402602001840193505050503073ffffffffffffffffffffffffffffffffffffffff1663610b5925836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561028d57600080fd5b505af11580156102a1573d6000803e3d6000fd5b50505050610198565b5050505050565b600080fdfea165627a7a72305820a7943512efc21328b99b303c8286d1cf65b8862a4e8fdc4fccae06642014b44f0029
Swarm Source
bzzr://a7943512efc21328b99b303c8286d1cf65b8862a4e8fdc4fccae06642014b44f
Loading...
Loading
Loading...
Loading
OVERVIEW
Library for creating and adding modules for Gnosis Safe contracts version 1.0.0Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.