Skip to content

Commit ef6a072

Browse files
jakelookumaryash90nkrishang
authored
Upgrade dependencies and minor clean up (#580)
* Update dependency and solc version * package-lock and yarn.lock * Fix prettier * Update lib dependencies - oz 4.9.3 - chainlink 2.7.1 - forge-std 1.7.3 * fix tests * prettier * Remove unused echidna and manticore * AirdropClaimable: Improve Code Quality - Rename confusing state variable to be more explicit - Remove unnecessary states and functions for deployment - Fix tests * Remove TW prefix for libs * Prettier 120 width --------- Co-authored-by: Yash <[email protected]> Co-authored-by: Yash <[email protected]> Co-authored-by: nkrishang <[email protected]>
1 parent 791e8df commit ef6a072

File tree

377 files changed

+9944
-8034
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+9944
-8034
lines changed

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ deployArgs.json
3838
/notes.txt
3939
.yalc/
4040
yalc.lock
41-
package-lock.json
42-
yarn.lock
4341

4442
# Forge
4543
#/lib
@@ -58,4 +56,4 @@ corpus/
5856
# IDES
5957
.idea
6058

61-
*.DS_Store
59+
*.DS_Store

.gitmodules

-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616
[submodule "lib/ERC721A-Upgradeable"]
1717
path = lib/ERC721A-Upgradeable
1818
url = https://github.com/chiru-labs/ERC721A-Upgradeable
19-
branch = v3.3.0
2019
[submodule "lib/ERC721A"]
2120
path = lib/ERC721A
2221
url = https://github.com/chiru-labs/ERC721A
23-
branch = v3.3.0
2422
[submodule "lib/dynamic-contracts"]
2523
path = lib/dynamic-contracts
2624
url = https://github.com/thirdweb-dev/dynamic-contracts

.prettierrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
{
1212
"files": "*.sol",
1313
"options": {
14-
"tabWidth": 4,
15-
"explicitTypes": "always"
14+
"tabWidth": 4
1615
}
1716
}
1817
]

contracts/base/ERC1155Base.sol

+5-18
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import "../extension/Ownable.sol";
1111
import "../extension/Royalty.sol";
1212
import "../extension/BatchMintMetadata.sol";
1313

14-
import "../lib/TWStrings.sol";
14+
import "../lib/Strings.sol";
1515

1616
/**
1717
* The `ERC1155Base` smart contract implements the ERC1155 NFT standard.
@@ -31,7 +31,7 @@ import "../lib/TWStrings.sol";
3131
*/
3232

3333
contract ERC1155Base is ERC1155, ContractMetadata, Ownable, Royalty, Multicall, BatchMintMetadata {
34-
using TWStrings for uint256;
34+
using Strings for uint256;
3535

3636
/*//////////////////////////////////////////////////////////////
3737
State variables
@@ -97,12 +97,7 @@ contract ERC1155Base is ERC1155, ContractMetadata, Ownable, Royalty, Multicall,
9797
* @param _tokenURI The full metadata URI for the NFTs minted (if a new NFT is being minted).
9898
* @param _amount The amount of the same NFT to mint.
9999
*/
100-
function mintTo(
101-
address _to,
102-
uint256 _tokenId,
103-
string memory _tokenURI,
104-
uint256 _amount
105-
) public virtual {
100+
function mintTo(address _to, uint256 _tokenId, string memory _tokenURI, uint256 _amount) public virtual {
106101
require(_canMint(), "Not authorized to mint.");
107102

108103
uint256 tokenIdToMint;
@@ -173,11 +168,7 @@ contract ERC1155Base is ERC1155, ContractMetadata, Ownable, Royalty, Multicall,
173168
* @param _tokenId The tokenId of the NFT to burn.
174169
* @param _amount The amount of the NFT to burn.
175170
*/
176-
function burn(
177-
address _owner,
178-
uint256 _tokenId,
179-
uint256 _amount
180-
) external virtual {
171+
function burn(address _owner, uint256 _tokenId, uint256 _amount) external virtual {
181172
address caller = msg.sender;
182173

183174
require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller");
@@ -193,11 +184,7 @@ contract ERC1155Base is ERC1155, ContractMetadata, Ownable, Royalty, Multicall,
193184
* @param _tokenIds The tokenIds of the NFTs to burn.
194185
* @param _amounts The amounts of the NFTs to burn.
195186
*/
196-
function burnBatch(
197-
address _owner,
198-
uint256[] memory _tokenIds,
199-
uint256[] memory _amounts
200-
) external virtual {
187+
function burnBatch(address _owner, uint256[] memory _tokenIds, uint256[] memory _amounts) external virtual {
201188
address caller = msg.sender;
202189

203190
require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller");

contracts/base/ERC1155DelayedReveal.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import "../extension/DelayedReveal.sol";
2525
*/
2626

2727
contract ERC1155DelayedReveal is ERC1155LazyMint, DelayedReveal {
28-
using TWStrings for uint256;
28+
using Strings for uint256;
2929

3030
/*//////////////////////////////////////////////////////////////
3131
Constructor

contracts/base/ERC1155Drop.sol

+5-13
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import "../extension/DropSinglePhase1155.sol";
1515
import "../extension/LazyMint.sol";
1616
import "../extension/DelayedReveal.sol";
1717

18-
import "../lib/CurrencyTransferLib.sol";
19-
import "../lib/TWStrings.sol";
18+
import { CurrencyTransferLib } from "../lib/CurrencyTransferLib.sol";
19+
import "../lib/Strings.sol";
2020

2121
/**
2222
* BASE: ERC1155Base
@@ -53,7 +53,7 @@ contract ERC1155Drop is
5353
DelayedReveal,
5454
DropSinglePhase1155
5555
{
56-
using TWStrings for uint256;
56+
using Strings for uint256;
5757

5858
/*//////////////////////////////////////////////////////////////
5959
Mappings
@@ -119,11 +119,7 @@ contract ERC1155Drop is
119119
* @param _tokenId The tokenId of the NFT to burn.
120120
* @param _amount The amount of the NFT to burn.
121121
*/
122-
function burn(
123-
address _owner,
124-
uint256 _tokenId,
125-
uint256 _amount
126-
) external virtual {
122+
function burn(address _owner, uint256 _tokenId, uint256 _amount) external virtual {
127123
address caller = msg.sender;
128124

129125
require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller");
@@ -139,11 +135,7 @@ contract ERC1155Drop is
139135
* @param _tokenIds The tokenIds of the NFTs to burn.
140136
* @param _amounts The amounts of the NFTs to burn.
141137
*/
142-
function burnBatch(
143-
address _owner,
144-
uint256[] memory _tokenIds,
145-
uint256[] memory _amounts
146-
) external virtual {
138+
function burnBatch(address _owner, uint256[] memory _tokenIds, uint256[] memory _amounts) external virtual {
147139
address caller = msg.sender;
148140

149141
require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller");

contracts/base/ERC1155LazyMint.sol

+7-27
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import "../extension/BatchMintMetadata.sol";
1313
import "../extension/LazyMint.sol";
1414
import "../extension/interface/IClaimableERC1155.sol";
1515

16-
import "../lib/TWStrings.sol";
16+
import "../lib/Strings.sol";
1717
import "../external-deps/openzeppelin/security/ReentrancyGuard.sol";
1818

1919
/**
@@ -59,7 +59,7 @@ contract ERC1155LazyMint is
5959
IClaimableERC1155,
6060
ReentrancyGuard
6161
{
62-
using TWStrings for uint256;
62+
using Strings for uint256;
6363

6464
/*//////////////////////////////////////////////////////////////
6565
Mappings
@@ -130,11 +130,7 @@ contract ERC1155LazyMint is
130130
* @param _tokenId The tokenId of the lazy minted NFT to mint.
131131
* @param _quantity The number of tokens to mint.
132132
*/
133-
function claim(
134-
address _receiver,
135-
uint256 _tokenId,
136-
uint256 _quantity
137-
) public payable virtual nonReentrant {
133+
function claim(address _receiver, uint256 _tokenId, uint256 _quantity) public payable virtual nonReentrant {
138134
require(_tokenId < nextTokenIdToMint(), "invalid id");
139135
verifyClaim(msg.sender, _tokenId, _quantity); // Add your claim verification logic by overriding this function.
140136

@@ -152,11 +148,7 @@ contract ERC1155LazyMint is
152148
* @param _tokenId The tokenId of the lazy minted NFT to mint.
153149
* @param _quantity The number of NFTs being claimed.
154150
*/
155-
function verifyClaim(
156-
address _claimer,
157-
uint256 _tokenId,
158-
uint256 _quantity
159-
) public view virtual {}
151+
function verifyClaim(address _claimer, uint256 _tokenId, uint256 _quantity) public view virtual {}
160152

161153
/**
162154
* @notice Lets an owner or approved operator burn NFTs of the given tokenId.
@@ -165,11 +157,7 @@ contract ERC1155LazyMint is
165157
* @param _tokenId The tokenId of the NFT to burn.
166158
* @param _amount The amount of the NFT to burn.
167159
*/
168-
function burn(
169-
address _owner,
170-
uint256 _tokenId,
171-
uint256 _amount
172-
) external virtual {
160+
function burn(address _owner, uint256 _tokenId, uint256 _amount) external virtual {
173161
address caller = msg.sender;
174162

175163
require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller");
@@ -185,11 +173,7 @@ contract ERC1155LazyMint is
185173
* @param _tokenIds The tokenIds of the NFTs to burn.
186174
* @param _amounts The amounts of the NFTs to burn.
187175
*/
188-
function burnBatch(
189-
address _owner,
190-
uint256[] memory _tokenIds,
191-
uint256[] memory _amounts
192-
) external virtual {
176+
function burnBatch(address _owner, uint256[] memory _tokenIds, uint256[] memory _amounts) external virtual {
193177
address caller = msg.sender;
194178

195179
require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller");
@@ -243,11 +227,7 @@ contract ERC1155LazyMint is
243227
* @param _tokenId The tokenId of the lazy minted NFT to mint.
244228
* @param _quantity The number of tokens to mint.
245229
*/
246-
function _transferTokensOnClaim(
247-
address _receiver,
248-
uint256 _tokenId,
249-
uint256 _quantity
250-
) internal virtual {
230+
function _transferTokensOnClaim(address _receiver, uint256 _tokenId, uint256 _quantity) internal virtual {
251231
_mint(_receiver, _tokenId, _quantity, "");
252232
}
253233

contracts/base/ERC1155SignatureMint.sol

+5-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import "./ERC1155Base.sol";
88
import "../extension/PrimarySale.sol";
99
import "../extension/SignatureMintERC1155.sol";
1010

11-
import "../lib/CurrencyTransferLib.sol";
11+
import { CurrencyTransferLib } from "../lib/CurrencyTransferLib.sol";
1212

1313
/**
1414
* BASE: ERC1155Base
@@ -49,13 +49,10 @@ contract ERC1155SignatureMint is ERC1155Base, PrimarySale, SignatureMintERC1155
4949
* @param _req The payload / mint request.
5050
* @param _signature The signature produced by an account signing the mint request.
5151
*/
52-
function mintWithSignature(MintRequest calldata _req, bytes calldata _signature)
53-
external
54-
payable
55-
virtual
56-
override
57-
returns (address signer)
58-
{
52+
function mintWithSignature(
53+
MintRequest calldata _req,
54+
bytes calldata _signature
55+
) external payable virtual override returns (address signer) {
5956
require(_req.quantity > 0, "Minting zero tokens.");
6057

6158
uint256 tokenIdToMint;

contracts/base/ERC20Base.sol

+1-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ contract ERC20Base is ContractMetadata, Multicall, Ownable, ERC20Permit, IMintab
3131
Constructor
3232
//////////////////////////////////////////////////////////////*/
3333

34-
constructor(
35-
address _defaultAdmin,
36-
string memory _name,
37-
string memory _symbol
38-
) ERC20Permit(_name, _symbol) {
34+
constructor(address _defaultAdmin, string memory _name, string memory _symbol) ERC20Permit(_name, _symbol) {
3935
_setupOwner(_defaultAdmin);
4036
}
4137

contracts/base/ERC20Drop.sol

+5-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import "../extension/PrimarySale.sol";
1212
import "../extension/DropSinglePhase.sol";
1313
import "../extension/interface/IBurnableERC20.sol";
1414

15-
import "../lib/CurrencyTransferLib.sol";
15+
import { CurrencyTransferLib } from "../lib/CurrencyTransferLib.sol";
1616

1717
/**
1818
* BASE: ERC20
@@ -112,12 +112,10 @@ contract ERC20Drop is ContractMetadata, Multicall, Ownable, ERC20Permit, Primary
112112
}
113113

114114
/// @dev Transfers the tokens being claimed.
115-
function _transferTokensOnClaim(address _to, uint256 _quantityBeingClaimed)
116-
internal
117-
virtual
118-
override
119-
returns (uint256)
120-
{
115+
function _transferTokensOnClaim(
116+
address _to,
117+
uint256 _quantityBeingClaimed
118+
) internal virtual override returns (uint256) {
121119
_mint(_to, _quantityBeingClaimed);
122120
return 0;
123121
}

contracts/base/ERC20DropVote.sol

+5-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import "../extension/Ownable.sol";
1111
import "../extension/PrimarySale.sol";
1212
import "../extension/DropSinglePhase.sol";
1313

14-
import "../lib/CurrencyTransferLib.sol";
14+
import { CurrencyTransferLib } from "../lib/CurrencyTransferLib.sol";
1515

1616
/**
1717
* BASE: ERC20Votes
@@ -95,12 +95,10 @@ contract ERC20DropVote is ContractMetadata, Multicall, Ownable, ERC20Votes, Prim
9595
}
9696

9797
/// @dev Transfers the tokens being claimed.
98-
function _transferTokensOnClaim(address _to, uint256 _quantityBeingClaimed)
99-
internal
100-
virtual
101-
override
102-
returns (uint256)
103-
{
98+
function _transferTokensOnClaim(
99+
address _to,
100+
uint256 _quantityBeingClaimed
101+
) internal virtual override returns (uint256) {
104102
_mint(_to, _quantityBeingClaimed);
105103
return 0;
106104
}

contracts/base/ERC20SignatureMint.sol

+6-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import "./ERC20Base.sol";
88
import "../extension/PrimarySale.sol";
99
import { SignatureMintERC20 } from "../extension/SignatureMintERC20.sol";
1010

11-
import "../lib/CurrencyTransferLib.sol";
11+
import { CurrencyTransferLib } from "../lib/CurrencyTransferLib.sol";
1212

1313
/**
1414
* BASE: ERC20
@@ -47,12 +47,10 @@ contract ERC20SignatureMint is ERC20Base, PrimarySale, SignatureMintERC20 {
4747
* @param _req The payload / mint request.
4848
* @param _signature The signature produced by an account signing the mint request.
4949
*/
50-
function mintWithSignature(MintRequest calldata _req, bytes calldata _signature)
51-
external
52-
payable
53-
virtual
54-
returns (address signer)
55-
{
50+
function mintWithSignature(
51+
MintRequest calldata _req,
52+
bytes calldata _signature
53+
) external payable virtual returns (address signer) {
5654
require(_req.quantity > 0, "Minting zero tokens.");
5755

5856
// Verify and process payload.
@@ -84,11 +82,7 @@ contract ERC20SignatureMint is ERC20Base, PrimarySale, SignatureMintERC20 {
8482
}
8583

8684
/// @dev Collects and distributes the primary sale value of tokens being claimed.
87-
function _collectPriceOnClaim(
88-
address _primarySaleRecipient,
89-
address _currency,
90-
uint256 _price
91-
) internal virtual {
85+
function _collectPriceOnClaim(address _primarySaleRecipient, address _currency, uint256 _price) internal virtual {
9286
if (_price == 0) {
9387
require(msg.value == 0, "!Value");
9488
return;

0 commit comments

Comments
 (0)