Skip to content

Commit

Permalink
latest contraption
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobHomanics committed Feb 24, 2024
1 parent 9402922 commit 6efb890
Show file tree
Hide file tree
Showing 21 changed files with 1,124 additions and 188 deletions.
5 changes: 5 additions & 0 deletions images/Avalanche.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Avalanche",
"description": "Avalanche is a decentralized, open-source proof of stake blockchain with smart contract functionality. AVAX is the native cryptocurrency of the platform.",
"image": "ipfs://bafkreic5yolrbksolbclhjcot6zurbbjlryjak73sw5t47ntjz6kietrky"
}
5 changes: 5 additions & 0 deletions images/Circuit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Circuit of the Americas",
"description": "Circuit of the Americas is a Grade 1 FIA-specification 3.426-mile motor racing track and facilities located in Austin, Texas, in the United States.",
"image": "ipfs://bafkreidghjqepxh7lipfuhsxusjcffq6ws6tlvpkdjv33727264oblleoa"
}
5 changes: 5 additions & 0 deletions images/Curios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Curios",
"description": "Self publishing and fan engagement for creators. Keep 100% of your sales and access fan contact information directly.",
"image": "ipfs://bafkreiad7cwpai6sqj7l37oekknmskgi6jznuwbxixqb5ylkxme63wd7iq"
}
5 changes: 5 additions & 0 deletions images/Polvos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Polvos",
"description": "Polvos serves great interior Mexican food and drinks to the heart of Austin's own 78704. Come by and visit us.",
"image": "ipfs://bafkreibicega6bwf7n7cjq32f45crela4gpby4aisrxkl6mri7oqs3bu3i"
}
Binary file added images/avalanche.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/circuit.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions images/ipfsJsons.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
curios: ipfs://bafkreiefz6lnc2iyqovgrhskycavvkvklaxq77yxrnucj22bhf6i7bctzy
polvos: ipfs://bafkreib3ols4uyiknwg3az4nekk4z3tkh2qhjegsglnglgia24lseg53qy
ava: ipfs://bafkreiaxfn4bqgobyplxz5ri2au63ynzdd4ot7c4tnfd3p6ldxjt6mr7ae
circuit: ipfs://bafkreigtz5a4r7bilr6dib5bt5db2zgmjpv3hhqrtomvqf2he64k3xgzni
rcb: ipfs://bafkreihq53gbz4fv3pj2uyr27fiwvgoe5c5xukvdg5ouedwpfij2tzh7ru
Binary file added images/rcb.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions images/rcb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Radio Coffee & Beer",
"description": "Hip spot for coffee, beer & pastries in wood-paneled digs, plus tables & a taco truck out back.",
"image": "ipfs://bafkreihq53gbz4fv3pj2uyr27fiwvgoe5c5xukvdg5ouedwpfij2tzh7ru"
}
25 changes: 16 additions & 9 deletions packages/foundry/contracts/ATXDAOPartnershipNft.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ 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 {
abstract contract ATXDAOPartnershipNft is ERC721URIStorage, AccessControl {
error ATXDAOPartnershipNft__NotValidOperator();

string mintUri;
uint256 mintCount;
uint256 tier;

constructor(
address[] memory admins,
string memory newMintUri
) ERC721("ATX DAO Partnership NFT", "ATXP") {
string memory newMintUri,
string memory name,
string memory symbol
) ERC721(name, symbol) {
for (uint256 i = 0; i < admins.length; i++) {
_grantRole(DEFAULT_ADMIN_ROLE, admins[i]);
}
Expand All @@ -41,14 +42,10 @@ contract ATXDAOPartnershipNft is ERC721URIStorage, AccessControl {
return super.supportsInterface(interfaceId);
}

function mint(
address target,
uint256 newTier
) external onlyRole(DEFAULT_ADMIN_ROLE) {
function mint(address target) external onlyRole(DEFAULT_ADMIN_ROLE) {
_mint(target, mintCount);
_setTokenURI(mintCount, mintUri);
mintCount++;
tier = newTier;
}

function setTokenURI(uint256 tokenId, string memory tokenUri) external {
Expand Down Expand Up @@ -81,4 +78,14 @@ contract ATXDAOPartnershipNft is ERC721URIStorage, AccessControl {
function getMintCount() external view returns (uint256) {
return mintCount;
}

function burn(uint256 tokenId) external {
if (msg.sender != ownerOf(tokenId)) {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) {
revert ATXDAOPartnershipNft__NotValidOperator();
}
}

_burn(tokenId);
}
}
23 changes: 23 additions & 0 deletions packages/foundry/contracts/RaineyStreetPartnershipNft.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//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";
import "./ATXDAOPartnershipNft.sol";

contract RaineyStreetPartnershipNft is ATXDAOPartnershipNft {
constructor(
address[] memory admins,
string memory newMintUri
)
ATXDAOPartnershipNft(
admins,
newMintUri,
"ATX DAO Partnership NFT - Rainey",
"ATXPR"
)
{}
}
23 changes: 23 additions & 0 deletions packages/foundry/contracts/SixthStreetPartnershipNft.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//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";
import "./ATXDAOPartnershipNft.sol";

contract SixthStreetPartnershipNft is ATXDAOPartnershipNft {
constructor(
address[] memory admins,
string memory newMintUri
)
ATXDAOPartnershipNft(
admins,
newMintUri,
"ATX DAO Partnership NFT - Sixth",
"ATXPS"
)
{}
}
21 changes: 18 additions & 3 deletions packages/foundry/script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../contracts/ATXDAOPartnershipNft.sol";
import "../contracts/RaineyStreetPartnershipNft.sol";
import "../contracts/SixthStreetPartnershipNft.sol";

// import "../contracts/ATXDAOPartnershipNft.sol";
import "./DeployHelpers.s.sol";

contract DeployScript is ScaffoldETHDeploy {
Expand All @@ -22,15 +25,27 @@ contract DeployScript is ScaffoldETHDeploy {
address[] memory admins = new address[](1);
admins[0] = admin;

ATXDAOPartnershipNft yourContract = new ATXDAOPartnershipNft(
RaineyStreetPartnershipNft yourContract1 = new RaineyStreetPartnershipNft(
admins,
"ipfs://bafkreide5gtpol2fzt75qt5rpds5vdmv24qnf43frionfhesfqqb2en66a"
);

SixthStreetPartnershipNft yourContract2 = new SixthStreetPartnershipNft(
admins,
"ipfs://bafkreide5gtpol2fzt75qt5rpds5vdmv24qnf43frionfhesfqqb2en66a"
);

console.logString(
string.concat(
"YourContract deployed at: ",
vm.toString(address(yourContract))
vm.toString(address(yourContract1))
)
);

console.logString(
string.concat(
"YourContract deployed at: ",
vm.toString(address(yourContract2))
)
);
vm.stopBroadcast();
Expand Down
206 changes: 103 additions & 103 deletions packages/foundry/test/YourContract.t.sol
Original file line number Diff line number Diff line change
@@ -1,103 +1,103 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import "forge-std/Test.sol";
import {ATXDAOPartnershipNft} from "../contracts/ATXDAOPartnershipNft.sol";

contract YourContractTest is Test {
ATXDAOPartnershipNft public nftCollection;

address user = makeAddr("User");
address user2 = makeAddr("User2");
address admin = makeAddr("Admin");
address multisig = makeAddr("Multisig");

function setUp() public {
console.log("User: ", user);
console.log("User 2: ", user2);
console.log("Admin: ", admin);

address[] memory admins = new address[](1);
admins[0] = admin;

nftCollection = new ATXDAOPartnershipNft(
admins,
"ipfs://bafkreide5gtpol2fzt75qt5rpds5vdmv24qnf43frionfhesfqqb2en66a"
);
}

function testSetTokenUriAsOwner() public {
vm.prank(admin);
nftCollection.mint(user, 0);

vm.prank(user);
nftCollection.setTokenURI(
0,
"ipfs://bafybeiaz55w6kf7ar2g5vzikfbft2qoexknstfouu524l7q3mliutns2u4/0"
);

assertEq(
nftCollection.tokenURI(0),
"ipfs://bafybeiaz55w6kf7ar2g5vzikfbft2qoexknstfouu524l7q3mliutns2u4/0"
);
}

function testSetTokenUriAsAdmin() public {
vm.prank(admin);
nftCollection.mint(user, 0);

vm.startPrank(admin);
nftCollection.setTokenURI(
0,
"ipfs://bafybeiaz55w6kf7ar2g5vzikfbft2qoexknstfouu524l7q3mliutns2u4/0"
);
vm.stopPrank();

assertEq(
nftCollection.tokenURI(0),
"ipfs://bafybeiaz55w6kf7ar2g5vzikfbft2qoexknstfouu524l7q3mliutns2u4/0"
);
}

function testRevertIfNotOwner() public {
vm.prank(admin);
nftCollection.mint(user, 0);

vm.startPrank(user2);
vm.expectRevert();
nftCollection.setTokenURI(
0,
"ipfs://bafybeiaz55w6kf7ar2g5vzikfbft2qoexknstfouu524l7q3mliutns2u4/0"
);
vm.stopPrank();
}

function testReturnToDao() public {
vm.startPrank(admin);
nftCollection.mint(user, 0);

nftCollection.revokeNft(0, multisig);
vm.stopPrank();

assertEq(nftCollection.ownerOf(0), multisig);
}

function testRevert__ReturnToDao__IfNotAdmin() public {
vm.startPrank(admin);
nftCollection.mint(user, 0);
vm.stopPrank();

vm.prank(user);
vm.expectRevert();
nftCollection.revokeNft(0, multisig);
}

function testTransfer() public {
vm.startPrank(admin);
nftCollection.mint(user, 0);
vm.stopPrank();

vm.prank(user);
nftCollection.transferFrom(user, user2, 0);
}
}
// // SPDX-License-Identifier: UNLICENSED
// pragma solidity ^0.8.13;

// import "forge-std/Test.sol";
// import {ATXDAOPartnershipNft} from "../contracts/ATXDAOPartnershipNft.sol";

// contract YourContractTest is Test {
// ATXDAOPartnershipNft public nftCollection;

// address user = makeAddr("User");
// address user2 = makeAddr("User2");
// address admin = makeAddr("Admin");
// address multisig = makeAddr("Multisig");

// function setUp() public {
// console.log("User: ", user);
// console.log("User 2: ", user2);
// console.log("Admin: ", admin);

// address[] memory admins = new address[](1);
// admins[0] = admin;

// nftCollection = new ATXDAOPartnershipNft(
// admins,
// "ipfs://bafkreide5gtpol2fzt75qt5rpds5vdmv24qnf43frionfhesfqqb2en66a"
// );
// }

// function testSetTokenUriAsOwner() public {
// vm.prank(admin);
// nftCollection.mint(user, 0);

// vm.prank(user);
// nftCollection.setTokenURI(
// 0,
// "ipfs://bafybeiaz55w6kf7ar2g5vzikfbft2qoexknstfouu524l7q3mliutns2u4/0"
// );

// assertEq(
// nftCollection.tokenURI(0),
// "ipfs://bafybeiaz55w6kf7ar2g5vzikfbft2qoexknstfouu524l7q3mliutns2u4/0"
// );
// }

// function testSetTokenUriAsAdmin() public {
// vm.prank(admin);
// nftCollection.mint(user, 0);

// vm.startPrank(admin);
// nftCollection.setTokenURI(
// 0,
// "ipfs://bafybeiaz55w6kf7ar2g5vzikfbft2qoexknstfouu524l7q3mliutns2u4/0"
// );
// vm.stopPrank();

// assertEq(
// nftCollection.tokenURI(0),
// "ipfs://bafybeiaz55w6kf7ar2g5vzikfbft2qoexknstfouu524l7q3mliutns2u4/0"
// );
// }

// function testRevertIfNotOwner() public {
// vm.prank(admin);
// nftCollection.mint(user, 0);

// vm.startPrank(user2);
// vm.expectRevert();
// nftCollection.setTokenURI(
// 0,
// "ipfs://bafybeiaz55w6kf7ar2g5vzikfbft2qoexknstfouu524l7q3mliutns2u4/0"
// );
// vm.stopPrank();
// }

// function testReturnToDao() public {
// vm.startPrank(admin);
// nftCollection.mint(user, 0);

// nftCollection.revokeNft(0, multisig);
// vm.stopPrank();

// assertEq(nftCollection.ownerOf(0), multisig);
// }

// function testRevert__ReturnToDao__IfNotAdmin() public {
// vm.startPrank(admin);
// nftCollection.mint(user, 0);
// vm.stopPrank();

// vm.prank(user);
// vm.expectRevert();
// nftCollection.revokeNft(0, multisig);
// }

// function testTransfer() public {
// vm.startPrank(admin);
// nftCollection.mint(user, 0);
// vm.stopPrank();

// vm.prank(user);
// nftCollection.transferFrom(user, user2, 0);
// }
// }
Loading

0 comments on commit 6efb890

Please sign in to comment.