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

Add tests upgrade to v2.2.0 #498

Merged
merged 58 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
d5bf510
Add try catch block and reverts state when error on before each
anajuliabit Dec 23, 2022
44fdc45
Upgrade tests must use old commit to deploy until version 2.1.0
anajuliabit Dec 27, 2022
e2c7b89
Add 'DR can be activated on creation' test
anajuliabit Dec 27, 2022
d508c5d
add new tests to metatx and bug fixes on 2.2.0 upgrade
anajuliabit Dec 28, 2022
500153b
Add tests to check if new facet ProtocolInitializationHandlerFacet wa…
anajuliabit Dec 29, 2022
a5eb8c8
Add tests to check updates on metatx validaTx
anajuliabit Dec 29, 2022
54c4742
Add test to validate hashFunctions were changed
anajuliabit Dec 30, 2022
a7702bc
Add test to raiseAndEscalateDispute
anajuliabit Dec 30, 2022
aef4ee7
Fix broken tests
anajuliabit Dec 30, 2022
1f9eb4a
Remove logs
anajuliabit Dec 31, 2022
b930b03
preminted voucher support
zajck Jan 3, 2023
e0a4b5d
correct cut actions order
zajck Jan 3, 2023
6c5e47a
correct orchestration address
zajck Jan 4, 2023
7a8cca4
voucher name and symbol
zajck Jan 4, 2023
27fd932
interfacesToRemove/Add logging
zajck Jan 4, 2023
36baac0
interfaceId tests
zajck Jan 4, 2023
bade901
General removal of initialize selector
zajck Jan 4, 2023
51b810e
no default replace
zajck Jan 4, 2023
3930925
Merge branch 'main' into upgrade-2.2.0-tests
anajuliabit Jan 9, 2023
466029f
Merge branch 'main' into upgrade-2.2.0-tests
zajck Jan 24, 2023
325f450
fix upgrade clients
zajck Jan 24, 2023
18117cf
update "newVersion"
zajck Jan 24, 2023
f9c4e31
Added missing values to config
zajck Jan 24, 2023
2b527bb
Merge main
anajuliabit Feb 15, 2023
9db286c
Fix upgrade to 2.2.0 old tests
anajuliabit Feb 15, 2023
f6b1c44
Finalize fixing old tests
anajuliabit Feb 16, 2023
4a7ee83
temp
anajuliabit Feb 17, 2023
348ae4f
Add new tests
anajuliabit Feb 17, 2023
a970766
Merge branch 'main' into upgrade-2.2.0-tests
anajuliabit Feb 17, 2023
ce178ec
Merge main
anajuliabit Mar 7, 2023
351a632
Set OZ version
anajuliabit Mar 8, 2023
88e3808
Fix prettier conf
anajuliabit Mar 8, 2023
3cb7c3c
Alternative tokenId
zajck Mar 15, 2023
2619990
fix tests
zajck Mar 15, 2023
dbbe4cb
move id handling to reserve range
zajck Mar 15, 2023
b318895
fix integration
zajck Mar 15, 2023
1f320fe
set min exchange id in constructor
zajck Mar 15, 2023
849516f
fix deploy
zajck Mar 15, 2023
5e7d774
fix unit tests
zajck Mar 15, 2023
5e6a76f
Merge branch 'main' into new-tokenId
mischat Mar 15, 2023
9ac8049
Merge branch 'new-tokenId' into upgrade-2.2.0-tests
zajck Mar 16, 2023
8c1f68e
adjust existing tests
zajck Mar 16, 2023
dfeb9da
fix old tests
zajck Mar 16, 2023
417ed8e
test exchange before and after upgrade
zajck Mar 16, 2023
5dd7c38
review fixes
zajck Mar 17, 2023
38c02de
Merge branch 'main' into new-tokenId
zajck Mar 17, 2023
bc65e1e
more before/after tests
zajck Mar 17, 2023
49012ba
remove extractExchageId + optimize vouchers
zajck Mar 17, 2023
30c5384
remove transferpremintedFrom
zajck Mar 17, 2023
df62003
test new voucher functions
zajck Mar 21, 2023
8e8272f
Merge branch 'main' into upgrade-2.2.0-tests
anajuliabit Mar 24, 2023
7b4f38c
set _committed in issueVoucher
zajck Apr 11, 2023
9ac6e48
Merge branch 'new-tokenId' into upgrade-2.2.0-tests
zajck Apr 11, 2023
5d1784f
Merge branch 'main' into upgrade-2.2.0-tests
zajck Apr 20, 2023
398e4cc
Solve node module caching issues
zajck Apr 20, 2023
45d0b56
Merge branch 'main' into upgrade-2.2.0-tests
zajck Apr 21, 2023
38816f1
Final v2.2.0 deployment config
zajck Apr 21, 2023
de81369
Merge branch 'main' into upgrade-2.2.0-tests
zajck Apr 21, 2023
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: 2 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@
"useTabs": false,
"singleQuote": false,
"bracketSpacing": true,
"explicitTypes": "always"
}
},
{
"files": "*.js",
"options": {
"printWidth": 120,
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": true
}
}
]
}
}
6 changes: 1 addition & 5 deletions contracts/diamond/JewelerLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ library JewelerLib {
* @param _init - the address of the contract or facet to execute _calldata
* @param _calldata - a function call, including function selector and arguments
*/
function diamondCut(
IDiamondCut.FacetCut[] memory _facetCuts,
address _init,
bytes memory _calldata
) internal {
function diamondCut(IDiamondCut.FacetCut[] memory _facetCuts, address _init, bytes memory _calldata) internal {
// Get the diamond storage slot
DiamondLib.DiamondStorage storage ds = DiamondLib.diamondStorage();

Expand Down
6 changes: 1 addition & 5 deletions contracts/diamond/facets/DiamondCutFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ contract DiamondCutFacet is IDiamondCut {
* @param _init - the address of the contract or facet to execute _calldata
* @param _calldata - a function call, including function selector and arguments
*/
function diamondCut(
FacetCut[] calldata _facetCuts,
address _init,
bytes calldata _calldata
) external override {
function diamondCut(FacetCut[] calldata _facetCuts, address _init, bytes calldata _calldata) external override {
// Get the diamond storage slot
DiamondLib.DiamondStorage storage ds = DiamondLib.diamondStorage();

Expand Down
9 changes: 3 additions & 6 deletions contracts/diamond/facets/DiamondLoupeFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,9 @@ contract DiamondLoupeFacet is IDiamondLoupe {
* @param _facet - the facet address
* @return facetFunctionSelectors_ - the selectors associated with a facet address
*/
function facetFunctionSelectors(address _facet)
external
view
override
returns (bytes4[] memory facetFunctionSelectors_)
{
function facetFunctionSelectors(
address _facet
) external view override returns (bytes4[] memory facetFunctionSelectors_) {
DiamondLib.DiamondStorage storage ds = DiamondLib.diamondStorage();
uint256 numSelectors;
facetFunctionSelectors_ = new bytes4[](ds.selectorCount);
Expand Down
56 changes: 9 additions & 47 deletions contracts/example/SnapshotGate/support/ERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ contract ERC721 is IERC721, IERC721Metadata {
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(msg.sender, tokenId), "ERC721: caller is not token owner nor approved");

Expand All @@ -154,23 +150,14 @@ contract ERC721 is IERC721, IERC721Metadata {
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}

/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public virtual override {
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {
require(_isApprovedOrOwner(msg.sender, tokenId), "ERC721: caller is not token owner nor approved");
_safeTransfer(from, to, tokenId, data);
}
Expand All @@ -193,12 +180,7 @@ contract ERC721 is IERC721, IERC721Metadata {
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory data
) internal virtual {
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
}
Expand Down Expand Up @@ -245,11 +227,7 @@ contract ERC721 is IERC721, IERC721Metadata {
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory data
) internal virtual {
function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, data),
Expand Down Expand Up @@ -320,11 +298,7 @@ contract ERC721 is IERC721, IERC721Metadata {
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");

Expand Down Expand Up @@ -357,11 +331,7 @@ contract ERC721 is IERC721, IERC721Metadata {
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
Expand Down Expand Up @@ -422,11 +392,7 @@ contract ERC721 is IERC721, IERC721Metadata {
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual {}

/**
* @dev Hook that is called after any transfer of tokens. This includes
Expand All @@ -439,9 +405,5 @@ contract ERC721 is IERC721, IERC721Metadata {
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
function _afterTokenTransfer(address from, address to, uint256 tokenId) internal virtual {}
}
6 changes: 1 addition & 5 deletions contracts/ext_libs/Address.sol
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ library Address {
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}

Expand Down
41 changes: 16 additions & 25 deletions contracts/ext_libs/Math.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ library Math {
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
Expand Down Expand Up @@ -137,12 +133,7 @@ library Math {
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
Expand Down Expand Up @@ -258,31 +249,31 @@ library Math {
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10**1) {
if (value >= 10 ** 1) {
result += 1;
}
}
Expand All @@ -296,7 +287,7 @@ library Math {
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}

Expand Down
13 changes: 2 additions & 11 deletions contracts/ext_libs/SafeERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,11 @@ import "./Address.sol";
library SafeERC20 {
using Address for address;

function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}

function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}

Expand Down
6 changes: 1 addition & 5 deletions contracts/interfaces/DAIAliases.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@ interface DAIAliases {

function pull(address usr, uint256 wad) external;

function move(
address src,
address dst,
uint256 wad
) external;
function move(address src, address dst, uint256 wad) external;
}
16 changes: 5 additions & 11 deletions contracts/interfaces/IERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ interface IERC1155 is IERC165 {
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);

/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
Expand Down Expand Up @@ -96,13 +96,7 @@ interface IERC1155 is IERC165 {
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
Expand Down
6 changes: 1 addition & 5 deletions contracts/interfaces/IERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,5 @@ interface IERC20 {
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
8 changes: 4 additions & 4 deletions contracts/interfaces/IERC2981.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ interface IERC2981 is IERC165 {
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount);
}
19 changes: 3 additions & 16 deletions contracts/interfaces/IERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ interface IERC721 is IERC165 {
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function safeTransferFrom(address from, address to, uint256 tokenId) external;

/**
* @dev Transfers `tokenId` token from `from` to `to`.
Expand All @@ -72,11 +68,7 @@ interface IERC721 is IERC165 {
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(address from, address to, uint256 tokenId) external;

/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
Expand Down Expand Up @@ -134,10 +126,5 @@ interface IERC721 is IERC165 {
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
Loading