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.
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.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 balanfn 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.
env - Access to the Soroban environment.user - Address providing the deposit.amount - Amount of collateral token to deposit.ContractError::DepositAmountMustBePositive] - If amount <= 0.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.
env - Access to the Soroban environment.token_address - Token contract to recover.to - Recipient of the recovered tokens.amount - Amount to recover.ContractError::CannotRecoverCollateral] - If token_address is the
configured collateral token.ContractError::RecoverAmountMustBePositive] - If amount <= 0.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.
env - Access to the Soroban environment.user - Address withdrawing its allowance.ContractError::NoWithdrawalAllowance] - If no positive allowance is
available for user.user is required.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.
env - Access to the Soroban environment.to - Recipient of collected fees.ContractError::NoFeesToCollect] - If no positive fee balance is
available.Fees and TotalWithdrawable.fn collect_fees(
env: soroban_sdk::Env,
to: soroban_sdk::Address,
) -> Result<(), ContractError>
Initializes the rollup contract.
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.ContractError::OwnerIsContract] - If owner is the address of
this contract.fn __constructor(
env: soroban_sdk::Env,
collateral_token: soroban_sdk::Address,
owner: soroban_sdk::Address,
)
Accepts a pending ownership transfer.
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.
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.
env - Access to the Soroban environment.new_owner - Proposed new owner.live_until_ledger - Ledger until which the pending transfer can be
accepted.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