Skip to content

Commit

Permalink
format sol files
Browse files Browse the repository at this point in the history
  • Loading branch information
channing-magiceden committed Mar 14, 2024
1 parent d69307c commit cf2b42c
Show file tree
Hide file tree
Showing 22 changed files with 217 additions and 327 deletions.
5 changes: 3 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
"trailingComma": "all",
"tabWidth": 2,
"printWidth": 80,
"plugins": ["prettier-plugin-solidity"],
"overrides": [
{
"files": "*.sol",
"options": {
"parser": "solidity-parse",
"printWidth": 80,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false,
"explicitTypes": "always"
"bracketSpacing": false
}
}
]
Expand Down
72 changes: 26 additions & 46 deletions contracts/ERC721CM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,9 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard {
*
* New supply cannot be larger than the old.
*/
function setMaxMintableSupply(uint256 maxMintableSupply)
external
virtual
onlyOwner
{
function setMaxMintableSupply(
uint256 maxMintableSupply
) external virtual onlyOwner {
if (maxMintableSupply > _maxMintableSupply) {
revert CannotIncreaseMaxMintableSupply();
}
Expand All @@ -258,10 +256,9 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard {
/**
* @dev Sets global wallet limit.
*/
function setGlobalWalletLimit(uint256 globalWalletLimit)
external
onlyOwner
{
function setGlobalWalletLimit(
uint256 globalWalletLimit
) external onlyOwner {
if (globalWalletLimit > _maxMintableSupply)
revert GlobalWalletLimitOverflow();
_globalWalletLimit = globalWalletLimit;
Expand All @@ -271,29 +268,18 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard {
/**
* @dev Returns number of minted token for a given address.
*/
function totalMintedByAddress(address a)
external
view
virtual
override
returns (uint256)
{
function totalMintedByAddress(
address a
) external view virtual override returns (uint256) {
return _numberMinted(a);
}

/**
* @dev Returns info for one stage specified by index (starting from 0).
*/
function getStageInfo(uint256 index)
external
view
override
returns (
MintStageInfo memory,
uint32,
uint256
)
{
function getStageInfo(
uint256 index
) external view override returns (MintStageInfo memory, uint32, uint256) {
if (index >= _mintStages.length) {
revert("InvalidStage");
}
Expand Down Expand Up @@ -470,11 +456,10 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard {
* NOTE: This function bypasses validations thus only available for owner.
* This is typically used for owner to pre-mint or mint the remaining of the supply.
*/
function ownerMint(uint32 qty, address to)
external
onlyOwner
hasSupply(qty)
{
function ownerMint(
uint32 qty,
address to
) external onlyOwner hasSupply(qty) {
_safeMint(to, qty);
}

Expand Down Expand Up @@ -525,12 +510,9 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard {
/**
* @dev Returns token URI for a given token id.
*/
function tokenURI(uint256 tokenId)
public
view
override(ERC721A, IERC721A)
returns (string memory)
{
function tokenURI(
uint256 tokenId
) public view override(ERC721A, IERC721A) returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

string memory baseURI = _currentBaseURI;
Expand Down Expand Up @@ -604,11 +586,9 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard {
/**
* @dev Returns the current active stage based on timestamp.
*/
function getActiveStageFromTimestamp(uint64 timestamp)
public
view
returns (uint256)
{
function getActiveStageFromTimestamp(
uint64 timestamp
) public view returns (uint256) {
for (uint256 i = 0; i < _mintStages.length; i++) {
if (
timestamp >= _mintStages[i].startTimeUnixSeconds &&
Expand All @@ -631,10 +611,10 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard {
/**
* @dev Validates the start timestamp is before end timestamp. Used when updating stages.
*/
function _assertValidStartAndEndTimestamp(uint64 start, uint64 end)
internal
pure
{
function _assertValidStartAndEndTimestamp(
uint64 start,
uint64 end
) internal pure {
if (start >= end) revert InvalidStartAndEndTimestamp();
}

Expand Down
4 changes: 3 additions & 1 deletion contracts/ERC721CMBasicRoyalties.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ contract ERC721CMBasicRoyalties is ERC721CM, BasicRoyalties {
BasicRoyalties(royaltyReceiver, royaltyFeeNumerator)
{}

function supportsInterface(bytes4 interfaceId)
function supportsInterface(
bytes4 interfaceId
)
public
view
virtual
Expand Down
4 changes: 3 additions & 1 deletion contracts/ERC721CMRoyalties.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ contract ERC721CMRoyalties is ERC721CM, UpdatableRoyalties {
UpdatableRoyalties(royaltyReceiver, royaltyFeeNumerator)
{}

function supportsInterface(bytes4 interfaceId)
function supportsInterface(
bytes4 interfaceId
)
public
view
virtual
Expand Down
72 changes: 26 additions & 46 deletions contracts/ERC721M.sol
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
*
* New supply cannot be larger than the old.
*/
function setMaxMintableSupply(uint256 maxMintableSupply)
external
virtual
onlyOwner
{
function setMaxMintableSupply(
uint256 maxMintableSupply
) external virtual onlyOwner {
if (maxMintableSupply > _maxMintableSupply) {
revert CannotIncreaseMaxMintableSupply();
}
Expand All @@ -254,10 +252,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
/**
* @dev Sets global wallet limit.
*/
function setGlobalWalletLimit(uint256 globalWalletLimit)
external
onlyOwner
{
function setGlobalWalletLimit(
uint256 globalWalletLimit
) external onlyOwner {
if (globalWalletLimit > _maxMintableSupply)
revert GlobalWalletLimitOverflow();
_globalWalletLimit = globalWalletLimit;
Expand All @@ -267,29 +264,18 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
/**
* @dev Returns number of minted token for a given address.
*/
function totalMintedByAddress(address a)
external
view
virtual
override
returns (uint256)
{
function totalMintedByAddress(
address a
) external view virtual override returns (uint256) {
return _numberMinted(a);
}

/**
* @dev Returns info for one stage specified by index (starting from 0).
*/
function getStageInfo(uint256 index)
external
view
override
returns (
MintStageInfo memory,
uint32,
uint256
)
{
function getStageInfo(
uint256 index
) external view override returns (MintStageInfo memory, uint32, uint256) {
if (index >= _mintStages.length) {
revert("InvalidStage");
}
Expand Down Expand Up @@ -466,11 +452,10 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
* NOTE: This function bypasses validations thus only available for owner.
* This is typically used for owner to pre-mint or mint the remaining of the supply.
*/
function ownerMint(uint32 qty, address to)
external
onlyOwner
hasSupply(qty)
{
function ownerMint(
uint32 qty,
address to
) external onlyOwner hasSupply(qty) {
_safeMint(to, qty);
}

Expand Down Expand Up @@ -521,12 +506,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
/**
* @dev Returns token URI for a given token id.
*/
function tokenURI(uint256 tokenId)
public
view
override(ERC721A, IERC721A)
returns (string memory)
{
function tokenURI(
uint256 tokenId
) public view override(ERC721A, IERC721A) returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

string memory baseURI = _currentBaseURI;
Expand Down Expand Up @@ -586,11 +568,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
/**
* @dev Returns the current active stage based on timestamp.
*/
function getActiveStageFromTimestamp(uint64 timestamp)
public
view
returns (uint256)
{
function getActiveStageFromTimestamp(
uint64 timestamp
) public view returns (uint256) {
for (uint256 i = 0; i < _mintStages.length; i++) {
if (
timestamp >= _mintStages[i].startTimeUnixSeconds &&
Expand All @@ -613,10 +593,10 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
/**
* @dev Validates the start timestamp is before end timestamp. Used when updating stages.
*/
function _assertValidStartAndEndTimestamp(uint64 start, uint64 end)
internal
pure
{
function _assertValidStartAndEndTimestamp(
uint64 start,
uint64 end
) internal pure {
if (start >= end) revert InvalidStartAndEndTimestamp();
}

Expand Down
7 changes: 3 additions & 4 deletions contracts/ERC721MAutoApprover.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ contract ERC721MAutoApprover is ERC721M {
return _autoApproveAddress;
}

function setAutoApproveAddress(address autoApproveAddress)
external
onlyOwner
{
function setAutoApproveAddress(
address autoApproveAddress
) external onlyOwner {
_autoApproveAddress = autoApproveAddress;
emit SetAutoApproveAddress(autoApproveAddress);
}
Expand Down
8 changes: 3 additions & 5 deletions contracts/ERC721MIncreasableSupply.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ contract ERC721MIncreasableSupply is ERC721M {
*
* New supply cannot be larger than the old, unless _canIncreaseMaxMintableSupply is true.
*/
function setMaxMintableSupply(uint256 maxMintableSupply)
external
override
onlyOwner
{
function setMaxMintableSupply(
uint256 maxMintableSupply
) external override onlyOwner {
if (
!_canIncreaseMaxMintableSupply &&
maxMintableSupply > _maxMintableSupply
Expand Down
7 changes: 3 additions & 4 deletions contracts/ERC721MOperatorFiltererAutoApprover.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ contract ERC721MOperatorFiltererAutoApprover is ERC721MOperatorFilterer {
return _autoApproveAddress;
}

function setAutoApproveAddress(address autoApproveAddress)
external
onlyOwner
{
function setAutoApproveAddress(
address autoApproveAddress
) external onlyOwner {
_autoApproveAddress = autoApproveAddress;
emit SetAutoApproveAddress(autoApproveAddress);
}
Expand Down
11 changes: 3 additions & 8 deletions contracts/IERC721M.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,7 @@ interface IERC721M is IERC721AQueryable {

function totalMintedByAddress(address a) external view returns (uint256);

function getStageInfo(uint256 index)
external
view
returns (
MintStageInfo memory,
uint32,
uint256
);
function getStageInfo(
uint256 index
) external view returns (MintStageInfo memory, uint32, uint256);
}
Loading

0 comments on commit cf2b42c

Please sign in to comment.