AccrossBridge

Git Source

Inherits: BaseBridge, IBridge, ReentrancyGuard

State Variables

acrossSpokePool

address public immutable acrossSpokePool;

maxSlippage

uint256 public immutable maxSlippage;

whitelistedRelayers

mapping(uint32 => mapping(address => bool)) public whitelistedRelayers;

SLIPPAGE_PRECISION

uint256 private constant SLIPPAGE_PRECISION = 1e5;

Functions

constructor

constructor(address _roles, address _spokePool) BaseBridge(_roles);

onlySpokePool

modifier onlySpokePool();

setWhitelistedRelayer

Whitelists a delegate address

function setWhitelistedRelayer(uint32 _dstId, address _relayer, bool status) external onlyBridgeConfigurator;

getFee

computes fee for bridge operation

function getFee(uint32, bytes memory, bytes memory) external pure returns (uint256);

Parameters

NameTypeDescription
<none>uint32
<none>bytes
<none>bytes

isRelayerWhitelisted

returns if an address represents a whitelisted delegates

function isRelayerWhitelisted(uint32 dstChain, address relayer) external view returns (bool);

sendMsg

rebalance through bridge

function sendMsg(
    uint256 _extractedAmount,
    address _market,
    uint32 _dstChainId,
    address _token,
    bytes memory _message,
    bytes memory
) external payable onlyRebalancer;

Parameters

NameTypeDescription
_extractedAmountuint256extracted amount for rebalancing
_marketaddressdestination address
_dstChainIduint32destination chain id
_tokenaddressthe token to rebalance
_messagebytesoperation message data
<none>bytes

handleV3AcrossMessage

handles AcrossV3 SpokePool message

function handleV3AcrossMessage(address tokenSent, uint256 amount, address, bytes memory message)
    external
    onlySpokePool
    nonReentrant;

Parameters

NameTypeDescription
tokenSentaddressthe token address received
amountuint256the token amount
<none>address
messagebytesthe custom message sent from source

_decodeMessage

function _decodeMessage(bytes memory _message) private pure returns (DecodedMessage memory);

_depositV3Now

function _depositV3Now(bytes memory _message, address _token, uint32 _dstChainId, address _market) private;

Events

Rebalanced

event Rebalanced(address indexed market, uint256 amount);

WhitelistedRelayerStatusUpdated

event WhitelistedRelayerStatusUpdated(
    address indexed sender, uint32 indexed dstId, address indexed delegate, bool status
);

Errors

AcrossBridge_TokenMismatch

error AcrossBridge_TokenMismatch();

AcrossBridge_NotAuthorized

error AcrossBridge_NotAuthorized();

AcrossBridge_NotImplemented

error AcrossBridge_NotImplemented();

AcrossBridge_AddressNotValid

error AcrossBridge_AddressNotValid();

AcrossBridge_SlippageNotValid

error AcrossBridge_SlippageNotValid();

AcrossBridge_RelayerNotValid

error AcrossBridge_RelayerNotValid();

Structs

DecodedMessage

struct DecodedMessage {
    uint256 inputAmount;
    uint256 outputAmount;
    address relayer;
    uint32 deadline;
    uint32 exclusivityDeadline;
}