Skip to content

Commit

Permalink
fix: logic structure of legacy and new ERC7589
Browse files Browse the repository at this point in the history
  • Loading branch information
EDUARDO MELO DE SIQUEIRA authored and EDUARDO MELO DE SIQUEIRA committed Jul 12, 2024
1 parent e2a6a65 commit f136cc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 6 additions & 6 deletions contracts/OriumSftMarketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,16 @@ contract OriumSftMarketplace is Initializable, OwnableUpgradeable, PausableUpgra
*/
function delistRentalOfferAndWithdraw(RentalOffer calldata _offer) external whenNotPaused {
_delistRentalOffer(_offer);
IERC7589 _rolesRegistry = IERC7589(
IOriumMarketplaceRoyalties(oriumMarketplaceRoyalties).sftRolesRegistryOf(_offer.tokenAddress)
);
IERC7589Legacy _rolesRegistryLegacy = IERC7589Legacy(
IOriumMarketplaceRoyalties(oriumMarketplaceRoyalties).sftRolesRegistryOf(_offer.tokenAddress)
);

if (_offer.tokenAddress == aavegotchiWearableAddress) {
IERC7589Legacy _rolesRegistryLegacy = IERC7589Legacy(
IOriumMarketplaceRoyalties(oriumMarketplaceRoyalties).sftRolesRegistryOf(_offer.tokenAddress)
);
_rolesRegistryLegacy.releaseTokens(_offer.commitmentId);
} else {
IERC7589 _rolesRegistry = IERC7589(
IOriumMarketplaceRoyalties(oriumMarketplaceRoyalties).sftRolesRegistryOf(_offer.tokenAddress)
);
_rolesRegistry.unlockTokens(_offer.commitmentId);
}
}
Expand Down
5 changes: 2 additions & 3 deletions contracts/libraries/LibOriumSftMarketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@ library LibOriumSftMarketplace {
address _expectedGrantor,
address _rolesRegistryAddress
) external view {
IERC7589 _rolesRegistry = IERC7589(_rolesRegistryAddress);
IERC7589Legacy _rolesRegistryLegacy = IERC7589Legacy(_rolesRegistryAddress);

if (_tokenAddress == aavegotchiWearableAddress) {
IERC7589Legacy _rolesRegistryLegacy = IERC7589Legacy(_rolesRegistryAddress);
require(
_rolesRegistryLegacy.grantorOf(_commitmentId) == _expectedGrantor,
'OriumSftMarketplace: expected grantor does not match the grantor of the commitmentId'
Expand All @@ -117,6 +115,7 @@ library LibOriumSftMarketplace {
"OriumSftMarketplace: tokenId provided does not match commitment's tokenId"
);
} else {
IERC7589 _rolesRegistry = IERC7589(_rolesRegistryAddress);
require(
_rolesRegistry.tokenAmountOf(_commitmentId) == _tokenAmount,
"OriumSftMarketplace: tokenAmount provided does not match commitment's tokenAmount"
Expand Down

0 comments on commit f136cc8

Please sign in to comment.