Skip to content
Verified contractExactMIT

BridgeB

Address0x0b6eca8eea9225e2aed7eaa1b7dc42682af73ad3
Balance

0 ETH

 

Transactions

99

 

Compiler

solc 0.8.26

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.26+commit.8a97fa7a
Language
solidity
Optimization
Yes, 200 runs
EVM version
paris
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
21,608,368
Creation transaction
0xd36a5e5918…471968f668

contracts/BridgeB.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

interface IERC20 {
    function mintTo(address to, uint256 amount) external;
    function burnFrom(address from, uint256 amount) external;
    function transfer(address to, uint256 amount) external returns (bool);
}

contract BridgeB {
    mapping(string => bool) public _usedTxRefs;

    event IncomingBridgeRequest(address indexed sender, uint256 amount);
    event BridgeProcessed(address indexed receiver, uint256 amount, string txRef);

    address public owner;
    IERC20 public token = IERC20(0x1D7ECbD285bC74D88d922E40D7b443CFa52420e9);

    modifier onlyOwner {
        require(msg.sender == owner, "Caller is not the owner");
        _;
    }

    constructor() {
        owner = msg.sender;
    }

    function transferOwnership(address newOwner) public onlyOwner {
        require(newOwner != address(0), "New owner cannot be zero address");
        owner = newOwner;
    }

    function changeToken(address erc20Address) public onlyOwner{
        token = IERC20(erc20Address);
    }

    function processBridgeRequest(address receiver, uint256 amount, string memory txRef) external onlyOwner {
        require(receiver != address(0), "Invalid receiver address");
        require(amount > 0, "Amount must be greater than zero");
        require(!_usedTxRefs[txRef], "Transaction reference already used");

        _usedTxRefs[txRef] = true;

        token.mintTo(receiver, amount);

        emit BridgeProcessed(receiver, amount, txRef);
    }

    function createBridgeRequest(uint256 amount) external {
        require(amount > 0, "Amount must be greater than zero");
        
        // Burn tokens from the sender
        token.burnFrom(msg.sender, amount);

        emit IncomingBridgeRequest(msg.sender, amount);
    }

    function recoverERC20(address tokenAddress, uint256 amount) external onlyOwner {
        require(tokenAddress != address(0), "Invalid token address");
        require(amount > 0, "Amount must be greater than zero");
        
        IERC20 recoverToken = IERC20(tokenAddress);
        bool success = recoverToken.transfer(owner, amount);
        require(success, "Recover ERC20 failed");
    }

    function recoverNativeCurrency() external onlyOwner {
        (bool success, ) = owner.call{value: address(this).balance}("");
        require(success, "Recover native currency failed");
    }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "paris",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.