# Staking item result Delivered paths: - `src/ShareStaking.sol` - `test/ShareStaking.t.sol` - `artifacts/goal/batches/sepolia-staking-app/items/staking/result.md` Implemented `ShareStaking(address tokenAddress)` for an ERC-20-like token. The contract exposes the required `token()`, `stake(uint256)`, `withdraw(uint256)`, `stakedBalance(address)`, `totalStaked()`, and `pointsOf(address)` interfaces. It accrues 18-decimal points at one point per elapsed second across active stakers, proportionally to stake. A high-precision cumulative index, global remainder, and per-user remainder preserve fractional accrual; empty intervals advance the checkpoint but issue no points. Stake and withdrawal validate nonzero amounts, available token/stake balance, and successful token transfer, and emit `Staked`/`Withdrawn` events. Added self-contained Foundry tests with `LocalToken`. They assert the requested A/B schedule (A earns `12e18`, B earns `6e18`) and cover partial exit, full exit, an idle pool, re-entry, and retained points. Next worker interfaces: - Deploy with `new ShareStaking(tokenAddress)` after the `test` ERC-20 is deployed. - Users must call the token's `approve(stakingAddress, amount)` before `stake(amount)`. - Read points with `pointsOf(user)`; all token and point values are `uint256` with 18 decimals. Checks run: - An initial `forge test --match-path test/ShareStaking.t.sol -vvv` run found a rounding loss in `test/ShareStaking.t.sol` at the `points after full withdrawal` assertion (`5999999999999999999` rather than `6e18`). The accumulator was updated to retain global and per-user fractional credit. - `forge fmt --check src/ShareStaking.sol test/ShareStaking.t.sol` — passed; no files changed. - `forge test --match-path test/ShareStaking.t.sol -vvv` — passed: 2 tests, 0 failures. - `git diff --check` — passed with no whitespace errors. No merged-trunk-only check is required for this isolated contract and test pair. This checkout contained no broader project test configuration beyond Foundry defaults, so a future merged-trunk worker may additionally run the repository-wide `forge test`.