chore: Implement VedaAdapter#166
Open
MoMannn wants to merge 29 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
Medium Risk
Introduces a new funds-moving adapter (
VedaAdapter) that redeems delegations to transfer ERC20s/vault shares and calls into external Veda contracts; any mistakes in terms parsing, delegation assumptions, or approvals could lead to loss of funds. Risk is mitigated by extensive fork-based tests and input validation, but the surface area is still security-sensitive.Overview
Adds a new
VedaAdaptercontract to support delegation-based deposits/withdrawals into Veda’s BoringVault viaIDelegationManager.redeemDelegations, including batch variants (depositByDelegationBatch/withdrawByDelegationBatch) and per-stream + batch events for indexing.The adapter now parses transfer amounts from the leaf delegation’s first caveat terms (ERC20TransferAmountEnforcer format) and includes owner-only safety utilities (
ensureAllowanceto restore max vault allowance;withdrawEmergencyto recover stuck tokens).Also adds a minimal
IVedaTellerinterface, a deployment script (DeployVedaAdapter.s.sol), and a large Arbitrum-fork test suite covering happy paths, validation/reverts, events, batching, replay prevention, and allowance behavior; CI and.env.exampleare updated with required Veda/Arbitrum RPC env vars.Reviewed by Cursor Bugbot for commit d6fe82a. Bugbot is set up for automated code reviews on this repo. Configure here.