跳到主要内容

JBArbitrumSucker

Git Source

Inherits: JBSucker, IJBArbitrumSucker

A JBSucker implementation to suck tokens between two chains connected by an Arbitrum bridge.

State Variables

ARBINBOX

The inbox used to send messages between the local and remote sucker.

IInbox public immutable override ARBINBOX;

GATEWAYROUTER

The gateway router for the specific chain

IArbGatewayRouter public immutable override GATEWAYROUTER;

LAYER

The layer that this contract is on.

JBLayer public immutable override LAYER;

Functions

constructor

constructor(
JBArbitrumSuckerDeployer deployer,
IJBDirectory directory,
IJBPermissions permissions,
IJBTokens tokens,
JBAddToBalanceMode addToBalanceMode,
address trusted_forwarder
)
JBSucker(directory, permissions, tokens, addToBalanceMode, trusted_forwarder);

Parameters

NameTypeDescription
deployerJBArbitrumSuckerDeployer
directoryIJBDirectoryA contract storing directories of terminals and controllers for each project.
permissionsIJBPermissionsA contract storing permissions.
tokensIJBTokensA contract that manages token minting and burning.
addToBalanceModeJBAddToBalanceModeThe mode of adding tokens to balance.
trusted_forwarderaddress

peerChainId

Returns the chain on which the peer is located.

function peerChainId() external view virtual override returns (uint256);

Returns

NameTypeDescription
<none>uint256chainId of the peer.

_isRemotePeer

Checks if the sender (_msgSender()) is a valid representative of the remote peer.

function _isRemotePeer(address sender) internal view override returns (bool);

Parameters

NameTypeDescription
senderaddressThe message's sender.

Returns

NameTypeDescription
<none>boolvalid A flag if the sender is a valid representative of the remote peer.

_sendRootOverAMB

Uses the L1/L2 gateway to send the root and assets over the bridge to the peer.

function _sendRootOverAMB(
uint256 transportPayment,
uint256,
address token,
uint256 amount,
JBRemoteToken memory remoteToken,
JBMessageRoot memory message
)
internal
override;

Parameters

NameTypeDescription
transportPaymentuint256the amount of msg.value that is going to get paid for sending this message.
<none>uint256
tokenaddressThe token to bridge the outbox tree for.
amountuint256
remoteTokenJBRemoteTokenInformation about the remote token being bridged to.
messageJBMessageRoot

_toL1

Bridge the token and data to the remote L1 chain.

function _toL1(address token, uint256 amount, bytes memory data, JBRemoteToken memory remoteToken) internal;

Parameters

NameTypeDescription
tokenaddressThe token to bridge.
amountuint256The amount of tokens to bridge.
databytesThe calldata to send to the remote chain. This calls JBSucker.fromRemote on the remote peer.
remoteTokenJBRemoteTokenInformation about the remote token to bridged to.

_toL2

Bridge the token and data to the remote L2 chain.

function _toL2(
address token,
uint256 transportPayment,
uint256 amount,
bytes memory data,
JBRemoteToken memory remoteToken
)
internal;

Parameters

NameTypeDescription
tokenaddressThe token to bridge.
transportPaymentuint256
amountuint256The amount of tokens to bridge.
databytesThe calldata to send to the remote chain. This calls JBSucker.fromRemote on the remote peer.
remoteTokenJBRemoteToken

Errors

JBArbitrumSucker_ChainNotSupported

error JBArbitrumSucker_ChainNotSupported(uint256 chainId);

JBArbitrumSucker_NotEnoughGas

error JBArbitrumSucker_NotEnoughGas(uint256 payment, uint256 cost);