From 31e543668d6e2a8ddce8864c5dd38a6406cc3317 Mon Sep 17 00:00:00 2001 From: lsqrl Date: Wed, 3 Jan 2024 12:14:29 +0100 Subject: [PATCH] fix post l1 --- src/Vault.sol | 1 + src/services/Service.sol | 1 + src/services/credit/CallOption.sol | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/src/Vault.sol b/src/Vault.sol index 4d8cd63..0c0a278 100644 --- a/src/Vault.sol +++ b/src/Vault.sol @@ -75,6 +75,7 @@ contract Vault is IVault, ERC4626, ERC20Permit { function sweep(address to, address token) external onlyOwner { assert(token != asset()); + assert(to != address(0)); IERC20 spuriousToken = IERC20(token); uint256 amount = spuriousToken.balanceOf(address(this)); diff --git a/src/services/Service.sol b/src/services/Service.sol index c0238a1..3fb5913 100644 --- a/src/services/Service.sol +++ b/src/services/Service.sol @@ -23,6 +23,7 @@ abstract contract Service is IService, ERC721Enumerable, Ownable { address _manager, uint256 _deadline ) ERC721(_name, _symbol) { + assert(_manager != address(0)); manager = IManager(_manager); locked = false; id = 0; diff --git a/src/services/credit/CallOption.sol b/src/services/credit/CallOption.sol index cdd3e3a..5cee13f 100644 --- a/src/services/credit/CallOption.sol +++ b/src/services/credit/CallOption.sol @@ -79,6 +79,9 @@ contract CallOption is CreditService { if (_ithil == address(0)) revert InvalidParams(); if (_initialPrice == 0) revert InvalidParams(); if (_underlying == address(0)) revert InvalidParams(); + if (_minLoan == 0) revert InvalidParams(); + if (_halvingTime == 0) revert InvalidParams(); + if (_tenorDuration == 0) revert InvalidParams(); initialPrice = _initialPrice; underlying = IERC20(_underlying); @@ -89,6 +92,7 @@ contract CallOption is CreditService { vestingTime = _initialVesting + block.timestamp; _vaultAddress = manager.vaults(_underlying); + if (_vaultAddress == address(0)) revert InvalidParams(); // approve vault to spend underlying token for deposits // technically, it should be re-approved if the total volume exceeds 2^256 // in practice, this event never happens, and in case just redeploy the service