Skip to main content

BridgeAdmin

BridgeAdmin#

Administrative contract deployed on L1 that has implicit references to all L2 DepositBoxes.

This contract is responsible for making global variables accessible to BridgePool contracts, which house passive liquidity and enable relaying of L2 deposits. The owner of this contract can also call permissioned functions on registered L2 DepositBoxes.

Functions#

constructor(address _finder, uint32 _optimisticOracleLiveness, uint64 _proposerBondPct, bytes32 _identifier) (public)

Construct the Bridge Admin

Parameters:#

  • _finder: DVM finder to find other UMA ecosystem contracts.
  • _optimisticOracleLiveness: Timeout that all bridging actions from L2->L1 must wait for a OptimisticOracle response.
  • _proposerBondPct: Percentage of the bridged amount that a relayer must put up as a bond.
  • _identifier: Identifier used when querying the OO for a cross bridge transfer action.
setIdentifier(bytes32 _identifier) (public)

Sets a price identifier to use for relayed deposits. BridgePools reads the identifier from this contract.

Can only be called by the current owner.

Parameters:#

  • _identifier: New identifier to set.
setOptimisticOracleLiveness(uint32 liveness) (public)

Sets challenge period for relayed deposits. BridgePools will read this value from this contract.

Can only be called by the current owner.

Parameters:#

  • liveness: New OptimisticOracle liveness period to set for relay price requests.
setProposerBondPct(uint64 _proposerBondPct) (public)

Sets challenge period for relayed deposits. BridgePools will read this value from this contract.

Can only be called by the current owner.

Parameters:#

  • _proposerBondPct: New OptimisticOracle proposer bond % to set for relay price requests. 1e18 = 100%.
setDepositContract(uint256 chainId, address depositContract, address messengerContract) (public)

Associates the L2 deposit and L1 messenger helper addresses with an L2 network ID.

Only callable by the current owner.

Parameters:#

  • chainId: L2 network ID to set addresses for.
  • depositContract: Address of L2 deposit contract.
  • messengerContract: Address of L1 helper contract that relays messages to L2.
transferBridgePoolAdmin(address[] bridgePools, address newAdmin) (public)

Enables the current owner to transfer ownership of a set of owned bridge pools to a new owner.

Only callable by the current owner.

Parameters:#

  • bridgePools: array of bridge pools to transfer ownership.
  • newAdmin: new admin contract to set ownership to.
setLpFeeRatePerSecond(address bridgePool, uint64 newLpFeeRate) (public)

Enable the current owner to change the decay rate at which LP shares accumulate fees for a particular BridgePool. The higher this value, the faster LP shares realize pending fees.

Only callable by the current owner.

Parameters:#

  • bridgePool: Bridge Pool to change LP fee rate for.
  • newLpFeeRate: The new rate to set for the bridgePool.
setCrossDomainAdmin(uint256 chainId, address admin, uint256 l1CallValue, uint256 l2Gas, uint256 l2GasPrice, uint256 maxSubmissionCost) (public)

Set new contract as the admin address in the L2 Deposit contract.

Only callable by the current owner. msg.value must equal to l1CallValue.

Parameters:#

  • chainId: L2 network ID where Deposit contract is deployed.
  • admin: New admin address to set on L2.
  • l1CallValue: Amount of ETH to include in msg.value. Used to pay for L2 fees, but its exact usage varies depending on the L2 network that this contract sends a message to.
  • l2Gas: Gas limit to set for relayed message on L2.
  • l2GasPrice: Gas price bid to set for relayed message on L2.
  • Arbitrum: only: fee deducted from L2 sender's balance to pay for L2 gas.
setMinimumBridgingDelay(uint256 chainId, uint64 minimumBridgingDelay, uint256 l1CallValue, uint256 l2Gas, uint256 l2GasPrice, uint256 maxSubmissionCost) (public)

Sets the minimum time between L2-->L1 token withdrawals in the L2 Deposit contract.

Only callable by the current owner. msg.value must equal to l1CallValue.

Parameters:#

  • chainId: L2 network ID where Deposit contract is deployed.
  • minimumBridgingDelay: the new minimum delay.
  • l1CallValue: Amount of ETH to include in msg.value. Used to pay for L2 fees, but its exact usage varies depending on the L2 network that this contract sends a message to.
  • l2Gas: Gas limit to set for relayed message on L2.
  • l2GasPrice: Gas price bid to set for relayed message on L2.
  • Arbitrum: only: fee deducted from L2 sender's balance to pay for L2 gas.
setEnableDepositsAndRelays(uint256 chainId, address l1Token, bool depositsEnabled, uint256 l1CallValue, uint256 l2Gas, uint256 l2GasPrice, uint256 maxSubmissionCost) (public)

Owner can pause/unpause L2 deposits for a tokens.

Only callable by Owner of this contract. Will set the same setting in the L2 Deposit contract via the cross domain messenger. msg.value must equal to l1CallValue.

Parameters:#

  • chainId: L2 network ID where Deposit contract is deployed.
  • l1Token: address of L1 Token to enable/disable deposits and relays for.
  • depositsEnabled: bool to set if the deposit box should accept/reject deposits.
  • l1CallValue: Amount of ETH to include in msg.value. Used to pay for L2 fees, but its exact usage varies depending on the L2 network that this contract sends a message to.
  • l2Gas: Gas limit to set for relayed message on L2.
  • l2GasPrice: Gas price bid to set for relayed message on L2.
  • Arbitrum: only: fee deducted from L2 sender's balance to pay for L2 gas.
whitelistToken(uint256 chainId, address l1Token, address l2Token, address bridgePool, uint256 l1CallValue, uint256 l2Gas, uint256 l2GasPrice, uint256 maxSubmissionCost) (public)

Privileged account can associate a whitelisted token with its linked token address on L2. The linked L2 token can thereafter be deposited into the Deposit contract on L2 and relayed via the BridgePool contract.

msg.value must equal to l1CallValue. This method is also used to to update the address of the bridgePool within a BridgeDepositBox through the re-whitelisting of a previously whitelisted token to update the address of the bridge pool in the deposit box. Only callable by Owner of this contract. Also initiates a cross-chain call to the L2 Deposit contract to whitelist the token mapping.

Parameters:#

  • chainId: L2 network ID where Deposit contract is deployed.
  • l1Token: Address of L1 token that can be used to relay L2 token deposits.
  • l2Token: Address of L2 token whose deposits are fulfilled by l1Token.
  • bridgePool: Address of BridgePool which manages liquidity to fulfill L2-->L1 relays.
  • l1CallValue: Amount of ETH to include in msg.value. Used to pay for L2 fees, but its exact usage varies depending on the L2 network that this contract sends a message to.
  • l2Gas: Gas limit to set for relayed message on L2.
  • l2GasPrice: Gas price bid to set for relayed message on L2.
  • Arbitrum: only: fee deducted from L2 sender's balance to pay for L2 gas.
depositContracts(uint256 chainId) โ†’ struct BridgeAdminInterface.DepositUtilityContracts (external)
whitelistedTokens(address l1Token, uint256 chainId) โ†’ address l2Token, address bridgePool (external)
_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)
owner() โ†’ address (public)

Returns the address of the current owner.

renounceOwnership() (public)

Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

transferOwnership(address newOwner) (public)

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

_transferOwnership(address newOwner) (internal)

Transfers ownership of the contract to a new account (newOwner). Internal function without access restriction.

_msgSender() โ†’ address (internal)
_msgData() โ†’ bytes (internal)
finder() โ†’ address (external)
optimisticOracleLiveness() โ†’ uint32 (external)
proposerBondPct() โ†’ uint64 (external)
identifier() โ†’ bytes32 (external)

Events#

OwnershipTransferred(address previousOwner, address newOwner)
SetDepositContracts(uint256 chainId, address l2DepositContract, address l2MessengerContract)
SetCrossDomainAdmin(uint256 chainId, address newAdmin)
SetRelayIdentifier(bytes32 identifier)
SetOptimisticOracleLiveness(uint32 liveness)
SetProposerBondPct(uint64 proposerBondPct)
WhitelistToken(uint256 chainId, address l1Token, address l2Token, address bridgePool)
SetMinimumBridgingDelay(uint256 chainId, uint64 newMinimumBridgingDelay)
DepositsEnabled(uint256 chainId, address l2Token, bool depositsEnabled)
BridgePoolsAdminTransferred(address[] bridgePools, address newAdmin)
SetLpFeeRate(address bridgePool, uint64 newLpFeeRatePerSecond)

Modifiers#

canRelay(uint256 chainId)
nonReentrant()

Prevents a contract from calling itself, directly or indirectly. Calling a nonReentrant function from another nonReentrant function is not supported. It is possible to prevent this from happening by making the nonReentrant function external, and making it call a private function that does the actual state modification.

nonReentrantView()

Designed to prevent a view-only method from being re-entered during a call to a nonReentrant() state-changing method.

onlyOwner()

Throws if called by any account other than the owner.