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.

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

Commit

This event is emitted when a commit is done.

Copy
Copied!
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.

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

Claim

This event is emitted when a claim is claimed.

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

CreateAccountCommit

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

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

AddClaimAttestation

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

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

AddCreateAccountAttestation

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

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

Credit

This event is emitted when witness rewards are distributed.

Copy
Copied!
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.

Copy
Copied!
event CreateAccount(address indexed receiver, uint256 value);

Data Types

AttestationClaimData

The data for a single attestation event.

Copy
Copied!
struct AttestationClaimData {
    address destination;
    uint256 amount;
}

ClaimData

The data for a claim.

Copy
Copied!
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.

Copy
Copied!
struct AddClaimAttestationData {
    uint256 claimId;
    uint256 amount;
    address sender;
    address destination;
}

CreateAccountData

The data for a create account event.

Copy
Copied!
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.

Copy
Copied!
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.

Copy
Copied!
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.

Copy
Copied!
mapping(address => CreateAccountData) public createAccounts;

_safe

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

Copy
Copied!
GnosisSafeL2 public _safe;

_tokenAddress

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

Copy
Copied!
address public _tokenAddress;

_lockingChainDoor

Address of the locking chain door.

Copy
Copied!
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.

Copy
Copied!
address public _lockingChainIssuer;

_lockingChainIssue

The token code on the locking chain.

Copy
Copied!
string public _lockingChainIssue;

_issuingChainDoor

The address of the issuing chain door.

Copy
Copied!
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.

Copy
Copied!
address public _issuingChainIssuer;

_issuingChainIssue

The token code on the issuing chain.

Copy
Copied!
string public _issuingChainIssue;

_isLocking

True if the current chain is a locking chain.

Copy
Copied!
bool public _isLocking;

_signatureReward

The witness signers reward per attestation.

Copy
Copied!
uint256 public _signatureReward;

_minAccountCreateAmount

The minimum amount for a create account operation.

Copy
Copied!
uint256 public _minAccountCreateAmount;

Call XChain Functions

createClaimId()

Analog function of the XChainCreateClaimID transaction.

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

commit()

Analog function of the XChainCommit transaction.

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

commitWithoutAddress()

Analog function of the XChainCommit without address transaction.

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

claim()

Analog function of the XChainClaim transaction.

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

createAccountCommit()

Analog function of the XChainCreateAccountCommit transaction.

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

addClaimAttestation()

Analog function of the XChainAddAttestation transaction for claims.

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

addCreateAccountAttestation()

Analog function of the XChainAddAttestation transaction for create accounts.

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

addAttestation()

Analog function of the XChainAddAttestation transaction for multiple attestations.

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

sendTransaction()

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

sendAssets()

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

View Functions

getWitnesses()

Retrieve witness servers adresses.

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

Ownership Management Functions

pause()

Pause the bridge door contract.

Copy
Copied!
function pause() public onlyOwner whenNotPaused;

unpause()

Unpause the bridge door contract.

Copy
Copied!
function unpause() public onlyOwner whenPaused;

execute()

Make or delegate a call on the bridge door contract.

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