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

Updates master from dev #273

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

Updates master from dev #273

wants to merge 31 commits into from

Conversation

steven2308
Copy link
Member

No description provided.

steven2308 and others added 30 commits March 2, 2024 22:03
RMRKTokenHolder (IERC7590-Draft Implementation) now reverts if transferred ERC-20 balance is not the specified amount.
Improves @dev comment on IERC7401, directOwnerOf method.
No long uses structs as return values for batch getters.
If a single attribute is sent on batch getter/setters it will use it for all collections and tokens.
Bumps [squirrelly](https://github.com/squirrellyjs/squirrelly) from 8.0.8 to 9.0.0.
- [Release notes](https://github.com/squirrellyjs/squirrelly/releases)
- [Commits](squirrellyjs/squirrelly@v8.0.8...v9.0.0)

---
updated-dependencies:
- dependency-name: squirrelly
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Interface was refactoring purely for ordering purposes.
Renames methods to set and get collection attributes metadata to make it explicit they are per collection.
Makes getAssetMetadata on MinifiedEquippable virtual.
The NFT to transfer can be equipped, nested or free.
The destination must be an NFT.
The NFT can be equipped into the destination.
If destination slot is occupied, it will be unequipped.
All these operations happen under a single transactions, given the right approvals.
This saves about 40% of gas since accept operation is not needed,
and pending children array is not used.

It also saves 4.5% of contract size.
@steven2308 steven2308 self-assigned this Jan 7, 2025
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Comment on lines +1285 to +1286
if (tokenId != 0 && !_tokenAssets[tokenId][assetId])
revert RMRKTokenDoesNotHaveAsset();

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.
Comment on lines +97 to +104
if (
(parentId != 0 && _msgSender() != owner) ||
!(_msgSender() == owner ||
isApprovedForAll(owner, _msgSender()) ||
getApproved(tokenId) == _msgSender())
) {
revert RMRKNotApprovedOrDirectOwner();
}

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.
Comment on lines +215 to +216
if (to == address(this) && tokenId == destinationId)
revert RMRKNestableTransferToSelf();

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.
tokenId,
data
);
_balances[from] -= 1;

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.security.basic-arithmetic-underflow Note

Possible arithmetic underflow
Comment on lines +337 to +339
if (nextOwner == address(this) && nextOwnerTokenId == currentId) {
revert RMRKNestableTransferToDescendant();
}

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.
Comment on lines +1750 to +1753
if (
_msgSender() != owner &&
!isApprovedForAllForAssets(owner, _msgSender())
) revert RMRKApproveForAssetsCallerIsNotOwnerNorApprovedForAll();

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.
Comment on lines +1876 to +1878
_equipCountPerChild[tokenId][equipment.childEquippableAddress][
equipment.childId
] -= 1;

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.security.basic-arithmetic-underflow Note

Possible arithmetic underflow
Comment on lines +50 to +51
if (tokenId != 0 && !_tokenAssets[tokenId][assetId])
revert RMRKTokenDoesNotHaveAsset();

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.
Comment on lines +256 to +265
if (
parentData.parentEquippedAssetId != 0 &&
parentData.parentEquippedSlotPartId != 0
) {
IERC6220(parentData.parentCollection).unequip(
parentData.parentTokenId,
parentData.parentEquippedAssetId,
parentData.parentEquippedSlotPartId
);
}

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.
Comment on lines +318 to +324
if (
child.contractAddress == childCollection &&
child.tokenId == childId
) {
destination.acceptChild(parentId, i, childCollection, childId);
return;
}

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant