ETH Price: $2,690.83 (-1.98%)

Contract

0x659b68756cF7E8f992bA097a64c9e5553CD7c194
 

Overview

ETH Balance

0.275657386213191246 ETH

Eth Value

$741.75 (@ $2,690.83/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Execute201071342024-06-16 21:47:4771 days ago1718574467IN
0x659b6875...53CD7c194
0 ETH0.000370635.99617542
Execute201071162024-06-16 21:44:1171 days ago1718574251IN
0x659b6875...53CD7c194
0 ETH0.000776184.7950237
Execute192857382024-02-22 21:10:47186 days ago1708636247IN
0x659b6875...53CD7c194
0 ETH0.0037280460.28922204
Execute192853512024-02-22 19:53:11186 days ago1708631591IN
0x659b6875...53CD7c194
0 ETH0.0045258361.45147157
Execute192577082024-02-18 22:41:59190 days ago1708296119IN
0x659b6875...53CD7c194
0 ETH0.0061090524.10347645
Execute191059082024-01-28 15:25:23211 days ago1706455523IN
0x659b6875...53CD7c194
0 ETH0.0017366116.19583578
Execute188869652023-12-28 22:05:47242 days ago1703801147IN
0x659b6875...53CD7c194
0 ETH0.0030809221.82205586
Execute179801352023-08-23 21:36:35369 days ago1692826595IN
0x659b6875...53CD7c194
0 ETH0.0048023438.50435634
Execute179800872023-08-23 21:26:59369 days ago1692826019IN
0x659b6875...53CD7c194
0 ETH0.0075021736.28446642
Execute179800552023-08-23 21:20:23369 days ago1692825623IN
0x659b6875...53CD7c194
0 ETH0.0037920531.98696337
Execute178370592023-08-03 21:10:23389 days ago1691097023IN
0x659b6875...53CD7c194
0 ETH0.0036998327.35026053
Execute177415212023-07-21 12:29:47402 days ago1689942587IN
0x659b6875...53CD7c194
0 ETH0.0030864321.64935134
Execute169177442023-03-27 9:11:35518 days ago1679908295IN
0x659b6875...53CD7c194
0 ETH0.0028570620.03976341
Execute166987402023-02-24 14:19:11549 days ago1677248351IN
0x659b6875...53CD7c194
0 ETH0.0049289427.89097831
Execute166942452023-02-23 23:05:47550 days ago1677193547IN
0x659b6875...53CD7c194
0 ETH0.0051196936.47516711
Execute166942422023-02-23 23:05:11550 days ago1677193511IN
0x659b6875...53CD7c194
0 ETH0.0095163437.77075243
Execute166773902023-02-21 14:11:47552 days ago1676988707IN
0x659b6875...53CD7c194
0 ETH0.0034444667.92884689
Execute163894692023-01-12 8:15:59592 days ago1673511359IN
0x659b6875...53CD7c194
0 ETH0.0012646518.01189604
Execute163712292023-01-09 19:06:59595 days ago1673291219IN
0x659b6875...53CD7c194
0 ETH0.0019404529.89958779
Execute163712262023-01-09 19:06:23595 days ago1673291183IN
0x659b6875...53CD7c194
0 ETH0.0041726327.96033762
Execute163141002023-01-01 19:46:47603 days ago1672602407IN
0x659b6875...53CD7c194
0 ETH0.0013510316.56355637
Execute163140892023-01-01 19:44:35603 days ago1672602275IN
0x659b6875...53CD7c194
0 ETH0.0030347917.12674375
Execute162143902022-12-18 21:53:11617 days ago1671400391IN
0x659b6875...53CD7c194
0 ETH0.0006815413.4408754
Execute161888162022-12-15 8:11:23620 days ago1671091883IN
0x659b6875...53CD7c194
0 ETH0.0008208814.18050012
Execute161888132022-12-15 8:10:47620 days ago1671091847IN
0x659b6875...53CD7c194
0 ETH0.0025006714.44867564
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
201071162024-06-16 21:44:1171 days ago1718574251
0x659b6875...53CD7c194
0.27565738 ETH
166773902023-02-21 14:11:47552 days ago1676988707
0x659b6875...53CD7c194
0.01 ETH
163712262023-01-09 19:06:23595 days ago1673291183
0x659b6875...53CD7c194
0.83170996 ETH
163140892023-01-01 19:44:35603 days ago1672602275
0x659b6875...53CD7c194
0.00397431 ETH
163140892023-01-01 19:44:35603 days ago1672602275
0x659b6875...53CD7c194
0.79883747 ETH
162143902022-12-18 21:53:11617 days ago1671400391
0x659b6875...53CD7c194
0.06 ETH
161888132022-12-15 8:10:47620 days ago1671091847
0x659b6875...53CD7c194
1.69125928 ETH
159497512022-11-11 22:27:35654 days ago1668205655
0x659b6875...53CD7c194
1.66833445 ETH
159425822022-11-10 22:24:11655 days ago1668119051
0x659b6875...53CD7c194
1.6736483 ETH
159312792022-11-09 8:27:47656 days ago1667982467
0x659b6875...53CD7c194
1.73839223 ETH
159312692022-11-09 8:25:47656 days ago1667982347
0x659b6875...53CD7c194
1.73733863 ETH
148813432022-05-31 22:43:03818 days ago1654036983
0x659b6875...53CD7c194
0.01431892 ETH
148730612022-05-30 14:29:33819 days ago1653920973
0x659b6875...53CD7c194
0.0094597 ETH
148730192022-05-30 14:20:36819 days ago1653920436
0x659b6875...53CD7c194
0.00821057 ETH
147736222022-05-14 12:30:23835 days ago1652531423
0x659b6875...53CD7c194
0.09714676 ETH
147034152022-05-03 7:47:51846 days ago1651564071
0x659b6875...53CD7c194
0.01069575 ETH
144434172022-03-23 15:41:15887 days ago1648050075
0x659b6875...53CD7c194
0.00481564 ETH
144302622022-03-21 14:35:31889 days ago1647873331
0x659b6875...53CD7c194
0.00751024 ETH
143875472022-03-14 22:51:43896 days ago1647298303
0x659b6875...53CD7c194
0.00922071 ETH
143414642022-03-07 18:58:11903 days ago1646679491
0x659b6875...53CD7c194
0.00976185 ETH
143414642022-03-07 18:58:11903 days ago1646679491
0x659b6875...53CD7c194
0.04360393 ETH
143399792022-03-07 13:31:52903 days ago1646659912
0x659b6875...53CD7c194
0.00410757 ETH
142958042022-02-28 16:46:46910 days ago1646066806
0x659b6875...53CD7c194
0.00964099 ETH
142137242022-02-15 23:34:01923 days ago1644968041
0x659b6875...53CD7c194
0.02187625 ETH
139490212022-01-06 1:40:24964 days ago1641433224
0x659b6875...53CD7c194
0.01382496 ETH
View All Internal Transactions
Loading...
Loading

Minimal Proxy Contract for 0x2a2b85eb1054d6f0c6c2e37da05ed3e5fea684ef

Contract Name:
Identity

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
/**
 *Submitted for verification at Etherscan.io on 2021-11-14
*/

pragma solidity 0.8.7;

// @TODO: Formatting
library LibBytes {
  // @TODO: see if we can just set .length = 
  function trimToSize(bytes memory b, uint newLen)
    internal
    pure
  {
    require(b.length > newLen, "BytesLib: only shrinking");
    assembly {
      mstore(b, newLen)
    }
  }


  /***********************************|
  |        Read Bytes Functions       |
  |__________________________________*/

  /**
   * @dev Reads a bytes32 value from a position in a byte array.
   * @param b Byte array containing a bytes32 value.
   * @param index Index in byte array of bytes32 value.
   * @return result bytes32 value from byte array.
   */
  function readBytes32(
    bytes memory b,
    uint256 index
  )
    internal
    pure
    returns (bytes32 result)
  {
    // Arrays are prefixed by a 256 bit length parameter
    index += 32;

    require(b.length >= index, "BytesLib: length");

    // Read the bytes32 from array memory
    assembly {
      result := mload(add(b, index))
    }
    return result;
  }
}



interface IERC1271Wallet {
	function isValidSignature(bytes32 hash, bytes calldata signature) external view returns (bytes4 magicValue);
}

library SignatureValidator {
	using LibBytes for bytes;

	enum SignatureMode {
		EIP712,
		EthSign,
		SmartWallet,
		Spoof
	}

	// bytes4(keccak256("isValidSignature(bytes32,bytes)"))
	bytes4 constant internal ERC1271_MAGICVALUE_BYTES32 = 0x1626ba7e;

	function recoverAddr(bytes32 hash, bytes memory sig) internal view returns (address) {
		return recoverAddrImpl(hash, sig, false);
	}

	function recoverAddrImpl(bytes32 hash, bytes memory sig, bool allowSpoofing) internal view returns (address) {
		require(sig.length >= 1, "SV_SIGLEN");
		uint8 modeRaw;
		unchecked { modeRaw = uint8(sig[sig.length - 1]); }
		SignatureMode mode = SignatureMode(modeRaw);

		// {r}{s}{v}{mode}
		if (mode == SignatureMode.EIP712 || mode == SignatureMode.EthSign) {
			require(sig.length == 66, "SV_LEN");
			bytes32 r = sig.readBytes32(0);
			bytes32 s = sig.readBytes32(32);
			uint8 v = uint8(sig[64]);
			// Hesitant about this check: seems like this is something that has no business being checked on-chain
			require(v == 27 || v == 28, "SV_INVALID_V");
			if (mode == SignatureMode.EthSign) hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
			address signer = ecrecover(hash, v, r, s);
			require(signer != address(0), "SV_ZERO_SIG");
			return signer;
		// {sig}{verifier}{mode}
		} else if (mode == SignatureMode.SmartWallet) {
			// 32 bytes for the addr, 1 byte for the type = 33
			require(sig.length > 33, "SV_LEN_WALLET");
			uint newLen;
			unchecked {
				newLen = sig.length - 33;
			}
			IERC1271Wallet wallet = IERC1271Wallet(address(uint160(uint256(sig.readBytes32(newLen)))));
			sig.trimToSize(newLen);
			require(ERC1271_MAGICVALUE_BYTES32 == wallet.isValidSignature(hash, sig), "SV_WALLET_INVALID");
			return address(wallet);
		// {address}{mode}; the spoof mode is used when simulating calls
		} else if (mode == SignatureMode.Spoof && allowSpoofing) {
			require(tx.origin == address(1), "SV_SPOOF_ORIGIN");
			require(sig.length == 33, "SV_SPOOF_LEN");
			sig.trimToSize(32);
			return abi.decode(sig, (address));
		} else revert("SV_SIGMODE");
	}
}


contract Identity {
	mapping (address => bytes32) public privileges;
	// The next allowed nonce
	uint public nonce;

	// Events
	event LogPrivilegeChanged(address indexed addr, bytes32 priv);
	event LogErr(address indexed to, uint value, bytes data, bytes returnData); // only used in tryCatch

	// Transaction structure
	// we handle replay protection separately by requiring (address(this), chainID, nonce) as part of the sig
	struct Transaction {
		address to;
		uint value;
		bytes data;
	}

	constructor(address[] memory addrs) {
		uint len = addrs.length;
		for (uint i=0; i<len; i++) {
			// @TODO should we allow setting to any arb value here?
			privileges[addrs[i]] = bytes32(uint(1));
			emit LogPrivilegeChanged(addrs[i], bytes32(uint(1)));
		}
	}

	// This contract can accept ETH without calldata
	receive() external payable {}

	// This contract can accept ETH with calldata
	// However, to support EIP 721 and EIP 1155, we need to respond to those methods with their own method signature
	fallback() external payable {
		bytes4 method = msg.sig;
		if (
			method == 0x150b7a02 // bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))
				|| method == 0xf23a6e61 // bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))
				|| method == 0xbc197c81 // bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))
		) {
			// Copy back the method
			// solhint-disable-next-line no-inline-assembly
			assembly {
				calldatacopy(0, 0, 0x04)
				return (0, 0x20)
			}
		}
	}

	function setAddrPrivilege(address addr, bytes32 priv)
		external
	{
		require(msg.sender == address(this), 'ONLY_IDENTITY_CAN_CALL');
		// Anti-bricking measure: if the privileges slot is used for special data (not 0x01),
		// don't allow to set it to true
		if (uint(privileges[addr]) > 1) require(priv != bytes32(uint(1)), 'UNSETTING_SPECIAL_DATA');
		privileges[addr] = priv;
		emit LogPrivilegeChanged(addr, priv);
	}

	function tipMiner(uint amount)
		external
	{
		require(msg.sender == address(this), 'ONLY_IDENTITY_CAN_CALL');
		// See https://docs.flashbots.net/flashbots-auction/searchers/advanced/coinbase-payment/#managing-payments-to-coinbaseaddress-when-it-is-a-contract
		// generally this contract is reentrancy proof cause of the nonce
		executeCall(block.coinbase, amount, new bytes(0));
	}

	function tryCatch(address to, uint value, bytes calldata data)
		external
	{
		require(msg.sender == address(this), 'ONLY_IDENTITY_CAN_CALL');
		(bool success, bytes memory returnData) = to.call{value: value, gas: gasleft()}(data);
		if (!success) emit LogErr(to, value, data, returnData);
	}


	// WARNING: if the signature of this is changed, we have to change IdentityFactory
	function execute(Transaction[] calldata txns, bytes calldata signature)
		external
	{
		require(txns.length > 0, 'MUST_PASS_TX');
		uint currentNonce = nonce;
		// NOTE: abi.encode is safer than abi.encodePacked in terms of collision safety
		bytes32 hash = keccak256(abi.encode(address(this), block.chainid, currentNonce, txns));
		// We have to increment before execution cause it protects from reentrancies
		nonce = currentNonce + 1;

		address signer = SignatureValidator.recoverAddrImpl(hash, signature, true);
		require(privileges[signer] != bytes32(0), 'INSUFFICIENT_PRIVILEGE');
		uint len = txns.length;
		for (uint i=0; i<len; i++) {
			Transaction memory txn = txns[i];
			executeCall(txn.to, txn.value, txn.data);
		}
		// The actual anti-bricking mechanism - do not allow a signer to drop their own priviledges
		require(privileges[signer] != bytes32(0), 'PRIVILEGE_NOT_DOWNGRADED');
	}

	// no need for nonce management here cause we're not dealing with sigs
	function executeBySender(Transaction[] calldata txns) external {
		require(txns.length > 0, 'MUST_PASS_TX');
		require(privileges[msg.sender] != bytes32(0), 'INSUFFICIENT_PRIVILEGE');
		uint len = txns.length;
		for (uint i=0; i<len; i++) {
			Transaction memory txn = txns[i];
			executeCall(txn.to, txn.value, txn.data);
		}
		// again, anti-bricking
		require(privileges[msg.sender] != bytes32(0), 'PRIVILEGE_NOT_DOWNGRADED');
	}

	function executeBySelf(Transaction[] calldata txns) external {
		require(msg.sender == address(this), 'ONLY_IDENTITY_CAN_CALL');
		require(txns.length > 0, 'MUST_PASS_TX');
		uint len = txns.length;
		for (uint i=0; i<len; i++) {
			Transaction memory txn = txns[i];
			executeCall(txn.to, txn.value, txn.data);
		}
	}

	// we shouldn't use address.call(), cause: https://github.com/ethereum/solidity/issues/2884
	// copied from https://github.com/uport-project/uport-identity/blob/develop/contracts/Proxy.sol
	// there's also
	// https://github.com/gnosis/MultiSigWallet/commit/e1b25e8632ca28e9e9e09c81bd20bf33fdb405ce
	// https://github.com/austintgriffith/bouncer-proxy/blob/master/BouncerProxy/BouncerProxy.sol
	// https://github.com/gnosis/safe-contracts/blob/7e2eeb3328bb2ae85c36bc11ea6afc14baeb663c/contracts/base/Executor.sol
	function executeCall(address to, uint256 value, bytes memory data)
		internal
	{
		assembly {
			let result := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0)

			switch result case 0 {
				let size := returndatasize()
				let ptr := mload(0x40)
				returndatacopy(ptr, 0, size)
				revert(ptr, size)
			}
			default {}
		}
		// A single call consumes around 477 more gas with the pure solidity version, for whatever reason
		// WARNING: do not use this, it corrupts the returnData string (returns it in a slightly different format)
		//(bool success, bytes memory returnData) = to.call{value: value, gas: gasleft()}(data);
		//if (!success) revert(string(data));
	}

	// EIP 1271 implementation
	// see https://eips.ethereum.org/EIPS/eip-1271
	function isValidSignature(bytes32 hash, bytes calldata signature) external view returns (bytes4) {
		if (privileges[SignatureValidator.recoverAddr(hash, signature)] != bytes32(0)) {
			// bytes4(keccak256("isValidSignature(bytes32,bytes)")
			return 0x1626ba7e;
		} else {
			return 0xffffffff;
		}
	}

	// EIP 1155 implementation
	// we pretty much only need to signal that we support the interface for 165, but for 1155 we also need the fallback function
	function supportsInterface(bytes4 interfaceID) external pure returns (bool) {
		return
			interfaceID == 0x01ffc9a7 ||    // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).
			interfaceID == 0x4e2312e0;      // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) ^ bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`).
	}
}

Contract ABI

[{"inputs":[{"internalType":"address[]","name":"addrs","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"returnData","type":"bytes"}],"name":"LogErr","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"bytes32","name":"priv","type":"bytes32"}],"name":"LogPrivilegeChanged","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Identity.Transaction[]","name":"txns","type":"tuple[]"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Identity.Transaction[]","name":"txns","type":"tuple[]"}],"name":"executeBySelf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Identity.Transaction[]","name":"txns","type":"tuple[]"}],"name":"executeBySender","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"privileges","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bytes32","name":"priv","type":"bytes32"}],"name":"setAddrPrivilege","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"tipMiner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"tryCatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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.