creation_sourcecode: //SPDX-License-Identifier: MIT
  
  pragma solidity ^0.8.17;
  
  interface IQuoter {
      function quoteExactInputSingle(
          address tokenIn,
          address tokenOut,
          uint24 fee,
          uint256 amountIn,
          uint160 sqrtPriceLimitX96
      ) external returns (uint256 amountOut);
  }
  
  interface Token {
      function mint(
          uint256 _value,
          address _to
      ) external returns (bool);
  
      function burn(
          uint256 _value,
          address _from
      ) external returns (bool) ;
  }
  
  contract Proxiable {
      function _updateDelegateContract(address _delegateContract) internal {
          require(
              bytes32(
                  0x0683d1c283a672fc58eb7940a0dba83ea98b96966a9ca1b030dec2c60cea4d1e
              ) == Proxiable(_delegateContract).proxiableUUID(),
              "Not compatible"
          );
          assembly {
              sstore(
                  0x0683d1c283a672fc58eb7940a0dba83ea98b96966a9ca1b030dec2c60cea4d1e,
                  _delegateContract
              )
          }
      }
  
      function proxiableUUID() public pure returns (bytes32) {
          return
              0x0683d1c283a672fc58eb7940a0dba83ea98b96966a9ca1b030dec2c60cea4d1e;
      }
  }
  
  contract Admins {
      modifier onlyAdmin() {
          require(msg.sender == admin, "You are not allowed!");
          _;
      }
  
      modifier onlyExecutor() {
          require(
              isExecutor[msg.sender] || msg.sender == admin,
              "You are not allowed!"
          );
          _;
      }
  
      address public admin;
      mapping(address => bool) public isExecutor;
      address[] public executors;
  
     
  
      function getExecutors() external view returns (address[] memory) {
          return executors;
      }
  
      function transferAdminship(
          address _addr
      ) external onlyAdmin returns (bool) {
          admin = _addr;
          return true;
      }
  
      function addExecutor(address _addr) external onlyAdmin returns (bool) {
          isExecutor[_addr] = true;
          executors.push(_addr);
          return true;
      }
  
      function removeExecutor(address _addr) external onlyAdmin returns (bool) {
          isExecutor[_addr] = false;
          uint256 len = executors.length;
          for (uint256 i = 0; i < len; i++) {
              if (executors[i] != _addr) {
                  continue;
              }
              if (len != i + 1) {
                  executors[i] = executors[len - 1];
              }
              executors.pop();
              break;
          }
          return true;
      }
  }
  
  contract Bridge is Admins, Proxiable {
      event TransferRequest(uint256 nonce);
  
      event TransferExecuted(Chain chain, uint256 nonce);
  
      enum Chain {
          ETH,
          POL
      }
  
      struct Request {
          Chain chain;
          uint256 nonce;
          address applicant;
          address receiver;
          uint256 value;
          uint256 fees;
      }
  
      address public UTAKE; // utake token address
      address public WCOIN; // ether token address
      address public USDC; // usdc token address
      address public QUOTER; // quote router
  
      Chain public chain; // current chain index
      uint256 public nonce; // this is chain nonce
      uint256 public minTransfer; // 5k ether
      uint256 public fee; // persentage fee where 10000 == 100%
  
      mapping(uint256 => Request) public requests; // nonce => Request
      mapping(Chain => mapping(uint256 => bool)) public transfers; // chain => nonce
  
      bool public isInitialized;
  
      function initializeProxy() external {
          require(!isInitialized, "Already initialized!");
          isInitialized = true;
          chain = Chain.ETH;
          minTransfer = 5000 ether;
          admin = msg.sender;
          fee = 300;
          QUOTER = 0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6;
          WCOIN = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
          USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
  
          UTAKE = 0xEC4384f90257a1F43BD82DEEC6Ad1B488ebB6D00;
      }
  
      function requestTransfer(
          Chain _chain,
          address _receiver,
          uint256 _value
      ) external payable returns (bool) {
          require(_chain != chain, "Invalid chian!");
          require(_receiver != address(0), "Invalid receiver!");
          require(_value >= minTransfer, "Amount to low for transfer!");
  
          uint256 utakeToUsdc = IQuoter(QUOTER).quoteExactInputSingle(
              UTAKE,
              USDC,
              10000,
              _value,
              0
          );
  
          uint256 usdcToWcoin = IQuoter(QUOTER).quoteExactInputSingle(
              USDC,
              WCOIN,
              500,
              utakeToUsdc,
              0
          );
  
          uint256 _fees = (usdcToWcoin / 10000) * fee;
  
          require(msg.value >= _fees, "Fees are higher then provided amount!");
          uint256 refund = msg.value - _fees;
          if (refund != 0) {
              (bool success, ) = payable(msg.sender).call{value: refund}("");
              require(success, "Error durring withdraw!");
          }
  
          unchecked {
              nonce++;
          }
  
          Token(UTAKE).burn(_value, msg.sender);
  
          requests[nonce] = Request({
              chain: _chain,
              nonce: nonce,
              applicant: msg.sender,
              receiver: _receiver,
              value: _value,
              fees: _fees
          });
  
          emit TransferRequest(nonce);
          return true;
      }
  
      function withdraw() external returns (bool) {
          (bool success, ) = payable(admin).call{value: address(this).balance}(
              ""
          );
          require(success, "Error durring withdraw!");
          return true;
      }
  
      function executeTransfer(
          Chain _chain,
          uint256 _nonce,
          address _receiver,
          uint256 _value
      ) external onlyExecutor returns (bool) {
          require(
              !transfers[_chain][_nonce],
              "This transfer was already executed!"
          );
  
          transfers[_chain][_nonce] = true;
  
          Token(UTAKE).mint(_value, _receiver);
  
          emit TransferExecuted(_chain, _nonce);
          return true;
      }
  
      function updateContract(address addr) external onlyAdmin returns (bool) {
          _updateDelegateContract(addr);
          return true;
      }
  
      function setMinTransfer(uint256 _value) external onlyAdmin returns (bool) {
          minTransfer = _value;
          return true;
      }
  
      function setFee(uint256 _fee) external onlyAdmin returns (bool) {
          fee = _fee;
          return true;
      }
  
      function setUTAKEAddress(address _token) external onlyAdmin returns (bool) {
          UTAKE = _token;
          return true;
      }
  
      function setWCOINAddress(address _token) external onlyAdmin returns (bool) {
          WCOIN = _token;
          return true;
      }
  
      function setUSDCAddress(address _token) external onlyAdmin returns (bool) {
          USDC = _token;
          return true;
      }
  
      function setQUOTERAddress(
          address _token
      ) external onlyAdmin returns (bool) {
          QUOTER = _token;
          return true;
      }
  }