Skip to content

Commit

Permalink
[REG-1250] Defender 2.0, Ethers v6 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
nickshatilo committed Apr 18, 2024
1 parent 11ab6d0 commit 1ad03ae
Show file tree
Hide file tree
Showing 105 changed files with 5,178 additions and 9,518 deletions.
5 changes: 3 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"assert": false,
"web3": false,
"usePlugin": false,
"extendEnvironment": false
"extendEnvironment": false,
"BigInt": true
},
"ignorePatterns": [
"types/**/*",
Expand All @@ -34,7 +35,7 @@
"strict": ["error", "global"],
// Code style
"array-bracket-spacing": ["off"],
"camelcase": ["error", {"properties": "always", "ignoreImports": true}],
"camelcase": ["error", {"properties": "always", "allow": [".*__factory"]}],
"comma-dangle": ["error", "always-multiline"],
"comma-spacing": ["error", {"before": false, "after": true}],
"dot-notation": ["error", {"allowKeywords": true, "allowPattern": ""}],
Expand Down
3 changes: 1 addition & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"files": "*.sol",
"options": {
"printWidth": 140,
"singleQuote": true,
"explicitTypes": "always"
"singleQuote": true
}
},
{
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.9.10

- Migrated to `ethers@6`, updated other dependencies

## v0.9.9

- Add `.clay` TLD
Expand Down
12 changes: 2 additions & 10 deletions contracts/IAddressReader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,15 @@ interface IAddressReader {
* @param token Token
* @param tokenId The token id to fetch records from.
*/
function getAddress(
string calldata network,
string calldata token,
uint256 tokenId
) external view returns (string memory);
function getAddress(string calldata network, string calldata token, uint256 tokenId) external view returns (string memory);

/**
* @dev Function to get address record key by network and token key
* @param network Network
* @param token Token
* @param tokenId The token id to fetch records from.
*/
function getAddressKey(
string calldata network,
string calldata token,
uint256 tokenId
) external view returns (string memory);
function getAddressKey(string calldata network, string calldata token, uint256 tokenId) external view returns (string memory);

/**
* @dev Function to get the list of address record keys by network and token
Expand Down
50 changes: 16 additions & 34 deletions contracts/IDataReader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,40 @@ interface IDataReader {
* @param keys Keys to query values.
* @param tokenId The token id to fetch.
*/
function getData(string[] calldata keys, uint256 tokenId)
external
view
returns (
address resolver,
address owner,
string[] memory values
);
function getData(
string[] calldata keys,
uint256 tokenId
) external view returns (address resolver, address owner, string[] memory values);

/**
* @dev Function to get resolver address, owner address and requested records for array of tokens.
* @param keys Keys to query values.
* @param tokenIds Array of token ids to fetch.
*/
function getDataForMany(string[] calldata keys, uint256[] calldata tokenIds)
external
view
returns (
address[] memory resolvers,
address[] memory owners,
string[][] memory values
);
function getDataForMany(
string[] calldata keys,
uint256[] calldata tokenIds
) external view returns (address[] memory resolvers, address[] memory owners, string[][] memory values);

/**
* @dev Function to get resolver address, owner address and requested records.
* @param keyHashes Key hashes to query values.
* @param tokenId The token id to fetch.
*/
function getDataByHash(uint256[] calldata keyHashes, uint256 tokenId)
external
view
returns (
address resolver,
address owner,
string[] memory keys,
string[] memory values
);
function getDataByHash(
uint256[] calldata keyHashes,
uint256 tokenId
) external view returns (address resolver, address owner, string[] memory keys, string[] memory values);

/**
* @dev Function to get resolver address, owner address and requested records for array of tokens.
* @param keyHashes Key hashes to query values.
* @param tokenIds Array of token ids to fetch.
*/
function getDataByHashForMany(uint256[] calldata keyHashes, uint256[] calldata tokenIds)
external
view
returns (
address[] memory resolvers,
address[] memory owners,
string[][] memory keys,
string[][] memory values
);
function getDataByHashForMany(
uint256[] calldata keyHashes,
uint256[] calldata tokenIds
) external view returns (address[] memory resolvers, address[] memory owners, string[][] memory keys, string[][] memory values);

/**
* @param tokenIds Array of token ids to fetch.
Expand Down
14 changes: 2 additions & 12 deletions contracts/IMintingManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,15 @@ interface IMintingManager is IERC1967 {
* @param tld id of parent token
* @param label SLD label to mint
*/
function claimTo(
address to,
uint256 tld,
string calldata label
) external;
function claimTo(address to, uint256 tld, string calldata label) external;

/**
* @dev Claims free domain. The fuction adds prefix to label.
* @param to address to mint the new SLD to
* @param tld id of parent token
* @param label SLD label to mint
*/
function claimToWithRecords(
address to,
uint256 tld,
string calldata label,
string[] calldata keys,
string[] calldata values
) external;
function claimToWithRecords(address to, uint256 tld, string calldata label, string[] calldata keys, string[] calldata values) external;

/**
* @dev Purchases a SLD using native token.
Expand Down
8 changes: 4 additions & 4 deletions contracts/IRecordReader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ interface IRecordReader {
* @param keyHashes The key to query the value of.
* @param tokenId The token id to set.
*/
function getManyByHash(uint256[] calldata keyHashes, uint256 tokenId)
external
view
returns (string[] memory keys, string[] memory values);
function getManyByHash(
uint256[] calldata keyHashes,
uint256 tokenId
) external view returns (string[] memory keys, string[] memory values);
}
30 changes: 5 additions & 25 deletions contracts/IRecordStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,59 +18,39 @@ interface IRecordStorage is IRecordReader {
* @param value The value to set key to
* @param tokenId ERC-721 token id to set
*/
function set(
string calldata key,
string calldata value,
uint256 tokenId
) external;
function set(string calldata key, string calldata value, uint256 tokenId) external;

/**
* @dev Set records by keys
* @param keys The keys set the values of
* @param values Records values
* @param tokenId ERC-721 token id of the domain
*/
function setMany(
string[] memory keys,
string[] memory values,
uint256 tokenId
) external;
function setMany(string[] memory keys, string[] memory values, uint256 tokenId) external;

/**
* @dev Set record by key hash
* @param keyHash The key hash set the value of
* @param value The value to set key to
* @param tokenId ERC-721 token id to set
*/
function setByHash(
uint256 keyHash,
string calldata value,
uint256 tokenId
) external;
function setByHash(uint256 keyHash, string calldata value, uint256 tokenId) external;

/**
* @dev Set records by key hashes
* @param keyHashes The key hashes set the values of
* @param values Records values
* @param tokenId ERC-721 token id of the domain
*/
function setManyByHash(
uint256[] calldata keyHashes,
string[] calldata values,
uint256 tokenId
) external;
function setManyByHash(uint256[] calldata keyHashes, string[] calldata values, uint256 tokenId) external;

/**
* @dev Reset all domain records and set new ones
* @param keys New record keys
* @param values New record values
* @param tokenId ERC-721 token id of the domain
*/
function reconfigure(
string[] memory keys,
string[] memory values,
uint256 tokenId
) external;
function reconfigure(string[] memory keys, string[] memory values, uint256 tokenId) external;

/**
* @dev Function to reset all existing records on a domain.
Expand Down
7 changes: 1 addition & 6 deletions contracts/IRootRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,5 @@ interface IRootRegistry is IMintableERC721 {
* @param keys New record keys
* @param values New record values
*/
function withdrawFromPolygon(
bytes calldata inputData,
uint256 tokenId,
string[] calldata keys,
string[] calldata values
) external;
function withdrawFromPolygon(bytes calldata inputData, uint256 tokenId, string[] calldata keys, string[] calldata values) external;
}
12 changes: 2 additions & 10 deletions contracts/MintingManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,7 @@ contract MintingManager is ERC2771Context, MinterRole, Blocklist, Pausable, IMin
_issueWithRecords(_msgSender(), _buildLabels(tld, _freeSLDLabel(label)), empty, empty, 0, true);
}

function claimTo(
address to,
uint256 tld,
string calldata label
) external override onlyAllowedSLD(tld, label) whenNotPaused {
function claimTo(address to, uint256 tld, string calldata label) external override onlyAllowedSLD(tld, label) whenNotPaused {
string[] memory empty;
_issueWithRecords(to, _buildLabels(tld, _freeSLDLabel(label)), empty, empty, 0, true);
}
Expand Down Expand Up @@ -381,11 +377,7 @@ contract MintingManager is ERC2771Context, MinterRole, Blocklist, Pausable, IMin
_block(tokenId);
}

function _ensureAllowed(
uint256 tld,
string memory label,
uint64 expiry
) private view {
function _ensureAllowed(uint256 tld, string memory label, uint64 expiry) private view {
require(_isTld(tld), 'MintingManager: TLD_NOT_REGISTERED');
require(_expirableTlds[tld] == (expiry > 0), 'MintingManager: TLD_EXPIRABLE_MISMATCH');

Expand Down
Loading

0 comments on commit 1ad03ae

Please sign in to comment.