-
-
Notifications
You must be signed in to change notification settings - Fork 109
chore: Implement VedaAdapter #166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
686b3b5
Implement VedaAdapter
MoMannn 89e74c4
basic boring on chain queue implementation
MoMannn 7dc2245
Move to arbitrum mainnet tests, implement new deposit function, remov…
MoMannn b0a56ed
Clean up docs, add batch events
MoMannn 5af6309
add arbitrum rpc to tests
MoMannn 0f8ee51
set API key in tests
MoMannn 25a8c19
add veda deployment script
MoMannn 7b3fb1d
Remove NotLeafDelegator check and add security consideration
MoMannn c022400
optimize inputs and add docs regarding senity check inputs
MoMannn 57120d5
additional tests and code optimization
MoMannn 4deb901
linter + fetching from latest block
MoMannn d3338bb
Merge branch 'main' into chore-veda-adapter
MoMannn 57b5b88
move deploy script to .env variables
MoMannn e412baf
fix teller docs
MoMannn 801ab0d
remove unnecesarry caller variable
MoMannn 16edf2a
update docs
MoMannn 51f1654
Update approval logic to unlimited
MoMannn 01be197
Merge branch 'chore-veda-adapter' of https://github.com/MetaMask/dele…
MoMannn 1f1182e
Use calldata instead of memory for external function array parameters
MoMannn adb6c64
Eliminate single-use encodedTransfer_ local variable
MoMannn 231e1de
Fix _ensureAllowance
MoMannn aba8aa5
fixate veda adapter deposit / withdrawal token in constructor
MoMannn 6301f8c
Merge branch 'main' of https://github.com/MetaMask/delegation-framewo…
MoMannn 077acc4
add veda adapter audit
MoMannn edf55c3
gas optimization - max approve in constructor
MoMannn f0c77d1
add monad specific deployment changes
MoMannn ede87fa
Merge branch 'main' into chore-veda-adapter
MoMannn 972d2c9
remove unnecessary parameter from event
MoMannn d6fe82a
Merge branch 'chore-veda-adapter' of https://github.com/MetaMask/dele…
MoMannn e2227ef
Veda adapter deployment
MoMannn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Binary file not shown.
85 changes: 85 additions & 0 deletions
85
broadcast/DeployVedaAdapter.s.sol/143/run-1780040823916.json
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| // SPDX-License-Identifier: MIT AND Apache-2.0 | ||
| pragma solidity 0.8.23; | ||
|
|
||
| import "forge-std/Script.sol"; | ||
| import { console2 } from "forge-std/console2.sol"; | ||
|
|
||
| import { VedaAdapter } from "../src/helpers/VedaAdapter.sol"; | ||
|
|
||
| /** | ||
| * @title DeployVedaAdapter | ||
| * @notice Deploys the VedaAdapter contract. | ||
| * @dev Fill the required variables in the .env file | ||
| * @dev run the script with: | ||
| * forge script script/DeployVedaAdapter.s.sol --rpc-url <your_rpc_url> --private-key $PRIVATE_KEY --broadcast | ||
| * For deploying on monad add --skip-simulation, because of how monad works the simulation fails because the token is not activated. | ||
| */ | ||
| contract DeployVedaAdapter is Script { | ||
| bytes32 salt; | ||
| address deployer; | ||
| address vedaAdapterOwner; | ||
| address delegationManager; | ||
| address boringVault; | ||
| address vedaTeller; | ||
| address depositToken; | ||
|
|
||
| function setUp() public { | ||
| salt = bytes32(abi.encodePacked(vm.envString("SALT"))); | ||
| vedaAdapterOwner = vm.envAddress("VEDA_ADAPTER_OWNER_ADDRESS"); | ||
| delegationManager = vm.envAddress("DELEGATION_MANAGER_ADDRESS"); | ||
| boringVault = vm.envAddress("VEDA_BORING_VAULT_ADDRESS"); | ||
| vedaTeller = vm.envAddress("VEDA_TELLER_ADDRESS"); | ||
| depositToken = vm.envAddress("VEDA_DEPOSIT_TOKEN_ADDRESS"); | ||
| deployer = msg.sender; | ||
| console2.log("~~~"); | ||
| console2.log("Owner: %s", vedaAdapterOwner); | ||
| console2.log("DelegationManager: %s", delegationManager); | ||
| console2.log("BoringVault: %s", boringVault); | ||
| console2.log("VedaTeller: %s", vedaTeller); | ||
| console2.log("DepositToken: %s", depositToken); | ||
| console2.log("Deployer: %s", deployer); | ||
| console2.log("Salt:"); | ||
| console2.logBytes32(salt); | ||
| } | ||
|
|
||
| function run() public { | ||
| console2.log("~~~"); | ||
|
|
||
| // Foundry's fork mode cannot interact with mUSD on Monad (NotActivated in revm). | ||
| // Mock the approve call so simulation passes; the real broadcast executes the | ||
| // actual constructor on-chain where the token works correctly. | ||
| // vm.mockCall(depositToken, abi.encodeWithSelector(bytes4(keccak256("approve(address,uint256)"))), abi.encode(true)); | ||
|
|
||
| vm.startBroadcast(); | ||
|
|
||
| address vedaAdapter = | ||
| address(new VedaAdapter{ salt: salt }(vedaAdapterOwner, delegationManager, boringVault, vedaTeller, depositToken)); | ||
| console2.log("VedaAdapter: %s", vedaAdapter); | ||
|
|
||
| vm.stopBroadcast(); | ||
|
|
||
| // vm.clearMockedCalls(); | ||
| } | ||
| } |
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| // Based on: | ||
| // https://github.com/Se7en-Seas/boring-vault/blob/main/src/base/Roles/TellerWithMultiAssetSupport.sol | ||
| // https://github.com/Veda-Labs/boring-vault/blob/dev/oct-2025/src/base/Roles/TellerWithYieldStreaming.sol | ||
|
|
||
| // SPDX-License-Identifier: MIT AND Apache-2.0 | ||
| pragma solidity 0.8.23; | ||
|
|
||
| /** | ||
| * @title IVedaTeller | ||
| * @notice Interface for the user-facing functions of Veda's TellerWithMultiAssetSupport. | ||
| * @dev Uses `address` for asset parameters to avoid importing Solmate's ERC20. | ||
| * The Teller is the entry/exit point for the BoringVault. All functions use `requiresAuth`, | ||
| * so callers must be authorized on the Teller's Authority. | ||
| */ | ||
| interface IVedaTeller { | ||
| /** | ||
| * @notice Allows users to deposit into the BoringVault, if the contract is not paused. | ||
| * @dev Shares are minted to `msg.sender`. A share lock period may apply. | ||
| * @param depositAsset The ERC20 token to deposit | ||
| * @param depositAmount The amount to deposit | ||
| * @param minimumMint The minimum shares the user expects to receive | ||
| * @param referralAddress Address used for referral tracking | ||
| * @return shares The number of vault shares minted | ||
| */ | ||
| function deposit( | ||
| address depositAsset, | ||
| uint256 depositAmount, | ||
| uint256 minimumMint, | ||
| address referralAddress | ||
| ) | ||
| external | ||
| payable | ||
| returns (uint256 shares); | ||
|
|
||
| /** | ||
| * @notice Allows an authorized caller to deposit into the BoringVault for another address, if this contract is not paused. | ||
| * @dev Intended for router-like integrations; this selector should remain role-gated. | ||
| * @param depositAsset The ERC20 token to deposit | ||
| * @param depositAmount The amount to deposit | ||
| * @param minimumMint The minimum shares the user expects to receive | ||
| * @param to The address that will receive the minted vault shares | ||
| * @param referralAddress Address used for referral tracking | ||
| * @return shares The number of vault shares minted | ||
| */ | ||
| function deposit( | ||
| address depositAsset, | ||
| uint256 depositAmount, | ||
| uint256 minimumMint, | ||
| address to, | ||
| address referralAddress | ||
| ) | ||
| external | ||
| payable | ||
| returns (uint256 shares); | ||
|
|
||
| /** | ||
| * @notice Allows users to withdraw from the BoringVault. | ||
| * @dev Available on TellerWithYieldStreaming. Burns shares from `msg.sender` and sends | ||
| * underlying assets to `to`. Updates vested yield before withdrawal. | ||
| * @param withdrawAsset The ERC20 token to receive | ||
| * @param shareAmount The amount of vault shares to burn | ||
| * @param minimumAssets The minimum underlying assets expected | ||
| * @param to The address that will receive the underlying assets | ||
| * @return assetsOut The amount of underlying assets sent | ||
| */ | ||
| function withdraw( | ||
| address withdrawAsset, | ||
| uint256 shareAmount, | ||
| uint256 minimumAssets, | ||
| address to | ||
| ) | ||
| external | ||
| returns (uint256 assetsOut); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.