Skip to content

Commit

Permalink
wip migrate ok
Browse files Browse the repository at this point in the history
  • Loading branch information
drikssy committed Oct 10, 2024
1 parent e44d328 commit 58d66f1
Show file tree
Hide file tree
Showing 76 changed files with 588 additions and 22,714 deletions.
22 changes: 18 additions & 4 deletions contracts/EntityForging.sol
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,24 @@ contract EntityForging is IEntityForging, AddressProviderResolver, ReentrancyGua
_cancelListingForForging(tokenId);
}

function migrateListingData(Listing[] memory _listings, uint256 _listingCount) external onlyProtocolMaintainer {
for (uint256 i = 0; i < _listings.length; i++) {
listings[i + 1] = _listings[i];
listedTokenIds[_listings[i].tokenId] = i + 1;
function migrateListingData(
Listing[] memory _listings,
uint256 startIndex,
uint256 endIndex,
uint256 _listingCount
)
external
onlyProtocolMaintainer
{
if (endIndex > _listings.length) {
revert EntityForging__OffsetOutOfBounds();
}
if (startIndex > endIndex) {
revert EntityForging__OffsetOutOfBounds();
}
for (uint256 i = startIndex; i < endIndex; i++) {
listings[startIndex + i + 1] = _listings[i];
listedTokenIds[_listings[i].tokenId] = startIndex + i + 1;
}
listingCount = _listingCount;
}
Expand Down
Loading

0 comments on commit 58d66f1

Please sign in to comment.