Skip to content

Latest commit

 

History

History
74 lines (52 loc) · 4.12 KB

cross-chain-cake-bridging.md

File metadata and controls

74 lines (52 loc) · 4.12 KB
description
PancakeSwap uses LayerZero OFT for Cross Chain CAKE Bridging

Cross Chain CAKE Bridging

Contract info

CAKE Bridging Contract

Contract name: CakeProxyOFT
Contract address: 0xb274202daBA6AE180c665B4fbE59857b7c3a8091

View on BscScan

Example of CAKE bridging to Aptos

sendFrom

{% code overflow="wrap" %}

    function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, LzCallParams calldata _callParams) external payable;

{% endcode %}

NameTypeDescription
NameTypeDescription
_fromaddressFrom address. This should be the address calling the CakeProxyOFT
_dstChainIduint16108 for Aptos mainnet
_toAddressbytes32The destination address on Aptos
_amountuint256Amount of CAKE in WEI. Please note that amounts less than 1e-8 will get dusted
_minAmountuint256Minimum receiving amount. We do not charge any fee in CAKE. But this should not be larger than _amount after being rounded down to 8 decimals.
_callParamstupleA set of call parameters used to define bridging behaviours. Continue reading for more detail.

{% hint style="info" %} sendFrom is a payable function. You will need to pay around 0.005-0.01 in BNB for destination airdrop gas fees. This value will vary based on the price of BNB/APT.

Please note that if you define extra gas being airdropped to your destination address, you will need to increase this number or tx will revert with not enough natives for fees {% endhint %}

How to form `_callParams`

{
    refundAddress,
    zroPaymentAddress,
    adapterParams
}
NameTypeDescription
NameTypeDescription
refundAddressaddressExcess fee (BNB) will be returned to this address
zroPaymentAddressaddress0x0000000000000000000000000000000000000000
adapterParamsbytesA set of parameters to define destination gas airdropping. Continue reading for more detail.

How to form `adapterParams`

{
    version,
    dstGasLimit,
    dstNativeGasTransferAmount,
    dstNativeGasTransferAddress
}
NameTypeDescription
NameTypeDescription
versionuint16Default is 2
dstGasLimituintDefault is 200000
dstNativeGasTransferAmountuintAmount destination native gas token to airdrop. Use 0 if you don't need the bridge to convert BNB and airdrop you APT
dstNativeGasTransferAddressbytesThe destination address that receives native gas tokens on destination chain
const adapterParams = utils.solidityPack(
    ["uint16", "uint", "uint", "bytes"],
    [2, 200000, 0, "0xYourAptosAddress"]
)

Utilities

Audits

OtterSec's PancakeSwap CAKE OFT (Bridging) security audit