Fix token owner error

This commit is contained in:
EmperorOrokuSaki 2022-12-07 18:38:08 +03:30
parent 63820f7a87
commit afb1f1e73b
5 changed files with 7252 additions and 3882 deletions

View File

@ -67,7 +67,7 @@ contract FleekERC721 is ERC721, FleekAccessControl {
) public payable requireCollectionOwner returns (uint256) {
uint256 tokenId = _tokenIds.current();
_mint(to, tokenId);
addTokenController(tokenId, to);
_addTokenController(tokenId, to);
_tokenIds.increment();
App storage app = _apps[tokenId];
@ -127,6 +127,14 @@ contract FleekERC721 is ERC721, FleekAccessControl {
_grantRole(_tokenRole(tokenId, "CONTROLLER"), controller);
}
function _addTokenController(
uint256 tokenId,
address controller
) internal {
_requireMinted(tokenId);
_grantRole(_tokenRole(tokenId, "CONTROLLER"), controller);
}
function removeTokenController(
uint256 tokenId,
address controller

View File

@ -62,8 +62,8 @@
}
},
"contracts/FleekERC721.sol": {
"lastModificationDate": 1670412322054,
"contentHash": "8e01be0410a9ffbb2857e7215da33704",
"lastModificationDate": 1670425560329,
"contentHash": "9522992e0912fe3d7fb8dbbd44df3550",
"sourceName": "contracts/FleekERC721.sol",
"solcConfig": {
"settings": {
@ -1356,8 +1356,8 @@
}
},
"test/foundry/apps.t.sol": {
"lastModificationDate": 1670421448731,
"contentHash": "ded5c47848d94e49eb22b8f12b8327ad",
"lastModificationDate": 1670425619647,
"contentHash": "04a0358899f22e7f132b2e88e022426c",
"sourceName": "test/foundry/apps.t.sol",
"solcConfig": {
"settings": {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,11 +9,7 @@ contract ContractBTest is Test {
function setUp() public {
fleekContract = new FleekERC721('Test Contract', 'FLKAPS');
}
function testCollectionOwner() public {
assertEq(fleekContract.COLLECTION_OWNER_ROLE, keccak256('0xb4c79daB8f259C7Aee6E5b2Aa729821864227e84'));
}
function testName() public {
assertEq(fleekContract.name(), 'Test Contract');
}