Bridge Door Interface

Attention

The XRPL EVM compatible sidechain implementation is a proof of concept extension to the XRP Ledger protocol and is for development purposes only. There is no official amendment currently and it is not available on the production Mainnet. The EVM compatible sidechain bridge is connected to the XRP Ledger Devnet. Do not send transactions in Mainnet.

Events

CreateClaim

This event is emitted when a claim is created.

event CreateClaim(uint256 indexed claimId, address indexed creator, address indexed sender);

Commit

This event is emitted when a commit is done.

event Commit(uint256 indexed claimId, address indexed sender, uint256 value, address receiver);

CommitWithoutAddress

This event is emitted when a commit is done, but no address was specified.

event CommitWithoutAddress(uint256 indexed claimId, address indexed sender, uint256 value);

Claim

This event is emitted when a claim is claimed.

event Claim(uint256 indexed claimId, address indexed sender, uint256 value, address destination);

CreateAccountCommit

This event is emitted when a create account commit is done.

event CreateAccountCommit(address indexed creator, address indexed destination, uint256 value, uint256 signatureReward);

AddClaimAttestation

This event is emitted when a witness performs a claim attestation.

event AddCreateAccountAttestation(address indexed witness, address indexed receiver, uint256 value);

AddCreateAccountAttestation

This event is emitted when a witness performs a create account attestation.

event AddCreateAccountAttestation(address indexed witness, address indexed receiver, uint256 value);

Credit

This event is emitted when witness rewards are distributed.

event Credit(uint256 indexed claimId, address indexed receiver, uint256 value);

CreateAccount

This event is emitted when an account is created after receiving enough create account attestations.

event CreateAccount(address indexed receiver, uint256 value);

Data Types

AttestationClaimData

The data for a single attestation event.

struct AttestationClaimData {
    address destination;
    uint256 amount;
}

ClaimData

The data for a claim.

struct ClaimData {
    address creator; // Address that has created the claim
    address sender; // address that will send the transaction on the other chain
    mapping(address => AttestationClaimData) attestations; // Attestations made
    bool exists; // Control flag
}

AddClaimAttestationData

The data for a claim attestation.

struct AddClaimAttestationData {
    uint256 claimId;
    uint256 amount;
    address sender;
    address destination;
}

CreateAccountData

The data for a create account event.

struct CreateAccountData {
    uint256 signatureReward; // The signature reward for the create account
    mapping(address => uint256) attestations; // Attestations made [witness address] => amount
    bool isCreated; // If the create account has already been created
    bool exists; // Control flag
}

AddCreateAccountAttestationData

The data for a create account attestation.

struct AddCreateAccountAttestationData {
    address destination;
    uint256 amount;
    uint256 signatureReward;
}

Storage

claims

Mapping that contains the information for all claim events. The keys are the claim IDs, and the values are the data for each claim.

mapping(uint256 => ClaimData) public claims;

createAccounts

Mapping that contains the information for all create account events. The keys are the addresses of accounts created, and the values are the data for each create account.

mapping(address => CreateAccountData) public createAccounts;

_safe

The address of the safe attached to this bridge door contract.

GnosisSafeL2 public _safe;

_tokenAddress

If the bridge isn't an XRP bridge, then the address of the ERC20 token associated with the bridge.

address public _tokenAddress;

_lockingChainDoor

Address of the locking chain door.

address public _lockingChainDoor;

_lockingChainIssuer

If the locking chain door is on the XRPL, then this is the address of the issuer on the XRPL. Otherwise, it's the token address on the locking chain.

address public _lockingChainIssuer;

_lockingChainIssue

The token code on the locking chain.

string public _lockingChainIssue;

_issuingChainDoor

The address of the issuing chain door.

address public _issuingChainDoor;

_issuingChainIssuer

If the issuing chain door is on the XRPL, then this is the address of the issuer on the XRPL. Otherwise, it's the token address on the issuing chain.

address public _issuingChainIssuer;

_issuingChainIssue

The token code on the issuing chain.

string public _issuingChainIssue;

_isLocking

True if the current chain is a locking chain.

bool public _isLocking;

_signatureReward

The witness signers reward per attestation.

uint256 public _signatureReward;

_minAccountCreateAmount

The minimum amount for a create account operation.

uint256 public _minAccountCreateAmount;

Call XChain Functions

createClaimId()

Analog function of the XChainCreateClaimID transaction.

function createClaimId(address sender) public virtual payable returns(uint256);

commit()

Analog function of the XChainCommit transaction.

function commit(address receiver, uint256 claimId, uint256 amount) public virtual payable;

commitWithoutAddress()

Analog function of the XChainCommit without address transaction.

function commitWithoutAddress(uint256 claimId, uint256 amount) public virtual payable;

claim()

Analog function of the XChainClaim transaction.

function claim(uint256 claimId, uint256 amount, address destination) public virtual;

createAccountCommit()

Analog function of the XChainCreateAccountCommit transaction.

function createAccountCommit(address destination, uint256 amount, uint256 signatureReward) public virtual payable;

addClaimAttestation()

Analog function of the XChainAddAttestation transaction for claims.

function addClaimAttestation(uint256 claimId, uint256 amount, address sender, address destination) public virtual;

addCreateAccountAttestation()

Analog function of the XChainAddAttestation transaction for create accounts.

function addCreateAccountAttestation(address destination, uint256 amount, uint256 signatureReward) public virtual;

addAttestation()

Analog function of the XChainAddAttestation transaction for multiple attestations.

function addAttestation(
        AddClaimAttestationData[] memory claimAttestations,
        AddCreateAccountAttestationData[] memory createAccountAttestations
    ) public virtual;

sendTransaction()

function sendTransaction(address payable destination, uint256 value) virtual internal;

sendAssets()

function sendAssets(address destination, uint256 amount) virtual internal;

View Functions

getWitnesses()

Retrieve witness servers adresses.

function getWitnesses() public virtual view returns (address[] memory);

Ownership Management Functions

pause()

Pause the bridge door contract.

function pause() public onlyOwner whenNotPaused;

unpause()

Unpause the bridge door contract.

function unpause() public onlyOwner whenPaused;

execute()

Make or delegate a call on the bridge door contract.

function execute(
    address to,
    uint256 value,
    bytes memory data,
    Enum.Operation operation
) public onlyOwner returns (bool success);