ETH Price: $2,092.48 (-0.63%)
Gas: 0.03 Gwei

Contract

0x1b70Ff1e5152FDb8425A2B84b098DF2F9C1DF54E
 

Overview

ETH Balance

8 wei

Eth Value

Less Than $0.01 (@ $2,092.48/ETH)

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Age:90D
Reset Filter

Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Age:90D
Reset Filter

Advanced mode:
Parent Transaction Hash Method Block
From
To

There are no matching entries

Update your filters to view other transactions

View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DepositBridge

Compiler Version
v0.8.21+commit.d9974bed

Optimization Enabled:
Yes with 10 runs

Other Settings:
shanghai EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import {IStoneVault} from "../interfaces/IStoneVault.sol";
import {IStone} from "../interfaces/IStone.sol";

import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";

contract DepositBridge is ReentrancyGuard {
    address public immutable stone;
    address payable public immutable vault;

    uint16 public immutable dstChainId;

    event BridgeTo(
        address indexed srcAddr,
        bytes dstAddr,
        uint256 etherAmount,
        uint256 stoneAmount,
        uint256 gasPaid
    );

    constructor(address _stone, address payable _vault, uint16 _dstChainId) {
        stone = _stone;
        vault = _vault;

        dstChainId = _dstChainId;
    }

    function bridgeTo(
        uint256 _amount,
        bytes calldata _dstAddress,
        uint256 _gasPaidForCrossChain
    ) public payable returns (uint256 stoneMinted) {
        stoneMinted = bridge(
            msg.sender,
            _amount,
            _dstAddress,
            _gasPaidForCrossChain
        );
    }

    function bridge(
        address _srcAddr,
        uint256 _amount,
        bytes calldata _dstAddress,
        uint256 _gasPaidForCrossChain
    ) public payable nonReentrant returns (uint256 stoneMinted) {
        require(msg.value >= _amount + _gasPaidForCrossChain, "wrong amount");

        IStoneVault stoneVault = IStoneVault(vault);
        stoneMinted = stoneVault.deposit{value: _amount}();

        IStone stoneToken = IStone(stone);
        stoneToken.sendFrom{value: _gasPaidForCrossChain}(
            address(this),
            dstChainId,
            _dstAddress,
            stoneMinted,
            payable(_srcAddr),
            address(0),
            bytes("")
        );

        emit BridgeTo(
            _srcAddr,
            _dstAddress,
            _amount,
            stoneMinted,
            _gasPaidForCrossChain
        );
    }

    function estimateSendFee(
        uint256 _amount,
        bytes calldata _dstAddress
    ) public view returns (uint nativeFee, uint zroFee) {
        return
            IStone(stone).estimateSendFee(
                dstChainId,
                _dstAddress,
                _amount,
                false,
                bytes("")
            );
    }

    receive() external payable {
        bytes memory dstAddr = abi.encodePacked(msg.sender);

        (uint nativeFee, ) = this.estimateSendFee(msg.value, dstAddr);

        require(msg.value > nativeFee, "too little");

        uint256 amount = msg.value - nativeFee;

        this.bridge{value: msg.value}(msg.sender, amount, dstAddr, nativeFee);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

interface IStoneVault {
    function deposit() external payable returns (uint256 mintAmount);

    function requestWithdraw(uint256 _shares) external;

    function instantWithdraw(
        uint256 _amount,
        uint256 _shares
    ) external returns (uint256 actualWithdrawn);

    function cancelWithdraw(uint256 _shares) external;

    function rollToNextRound() external;
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

interface IStone {
    function sendFrom(
        address _from,
        uint16 _dstChainId,
        bytes calldata _toAddress,
        uint _amount,
        address payable _refundAddress,
        address _zroPaymentAddress,
        bytes calldata _adapterParams
    ) external payable;

    function estimateSendFee(
        uint16 _dstChainId,
        bytes calldata _toAddress,
        uint _amount,
        bool _useZro,
        bytes calldata _adapterParams
    ) external view returns (uint nativeFee, uint zroFee);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_stone","type":"address"},{"internalType":"address payable","name":"_vault","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"srcAddr","type":"address"},{"indexed":false,"internalType":"bytes","name":"dstAddr","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"etherAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stoneAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasPaid","type":"uint256"}],"name":"BridgeTo","type":"event"},{"inputs":[{"internalType":"address","name":"_srcAddr","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_dstAddress","type":"bytes"},{"internalType":"uint256","name":"_gasPaidForCrossChain","type":"uint256"}],"name":"bridge","outputs":[{"internalType":"uint256","name":"stoneMinted","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_dstAddress","type":"bytes"},{"internalType":"uint256","name":"_gasPaidForCrossChain","type":"uint256"}],"name":"bridgeTo","outputs":[{"internalType":"uint256","name":"stoneMinted","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"dstChainId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_dstAddress","type":"bytes"}],"name":"estimateSendFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stone","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60e060405234801561000f575f80fd5b50604051610a98380380610a9883398101604081905261002e91610068565b60015f556001600160a01b03928316608052911660a05261ffff1660c0526100b8565b6001600160a01b0381168114610065575f80fd5b50565b5f805f6060848603121561007a575f80fd5b835161008581610051565b602085015190935061009681610051565b604085015190925061ffff811681146100ad575f80fd5b809150509250925092565b60805160a05160c0516109936101055f395f818161022e015281816103ee015261053001525f81816102bb015261033101525f81816101bd015281816103ba015261050301526109935ff3fe608060405260043610610057575f3560e01c80630167eb85146101ac578063274d427d146101fc57806330c593f71461021d5780638b886bf214610263578063ccb2b35d14610276578063fbfa77cf146102aa575f80fd5b366101a857604080513360601b6001600160601b031916602082015281516014818303018152603482019283905263ccb2b35d60e01b9092525f90309063ccb2b35d906100aa9034908690603801610645565b6040805180830381865afa1580156100c4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100e89190610665565b50905080341161012c5760405162461bcd60e51b815260206004820152600a602482015269746f6f206c6974746c6560b01b60448201526064015b60405180910390fd5b5f610137823461069b565b60405163274d427d60e01b8152909150309063274d427d9034906101659033908690899089906004016106b4565b60206040518083038185885af1158015610181573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906101a691906106eb565b005b5f80fd5b3480156101b7575f80fd5b506101df7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61020f61020a366004610746565b6102dd565b6040519081526020016101f3565b348015610228575f80fd5b506102507f000000000000000000000000000000000000000000000000000000000000000081565b60405161ffff90911681526020016101f3565b61020f6102713660046107af565b6104cf565b348015610281575f80fd5b506102956102903660046107fd565b6104dd565b604080519283526020830191909152016101f3565b3480156102b5575f80fd5b506101df7f000000000000000000000000000000000000000000000000000000000000000081565b5f6102e66105ab565b6102f08286610844565b34101561032e5760405162461bcd60e51b815260206004820152600c60248201526b1ddc9bdb99c8185b5bdd5b9d60a21b6044820152606401610123565b5f7f00000000000000000000000000000000000000000000000000000000000000009050806001600160a01b031663d0e30db0876040518263ffffffff1660e01b815260040160206040518083038185885af1158015610390573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906103b591906106eb565b91505f7f00000000000000000000000000000000000000000000000000000000000000009050806001600160a01b0316635190563685307f00000000000000000000000000000000000000000000000000000000000000008a8a898f5f60405180602001604052805f8152506040518a63ffffffff1660e01b815260040161044498979695949392919061087f565b5f604051808303818588803b15801561045b575f80fd5b505af115801561046d573d5f803e3d5ffd5b5050505050876001600160a01b03167f7bade912b065eda5ac7cd77eec98b7da506abc9e62b0e70af88226eeb2b044bf87878a87896040516104b39594939291906108e3565b60405180910390a250506104c660015f55565b95945050505050565b5f6104c633868686866102dd565b604080516020810182525f8082529151632a205e3d60e01b815282916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691632a205e3d91610561917f000000000000000000000000000000000000000000000000000000000000000091899189918c91899190600401610913565b6040805180830381865afa15801561057b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061059f9190610665565b91509150935093915050565b60025f54036105fc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610123565b60025f55565b5f81518084525f5b818110156106265760208185018101518683018201520161060a565b505f602082860101526020601f19601f83011685010191505092915050565b828152604060208201525f61065d6040830184610602565b949350505050565b5f8060408385031215610676575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b818103818111156106ae576106ae610687565b92915050565b60018060a01b0385168152836020820152608060408201525f6106da6080830185610602565b905082606083015295945050505050565b5f602082840312156106fb575f80fd5b5051919050565b5f8083601f840112610712575f80fd5b5081356001600160401b03811115610728575f80fd5b60208301915083602082850101111561073f575f80fd5b9250929050565b5f805f805f6080868803121561075a575f80fd5b85356001600160a01b0381168114610770575f80fd5b94506020860135935060408601356001600160401b03811115610791575f80fd5b61079d88828901610702565b96999598509660600135949350505050565b5f805f80606085870312156107c2575f80fd5b8435935060208501356001600160401b038111156107de575f80fd5b6107ea87828801610702565b9598909750949560400135949350505050565b5f805f6040848603121561080f575f80fd5b8335925060208401356001600160401b0381111561082b575f80fd5b61083786828701610702565b9497909650939450505050565b808201808211156106ae576106ae610687565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b5f60018060a01b03808b16835261ffff8a16602084015260e060408401526108ab60e08401898b610857565b876060850152818716608085015281861660a085015283810360c08501526108d38186610602565b9c9b505050505050505050505050565b608081525f6108f6608083018789610857565b602083019590955250604081019290925260609091015292915050565b61ffff8716815260a060208201525f61093060a083018789610857565b856040840152841515606084015282810360808401526109508185610602565b999850505050505050505056fea264697066735822122024385c4b2fcda6112c4db0cec289d5b80c2b5b10be1b5582abe4a7b61ba8575c64736f6c634300081500330000000000000000000000007122985656e38bdc0302db86685bb972b145bd3c000000000000000000000000a62f9c5af106feee069f38de51098d9d81b9057200000000000000000000000000000000000000000000000000000000000000d6

Deployed Bytecode

0x608060405260043610610057575f3560e01c80630167eb85146101ac578063274d427d146101fc57806330c593f71461021d5780638b886bf214610263578063ccb2b35d14610276578063fbfa77cf146102aa575f80fd5b366101a857604080513360601b6001600160601b031916602082015281516014818303018152603482019283905263ccb2b35d60e01b9092525f90309063ccb2b35d906100aa9034908690603801610645565b6040805180830381865afa1580156100c4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100e89190610665565b50905080341161012c5760405162461bcd60e51b815260206004820152600a602482015269746f6f206c6974746c6560b01b60448201526064015b60405180910390fd5b5f610137823461069b565b60405163274d427d60e01b8152909150309063274d427d9034906101659033908690899089906004016106b4565b60206040518083038185885af1158015610181573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906101a691906106eb565b005b5f80fd5b3480156101b7575f80fd5b506101df7f0000000000000000000000007122985656e38bdc0302db86685bb972b145bd3c81565b6040516001600160a01b0390911681526020015b60405180910390f35b61020f61020a366004610746565b6102dd565b6040519081526020016101f3565b348015610228575f80fd5b506102507f00000000000000000000000000000000000000000000000000000000000000d681565b60405161ffff90911681526020016101f3565b61020f6102713660046107af565b6104cf565b348015610281575f80fd5b506102956102903660046107fd565b6104dd565b604080519283526020830191909152016101f3565b3480156102b5575f80fd5b506101df7f000000000000000000000000a62f9c5af106feee069f38de51098d9d81b9057281565b5f6102e66105ab565b6102f08286610844565b34101561032e5760405162461bcd60e51b815260206004820152600c60248201526b1ddc9bdb99c8185b5bdd5b9d60a21b6044820152606401610123565b5f7f000000000000000000000000a62f9c5af106feee069f38de51098d9d81b905729050806001600160a01b031663d0e30db0876040518263ffffffff1660e01b815260040160206040518083038185885af1158015610390573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906103b591906106eb565b91505f7f0000000000000000000000007122985656e38bdc0302db86685bb972b145bd3c9050806001600160a01b0316635190563685307f00000000000000000000000000000000000000000000000000000000000000d68a8a898f5f60405180602001604052805f8152506040518a63ffffffff1660e01b815260040161044498979695949392919061087f565b5f604051808303818588803b15801561045b575f80fd5b505af115801561046d573d5f803e3d5ffd5b5050505050876001600160a01b03167f7bade912b065eda5ac7cd77eec98b7da506abc9e62b0e70af88226eeb2b044bf87878a87896040516104b39594939291906108e3565b60405180910390a250506104c660015f55565b95945050505050565b5f6104c633868686866102dd565b604080516020810182525f8082529151632a205e3d60e01b815282916001600160a01b037f0000000000000000000000007122985656e38bdc0302db86685bb972b145bd3c1691632a205e3d91610561917f00000000000000000000000000000000000000000000000000000000000000d691899189918c91899190600401610913565b6040805180830381865afa15801561057b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061059f9190610665565b91509150935093915050565b60025f54036105fc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610123565b60025f55565b5f81518084525f5b818110156106265760208185018101518683018201520161060a565b505f602082860101526020601f19601f83011685010191505092915050565b828152604060208201525f61065d6040830184610602565b949350505050565b5f8060408385031215610676575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b818103818111156106ae576106ae610687565b92915050565b60018060a01b0385168152836020820152608060408201525f6106da6080830185610602565b905082606083015295945050505050565b5f602082840312156106fb575f80fd5b5051919050565b5f8083601f840112610712575f80fd5b5081356001600160401b03811115610728575f80fd5b60208301915083602082850101111561073f575f80fd5b9250929050565b5f805f805f6080868803121561075a575f80fd5b85356001600160a01b0381168114610770575f80fd5b94506020860135935060408601356001600160401b03811115610791575f80fd5b61079d88828901610702565b96999598509660600135949350505050565b5f805f80606085870312156107c2575f80fd5b8435935060208501356001600160401b038111156107de575f80fd5b6107ea87828801610702565b9598909750949560400135949350505050565b5f805f6040848603121561080f575f80fd5b8335925060208401356001600160401b0381111561082b575f80fd5b61083786828701610702565b9497909650939450505050565b808201808211156106ae576106ae610687565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b5f60018060a01b03808b16835261ffff8a16602084015260e060408401526108ab60e08401898b610857565b876060850152818716608085015281861660a085015283810360c08501526108d38186610602565b9c9b505050505050505050505050565b608081525f6108f6608083018789610857565b602083019590955250604081019290925260609091015292915050565b61ffff8716815260a060208201525f61093060a083018789610857565b856040840152841515606084015282810360808401526109508185610602565b999850505050505050505056fea264697066735822122024385c4b2fcda6112c4db0cec289d5b80c2b5b10be1b5582abe4a7b61ba8575c64736f6c63430008150033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000007122985656e38bdc0302db86685bb972b145bd3c000000000000000000000000a62f9c5af106feee069f38de51098d9d81b9057200000000000000000000000000000000000000000000000000000000000000d6

-----Decoded View---------------
Arg [0] : _stone (address): 0x7122985656e38BDC0302Db86685bb972b145bD3C
Arg [1] : _vault (address): 0xA62F9C5af106FeEE069F38dE51098D9d81B90572
Arg [2] : _dstChainId (uint16): 214

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000007122985656e38bdc0302db86685bb972b145bd3c
Arg [1] : 000000000000000000000000a62f9c5af106feee069f38de51098d9d81b90572
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000d6


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
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.