Skip to content

Commit

Permalink
Check for nonce consumption during attest
Browse files Browse the repository at this point in the history
  • Loading branch information
vimageDE committed Dec 16, 2024
1 parent 9d26c19 commit 42bd879
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/examples/allocator/SimpleAllocator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ contract SimpleAllocator is ISimpleAllocator {
uint256 balance = ERC6909(_COMPACT_CONTRACT).balanceOf(from_, id_);
// Check unlocked balance
bytes32 tokenHash = _getTokenHash(id_, from_);
if (_claim[tokenHash] > block.timestamp ? (balance < amount_ + _amount[tokenHash]) : (balance < amount_)) {

uint256 fullAmount = amount_;
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) {
revert InsufficientBalance(from_, id_);
}

Expand Down

0 comments on commit 42bd879

Please sign in to comment.