Skip to content

Commit

Permalink
ON-713: adding minDuration on roleDeadLine require - createRentalOffer
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 Jun 14, 2024
1 parent 123ea0c commit e69681f
Show file tree
Hide file tree
Showing 22 changed files with 283 additions and 234 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ coverage.json
out
cache_forge
forge-artifacts
.npmrc


.openzeppelin/unknown-31337.json
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

Orium Protocol for renting NFTs. Powered by ERC7432 and ERC7589.


## Getting Started

To get started with this project, clone the repository and run the following commands:
Expand All @@ -14,7 +13,6 @@ npm test
npm run coverage
```


## Install Foundry

To be able to use foundry, run the following commands:
Expand Down
74 changes: 37 additions & 37 deletions addresses/cronos/index.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{
"Multisig": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"RolesRegistry": {
"address": "0xB1b599Ec67ad23AF7FAC240191319822e674571A"
},
"SftRolesRegistrySingleRole": {
"address": ""
},
"KMSDeployer": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"NftRentalMarketplace": {
"address": "",
"operator": "",
"implementation": "",
"proxyAdmin": ""
},
"ImmutableOwnerCreate2Factory": {
"address": "0x066f91a9Aa4C33D4ea4c12aBee6f4cb4e919F71d"
},
"OriumMarketplaceRoyalties": {
"address": "0xC3154ccAC181eb9d71ccd53f29F425BDdD52d983",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0xAb8E668acD4FEF935D5DfD869410bf8704688a53",
"proxyAdmin": "0x5E053177c73636d4378cfB4D095cFb374eBb3Da6"
},
"OriumSftMarketplace": {
"address": "0x48c769f6a8de57d824f0e7330d7A27dee53a43cD",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0x17ecC3620cE4062fA5eC4298a6BDc6d5A25d75Fe",
"proxyAdmin": "0x5E053177c73636d4378cfB4D095cFb374eBb3Da6"
},
"ERC7432WrapperForERC4907": {
"address": ""
}
}
"Multisig": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"RolesRegistry": {
"address": "0xB1b599Ec67ad23AF7FAC240191319822e674571A"
},
"SftRolesRegistrySingleRole": {
"address": ""
},
"KMSDeployer": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"NftRentalMarketplace": {
"address": "",
"operator": "",
"implementation": "",
"proxyAdmin": ""
},
"ImmutableOwnerCreate2Factory": {
"address": "0x066f91a9Aa4C33D4ea4c12aBee6f4cb4e919F71d"
},
"OriumMarketplaceRoyalties": {
"address": "0xC3154ccAC181eb9d71ccd53f29F425BDdD52d983",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0xAb8E668acD4FEF935D5DfD869410bf8704688a53",
"proxyAdmin": "0x5E053177c73636d4378cfB4D095cFb374eBb3Da6"
},
"OriumSftMarketplace": {
"address": "0x48c769f6a8de57d824f0e7330d7A27dee53a43cD",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0x17ecC3620cE4062fA5eC4298a6BDc6d5A25d75Fe",
"proxyAdmin": "0x5E053177c73636d4378cfB4D095cFb374eBb3Da6"
},
"ERC7432WrapperForERC4907": {
"address": ""
}
}
74 changes: 37 additions & 37 deletions addresses/cronosTestnet/index.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{
"Multisig": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"RolesRegistry": {
"address": "0xB1b599Ec67ad23AF7FAC240191319822e674571A"
},
"SftRolesRegistrySingleRole": {
"address": ""
},
"KMSDeployer": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"NftRentalMarketplace": {
"address": "",
"operator": "",
"implementation": "",
"proxyAdmin": ""
},
"ImmutableOwnerCreate2Factory": {
"address": "0x066f91a9Aa4C33D4ea4c12aBee6f4cb4e919F71d"
},
"OriumMarketplaceRoyalties": {
"address": "0x48c769f6a8de57d824f0e7330d7A27dee53a43cD",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0x17ecC3620cE4062fA5eC4298a6BDc6d5A25d75Fe",
"proxyAdmin": "0xC3154ccAC181eb9d71ccd53f29F425BDdD52d983"
},
"OriumSftMarketplace": {
"address": "0x3Af779a00868B3Ac35Ea9424340ec8A23ADDCfB4",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0xe359D2353D8f2E6Bd574E49F34c987729380EA1C",
"proxyAdmin": "0xC3154ccAC181eb9d71ccd53f29F425BDdD52d983"
},
"ERC7432WrapperForERC4907": {
"address": ""
}
}
"Multisig": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"RolesRegistry": {
"address": "0xB1b599Ec67ad23AF7FAC240191319822e674571A"
},
"SftRolesRegistrySingleRole": {
"address": ""
},
"KMSDeployer": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"NftRentalMarketplace": {
"address": "",
"operator": "",
"implementation": "",
"proxyAdmin": ""
},
"ImmutableOwnerCreate2Factory": {
"address": "0x066f91a9Aa4C33D4ea4c12aBee6f4cb4e919F71d"
},
"OriumMarketplaceRoyalties": {
"address": "0x48c769f6a8de57d824f0e7330d7A27dee53a43cD",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0x17ecC3620cE4062fA5eC4298a6BDc6d5A25d75Fe",
"proxyAdmin": "0xC3154ccAC181eb9d71ccd53f29F425BDdD52d983"
},
"OriumSftMarketplace": {
"address": "0x3Af779a00868B3Ac35Ea9424340ec8A23ADDCfB4",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0xe359D2353D8f2E6Bd574E49F34c987729380EA1C",
"proxyAdmin": "0xC3154ccAC181eb9d71ccd53f29F425BDdD52d983"
},
"ERC7432WrapperForERC4907": {
"address": ""
}
}
84 changes: 41 additions & 43 deletions addresses/moonbeam/index.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
{
"Multisig": {
"address": ""
},
"RolesRegistry": {
"address": ""
},
"SftRolesRegistrySingleRole": {
"address": ""
},
"KMSDeployer": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"ImmutableOwnerCreate2Factory": {
"address": ""
},
"OriumMarketplaceRoyalties": {
"address": "0x1FdB03ee7e0A861D0495075C1459ef87bC4de54c",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0xeE485138ae7b0A50F2342c67675c6D0a3bd1d3ea",
"proxyAdmin": "0xbee720D292d591cc94f522050cc2069070e3a15C"
},
"OriumSftMarketplace": {
"address": "",
"operator": "",
"implementation": "",
"proxyAdmin": "",
"libraries": [
""
]
},
"ERC7432WrapperForERC4907": {
"address": "0xc3154ccac181eb9d71ccd53f29f425bddd52d983"
},
"NftRentalMarketplace": {
"address": "0x201E1636BB21Dfd51F93815BCD008EAe2Fa29bD9",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0x1112949A242A0283c2170b9F28931ccBE8878d18",
"proxyAdmin": "0x668e73cF24361cfE13801681d8885e6632A7Eaa6",
"libraries": {
"LibNftRentalMarketplace": "0x037c0ae89bAE6d86476074CE3ef4F235467B1B79"
}
}
}
"Multisig": {
"address": ""
},
"RolesRegistry": {
"address": ""
},
"SftRolesRegistrySingleRole": {
"address": ""
},
"KMSDeployer": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"ImmutableOwnerCreate2Factory": {
"address": ""
},
"OriumMarketplaceRoyalties": {
"address": "0x1FdB03ee7e0A861D0495075C1459ef87bC4de54c",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0xeE485138ae7b0A50F2342c67675c6D0a3bd1d3ea",
"proxyAdmin": "0xbee720D292d591cc94f522050cc2069070e3a15C"
},
"OriumSftMarketplace": {
"address": "",
"operator": "",
"implementation": "",
"proxyAdmin": "",
"libraries": [""]
},
"ERC7432WrapperForERC4907": {
"address": "0xc3154ccac181eb9d71ccd53f29f425bddd52d983"
},
"NftRentalMarketplace": {
"address": "0x201E1636BB21Dfd51F93815BCD008EAe2Fa29bD9",
"operator": "0x04c8c6c56dab836f8bd62cb6884371507e706806",
"implementation": "0x1112949A242A0283c2170b9F28931ccBE8878d18",
"proxyAdmin": "0x668e73cF24361cfE13801681d8885e6632A7Eaa6",
"libraries": {
"LibNftRentalMarketplace": "0x037c0ae89bAE6d86476074CE3ef4F235467B1B79"
}
}
}
80 changes: 40 additions & 40 deletions addresses/polygon/index.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"Multisig": {
"address": "0x359E1208DE02Af11461A37D72165Ef2dcD2Adfc8"
},
"RolesRegistry": {
"address": "0xB1b599Ec67ad23AF7FAC240191319822e674571A"
},
"SftRolesRegistrySingleRole": {
"address": "0x071BC9F5aA747A9A8E8cE796e006d10dBf241E04"
},
"KMSDeployer": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"NftRentalMarketplace": {
"address": "",
"operator": "",
"implementation": "",
"proxyAdmin": ""
},
"ImmutableOwnerCreate2Factory": {
"address": "0x066f91a9Aa4C33D4ea4c12aBee6f4cb4e919F71d"
},
"OriumMarketplaceRoyalties": {
"address": "0x1fBAf746747aDdd76B70C76cd1069fFcaB1B7be4",
"operator": "0x359E1208DE02Af11461A37D72165Ef2dcD2Adfc8",
"implementation": "0x4211fC0292D38c38EdE6b0cec9E27a69f40cDf1a",
"proxyAdmin": "0x48c769f6a8de57d824f0e7330d7A27dee53a43cD"
},
"OriumSftMarketplace": {
"address": "0xB1D47B09aa6D81d7B00C3A37705a6A157B83C49F",
"operator": "0x359E1208DE02Af11461A37D72165Ef2dcD2Adfc8",
"implementation": "0x28c0DFe3e6B53ff3A25B9655A0B9D62120Ae34Fc",
"proxyAdmin": "0x48c769f6a8de57d824f0e7330d7A27dee53a43cD",
"libraries": {
"LibOriumSftMarketplace": "0xF992Cf6815aC9c08B3631b5587e16d561ef9a969"
}
},
"ERC7432WrapperForERC4907": {
"address": ""
}
}
"Multisig": {
"address": "0x359E1208DE02Af11461A37D72165Ef2dcD2Adfc8"
},
"RolesRegistry": {
"address": "0xB1b599Ec67ad23AF7FAC240191319822e674571A"
},
"SftRolesRegistrySingleRole": {
"address": "0x071BC9F5aA747A9A8E8cE796e006d10dBf241E04"
},
"KMSDeployer": {
"address": "0x04c8c6c56dab836f8bd62cb6884371507e706806"
},
"NftRentalMarketplace": {
"address": "",
"operator": "",
"implementation": "",
"proxyAdmin": ""
},
"ImmutableOwnerCreate2Factory": {
"address": "0x066f91a9Aa4C33D4ea4c12aBee6f4cb4e919F71d"
},
"OriumMarketplaceRoyalties": {
"address": "0x1fBAf746747aDdd76B70C76cd1069fFcaB1B7be4",
"operator": "0x359E1208DE02Af11461A37D72165Ef2dcD2Adfc8",
"implementation": "0x4211fC0292D38c38EdE6b0cec9E27a69f40cDf1a",
"proxyAdmin": "0x48c769f6a8de57d824f0e7330d7A27dee53a43cD"
},
"OriumSftMarketplace": {
"address": "0xB1D47B09aa6D81d7B00C3A37705a6A157B83C49F",
"operator": "0x359E1208DE02Af11461A37D72165Ef2dcD2Adfc8",
"implementation": "0x28c0DFe3e6B53ff3A25B9655A0B9D62120Ae34Fc",
"proxyAdmin": "0x48c769f6a8de57d824f0e7330d7A27dee53a43cD",
"libraries": {
"LibOriumSftMarketplace": "0xF992Cf6815aC9c08B3631b5587e16d561ef9a969"
}
},
"ERC7432WrapperForERC4907": {
"address": ""
}
}
8 changes: 6 additions & 2 deletions contracts/NftRentalMarketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgr
* @dev To optimize for gas, only the offer hash is stored on-chain
* @param _offer The rental offer struct.
*/

function createRentalOffer(RentalOffer calldata _offer) external whenNotPaused {
LibNftRentalMarketplace.validateCreateRentalOfferParams(
oriumMarketplaceRoyalties,
Expand All @@ -118,7 +119,7 @@ contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgr
roleDeadline[_offer.roles[i]][_offer.tokenAddress][_offer.tokenId] < block.timestamp,
'NftRentalMarketplace: role still has an active offer'
);
roleDeadline[_offer.roles[i]][_offer.tokenAddress][_offer.tokenId] = _offer.deadline;
roleDeadline[_offer.roles[i]][_offer.tokenAddress][_offer.tokenId] = _offer.deadline - _offer.minDuration;
}

bytes32 _offerHash = LibNftRentalMarketplace.hashRentalOffer(_offer);
Expand Down Expand Up @@ -149,7 +150,6 @@ contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgr
function acceptRentalOffer(RentalOffer calldata _offer, uint64 _duration) external whenNotPaused {
bytes32 _offerHash = LibNftRentalMarketplace.hashRentalOffer(_offer);
uint64 _expirationDate = uint64(block.timestamp + _duration);

LibNftRentalMarketplace.validateAcceptRentalOfferParams(
_offer.borrower,
_offer.minDuration,
Expand Down Expand Up @@ -180,6 +180,10 @@ contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgr
_offer.rolesData
);

// for (uint256 i = 0; i < _offer.roles.length; i++) {
// roleDeadline[_offer.roles[i]][_offer.tokenAddress][_offer.tokenId] - _expirationDate;
// }

rentals[_offerHash] = Rental({ borrower: msg.sender, expirationDate: _expirationDate });

emit RentalStarted(_offer.lender, _offer.nonce, msg.sender, _expirationDate);
Expand Down
Loading

0 comments on commit e69681f

Please sign in to comment.