|
| 1 | +// SPDX-License-Identifier: MIT |
| 2 | + |
| 3 | +pragma solidity ^0.8.0; |
| 4 | + |
| 5 | +interface IBridgeV4 { |
| 6 | + |
| 7 | + struct ClaimData { |
| 8 | + address payable to; |
| 9 | + uint256 amount; |
| 10 | + bytes32 blockHash; |
| 11 | + bytes32 transactionHash; |
| 12 | + uint32 logIndex; |
| 13 | + } |
| 14 | + |
| 15 | + function version() external pure returns (string memory); |
| 16 | + |
| 17 | + function getFeePercentage() external view returns(uint); |
| 18 | + |
| 19 | + /** |
| 20 | + * ERC-20 tokens approve and transferFrom pattern |
| 21 | + * See https://eips.ethereum.org/EIPS/eip-20#transferfrom |
| 22 | + */ |
| 23 | + function receiveTokensTo(address tokenToUse, address to, uint256 amount) external; |
| 24 | + |
| 25 | + /** |
| 26 | + * Use network currency and cross it. |
| 27 | + */ |
| 28 | + function depositTo(address to) external payable; |
| 29 | + |
| 30 | + /** |
| 31 | + * ERC-777 tokensReceived hook allows to send tokens to a contract and notify it in a single transaction |
| 32 | + * See https://eips.ethereum.org/EIPS/eip-777#motivation for details |
| 33 | + */ |
| 34 | + function tokensReceived ( |
| 35 | + address operator, |
| 36 | + address from, |
| 37 | + address to, |
| 38 | + uint amount, |
| 39 | + bytes calldata userData, |
| 40 | + bytes calldata operatorData |
| 41 | + ) external; |
| 42 | + |
| 43 | + /** |
| 44 | + * Accepts the transaction from the other chain that was voted and sent by the Federation contract |
| 45 | + */ |
| 46 | + function acceptTransfer( |
| 47 | + address _originalTokenAddress, |
| 48 | + address payable _from, |
| 49 | + address payable _to, |
| 50 | + uint256 _amount, |
| 51 | + bytes32 _blockHash, |
| 52 | + bytes32 _transactionHash, |
| 53 | + uint32 _logIndex |
| 54 | + ) external; |
| 55 | + |
| 56 | + /** |
| 57 | + * Claims the crossed transaction using the hash, this sends the funds to the address indicated in |
| 58 | + */ |
| 59 | + function claim(ClaimData calldata _claimData) external returns (uint256 receivedAmount); |
| 60 | + |
| 61 | + function claimFallback(ClaimData calldata _claimData) external returns (uint256 receivedAmount); |
| 62 | + |
| 63 | + function claimGasless( |
| 64 | + ClaimData calldata _claimData, |
| 65 | + address payable _relayer, |
| 66 | + uint256 _fee, |
| 67 | + uint256 _deadline, |
| 68 | + uint8 _v, |
| 69 | + bytes32 _r, |
| 70 | + bytes32 _s |
| 71 | + ) external returns (uint256 receivedAmount); |
| 72 | + |
| 73 | + function getTransactionDataHash( |
| 74 | + address _to, |
| 75 | + uint256 _amount, |
| 76 | + bytes32 _blockHash, |
| 77 | + bytes32 _transactionHash, |
| 78 | + uint32 _logIndex |
| 79 | + ) external returns(bytes32); |
| 80 | + |
| 81 | + event Cross( |
| 82 | + address indexed _tokenAddress, |
| 83 | + address indexed _from, |
| 84 | + address indexed _to, |
| 85 | + uint256 _amount, |
| 86 | + bytes _userData |
| 87 | + ); |
| 88 | + event NewSideToken( |
| 89 | + address indexed _newSideTokenAddress, |
| 90 | + address indexed _originalTokenAddress, |
| 91 | + string _newSymbol, |
| 92 | + uint256 _granularity |
| 93 | + ); |
| 94 | + event AcceptedCrossTransfer( |
| 95 | + bytes32 indexed _transactionHash, |
| 96 | + address indexed _originalTokenAddress, |
| 97 | + address indexed _to, |
| 98 | + address _from, |
| 99 | + uint256 _amount, |
| 100 | + bytes32 _blockHash, |
| 101 | + uint256 _logIndex |
| 102 | + ); |
| 103 | + event FeePercentageChanged(uint256 _amount); |
| 104 | + event Claimed( |
| 105 | + bytes32 indexed _transactionHash, |
| 106 | + address indexed _originalTokenAddress, |
| 107 | + address indexed _to, |
| 108 | + address _sender, |
| 109 | + uint256 _amount, |
| 110 | + bytes32 _blockHash, |
| 111 | + uint256 _logIndex, |
| 112 | + address _reciever, |
| 113 | + address _relayer, |
| 114 | + uint256 _fee |
| 115 | + ); |
| 116 | +} |
0 commit comments