-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added mint and setTokenUri functionality, transfer needs some work ba…
…sed on requirements
- Loading branch information
1 parent
d925d97
commit 3be6122
Showing
5 changed files
with
255 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.0 <0.9.0; | ||
|
||
// Useful for debugging. Remove when deploying to a live network. | ||
import "forge-std/console.sol"; | ||
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | ||
import {ERC721URIStorage} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; | ||
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; | ||
|
||
contract ATXDAOPartnershipNft is ERC721URIStorage, AccessControl { | ||
constructor(address[] memory admins) ERC721("ADNDN", "ATX") { | ||
for (uint256 i = 0; i < admins.length; i++) { | ||
_grantRole(DEFAULT_ADMIN_ROLE, admins[i]); | ||
} | ||
} | ||
|
||
uint256 mintCount; | ||
|
||
function mint(address target) external onlyRole(DEFAULT_ADMIN_ROLE) { | ||
_mint(target, mintCount); | ||
mintCount++; | ||
} | ||
|
||
error ATXDAOPartnershipNft__NotValidOperator(); | ||
|
||
function setTokenURI(uint256 tokenId, string memory tokenUri) external { | ||
if (msg.sender != ownerOf(tokenId)) { | ||
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) { | ||
revert ATXDAOPartnershipNft__NotValidOperator(); | ||
} | ||
} | ||
|
||
_setTokenURI(tokenId, tokenUri); | ||
} | ||
|
||
function returnToDao( | ||
uint256 tokenId | ||
) external onlyRole(DEFAULT_ADMIN_ROLE) { | ||
transferFrom(ownerOf(tokenId), msg.sender, tokenId); | ||
} | ||
|
||
function supportsInterface( | ||
bytes4 interfaceId | ||
) public view override(ERC721URIStorage, AccessControl) returns (bool) { | ||
return super.supportsInterface(interfaceId); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,135 @@ | ||
TN: | ||
SF:contracts/ATXDAOPartnershipNft.sol | ||
FN:19,ATXDAOPartnershipNft.mint | ||
FNDA:3,ATXDAOPartnershipNft.mint | ||
DA:20,3 | ||
DA:21,3 | ||
FN:26,ATXDAOPartnershipNft.setTokenURI | ||
FNDA:3,ATXDAOPartnershipNft.setTokenURI | ||
DA:27,3 | ||
BRDA:27,0,0,1 | ||
BRDA:27,0,1,1 | ||
DA:28,2 | ||
BRDA:28,1,0,1 | ||
BRDA:28,1,1,1 | ||
DA:29,1 | ||
DA:33,2 | ||
FN:36,ATXDAOPartnershipNft.supportsInterface | ||
FNDA:0,ATXDAOPartnershipNft.supportsInterface | ||
DA:39,0 | ||
FNF:3 | ||
FNH:2 | ||
LF:7 | ||
LH:6 | ||
BRF:4 | ||
BRH:4 | ||
end_of_record | ||
TN: | ||
SF:script/DeployHelpers.s.sol | ||
FN:19,ScaffoldETHDeploy.setupLocalhostEnv | ||
FNDA:0,ScaffoldETHDeploy.setupLocalhostEnv | ||
DA:23,0 | ||
BRDA:23,0,0,- | ||
BRDA:23,0,1,- | ||
DA:24,0 | ||
DA:25,0 | ||
DA:26,0 | ||
DA:27,0 | ||
DA:28,0 | ||
DA:29,0 | ||
DA:31,0 | ||
FN:35,ScaffoldETHDeploy.exportDeployments | ||
FNDA:0,ScaffoldETHDeploy.exportDeployments | ||
DA:37,0 | ||
DA:38,0 | ||
DA:39,0 | ||
DA:40,0 | ||
DA:42,0 | ||
DA:44,0 | ||
DA:46,0 | ||
DA:47,0 | ||
DA:54,0 | ||
DA:56,0 | ||
DA:61,0 | ||
DA:62,0 | ||
FN:65,ScaffoldETHDeploy.getChain | ||
FNDA:0,ScaffoldETHDeploy.getChain | ||
DA:66,0 | ||
FN:69,ScaffoldETHDeploy.findChainName | ||
FNDA:0,ScaffoldETHDeploy.findChainName | ||
DA:70,0 | ||
DA:71,0 | ||
DA:72,0 | ||
DA:73,0 | ||
DA:81,0 | ||
FNF:4 | ||
FNH:0 | ||
LF:26 | ||
LH:0 | ||
BRF:2 | ||
BRH:0 | ||
end_of_record | ||
TN: | ||
SF:script/VerifyAll.s.sol | ||
FN:27,VerifyAll.run | ||
FNDA:0,VerifyAll.run | ||
DA:28,0 | ||
DA:29,0 | ||
DA:35,0 | ||
DA:37,0 | ||
DA:38,0 | ||
DA:39,0 | ||
FN:43,VerifyAll._verifyIfContractDeployment | ||
FNDA:0,VerifyAll._verifyIfContractDeployment | ||
DA:44,0 | ||
DA:51,0 | ||
BRDA:51,0,0,- | ||
BRDA:51,0,1,- | ||
DA:52,0 | ||
FN:56,VerifyAll._verifyContract | ||
FNDA:0,VerifyAll._verifyContract | ||
DA:57,0 | ||
DA:64,0 | ||
DA:71,0 | ||
DA:78,0 | ||
DA:85,0 | ||
DA:91,0 | ||
DA:92,0 | ||
DA:93,0 | ||
DA:94,0 | ||
DA:95,0 | ||
DA:96,0 | ||
DA:97,0 | ||
DA:98,0 | ||
DA:99,0 | ||
DA:100,0 | ||
DA:102,0 | ||
DA:104,0 | ||
BRDA:104,1,0,- | ||
BRDA:104,1,1,- | ||
DA:105,0 | ||
DA:111,0 | ||
DA:113,0 | ||
DA:115,0 | ||
FN:118,VerifyAll.nextTransaction | ||
FNDA:0,VerifyAll.nextTransaction | ||
DA:121,0 | ||
FN:128,VerifyAll._getCompiledBytecode | ||
FNDA:0,VerifyAll._getCompiledBytecode | ||
DA:131,0 | ||
DA:132,0 | ||
DA:140,0 | ||
FN:143,VerifyAll.getTransactionFromRaw | ||
FNDA:0,VerifyAll.getTransactionFromRaw | ||
DA:147,0 | ||
FN:150,VerifyAll.searchStr | ||
FNDA:0,VerifyAll.searchStr | ||
DA:154,0 | ||
DA:155,0 | ||
FNF:7 | ||
FNH:0 | ||
LF:37 | ||
LH:0 | ||
BRF:4 | ||
BRH:0 | ||
end_of_record |
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