xDai Bridge Management API

The following management interfaces are available for the validators of the xDai bridge.

Methods are described for contracts on the Eth Mainnet and the xDai bridge. They include methods for the following upgrade and management functionality.

Upgrade the bridge contracts implementation:

The contract on the ETH Mainnet:

Address

Explorers

ABI

0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016

Blockscout

Etherscan

EternalStorageProxy ABI

Method

Description

upgradeTo

Upgrade the current implementation of the bridge contract to a new one. This method expects an integer which specifies the next implementation version and an Ethereum address where the next implementation was deployed.

upgradeToAndCall

Upgrade the current implementation of the bridge contract to a new one and automatically call a method in the new implementation. The method expects an integer specifying the next implementation version, an Ethereum address where the next implementation was deployed, and a set of bytes containing the selector of the method with the parameters ABI-encoded. The encoded method will be called on behalf of the proxy contract.

transferProxyOwnership

Changes the upgrade admin account whose operations are allowed to upgrade the bridge contract implementation. The method expects a new Ethereum address.

The contract on the xDai chain:

Address

Explorers

ABI

0x7301cfa0e1756b71869e93d4e4dca5c7d0eb0aa6

Blockscout

EternalStorageProxy ABI

Method

Description

upgradeTo

Upgrade the current implementation of the bridge contract to a new one. The method expects an integer specifying the next implementation version and an Ethereum address where the next implementation was deployed.

upgradeToAndCall

Upgrade the current implementation of the bridge contract to a new one and automatically call a method in the new implementation. The method expects an integer specifying the next implementation version, an Ethereum address where the next implementation was deployed, and a set of bytes containing the selector of the method with the parameters ABI-encoded. The encoded method will be called on behalf of the proxy contract.

transferProxyOwnership

Changes the upgrade admin account whose operations are allowed to upgrade the bridge contract implementation. The method expects a new Ethereum address.

Upgrade the validators contracts implementation:

The contract on the ETH Mainnet:

Address

Explorers

ABI

0xe1579dEbdD2DF16Ebdb9db8694391fa74EeA201E

Blockscout, Etherscan

EternalStorageProxy ABI

Method

Description

upgradeTo

Upgrade the current implementation of the bridge contract to a new one. The method expects an integer specifying the next implementation version and an Ethereum address where the next implementation was deployed.

upgradeToAndCall

Upgrade the current implementation of the bridge contract to a new one and automatically calls a method in the new implementation. The method expects an integer specifying the next implementation version, an Ethereum address where the next implementation was deployed, and a set of bytes containing the selector of the method with the parameters ABI-encoded. The encoded method will be called on behalf of the proxy contract.

transferProxyOwnership

Changes the upgrade admin account whose operations are allowed to upgrade the validators contract implementation. The method expects a new Ethereum address.

The contract on the xDai chain:

Address

Explorers

ABI

0xb289f0e6fbdff8eee340498a56e1787b303f1b6d

Blockscout

EternalStorageProxy ABI

Method

Description

`upgradeTo

Upgrade the current implementation of the bridge contract to a new one. The method expects an integer specifying the next implementation version and an Ethereum address where the next implementation is deployed.

upgradeToAndCall

Upgrade the current implementation of the bridge contract to a new one and automatically call a method in the new implementation. The method expects an integer numbering the next implementation version, an Ethereum address where the next implementation is deployed, and a set of bytes containing the selector of the method with the parameters ABI-encoded. The encoded method will be called on behalf of the proxy contract.

transferProxyOwnership

Changes the upgrade admin account whose operations are allowed to upgrade the validators contract implementation. The method expects a new Ethereum address.

Management of the bridge validators list and the number of required signatures:

The contract on the ETH Mainnet:

Address

Explorers

ABI

0xe1579dEbdD2DF16Ebdb9db8694391fa74EeA201E

Blockscout, Etherscan

BridgeValidators ABI

Method

Description

addValidator

Adds a new validator. The method expects the Ethereum address of the new validator. We recommend stopping all bridge instances prior to adding the new validator. The corresponding validator must also be added to the other side of the bridge.

removeValidator

Removes a validator. The method expects the address of the validator that needs to be removed. The operation will only be successful if the number of remaining validators remains greater or equal to the number of required signatures. We recommend stopping all bridge instances prior to removing a validator. The corresponding validator must also be removed on the other side of the bridge.

setRequiredSignatures

Sets the number of required signatures (the number of validators' confirmations). The method expects an integer. We recommend stopping all bridge instances prior to setting signatures. The number of required signatures must also be updated to this value on the other side of the bridge.

transferOwnership

Changes the management account whose operations are allowed to change parameters of the validators contract. The method expects a new Ethereum address.

The contract on the xDai chain:

Address

Explorers

ABI

0xb289f0e6fbdff8eee340498a56e1787b303f1b6d

Blockscout

BridgeValidators ABI

Method

Description

addValidator

Adds a new validator. The method expects an Ethereum address of the new validator. We recommend stopping all bridge instances prior to adding the new validator. The corresponding validator must also be added on the other side of the bridge.

removeValidator

Removes a validator. The method expects the address of the validator that needs to be removed. The operation will only be successful if the number of remaining validators remains greater or equal to the number of required signatures. We recommend stopping all bridge instances prior to removing a validator. The corresponding validator must also be removed on the other side of the bridge.

setRequiredSignatures

Sets the number of required signatures (the number of validators' confirmations). The method expects an integer. We recommend stopping all bridge instances prior to setting signatures. The number of required signatures must also be updated to this value on the other side of the bridge.

transferOwnership

Changes the management account whose operations are allowed to change parameters of the validators contract. The method expects a new Ethereum address.

Management of the bridge parameters:

The contract on the ETH Mainnet:

Address

Explorers

ABI

0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016

Blockscout, Etherscan

ForeignBridgeErcToNative ABI

Method

Description

setExecutionDailyLimit

Sets the daily limit on the amount of tokens that the bridge validators can request to unlock through confirmations. The method expects an integer - the amount of tokens. The value must be the same as the daily limit set on the other side of the bridge. This parameter is needed to secure the bridge from malicious validator actions.

setExecutionMaxPerTx

Sets the maximum number of tokens that bridge validators can request to unlock in one transaction. The method expects an integer - the amount of tokens. The value must be the same as the daily limit set on the other side of the bridge. This parameter is needed to secure the bridge from malicious validator actions.

setGasPrice

Sets the gas price used by the bridge instance to send transactions to the ETH Mainnet if the gas price oracle is not accessible. The method expects an integer - the gas price in Wei.

setRequiredBlockConfirmations

Sets the finalization threshold - the number of blocks after which the bridge instance considers the chain finalized and sends the confirmation for the corresponding transfer request. The method expects an integer.

transferOwnership

Changes the management account whose operations are allowed to change parameters of the bridge contract. The method expects a new Ethereum address.

claimTokens

Allows the user to transfer ether or ERC20 tokens sent to the bridge address by mistake. The method expects the Ethereum address of an ERC20 token contract and the Ethereum address of a token recipient. If ether is sent instead of tokens the token address account must be 0. The method will fail if the token address is the same as the address of the token contract used for bridge operations. Only the account that is able to upgrade the bridge contracts can call this method.

The contract on the xDai chain:

Address

Explorers

ABI

0x7301cfa0e1756b71869e93d4e4dca5c7d0eb0aa6

Blockscout

HomeBridgeErcToNative ABI

Method

Description

setDailyLimit

Sets the daily limit of xDai coins that can be transferred to the ETH Mainnet by the xDai chain users. The method expects an integer - the amount of coins in Wei. If this parameter is changed ExecutionDailyLimit must be set to the same value on the ETH Mainnet side.

setMaxPerTx

Sets the maximum amount of xDai coins that can be transferred to the ETH Mainnet by a chain user in one transaction. The method expects an integer - the amount of coins in Wei. If this parameter is changed ExecutionMaxPerTx must be set to the same value on the ETH Mainnet side.

setMinPerTx

Sets the minimum amount of xDai coins that can be transferred to the ETH Mainnet by a chain user in one transaction. The method expects an integer - the amount of coins in Wei. This parameter is needed to secure that the validators account is not dried out by transactions whose values are less than network fees.

setExecutionDailyLimit

Sets the daily limit of xDai coins that can be requested by the bridge validators to be minted through confirmations. The method expects an integer - the amount of tokens. This parameter is needed to secure the bridge from malicious validator actions.

setExecutionMaxPerTx

Sets the maximum amount of xDai coins that can be requested by the bridge validators to be minted in one transaction. The method expects an integer - the amount of tokens. This parameter is needed to secure the bridge from malicious validator actions.

setRequiredBlockConfirmations

Sets the finalization threshold - the number of blocks after which the bridge instance considers the chain finalized and sends the confirmation for the corresponding transfer request. The method expects an integer.

transferOwnership

Changes the management account whose operations are allowed to change parameters of the bridge contract. The method expects a new Ethereum address.

claimTokens

Allows the user to transfer xDai coins or ERC20 tokens sent to the bridge address by mistake. The method expects the Ethereum address of an ERC20 token contract and the Ethereum address of a token recipient. If ether should be sent instead of tokens the token address account must be 0. The method can only be called from the admin account able to upgrade bridge contracts.