Add staking-vault skill — deploy your own ERC-4626 staking vault#381
Open
0xAxiom wants to merge 24 commits into
Open
Add staking-vault skill — deploy your own ERC-4626 staking vault#3810xAxiom wants to merge 24 commits into
0xAxiom wants to merge 24 commits into
Conversation
…T.md - Updated SKILL.md with complete API reference (700+ lines) - Updated HEARTBEAT.md with detailed automation checklist - Added copy-paste ready code snippets for all major languages - Included comprehensive error handling and troubleshooting - Added performance analytics and copy-trading strategies - Complete integration examples for Bankr wallet and Net Protocol Supports: signal publishing, copy-trading, provider registration, performance tracking, webhooks, cross-posting to Net Protocol feeds.
- Transaction-verified trading signals on Base - Complete API coverage: registration, signal publishing, leaderboards - Copy-paste ready code snippets for bash/JS - Heartbeat integration examples - Real-time polling and webhook support - Cross-integration with Bankr and Net Protocol skills Addresses agent onboarding by making trading signals discoverable to all OpenClaw agents.
Generic, parameterized port of the StakedAxiom (xAXIOM) contract any agent can lift, configure, and ship for their own ERC-20. - src/StakingVault.sol — ERC-4626 vault, ~200 lines. Aave-style cooldown, JIT-resistant (cooldown rebases on inbound shares), inflation-attack hardened (_decimalsOffset = 6), Ownable2Step. Owner can adjust cooldown params (bounded) and rescue non-stake tokens. Cannot mint, burn, pause, upgrade, or rescue the stake token. - script/Deploy.s.sol — env-driven forge script (STAKE_TOKEN, OWNER, VAULT_NAME, VAULT_SYMBOL, COOLDOWN_PERIOD, WITHDRAW_WINDOW). - test/StakingVault.t.sol — 24 forge tests, all passing on solc 0.8.28 with OZ 5.6.1. Covers share math, pro-rata rewards, cooldown gating, JIT regression, inflation-attack mitigation, ERC-4626 spec compliance. - scripts/init.sh — installs forge-std + OZ, builds, runs tests. - scripts/deploy.sh — wraps forge script with .env loading; supports base / base_sepolia / mainnet. - references/SECURITY.md — full audit (1 critical, 1 medium, 1 low accepted, 1 informational — all fixed and regression-tested). - references/integration.md — reward-flow patterns (cron / streaming / governance), frontend display notes, operational checklist. Reward distribution is a single `stakeToken.transfer(vault, amount)` call that rebases share price pro rata — no claim step, no reward debt, no per-holder gas. ERC-4626 spec-compliant so aggregator UIs (Yearn, Beefy, Morpho) work out of the box. Reference deployment: xAXIOM on Base, frontend at clawbots.org/stake.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Generic, parameterized port of the StakedAxiom (xAXIOM) contract that any agent or project can lift, configure, and ship as a share-price-rebase staking vault for their own ERC-20.
Reward distribution = single
stakeToken.transfer(vault, amount)call that rebases share price pro rata. No claim step, no reward debt, no per-holder gas. ERC-4626 spec-compliant so aggregator UIs (Yearn, Beefy, Morpho) work out of the box.What's in the skill
src/StakingVault.sol— ERC-4626 vault, ~200 lines. Aave-style two-step cooldown, JIT-resistant (cooldown rebases on inbound shares — defeats the "tiny-cooldown-then-huge-deposit" attack), inflation-attack hardened (_decimalsOffset = 6),Ownable2Step. Owner can adjust cooldown params (bounded≤ 30 days/≥ 1 day) and rescue non-stake tokens. Cannot mint, burn, pause, upgrade, or rescue the stake token.script/Deploy.s.sol— env-driven forge script (STAKE_TOKEN,OWNER,VAULT_NAME,VAULT_SYMBOL, optionalCOOLDOWN_PERIOD/WITHDRAW_WINDOW).test/StakingVault.t.sol— 24 forge tests, all passing onsolc 0.8.28with OZ 5.6.1. Covers share math, pro-rata rewards, cooldown gating, JIT regression, transfer-during-cooldown blocking, inflation-attack mitigation, and ERC-4626maxRedeem/maxWithdrawspec compliance.scripts/init.sh— installsforge-std+OpenZeppelin/openzeppelin-contracts, builds, runs tests.scripts/deploy.sh— wrapsforge scriptwith.envloading; supportsbase/base_sepolia/mainnet.references/SECURITY.md— full audit findings (1 critical, 1 medium, 1 low accepted, 1 informational — all fixed and regression-tested).references/integration.md— reward-flow patterns (daily cron / streaming / governance), frontend display notes (convertToAssetsfor user balances,cooldownStatusfor UI state machine), operational checklist.Reference deployment
Originally deployed as xAXIOM on Base. Live frontend at https://clawbots.org/stake. This skill is the public, generalized port —
nameandsymbollifted to constructor args so any project can spin up their ownxTokenwith their own ticker/cooldown.Test plan
forge buildclean on solc 0.8.28forge test -vv— 24/24 passingmaxRedeem/maxWithdrawspec-compliant (0 outside withdraw window)cooldownPeriodbeyondMAX_COOLDOWN = 30 daysor setwithdrawWindowbelowMIN_WITHDRAW_WINDOW = 1 daybash scripts/deploy.sh base_sepolia(requires deployer-side.env— not part of CI)🤖 Generated with Claude Code