# 5.4 IBC-Ripple

**Contract Interface**

```javascript
  struct Withdrawal {
        uint wtype; // 0: default, 1: send to cold
        address user;
        address extraUser;
        bytes from;
        bytes dest;
        bytes tag;
        uint amount;
        bool validated;
        bool isCanceled;
        uint fee;
        uint seq;
        mapping(address => bytes32) signatureHashs;
    }

    struct Suggestion {
        address[] validators;
        bytes32[] signatureHashs;
        uint fee;
        uint seq;
    }

    mapping(bytes32 => bool) public isDeposited;
    mapping(uint => Withdrawal) public withdrawals;
    mapping(uint => mapping(uint => Suggestion)) public suggestions;

    bool public isActivated = true;
    uint public withdrawalCount;
    uint public suggestCount;
    uint public lastWithdrew;
    uint public lastSelected;
    uint public lastSequence;
    uint public xrpBalance;
    uint public holdingLimit;
    bytes public xrpWallet;

    bytes coldAddr;
    bytes32 public tSummary = sha256(abi.encodePacked('XRP', address(1)));
    
    event XrpDepositRelay(bytes32 txid, bytes xrpWallet, address toAddr, uint amount, address extraToAddr);
    event XrpDepositValidated(bytes32 txid, bytes xrpWallet, address toAddr, uint amount, address extraToAddr);
    event XrpDepositColdRelay(bytes32 txid, bytes xrpWallet, uint amount);
    event XrpDepositColdValidated(bytes32 txid, bytes xrpWallet, uint amount);
    event XrpWithdrawAdded(uint withdrawId, address balanceAddr, uint withdrawIndex, bytes xrpWallet, uint wtype, address user, address extraUser, bytes dest, bytes tag, uint amount);
    event XrpWithdrawSuggested(uint suggestIndex, uint withdrawIndex, address[] validators, bytes32[] sigHashs, uint fee, uint seq);
    event XrpSuggestionValidated(uint suggestIndex, uint withdrawIndex, uint fee, uint seq);
    event XrpWithdrawValidated(uint withdrawIndex);
    event XrpTransactionFailed(uint withdrawIndex);
    event XrpWithdrawCanceled(uint withdrawIndex);

    function relayDeposit(bytes32 txid, address toAddr, uint amount, address extraToAddr) public onlyActivated
    function relayDepositCold(bytes32 txid, uint amount) public onlyActivated
    function validateDeposit(bytes32 txid, address toAddr, uint amount, address extraToAddr, address validator, uint8 vSig, bytes32 rSig, bytes32 sSig) public
    function validateDepositCold(bytes32 txid, uint amount, address validator, uint8 vSig, bytes32 rSig, bytes32 sSig) public
    function withdraw(uint withdrawId, address user, bytes32 tokenSummary, bytes memory destination, uint amount, bytes memory comment) public onlyActivated
    function withdraw(uint withdrawId, address user, address extraUser, bytes32 tokenSummary, bytes memory destination, uint amount, bytes memory comment) public onlyActivated
    function transferToCold() public
    function suggestWithdraw(uint withdrawIndex, address[] memory validators, bytes32[] memory sigHashs, uint fee, uint seq) public
    function relaySuggestion(uint withdrawIndex, uint suggestIndex) public
    function validateSuggestion(uint withdrawIndex, uint suggestIndex, address validator, uint8 vSig, bytes32 rSig, bytes32 sSig) public
    function relayWithdraw(uint suggestIndex, uint withdrawIndex) public
    function validateWithdraw(uint withdrawIndex, address validator, uint8[] memory vSigs, bytes32[] memory rSigs, bytes32[] memory sSigs) public
    function relayTransactionFailed(uint withdrawIndex) public
    function cancelWithdraw(uint withdrawIndex, address validator, uint8 vSig, bytes32 rSig, bytes32 sSig) public
    
    function withdrawIndexToSuggest() public view returns(uint)
    function withdrawIndexToSign() public view returns(uint)
    function getSuggestionValidators(uint withdrawIndex, uint suggestIndex) public view returns (address[] memory)
    function getSuggestionSigHashs(uint withdrawIndex, uint suggestIndex) public view returns (bytes32[] memory)
    function getSignatureHash(uint withdrawIndex, address validator) public view returns (bytes32)
```
