Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REG-1250] Defender 2.0, Ethers v6 migration #333

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 3 additions & 3 deletions .github/workflows/contracts_size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fetch-depth: 2
- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 20.x
- uses: actions/cache@v3
id: cache
with:
Expand All @@ -36,7 +36,7 @@ jobs:
fetch-depth: 2
- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 20.x
- uses: actions/cache@v3
id: cache
with:
Expand All @@ -51,4 +51,4 @@ jobs:
- uses: unstoppabledomains/solidity-sizer@v0.1.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
command: yarn compile:size
command: yarn compile:size
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 20.x
- uses: actions/cache@v3
id: cache
with:
Expand All @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 20.x
- uses: actions/cache@v3
id: cache
with:
Expand All @@ -58,7 +58,7 @@ jobs:
fetch-depth: 2
- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 20.x
- uses: actions/cache@v3
id: cache
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: actions/setup-node@v2
if: steps.latesttag.outputs.tag != env.PACKAGE_VERSION
with:
node-version: 16.x
node-version: 20.x

- uses: actions/cache@v3
id: cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 20.x
- uses: actions/cache@v3
id: cache
with:
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.11.0
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
Loading