generated from w3hc/w3hc-hardhat-template
-
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.
- Loading branch information
Showing
22 changed files
with
201 additions
and
2,346 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,75 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | ||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; | ||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; | ||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
import "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; | ||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Votes.sol"; | ||
|
||
/// @custom:security-contact [email protected] | ||
contract ArtheraWhitepaper is | ||
ERC721, | ||
ERC721Enumerable, | ||
ERC721URIStorage, | ||
ERC721Burnable, | ||
Ownable, | ||
EIP712, | ||
ERC721Votes | ||
{ | ||
uint256 private _nextTokenId; | ||
|
||
string public uri; | ||
|
||
constructor( | ||
string memory _uri, | ||
address initialOwner | ||
) ERC721("Arthera Whitepaper", "WP") EIP712("Arthera Whitepaper", "1") Ownable(initialOwner) { | ||
uri = _uri; | ||
} | ||
|
||
// Overrides IERC6372 functions to make the token & governor timestamp-based | ||
function clock() public view override returns (uint48) { | ||
return uint48(block.timestamp); | ||
} | ||
|
||
// solhint-disable-next-line func-name-mixedcase | ||
function CLOCK_MODE() public pure override returns (string memory) { | ||
return "mode=timestamp"; | ||
} | ||
|
||
function safeMint() public { | ||
uint256 tokenId = _nextTokenId++; | ||
_safeMint(msg.sender, tokenId); | ||
_setTokenURI(tokenId, uri); | ||
} | ||
|
||
function _update( | ||
address to, | ||
uint256 tokenId, | ||
address auth | ||
) internal override(ERC721, ERC721Enumerable, ERC721Votes) returns (address) { | ||
return super._update(to, tokenId, auth); | ||
} | ||
|
||
function _increaseBalance( | ||
address account, | ||
uint128 value | ||
) internal override(ERC721, ERC721Enumerable, ERC721Votes) { | ||
super._increaseBalance(account, value); | ||
} | ||
|
||
function tokenURI( | ||
uint256 tokenId | ||
) public view override(ERC721, ERC721URIStorage) returns (string memory) { | ||
return super.tokenURI(tokenId); | ||
} | ||
|
||
function supportsInterface( | ||
bytes4 interfaceId | ||
) public view override(ERC721, ERC721Enumerable, ERC721URIStorage) 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,77 @@ | ||
import "@nomiclabs/hardhat-ethers" | ||
import color from "cli-color" | ||
var msg = color.xterm(39).bgXterm(128) | ||
import hre, { ethers, network } from "hardhat" | ||
|
||
const initialMint = ethers.parseEther("10000") | ||
|
||
export default async ({ getNamedAccounts, deployments }: any) => { | ||
const { deploy } = deployments | ||
|
||
const { deployer } = await getNamedAccounts() | ||
|
||
const uri = | ||
"https://bafybeifkpdwa4tkbbze5qui3yn2ph5cntiiojmdlkoxah5fs4mc55b3vt4.ipfs.w3s.link/arthera-whitepaper-nft-metadata.json" | ||
|
||
console.log("deployer:", deployer) | ||
|
||
const awp = await deploy("ArtheraWhitepaper", { | ||
from: deployer, | ||
args: [uri, deployer], | ||
log: true | ||
}) | ||
|
||
switch (hre.network.name) { | ||
case "arthera": | ||
console.log( | ||
"Arthera Whitepaper NFT contract deployed:", | ||
msg(awp.receipt.contractAddress) | ||
) | ||
|
||
try { | ||
console.log( | ||
"Please use `pnpm sourcify:arthera` to verify your contract." | ||
) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
|
||
break | ||
case "arthera-testnet": | ||
console.log( | ||
"Arthera Whitepaper NFT contract deployed:", | ||
msg(awp.receipt.contractAddress) | ||
) | ||
|
||
try { | ||
console.log( | ||
"Please use `pnpm sourcify:arthera-testnet` to verify your contract." | ||
) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
|
||
break | ||
case "sepolia": | ||
try { | ||
console.log( | ||
"Arthera Whitepaper NFT contract deployed:", | ||
msg(awp.receipt.contractAddress) | ||
) | ||
console.log("\nEtherscan verification in progress...") | ||
console.log( | ||
"\nWaiting for 6 block confirmations (you can skip this part)" | ||
) | ||
await hre.run("verify:verify", { | ||
network: network.name, | ||
address: awp.receipt.contractAddress, | ||
constructorArguments: [initialMint] | ||
}) | ||
console.log("Etherscan verification done. ✅") | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
break | ||
} | ||
} | ||
export const tags = ["ArtheraWhitepaper"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.