Skip to content

Commit

Permalink
Refactor sanctions safety checks in KintoID contract for streamlined …
Browse files Browse the repository at this point in the history
…logic and improved readability.
  • Loading branch information
ylv-io committed Dec 3, 2024
1 parent 53a998a commit 76242b0
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/KintoID.sol
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,9 @@ contract KintoID is
* @return true if the account is sanctions safe.
*/
function isSanctionsSafe(address _account) public view virtual override returns (bool) {
Metadata storage meta = _kycmetas[_account];
if (meta.sanctionsCount > 0 || !isSanctionsMonitored(7)) {
// If the sanction is not confirmed within 3 days, consider the account sanctions safe
return (block.timestamp - sanctionedAt[_account]) > 3 days;
}

// If the account has no sanctions, consider it sanctions safe
return true;
// If the sanction is not confirmed within 3 days, consider the account sanctions safe
return isSanctionsMonitored(7)
&& (_kycmetas[_account].sanctionsCount == 0 || (block.timestamp - sanctionedAt[_account]) > 3 days);
}

/**
Expand All @@ -389,13 +384,9 @@ contract KintoID is
* @return true if the account is sanctions safe in a given country.
*/
function isSanctionsSafeIn(address _account, uint16 _countryId) external view virtual override returns (bool) {
if (_kycmetas[_account].sanctions.get(_countryId) || !isSanctionsMonitored(7)) {
// If the sanction is not confirmed within 3 days, consider the account sanctions safe
return (block.timestamp - sanctionedAt[_account]) > 3 days;
}

// If the account has no sanctions, consider it sanctions safe
return true;
// If the sanction is not confirmed within 3 days, consider the account sanctions safe
return isSanctionsMonitored(7)
&& (!_kycmetas[_account].sanctions.get(_countryId) || (block.timestamp - sanctionedAt[_account]) > 3 days);
}

function confirmSanction(address _account) external onlyRole(GOVERNANCE_ROLE) {

Check warning on line 392 in src/KintoID.sol

View check run for this annotation

Codecov / codecov/patch

src/KintoID.sol#L392

Added line #L392 was not covered by tests
Expand Down

0 comments on commit 76242b0

Please sign in to comment.