跳到主要内容

JBOptimismSucker

Git Source

Inherits: JBSucker, IJBOptimismSucker

A JBSucker implementation to suck tokens between two chains connected by an OP Bridge.

State Variables

OPBRIDGE

The bridge used to bridge tokens between the local and remote chain.

IOPStandardBridge public immutable override OPBRIDGE;

OPMESSENGER

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

IOPMessenger public immutable override OPMESSENGER;

Functions

constructor

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

Parameters

NameTypeDescription
deployerJBOptimismSuckerDeployerA contract that deploys the clones for this contracts.
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 override returns (bool valid);

Parameters

NameTypeDescription
senderaddressThe message's sender.

_sendRootOverAMB

Use the OPMESSENGER to send the outbox tree for the token and the corresponding funds to the peer over the OPBRIDGE.

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