feat(example): MockPendleRouter contract + deploy runbook (scenario A unblock)#20
Open
mike-diamond wants to merge 1 commit into
Open
feat(example): MockPendleRouter contract + deploy runbook (scenario A unblock)#20mike-diamond wants to merge 1 commit into
mike-diamond wants to merge 1 commit into
Conversation
…nario A The Buildathon demo app referenced MockPendleRouter (envelope-builder.ts imports getMockPendleRouterAddress, holds MOCK_PENDLE_ROUTER_ABI, points at contracts/src/MockPendleRouter.sol) but the contract and its deploy script did not exist - scenario A (Pendle yield swap) was undeployable. - contracts/src/MockPendleRouter.sol: deterministic 1:0.995 mock matching the ABI the app already expects. Token-agnostic (no real transfers), emits SwapExactTokenForPt, reverts InsufficientPtOut below minPtOut. Apache-2.0. - contracts/script/DeployMockPendleRouter.s.sol: Arbitrum Sepolia deploy script. - contracts/test/MockPendleRouter.t.sol: 5 tests incl. an end-to-end agent-signed envelope -> AgentPolicyGate -> router integration test. - DEPLOY.md: full copy-paste deploy runbook (both chains, allow-list step, signer-pair pre-check, deployed.json + decoder-data wiring, smoke test). - contracts/README.md: pointer to DEPLOY.md. Verification: forge test 20 passed (15 gate + 5 router), app tsc --noEmit clean. Contracts still need a funded-key deploy (Mike) - see DEPLOY.md.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Makes the Buildathon demo's scenario A (Pendle yield swap) actually deployable + runnable, and pre-writes the full deploy runbook so the on-chain deploy (which needs Mike's funded key) is copy-paste.
The gap: the app already referenced
MockPendleRouter(src/agent/envelope-builder.tsimportsgetMockPendleRouterAddress, holdsMOCK_PENDLE_ROUTER_ABI, and comments point atcontracts/src/MockPendleRouter.sol), but the contract and its deploy script did not exist. Scenario A could not be deployed end-to-end.Changes
contracts/src/MockPendleRouter.solSwapExactTokenForPt, revertsInsufficientPtOutbelowminPtOut. Apache-2.0.contracts/script/DeployMockPendleRouter.s.solcontracts/test/MockPendleRouter.t.solagent-signed envelope -> AgentPolicyGate -> routerintegration test proving the scenario A on-chain path.DEPLOY.mddeployed.json+decoder-datawiring, post-deploycastverification, smoke test.contracts/README.mdDEPLOY.md.Verification
Mock fidelity
The mock's fixed 995/1000 rate is exactly what
buildPendleEnvelopeassumes: it setsminPtOut = amountIn * (10000 - slippageBps) / 10000, so any declared slippage of 50 bps or looser succeeds and anything tighter revertsInsufficientPtOut- the same shape a real router would present. The integration test pins the 50 bps boundary.What this does NOT do
forge scriptrun (Mike) - the whole point ofDEPLOY.md.buildRwaEnvelopestill throws "not implemented" (Phase 2 Day 10).DEPLOY.mddeploys the Robinhood gate only, for the multi-chain claim.Notes for review
MockPendleRouteris intentionally stateless and token-free. If you want the demo to show a real ERC-20 pull (approve + transferFrom), that is a larger change and would need a mock input token + an approve leg in the envelope.DEPLOY.mdflags the two silent-failure traps explicitly: skipping the allow-list, and a signer-pair mismatch. Both compile + deploy fine and only revert at execute time.Leaving this open for your review - not merging.