Contract 64d4551dcd3dfe17e0bd5021bc2ce99c353d50689d44768b97eb25a59046dae4

← Back to Index 📥 Download WASM

Meta

cliver 28.1.0#c0f4d0da891bbf214c08b8c5035ae6db80e9a3bd
rssdk_spec_shaking 2
rssdkver 26.1.1#8ac18efb681a1c0b4b85a38c5a380300344e3f39
rsver 1.96.0

Instances

  • CDL4XYNVH4V2Q4KDPJXAH57RRF4447MAQY5S7I2XXHDN5ILCGL3TVFXN

Interface

Returns currently accrued protocol fees.

fn fees(env: soroban_sdk::Env) -> i128

Returns the current owner.

fn owner(env: soroban_sdk::Env) -> Option

Advances the rollup state to a new block hash and posts new withdrawable balances plus fees.

Arguments

  • env - Access to the Soroban environment.
  • old_block_hash - Expected current block hash.
  • new_block_hash - New block hash to commit.
  • new_withdrawal_credits - Recipients and amounts of the newly posted withdrawal allowances.
  • new_withdrawal_sum - Sum of all new withdrawal amounts.
  • new_fees - Fees accrued in the new rollup block.

Errors

  • [ContractError::NewBlockHashEmpty] - If new_block_hash is zero.
  • [ContractError::OldBlockHashMismatch] - If old_block_hash does not match the currently stored block hash.
  • [ContractError::BlockHashUnchanged] - If the new block hash is equal to the old block hash.
  • [ContractError::ArrayLengthExceedsLimit] - If more than 100 withdrawal credits are posted.
  • [ContractError::WithdrawalSumMismatch] - If the provided new_withdrawal_sum does not match the calculated total.
  • [ContractError::InsufficientBalance] - If the contract balan
fn rollup(
    env: soroban_sdk::Env,
    old_block_hash: soroban_sdk::BytesN<32>,
    new_block_hash: soroban_sdk::BytesN<32>,
    new_withdrawal_credits: soroban_sdk::Vec,
    new_withdrawal_sum: i128,
    new_fees: i128,
) -> Result<(), ContractError>

Deposits collateral into the rollup.

Arguments

  • env - Access to the Soroban environment.
  • user - Address providing the deposit.
  • amount - Amount of collateral token to deposit.

Errors

  • [ContractError::DepositAmountMustBePositive] - If amount <= 0.

Notes

  • Authorization from user is required.
fn deposit(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    amount: i128,
) -> Result<(), ContractError>

Recovers non-collateral tokens that were sent to the contract.

Arguments

  • env - Access to the Soroban environment.
  • token_address - Token contract to recover.
  • to - Recipient of the recovered tokens.
  • amount - Amount to recover.

Errors

  • [ContractError::CannotRecoverCollateral] - If token_address is the configured collateral token.
  • [ContractError::RecoverAmountMustBePositive] - If amount <= 0.

Notes

  • Owner authorization is required.
fn recover(
    env: soroban_sdk::Env,
    token_address: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
) -> Result<(), ContractError>

Replaces the contract Wasm with new_wasm_hash. Requires authorization from the owner.

fn upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
    operator: soroban_sdk::Address,
)

Withdraws the full posted allowance for user.

Arguments

  • env - Access to the Soroban environment.
  • user - Address withdrawing its allowance.

Errors

  • [ContractError::NoWithdrawalAllowance] - If no positive allowance is available for user.

Notes

  • Authorization from user is required.
  • This method withdraws the full stored allowance and resets it to zero.
fn withdraw(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
) -> Result<(), ContractError>

Returns the height of the latest committed rollup block.

The constructor sets this to zero, and every [Self::rollup] increments it by one, so the value counts the blocks committed so far.

fn block_height(env: soroban_sdk::Env) -> u32

Collects all currently accrued protocol fees.

Arguments

  • env - Access to the Soroban environment.
  • to - Recipient of collected fees.

Errors

  • [ContractError::NoFeesToCollect] - If no positive fee balance is available.

Notes

  • Owner authorization is required.
  • Collected fees are removed from both Fees and TotalWithdrawable.
fn collect_fees(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
) -> Result<(), ContractError>

Initializes the rollup contract.

Arguments

  • env - Access to the Soroban environment.
  • collateral_token - Token contract used for deposits, withdrawals, and fees.
  • owner - Upgrade and admin authority for rollup updates and fee collection.

Errors

  • [ContractError::OwnerIsContract] - If owner is the address of this contract.

Notes

  • The latest block hash is initialized to the zero hash.
  • The block height is initialized to zero.
  • Fees and total withdrawable balances are initialized to zero.
fn __constructor(
    env: soroban_sdk::Env,
    collateral_token: soroban_sdk::Address,
    owner: soroban_sdk::Address,
)

Accepts a pending ownership transfer.

Arguments

  • env - Access to the Soroban environment.
fn accept_ownership(env: soroban_sdk::Env)

Returns the latest committed rollup block hash.

fn latest_block_hash(env: soroban_sdk::Env) -> soroban_sdk::BytesN<32>

Returns the current collateral-token balance held by the contract.

fn collateral_balance(env: soroban_sdk::Env) -> i128

Rejects ownership renunciation.

Errors

  • [ContractError::RenounceOwnershipDisabled] - Always returned.
fn renounce_ownership(env: soroban_sdk::Env) -> Result<(), ContractError>

Returns the total amount currently reserved for user withdrawals plus accrued fees.

fn total_withdrawable(env: soroban_sdk::Env) -> i128

Initiates a 2-step ownership transfer.

The proposed new owner must later call [Self::accept_ownership] to complete the transfer.

Arguments

  • env - Access to the Soroban environment.
  • new_owner - Proposed new owner.
  • live_until_ledger - Ledger until which the pending transfer can be accepted.

Notes

  • Authorization is enforced internally by the ownable library.
fn transfer_ownership(
    env: soroban_sdk::Env,
    new_owner: soroban_sdk::Address,
    live_until_ledger: u32,
)

Returns the current withdrawal allowance for user.

fn withdrawal_allowances(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128

Imports

WebAssembly Text (WAT) ▶