Staking Architecture
This section describes the technical implementation of staking operations in SAI Wallet: contract contour, transaction assembly and execution, correctness rules, and position update mechanisms.
The user model (strategy selection, quota and result display) is described in the key features section:
Yield.
Role of Staking in Overall Architecture
Staking is implemented as a set of unified operations integrated into the general SAI Wallet approach: a complex operation is described as a workflow of steps with statuses and recovery support.
Related sections:
- Wallet Architecture — layers and responsibility boundaries
- Cross-chain Workflow — state model, steps, and execution rules
Invariants and Execution Constraints
When executing staking operations, the following invariants are used:
- asset is identified by network context (network + contract + decimals);
- for EVM networks, the need for allowance/approve is accounted for if the strategy requires token withdrawal;
- quota fixes parameters and assumptions (strategy identifier, limits, deadline/execution constraints) for result reproducibility;
- route costs and protocol/application fees are reflected separately.
Observability and Position Updates
Position updates are performed based on network data:
- transaction statuses and receipts;
- contract events (router/adapter/position accounting contract, if used);
- cross-chain step confirmations (if the operation includes messaging).
It is recommended to distinguish:
- execution error (revert/step rejection),
- observability error (data delay from RPC/indexer side with an already sent transaction).
Extensibility: Adding a New Strategy (Technically)
Adding a new strategy at the architecture level includes:
- registering the strategy in the catalog (metadata, network, asset, constraints);
- connecting an adapter implementing the IStake interface;
- defining quota parameters and position format;
- configuring monitoring and position updates by transactions and events, including cross-chain confirmations if necessary.
Thus, new strategies are added without changing the user flow: “strategy selection → quota → execution → position”.