Skip to content

Commit

Permalink
fix: add rules to natspec
Browse files Browse the repository at this point in the history
  • Loading branch information
marktoda committed Nov 6, 2024
1 parent 8055ecb commit df948e3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/libraries/VanityAddressLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@ library VanityAddressLib {
}

/// @notice Scores an address based on its vanity
/// @dev Scoring rules:
/// Requirement: The first nonzero nibble must be 4
/// 10 points for every leading 0 nibble
/// 40 points if the first 4 is followed by 3 more 4s
/// 20 points if the first nibble after the 4 4s is NOT a 4
/// 20 points if the last 4 nibbles are 4s
/// 1 point for every 4
/// @param addr The address to score
/// @return calculatedScore The vanity score of the address
function score(address addr) internal pure returns (uint256 calculatedScore) {
// Scoring rules:
// Requirement: The first nonzero nibble must be 4
// 10 points for every leading 0 nibble
// 40 points if the first 4 is followed by 3 more 4s
// 20 points if the first nibble after the 4 4s is NOT a 4
// 20 points if the last 4 nibbles are 4s
// 1 point for every 4

// convert the address to bytes for easier parsing
bytes20 addrBytes = bytes20(addr);

Expand Down

0 comments on commit df948e3

Please sign in to comment.