Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ARBITRUM_NOVA_RPC_URL=https://nova.arbitrum.io/rpc
SEI_RPC_URL=https://evm-rpc.sei-apis.com
INK_RPC_URL=https://rpc-gel.inkonchain.com
SONIC_RPC_URL=https://rpc.soniclabs.com
MONAD_RPC_URL=https://rpc.monad.xyz
MONAD_RPC_URL=https://monad-mainnet.infura.io/v3/${RPC_API_KEY}
MEGA_ETH_RPC_URL=
RONIN_RPC_URL=https://api.roninchain.com/rpc
TEMPO_RPC_URL=https://rpc.tempo.xyz
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ jobs:
env:
LINEA_RPC_URL: ${{ secrets.LINEA_RPC_URL }}
ARBITRUM_RPC_URL: ${{ secrets.ARBITRUM_RPC_URL }}
MONAD_RPC_URL: ${{ secrets.MONAD_RPC_URL }}
RPC_API_KEY: ${{ secrets.RPC_API_KEY }}
Binary file added audits/cyfrin/cyfrin-10-26.pdf
Binary file not shown.

Large diffs are not rendered by default.

85 changes: 85 additions & 0 deletions broadcast/DeployComplianceVedaAdapter.s.sol/143/run-latest.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions documents/Deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ forge script script/DeployCaveatEnforcers.s.sol --rpc-url <your_rpc_url> --priva

**MegaETH:** append `--gas-limit 300000000 --with-gas-price 2100000 --priority-gas-price 100000 --skip-simulation` to the `forge script` command (mainnet and testnet).

**Monad (`DeployVedaAdapter` and `DeployComplianceVedaAdapter`):** mUSD uses post-London opcodes and this repo pins `evm_version = "london"`, so the constructor's `forceApprove` reverts in the local script run. `--skip-simulation` does not skip that local run. Pick one:

1. Append `--evm-version shanghai`. Compile, broadcast, and verify with that same setting: a different compiler EVM version changes creation code and the CREATE2 address.
2. Stay on London and uncomment the `vm.mockCall` (and `vm.clearMockedCalls`) in the script's `run()`. The mock only affects the local simulation; the real constructor still runs on-chain. Leave those lines commented when using `--evm-version shanghai`.

### Salt Value

The deployment scripts use a predefined salt value, which is **"GATOR"**. This value is converted into a **`bytes32`** format.
Expand Down
65 changes: 65 additions & 0 deletions script/DeployComplianceVedaAdapter.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// 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 { ComplianceVedaAdapter } from "../src/helpers/ComplianceVedaAdapter.sol";

/**
* @title DeployComplianceVedaAdapter
* @notice Deploys ComplianceVedaAdapter deterministically with CREATE2.
* @dev Run with:
* forge script script/DeployComplianceVedaAdapter.s.sol --rpc-url <rpc_url> --private-key $PRIVATE_KEY --broadcast
* On Monad, mUSD uses post-London opcodes and this repo pins London, so the constructor's forceApprove
* reverts in the local script run. Pick one:
* 1. Append --evm-version shanghai. Compile, broadcast, and verify with that same setting: a different
* compiler EVM version changes creation code and the CREATE2 address.
* 2. Stay on London and uncomment the vm.mockCall (and vm.clearMockedCalls) in run(). The mock only
* affects the local simulation; the real constructor still runs on-chain.
*/
contract DeployComplianceVedaAdapter is Script {
bytes32 internal salt;
address internal vedaAdapterOwner;
address internal delegationManager;
address internal boringVault;
address internal vedaTeller;
address internal 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");

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("Salt:");
console2.logBytes32(salt);
}

function run() public {
vm.startBroadcast();

// London only. Foundry's fork mode cannot interact with mUSD on Monad (NotActivated in revm).
// Uncomment so the local simulation passes. Leave commented when using --evm-version shanghai.
// The mock only affects the local simulation; the real constructor still runs on-chain.
// vm.mockCall(depositToken, abi.encodeWithSelector(bytes4(keccak256("approve(address,uint256)"))), abi.encode(true));

address deployed = address(
new ComplianceVedaAdapter{ salt: salt }(vedaAdapterOwner, delegationManager, boringVault, vedaTeller, depositToken)
);

vm.stopBroadcast();
console2.log("ComplianceVedaAdapter: %s", deployed);

// Uncomment together with vm.mockCall above when deploying on London.
// vm.clearMockedCalls();
}
}
14 changes: 10 additions & 4 deletions script/DeployVedaAdapter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import { VedaAdapter } from "../src/helpers/VedaAdapter.sol";
* @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.
* On Monad, mUSD uses post-London opcodes and this repo pins London, so the constructor's forceApprove
* reverts in the local script run. Pick one:
* 1. Append --evm-version shanghai. Compile, broadcast, and verify with that same setting: a different
* compiler EVM version changes creation code and the CREATE2 address.
* 2. Stay on London and uncomment the vm.mockCall (and vm.clearMockedCalls) in run(). The mock only
* affects the local simulation; the real constructor still runs on-chain.
*/
contract DeployVedaAdapter is Script {
bytes32 salt;
Expand Down Expand Up @@ -45,9 +50,9 @@ contract DeployVedaAdapter is Script {
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.
// London only. Foundry's fork mode cannot interact with mUSD on Monad (NotActivated in revm).
// Uncomment so the local simulation passes. Leave commented when using --evm-version shanghai.
// The mock only affects the local simulation; the real constructor still runs on-chain.
// vm.mockCall(depositToken, abi.encodeWithSelector(bytes4(keccak256("approve(address,uint256)"))), abi.encode(true));

vm.startBroadcast();
Expand All @@ -58,6 +63,7 @@ contract DeployVedaAdapter is Script {

vm.stopBroadcast();

// Uncomment together with vm.mockCall above when deploying on London.
// vm.clearMockedCalls();
}
}
Loading
Loading