Skip to content

Commit

Permalink
forge fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
vimageDE committed Dec 18, 2024
1 parent 79acc44 commit 47b5b28
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 272 deletions.
11 changes: 5 additions & 6 deletions src/examples/allocator/SimpleAllocator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { Compact } from "src/types/EIP712Types.sol";
import { ResetPeriod } from "src/lib/IdLib.sol";

contract SimpleAllocator is ISimpleAllocator {

address public immutable COMPACT_CONTRACT;
address public immutable ARBITER;
uint256 public immutable MIN_WITHDRAWAL_DELAY;
Expand Down Expand Up @@ -55,13 +54,13 @@ contract SimpleAllocator is ISimpleAllocator {
revert InvalidExpiration(compact_.expires);
}
// Check expiration is not longer then the tokens forced withdrawal time
(,, ResetPeriod resetPeriod, ) = ITheCompact(COMPACT_CONTRACT).getLockDetails(compact_.id);
if(compact_.expires > block.timestamp + _resetPeriodToSeconds(resetPeriod) ){
(,, ResetPeriod resetPeriod,) = ITheCompact(COMPACT_CONTRACT).getLockDetails(compact_.id);
if (compact_.expires > block.timestamp + _resetPeriodToSeconds(resetPeriod)) {
revert ForceWithdrawalAvailable(compact_.expires, block.timestamp + _resetPeriodToSeconds(resetPeriod));
}
// Check expiration is not past an active force withdrawal
(, uint256 forcedWithdrawalExpiration) = ITheCompact(COMPACT_CONTRACT).getForcedWithdrawalStatus(compact_.sponsor, compact_.id);
if(forcedWithdrawalExpiration != 0 && forcedWithdrawalExpiration < compact_.expires) {
if (forcedWithdrawalExpiration != 0 && forcedWithdrawalExpiration < compact_.expires) {
revert ForceWithdrawalAvailable(compact_.expires, forcedWithdrawalExpiration);
}
// Check nonce is not yet consumed
Expand Down Expand Up @@ -115,11 +114,11 @@ contract SimpleAllocator is ISimpleAllocator {
bytes32 tokenHash = _getTokenHash(id_, from_);

uint256 fullAmount = amount_;
if(_claim[tokenHash] > block.timestamp) {
if (_claim[tokenHash] > block.timestamp) {
// Lock is still active, add the locked amount if the nonce has not yet been consumed
fullAmount += ITheCompact(COMPACT_CONTRACT).hasConsumedAllocatorNonce(_nonce[tokenHash], address(this)) ? 0 : _amount[tokenHash];
}
if( balance < fullAmount) {
if (balance < fullAmount) {
revert InsufficientBalance(from_, id_, balance, fullAmount);
}

Expand Down
2 changes: 0 additions & 2 deletions src/interfaces/ISimpleAllocator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ pragma solidity ^0.8.27;
import { IAllocator } from "src/interfaces/IAllocator.sol";
import { Compact } from "src/types/EIP712Types.sol";


interface ISimpleAllocator is IAllocator {

/// @notice Thrown if a claim is already active
error ClaimActive(address sponsor);

Expand Down
22 changes: 10 additions & 12 deletions src/test/TheCompactMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { ResetPeriod } from "src/types/ResetPeriod.sol";
import { Scope } from "src/types/Scope.sol";
import { console2 } from "forge-std/console2.sol";


contract TheCompactMock is ERC6909 {
using IdLib for uint96;
using IdLib for uint256;
Expand Down Expand Up @@ -96,17 +95,16 @@ contract TheCompactMock is ERC6909 {
}

function DOMAIN_SEPARATOR() public view returns (bytes32) {
return
keccak256(
abi.encode(
// keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')
0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,
keccak256("The Compact"),
keccak256("0"),
block.chainid,
address(this)
)
);
return keccak256(
abi.encode(
// keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')
0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,
keccak256("The Compact"),
keccak256("0"),
block.chainid,
address(this)
)
);
}

function name(
Expand Down
Loading

0 comments on commit 47b5b28

Please sign in to comment.