chore: Implement VedaAdapter#166
Open
MoMannn wants to merge 27 commits into
Open
Conversation
McOso
reviewed
Apr 3, 2026
| * @param _amount The amount of tokens to recover | ||
| * @param _recipient The address to receive the recovered tokens | ||
| */ | ||
| function withdrawEmergency(IERC20 _token, uint256 _amount, address _recipient) external onlyOwner { |
Member
There was a problem hiding this comment.
hmm im thinking we get rid of this function. It doesnt seem possible for tokens to be left in this contract without the tx reverting, since it's atomic. If we remove, it really makes the adapter clean and lightweight, removes the need for owner / state.
Member
Author
There was a problem hiding this comment.
This is in case of someone sending tokens directly to the contract (mistaking it for EOA).
hanzel98
reviewed
Apr 4, 2026
hanzel98
reviewed
Apr 4, 2026
… into chore-veda-adapter
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ede87fa. Configure here.
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.

What?
VedaAdapter.sol— a new adapter contract for delegation-based deposits and withdrawals on Veda BoringVaultIVedaTeller.sol— minimal interface for Veda's TellerWithMultiAssetSupportVedaLending.t.sol— comprehensive test suite (fork tests, happy paths, input validation, events, batch operations, edge cases, 3-level delegation chain, terms validation, replay prevention, slippage protection, alternative delegator)BatchDepositExecutedandBatchWithdrawExecutedevents for off-chain indexing of batch operationsWhy?
How?
DelegationMetaSwapAdapter_parseERC20TransferTermshelper, which validates that terms are at least 52 bytes (ERC20TransferAmountEnforcer format) before reading with assemblyteller.deposit()to mint shares directly to the root delegatorteller.withdraw()to burn shares and send the desired underlying output asset to the root delegator. The output token is passed as a function parameter (distinct from the vault share token in the caveat)depositByDelegationBatch/withdrawByDelegationBatch, each emitting a batch-level event alongside per-streamDepositExecuted/WithdrawExecutedeventswithdrawEmergency(owner-only) for recovering tokens accidentally sent to the contractNote
Note
High Risk
Introduces a new on-chain adapter that redeems delegation chains to transfer ERC20s/vault shares and then calls into an external Veda Teller, including unlimited vault allowance management; mistakes could enable unintended asset movement if delegations/caveats are mis-specified.
Overview
Adds
VedaAdapter, a new delegation-powered adapter that redeems a provided delegation chain to pull eitherdepositToken(for deposits) or vault shares (for withdrawals) into the adapter, then calls Veda’steller.deposit/teller.withdrawto mint/burn shares for the root delegator; also adds batch variants (depositByDelegationBatch/withdrawByDelegationBatch) and an owner-onlywithdrawEmergency+ensureAllowancefail-safe.Introduces
IVedaTeller, a deploy script (DeployVedaAdapter.s.sol), and a large Arbitrum-fork test suite (VedaLending.t.sol) covering happy paths, validation/reverts, events (including new batch-level events), replay/slippage behaviors, and multi-hop delegation chains; CI is updated to passARBITRUM_RPC_URL/RPC_API_KEY, and.env.examplegains Veda-specific addresses.Reviewed by Cursor Bugbot for commit ede87fa. Bugbot is set up for automated code reviews on this repo. Configure here.