Skip to content

Commit

Permalink
Merge pull request #164 from euler-xyz/pragmas
Browse files Browse the repository at this point in the history
Overall improvements
  • Loading branch information
kasperpawlowski authored Jun 14, 2024
2 parents f791f94 + bef8923 commit 1601566
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Errors.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.19;
pragma solidity ^0.8.0;

import {IEVC} from "./interfaces/IEthereumVaultConnector.sol";

Expand Down
4 changes: 2 additions & 2 deletions src/EthereumVaultConnector.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.19;
pragma solidity ^0.8.0;

import {Set, SetStorage} from "./Set.sol";
import {Events} from "./Events.sol";
Expand Down Expand Up @@ -974,7 +974,7 @@ contract EthereumVaultConnector is Events, Errors, TransientStorage, IEVC {
/// @param vault The address of the vault to check the status for.
/// @return isValid A boolean indicating if the vault status is valid.
/// @return result The bytes returned from the vault call, indicating the vault status.
function checkVaultStatusInternal(address vault) internal returns (bool isValid, bytes memory result) {
function checkVaultStatusInternal(address vault) internal virtual returns (bool isValid, bytes memory result) {
bool success;
(success, result) = vault.call(abi.encodeCall(IVault.checkVaultStatus, ()));

Expand Down
2 changes: 1 addition & 1 deletion src/Events.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.19;
pragma solidity ^0.8.0;

/// @title Events
/// @custom:security-contact [email protected]
Expand Down
2 changes: 1 addition & 1 deletion src/ExecutionContext.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.19;
pragma solidity ^0.8.0;

type EC is uint256;

Expand Down
2 changes: 1 addition & 1 deletion src/Set.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.19;
pragma solidity ^0.8.0;

/// @dev Represents the maximum number of elements that can be stored in the set.
/// Must not exceed 255 due to the uint8 data type limit.
Expand Down
2 changes: 1 addition & 1 deletion src/TransientStorage.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.19;
pragma solidity ^0.8.0;

import {ExecutionContext, EC} from "./ExecutionContext.sol";
import {Set, SetStorage} from "./Set.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IERC1271.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)

pragma solidity ^0.8.19;
pragma solidity >=0.8.0;

/// @dev Interface of the ERC1271 standard signature validation method for
/// contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IEthereumVaultConnector.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.19;
pragma solidity >=0.8.0;

/// @title IEVC
/// @custom:security-contact [email protected]
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IVault.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.19;
pragma solidity >=0.8.0;

/// @title IVault
/// @custom:security-contact [email protected]
Expand Down
2 changes: 1 addition & 1 deletion src/utils/EVCUtil.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.19;
pragma solidity ^0.8.0;

import {IEVC} from "../interfaces/IEthereumVaultConnector.sol";

Expand Down
22 changes: 18 additions & 4 deletions test/invariants/EthereumVaultConnector.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,26 @@ contract EthereumVaultConnectorHandler is EthereumVaultConnectorScribble, Test {
accountControllers[account].firstElement = firstElementCache;
}

function requireAccountStatusCheckInternal(address) internal pure override {
return;
function checkAccountStatusInternal(address account)
internal
view
virtual
override
returns (bool isValid, bytes memory result)
{
SetStorage storage accountControllersStorage = accountControllers[account];
uint256 numOfControllers = accountControllersStorage.numElements;

if (numOfControllers == 0) return (true, "");
else if (numOfControllers > 1) return (false, abi.encodeWithSelector(EVC_ControllerViolation.selector));

isValid = true;
result = "";
}

function requireVaultStatusCheckInternal(address) internal pure override {
return;
function checkVaultStatusInternal(address) internal pure override returns (bool isValid, bytes memory result) {
isValid = true;
result = "";
}

function exposeAccountCollaterals(address account) external view returns (uint8, address[] memory) {
Expand Down
1 change: 1 addition & 0 deletions test/unit/EthereumVaultConnector/Permit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ contract PermitTest is Test {
data = abi.encode(keccak256(data));

vm.assume(!evc.haveCommonOwner(alice, address(0)) && alice != address(evc));
vm.assume(msgSender != address(evc));
vm.assume(nonce > 0 && nonce < type(uint256).max);

vm.warp(deadline);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ contract SetPermitDisabledModeTest is Test {
function test_Integration_SetPermitDisabledMode(address alice, address vault, address operator) public {
vm.assume(alice != address(0) && !evc.haveCommonOwner(alice, operator) && alice.code.length == 0);
vm.assume(
vault != address(0) && vault != alice && vault != operator && vault.code.length == 0
uint160(vault) > 255 && vault != alice && vault != operator && vault.code.length == 0
&& vault != 0xF62849F9A0B5Bf2913b396098F7c7019b51A820a
);
vm.assume(operator != address(0) && operator.code.length == 0);
Expand Down

0 comments on commit 1601566

Please sign in to comment.