-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: restrict owner change in _beforeTokenTransfer
- Loading branch information
1 parent
8006a04
commit c4f2afd
Showing
4 changed files
with
94 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pragma solidity ^0.8.4; | ||
|
||
// modules | ||
import { | ||
LSP8IdentifiableDigitalAsset | ||
} from "../../LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol"; | ||
import { | ||
LSP8Burnable | ||
} from "../../LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol"; | ||
|
||
contract LSP8TransferOwnerChange is LSP8IdentifiableDigitalAsset, LSP8Burnable { | ||
constructor( | ||
string memory name_, | ||
string memory symbol_, | ||
address newOwner_, | ||
uint256 lsp4TokenType_, | ||
uint256 lsp8TokenIdFormat_ | ||
) | ||
LSP8IdentifiableDigitalAsset( | ||
name_, | ||
symbol_, | ||
newOwner_, | ||
lsp4TokenType_, | ||
lsp8TokenIdFormat_ | ||
) | ||
{} | ||
|
||
function mint( | ||
address to, | ||
bytes32 tokenId, | ||
bool force, | ||
bytes memory data | ||
) public { | ||
_mint(to, tokenId, force, data); | ||
} | ||
|
||
function _beforeTokenTransfer(address, address, bytes32 tokenId, bytes memory) internal override { | ||
|
||
// if tokenID exist transfer token ownership to this contract | ||
if (_tokenOwners[tokenId] != address(0)) { | ||
_tokenOwners[tokenId] = address(this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters