Skip to content

Commit

Permalink
fix: LR-01 (#157)
Browse files Browse the repository at this point in the history
* fix: LR-01

* chore: circle

* fix: package-lock
  • Loading branch information
nachomazzara authored May 4, 2022
1 parent 7cd5834 commit 15c77b5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: npm install
- run: npm ci

- save_cache:
paths:
Expand Down
2 changes: 1 addition & 1 deletion contracts/land/LANDRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ contract LANDRegistry is Storage, Ownable, FullAssetRegistry, ILANDRegistry {
}

function setLatestToNow(address user) external {
require(msg.sender == proxyOwner || _isApprovedForAll(msg.sender, user), "Unauthorized user");
require(msg.sender == proxyOwner || _isApprovedForAll(user, msg.sender), "Unauthorized user");
// solium-disable-next-line security/no-block-members
latestPing[user] = block.timestamp;
}
Expand Down
4 changes: 2 additions & 2 deletions full/LANDRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ contract ERC721Base is AssetRegistryStorage, IERC721Base, ERC165 {
*/
function approve(address operator, uint256 assetId) external {
address holder = _ownerOf(assetId);
require(msg.sender == holder || _isApprovedForAll(msg.sender, holder));
require(msg.sender == holder || _isApprovedForAll(holder, msg.sender));
require(operator != holder);

if (_getApprovedAddress(assetId) != operator) {
Expand Down Expand Up @@ -1061,7 +1061,7 @@ contract LANDRegistry is Storage, Ownable, FullAssetRegistry, ILANDRegistry {
}

function setLatestToNow(address user) external {
require(msg.sender == proxyOwner || _isApprovedForAll(msg.sender, user), "Unauthorized user");
require(msg.sender == proxyOwner || _isApprovedForAll(user, msg.sender), "Unauthorized user");
// solium-disable-next-line security/no-block-members
latestPing[user] = block.timestamp;
}
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"homepage": "https://github.com/decentraland/land#readme",
"dependencies": {
"erc821": "^5.3.0",
"erc821": "^6.0.0",
"openzeppelin-zos": "1.9.4",
"zos": "1.4.0",
"zos-lib": "1.4.0"
Expand Down
6 changes: 6 additions & 0 deletions test/LANDRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@ contract('LANDRegistry', accounts => {
data.should.be.equal('test_data')
})

it('reverts when trying to approve a not authorized LAND :: approvalForAll', async function() {
await land.setApprovalForAll(user, true, sentByOperator)

await assertRevert(land.approve(anotherUser, 1, sentByOperator))
})

it('updates the parcel data if authorized :: approve for all', async function() {
await land.setApprovalForAll(operator, true, sentByUser)
const originalData = await land.landData(0, 1, sentByUser)
Expand Down

0 comments on commit 15c77b5

Please sign in to comment.