ETH Price: $3,210.30 (-2.99%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Commit182271322023-09-27 12:35:59483 days ago1695818159IN
0x028E0630...63993cfAd
0 ETH0.0022532714.57259577
Commit182270442023-09-27 12:18:11483 days ago1695817091IN
0x028E0630...63993cfAd
0 ETH0.0023303415.30044395

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CommitUserWeight

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion
File 1 of 3 : CommitUserWeight.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "./interfaces/IZkEvmBridge.sol";
import "./interfaces/IvlCVX.sol";

contract CommitUserWeight {

    bytes4 private constant updateSelector = bytes4(keccak256("updateWeight(address,uint256,uint256)"));
    address public constant vlcvx = address(0x72a19342e8F1838460eBFCCEf09F6585e32db86E);
    address public constant bridge = address(0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe);
    uint256 public constant epochDuration = 86400 * 7;

    function currentEpoch() public view returns (uint256) {
        return block.timestamp/epochDuration*epochDuration;
    }

    function commit(
        address _userAddress,
        address _contractAddr
    ) external  {
        //make sure vlcvx is checkpointed
        IvlCVX(vlcvx).checkpointEpoch();

        //get vlcvx balance
        uint256 balance = IvlCVX(vlcvx).balanceOf(_userAddress);

        //build data
        bytes memory data = abi.encodeWithSelector(updateSelector, _userAddress, currentEpoch(), balance);

        //submit to L2
        uint32 destinationNetwork = 1;
        bool forceUpdateGlobalExitRoot = true;
        IZkEvmBridge(bridge).bridgeMessage{value:0}(
            destinationNetwork,
            _contractAddr,
            forceUpdateGlobalExitRoot,
            data
        );
    }
}

File 2 of 3 : IvlCVX.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

interface IvlCVX{
	function checkpointEpoch() external;
	function epochCount() external view returns(uint256);
	function balanceOf(address _user) view external returns(uint256 amount);
}

File 3 of 3 : IZkEvmBridge.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;


interface IZkEvmBridge{
	function bridgeMessage(
		uint32 destinationNetwork,
		address destinationAddress,
		bool forceUpdateGlobalExitRoot,
		bytes calldata metadata
	) external payable;
}

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "london",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"bridge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"address","name":"_contractAddr","type":"address"}],"name":"commit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vlcvx","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50610454806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80634ff0876a1461005c57806354aa24741461007957806376671808146100ac578063bb82717b146100b4578063e78cea92146100c9575b600080fd5b61006662093a8081565b6040519081526020015b60405180910390f35b6100947372a19342e8f1838460ebfccef09f6585e32db86e81565b6040516001600160a01b039091168152602001610070565b6100666100e4565b6100c76100c2366004610308565b610103565b005b610094732a3dd3eb832af982ec71669e178424b10dca2ede81565b600062093a806100f4814261033b565b6100fe919061035d565b905090565b7372a19342e8f1838460ebfccef09f6585e32db86e6001600160a01b031663c1009f4b6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561015257600080fd5b505af1158015610166573d6000803e3d6000fd5b50506040516370a0823160e01b81526001600160a01b0385166004820152600092507372a19342e8f1838460ebfccef09f6585e32db86e91506370a0823190602401602060405180830381865afa1580156101c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e9919061038a565b905060007f5e523adba96ceba34be167e17cb7b2bc1cf8a259e98ea66217de9fc1e3c80407846102176100e4565b6040516001600160a01b03909216602483015260448201526064810184905260840160408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051630481fe6f60e31b81529091506001908190732a3dd3eb832af982ec71669e178424b10dca2ede9063240ff378906000906102b29085908a9082908a906004016103a3565b6000604051808303818588803b1580156102cb57600080fd5b505af11580156102df573d6000803e3d6000fd5b5050505050505050505050565b80356001600160a01b038116811461030357600080fd5b919050565b6000806040838503121561031b57600080fd5b610324836102ec565b9150610332602084016102ec565b90509250929050565b60008261035857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561038557634e487b7160e01b600052601160045260246000fd5b500290565b60006020828403121561039c57600080fd5b5051919050565b63ffffffff851681526000602060018060a01b03861681840152841515604084015260806060840152835180608085015260005b818110156103f35785810183015185820160a0015282016103d7565b8181111561040557600060a083870101525b50601f01601f19169290920160a001969550505050505056fea264697066735822122033fc330b22cf7ed2d2928c76b02db3cc0dfb675c8f5c815b023b5f5e784383c164736f6c634300080a0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100575760003560e01c80634ff0876a1461005c57806354aa24741461007957806376671808146100ac578063bb82717b146100b4578063e78cea92146100c9575b600080fd5b61006662093a8081565b6040519081526020015b60405180910390f35b6100947372a19342e8f1838460ebfccef09f6585e32db86e81565b6040516001600160a01b039091168152602001610070565b6100666100e4565b6100c76100c2366004610308565b610103565b005b610094732a3dd3eb832af982ec71669e178424b10dca2ede81565b600062093a806100f4814261033b565b6100fe919061035d565b905090565b7372a19342e8f1838460ebfccef09f6585e32db86e6001600160a01b031663c1009f4b6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561015257600080fd5b505af1158015610166573d6000803e3d6000fd5b50506040516370a0823160e01b81526001600160a01b0385166004820152600092507372a19342e8f1838460ebfccef09f6585e32db86e91506370a0823190602401602060405180830381865afa1580156101c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e9919061038a565b905060007f5e523adba96ceba34be167e17cb7b2bc1cf8a259e98ea66217de9fc1e3c80407846102176100e4565b6040516001600160a01b03909216602483015260448201526064810184905260840160408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051630481fe6f60e31b81529091506001908190732a3dd3eb832af982ec71669e178424b10dca2ede9063240ff378906000906102b29085908a9082908a906004016103a3565b6000604051808303818588803b1580156102cb57600080fd5b505af11580156102df573d6000803e3d6000fd5b5050505050505050505050565b80356001600160a01b038116811461030357600080fd5b919050565b6000806040838503121561031b57600080fd5b610324836102ec565b9150610332602084016102ec565b90509250929050565b60008261035857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561038557634e487b7160e01b600052601160045260246000fd5b500290565b60006020828403121561039c57600080fd5b5051919050565b63ffffffff851681526000602060018060a01b03861681840152841515604084015260806060840152835180608085015260005b818110156103f35785810183015185820160a0015282016103d7565b8181111561040557600060a083870101525b50601f01601f19169290920160a001969550505050505056fea264697066735822122033fc330b22cf7ed2d2928c76b02db3cc0dfb675c8f5c815b023b5f5e784383c164736f6c634300080a0033

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  ]

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.