-
Notifications
You must be signed in to change notification settings - Fork 58
Closed
Description
The current Swap
example-contract doesn't support swaps from Bitcoin to: (SOL/SUI/TON)
- Bitcoin > Solana
- Bitcoin > SUI
- Bitcoin > TON
As @fadeev suggested, I already convert the Solana address to hex to add it on the bitcoin memo (as required), but the contract itself doesn't recognize that format. It only handles EVM-compatible destinations when Bitcoin is the source chain.
To move forward with BTC > Solana/SUI/TON cross-chain, the Swap
contract needs to support different address formats and decoding logic depending on the target chain.
As I see, the onCall
and withdraw
must be updated.
I created bytesToBech32Bytes
to test, but no success so far…
BytesHelperLib.sol
function bytesToBech32Bytes(
bytes calldata data,
uint256 offset
) internal pure returns (bytes memory) {
bytes memory bech32Bytes = new bytes(42);
for (uint i = 0; i < 42; i++) {
bech32Bytes[i] = data[i + offset];
}
return bech32Bytes;
}
Swap.sol
if (context.chainID == BITCOIN_TESTNET || context.chainID == BITCOIN) {
params.target = BytesHelperLib.bytesToAddress(message, 0);
//params.to = abi.encodePacked(BytesHelperLib.bytesToAddress(message, 20)); //EVM
//SOL ADDRESS (TESTING)
params.to = BytesHelperLib.bytesToBech32Bytes(message, 20);
...
Can you implement this logic on the swap example contract or guidance on how to implement this?
Metadata
Metadata
Assignees
Labels
No labels