i write a contract wanting to send some bnb from opbnb to greenfiled testnet.
Here is my code:
function topUpBNB(uint256 transferOutAmount) external payable {
(uint256 relayFee, uint256 ackRelayFee) = ICrossChain(cross_chain).getRelayFees();
require(msg.value == transferOutAmount + relayFee + ackRelayFee, "msg.value not enough");
_topUpBNB(transferOutAmount,relayFee,ackRelayFee);
}
function _topUpBNB(uint256 transferOutAmount,uint256 relayFee, uint256 ackRelayFee) internal {
bool result = ITokenHub(tokenHub).transferOut{ value: transferOutAmount + relayFee + ackRelayFee }(
address(this),
transferOutAmount
);
require(result,"fail to transfer token");
}
The tokenHub I set is 0x59614C9e9B5Df6dF4dc9e457cc7F3a67D796d3b2
.
And I got the error execution reverted: the contract and channel have not been registered
What wrong with it?
I sent bnb from bsc testnet to greenfield successfully before.