Verified contractExactBSD-3-Clause-Clear
NuvaHomeDepositBatcherConfidential
Address0x2a900740f691d9fdfd00cd414dc15eb2e0e622c1
- Balance
0 ETH
- Transactions
11
- Compiler
solc 0.8.28
- Same code
Only this contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 800 runs
- EVM version
- cancun
- License
- BSD-3-Clause-Clear
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,407,041
- Creation transaction
- 0x20702a89b3…4c2b8c1e7b
47 files
The source code is large: one file is shown at a time. Choose a file in the list.
- src/batcher/adapters/NuvaHomeDepositBatcherConfidential.solmain7.04 KB
- dependencies/@encrypted-types-0.0.4/EncryptedTypes.sol5.81 KB
- dependencies/@fhevm-solidity-0.13.0/config/ZamaConfig.sol4.75 KB
- dependencies/@fhevm-solidity-0.13.0/lib/FHE.sol325.77 KB
- dependencies/@fhevm-solidity-0.13.0/lib/FheType.sol1.1 KB
- dependencies/@fhevm-solidity-0.13.0/lib/Impl.sol37.29 KB
- dependencies/@fhevm-solidity-0.13.0/lib/cryptography/FhevmECDSA.sol12.33 KB
- dependencies/@openzeppelin-community-contracts-0.0.1/contracts/interfaces/IERC7575.sol747 B
- dependencies/@openzeppelin-confidential-contracts-0.5.3/contracts/finance/BatcherConfidential.sol22.79 KB
- dependencies/@openzeppelin-confidential-contracts-0.5.3/contracts/interfaces/IERC7984.sol5.64 KB
- dependencies/@openzeppelin-confidential-contracts-0.5.3/contracts/interfaces/IERC7984ERC20Wrapper.sol2.5 KB
- dependencies/@openzeppelin-confidential-contracts-0.5.3/contracts/interfaces/IERC7984Receiver.sol1.06 KB
- dependencies/@openzeppelin-confidential-contracts-0.5.3/contracts/token/ERC7984/ERC7984.sol13.33 KB
- dependencies/@openzeppelin-confidential-contracts-0.5.3/contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol10.96 KB
- dependencies/@openzeppelin-confidential-contracts-0.5.3/contracts/token/ERC7984/utils/ERC7984Utils.sol2.12 KB
- dependencies/@openzeppelin-confidential-contracts-0.5.3/contracts/utils/FHESafeMath.sol3.93 KB
- dependencies/@openzeppelin-contracts-5.1.0/access/Ownable.sol3.1 KB
- dependencies/@openzeppelin-contracts-5.1.0/interfaces/IERC1363.sol4.45 KB
- dependencies/@openzeppelin-contracts-5.1.0/interfaces/IERC1363Receiver.sol1.32 KB
- dependencies/@openzeppelin-contracts-5.1.0/interfaces/IERC165.sol192 B
- dependencies/@openzeppelin-contracts-5.1.0/interfaces/IERC20.sol181 B
- dependencies/@openzeppelin-contracts-5.1.0/interfaces/IERC20Metadata.sol216 B
- dependencies/@openzeppelin-contracts-5.1.0/interfaces/IERC4626.sol12.18 KB
- dependencies/@openzeppelin-contracts-5.1.0/token/ERC20/IERC20.sol2.78 KB
- dependencies/@openzeppelin-contracts-5.1.0/token/ERC20/extensions/IERC20Metadata.sol684 B
- dependencies/@openzeppelin-contracts-5.1.0/token/ERC20/utils/SafeERC20.sol9.44 KB
- dependencies/@openzeppelin-contracts-5.1.0/utils/Address.sol6.03 KB
- dependencies/@openzeppelin-contracts-5.1.0/utils/Context.sol963 B
- dependencies/@openzeppelin-contracts-5.1.0/utils/Errors.sol896 B
- dependencies/@openzeppelin-contracts-5.1.0/utils/Panic.sol1.97 KB
- dependencies/@openzeppelin-contracts-5.1.0/utils/Pausable.sol2.83 KB
- dependencies/@openzeppelin-contracts-5.1.0/utils/ReentrancyGuardTransient.sol2.06 KB
- dependencies/@openzeppelin-contracts-5.1.0/utils/TransientSlot.sol5.07 KB
- dependencies/@openzeppelin-contracts-5.1.0/utils/introspection/ERC165.sol912 B
- dependencies/@openzeppelin-contracts-5.1.0/utils/introspection/ERC165Checker.sol5.05 KB
- dependencies/@openzeppelin-contracts-5.1.0/utils/introspection/IERC165.sol870 B
- dependencies/@openzeppelin-contracts-5.1.0/utils/math/Math.sol28.31 KB
- dependencies/@openzeppelin-contracts-5.1.0/utils/math/SafeCast.sol34.94 KB
- dependencies/community-oz-contracts-5.7.0/interfaces/IERC165.sol193 B
- dependencies/community-oz-contracts-5.7.0/interfaces/IERC4626.sol12.21 KB
- dependencies/community-oz-contracts-5.7.0/token/ERC20/IERC20.sol2.78 KB
- dependencies/community-oz-contracts-5.7.0/token/ERC20/extensions/IERC20Metadata.sol684 B
- dependencies/community-oz-contracts-5.7.0/utils/introspection/IERC165.sol871 B
- src/batcher/VaultBatcherConfidential.sol18.72 KB
- src/batcher/interfaces/IAsyncBatcher.sol1.27 KB
- src/batcher/interfaces/IVaultBatcherConfidential.sol5.81 KB
- vendor/nuva/IRemoteVault.sol3.1 KB
src/batcher/adapters/NuvaHomeDepositBatcherConfidential.sol
// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity 0.8.28;
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC7984ERC20Wrapper} from "@openzeppelin/confidential-contracts/interfaces/IERC7984ERC20Wrapper.sol";
import {IRemoteVault} from "../../../vendor/nuva/IRemoteVault.sol";
import {VaultBatcherConfidential} from "../VaultBatcherConfidential.sol";
import {IAsyncBatcher} from "../interfaces/IAsyncBatcher.sol";
/// @custom:security-contact [email protected]
/// @notice Deposits USDC through Nuva's RemoteVault and settles once Nuva's keeper mints the nvHOME.
/// @dev The deposit is tracked by its RemoteVault id, derived before the call and checked after it. Only the keeper's
/// mint clears that record, so a cleared record completes the batch. The USDC leaves in the request, and RemoteVault
/// has no deposit refund: from then on neither pause nor the deadline can cancel the batch, which waits for the mint.
/// Dispatch pins the destination for the batch's deposit, so a later update applies from the next batch. The owner
/// therefore cannot rescue a dispatched batch: if Nuva stops accepting the pinned destination, the deposit retries
/// until the deadline refunds the batch.
contract NuvaHomeDepositBatcherConfidential is VaultBatcherConfidential, IAsyncBatcher {
error InvalidDepositDestination(address destination);
error RequestIdMismatch(bytes32 requestId);
event DepositDestinationSet(address destination);
struct Request {
uint256 batchId;
bytes32 requestId;
uint256 assets;
}
Request private _request;
address private _destination;
// The in-flight batch's destination, pinned at its dispatch.
address private _batchDestination;
constructor(
IERC7984ERC20Wrapper fromToken_,
IERC7984ERC20Wrapper toToken_,
IRemoteVault remoteVault_,
address owner_,
uint256 minBatchAge_,
uint256 callbackDeadline_,
address destination_
)
VaultBatcherConfidential(
fromToken_,
toToken_,
IERC4626(address(remoteVault_)),
owner_,
minBatchAge_,
callbackDeadline_
)
{
address asset = remoteVault_.assetToken();
address fromUnderlying = fromToken_.underlying();
require(fromUnderlying == asset, RouteAssetMismatch(fromUnderlying, asset));
address share = remoteVault_.shareToken();
address toUnderlying = toToken_.underlying();
require(toUnderlying == share, RouteShareMismatch(toUnderlying, share));
_setDepositDestination(destination_);
}
function routeDescription() public pure override returns (string memory) {
return "Deposit USDC through Nuva's RemoteVault and settle once Nuva mints the nvHOME.";
}
function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return interfaceId == type(IAsyncBatcher).interfaceId || super.supportsInterface(interfaceId);
}
/// @dev The pending amount drops to zero once Nuva's mint clears the deposit record.
function asyncRequest(uint256 batchId) external view returns (AsyncRequest memory request) {
if (_requestPlaced(batchId)) {
return AsyncRequest(uint256(_request.requestId), _minted() ? 0 : _request.assets, 0);
}
}
/// @notice The whitelisted RemoteVault destination later deposits forward their USDC to.
function depositDestination() external view returns (address) {
return _destination;
}
/// @dev Only callable by the owner. A dispatched batch keeps the destination pinned at its dispatch.
/// @param destination Whitelisted RemoteVault receiver for later batches' USDC.
function setDepositDestination(address destination) external onlyOwner {
_setDepositDestination(destination);
}
function dispatchBatch() public override {
super.dispatchBatch();
_batchDestination = _destination;
}
function _requestPlaced(uint256 batchId) private view returns (bool) {
return batchId != 0 && _request.batchId == batchId && batchState(batchId) == BatchState.Dispatched;
}
/// @dev Once the USDC has left, only the mint ends the batch: pause and the deadline no longer apply.
function _executeRoute(uint256 batchId, uint256 amount) internal override returns (ExecuteOutcome) {
if (_request.batchId == batchId) return _minted() ? ExecuteOutcome.Complete : ExecuteOutcome.Partial;
return super._executeRoute(batchId, amount);
}
/// @dev Places the deposit. A refused deposit keeps the USDC and retries until the deadline, as the synchronous
/// deposit batcher does.
function _executeVaultRoute(uint256 batchId, uint256 amount) internal override returns (ExecuteOutcome) {
IERC20 asset = IERC20(fromToken().underlying());
IRemoteVault remoteVault = _remoteVault();
uint256 assets = amount * fromToken().rate();
bytes32 requestId = _nextRequestId(remoteVault);
SafeERC20.forceApprove(asset, address(remoteVault), assets);
try remoteVault.deposit(assets, _batchDestination) {
(address user, uint256 recorded) = remoteVault.pendingDeposits(requestId);
require(user == address(this) && recorded == assets, RequestIdMismatch(requestId));
_request = Request(batchId, requestId, assets);
emit AsyncRequested(batchId, uint256(requestId), assets);
} catch (bytes memory reason) {
SafeERC20.forceApprove(asset, address(remoteVault), 0);
emit AsyncRequestFailed(batchId, reason);
}
return ExecuteOutcome.Partial;
}
/// @dev The keeper's mint deletes the record and mints a nonzero amount to this contract in one call, so a
/// cleared record means the shares are here. Shares sent before it cannot complete the batch.
function _minted() private view returns (bool) {
(address user,) = _remoteVault().pendingDeposits(_request.requestId);
return user == address(0);
}
/// @dev The id RemoteVault gives this contract's next request in this block.
function _nextRequestId(IRemoteVault remoteVault) private view returns (bytes32) {
return keccak256(
abi.encodePacked(
block.timestamp, block.chainid, address(remoteVault), address(this), remoteVault.depositNonce() + 1
)
);
}
function _setDepositDestination(address destination) private {
require(_remoteVault().isDestination(destination), InvalidDepositDestination(destination));
_destination = destination;
emit DepositDestinationSet(destination);
}
function _remoteVault() private view returns (IRemoteVault) {
return IRemoteVault(address(_vault()));
}
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 800,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@fhevm/solidity/=dependencies/@fhevm-solidity-0.13.0/",
"@openzeppelin/confidential-contracts/=dependencies/@openzeppelin-confidential-contracts-0.5.3/contracts/",
"@openzeppelin/community-contracts/=dependencies/@openzeppelin-community-contracts-0.0.1/contracts/",
"dependencies/@openzeppelin-community-contracts-0.0.1/:@openzeppelin/contracts/=dependencies/community-oz-contracts-5.7.0/",
"@openzeppelin/contracts-upgradeable/=dependencies/@openzeppelin-contracts-upgradeable-5.1.0/",
"@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.1.0/",
"encrypted-types/=dependencies/@encrypted-types-0.0.4/",
"forge-fhevm/=dependencies/forge-fhevm-0.1.0/src/",
"forge-std/=dependencies/forge-std-1.14.0/src/",
"metamorpho/=dependencies/metamorpho-v1.1-1.1.0/src/",
"morpho-blue/=dependencies/morpho-blue-1.0.0/",
"vault-v2/=dependencies/vault-v2-2026.08.13/src/",
"vendor/nest/:@solmate/=vendor/nest/lib/solmate/src/",
"vendor/nest/:contracts/=vendor/nest/contracts/",
"@axelar-network/axelar-gmp-sdk-solidity/=dependencies/@openzeppelin-community-contracts-0.0.1/lib/axelar-gmp-sdk-solidity/",
"@encrypted-types-0.0.4/=dependencies/@encrypted-types-0.0.4/",
"@fhevm-solidity-0.13.0/=dependencies/@fhevm-solidity-0.13.0/",
"@fhevm/host-contracts/=dependencies/forge-fhevm-0.1.0/src/fhevm-host/",
"@openzeppelin-community-contracts-0.0.1/=dependencies/@openzeppelin-community-contracts-0.0.1/contracts/",
"@openzeppelin-confidential-contracts-0.5.3/=dependencies/@openzeppelin-confidential-contracts-0.5.3/contracts/",
"@openzeppelin-contracts-5.1.0/=dependencies/@openzeppelin-contracts-5.1.0/",
"@openzeppelin-contracts-upgradeable-5.1.0/=dependencies/@openzeppelin-contracts-upgradeable-5.1.0/",
"@zk-email/contracts/=dependencies/@openzeppelin-community-contracts-0.0.1/lib/zk-email-verify/packages/contracts/",
"@zk-email/email-tx-builder/=dependencies/@openzeppelin-community-contracts-0.0.1/lib/email-tx-builder/packages/contracts/",
"community-oz-contracts-5.7.0/=dependencies/community-oz-contracts-5.7.0/",
"forge-fhevm-0.1.0/=dependencies/forge-fhevm-0.1.0/src/",
"forge-std-1.14.0/=dependencies/forge-std-1.14.0/src/",
"metamorpho-v1.1-1.1.0/=dependencies/metamorpho-v1.1-1.1.0/src/",
"morpho-blue-1.0.0/=dependencies/morpho-blue-1.0.0/src/",
"vault-v2-2026.08.13/=dependencies/vault-v2-2026.08.13/src/",
"wormhole-solidity-sdk/=dependencies/@openzeppelin-community-contracts-0.0.1/lib/wormhole-solidity-sdk/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.