Skip to content

Commit

Permalink
initial pass
Browse files Browse the repository at this point in the history
  • Loading branch information
iainnash committed Feb 2, 2023
1 parent 23a4562 commit 6515a1f
Show file tree
Hide file tree
Showing 20 changed files with 584 additions and 94 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: test

on: push

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- uses: actions/setup-node@v2
with:
node-version: "16"

- run: npm install

- name: Run Forge coverage
run: |
yarn run coverage
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test

- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1

- name: Report code coverage
uses: zgosalvez/github-actions-report-lcov@v3
with:
coverage-files: coverage/lcov.*.info
minimum-coverage: 90
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: test

on: workflow_dispatch
on: push

env:
FOUNDRY_PROFILE: ci
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"solidity.compileUsingRemoteVersion": "v0.8.17+commit.8df45f5f"
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Zora Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@
"license": "MIT",
"scripts": {
"test": "forge test",
"test-gas": "forge test --gas-report"
"test-gas": "forge test --gas-report",
"prettier": "prettier --write 'src/**/*.sol'",
"coverage": "forge coverage --report lcov"
},
"dependencies": {
"@openzeppelin/contracts-upgradeable": "4.8.0",
"@openzeppelin/contracts": "4.8.0",
"@openzeppelin/contracts-upgradeable": "4.8.0",
"ds-test": "https://github.com/dapphub/ds-test#cd98eff28324bfac652e63a239a60632a761790b",
"forge-std": "https://github.com/foundry-rs/forge-std#cd7d533f9a0ee0ec02ad81e0a8f262bc4203c653"
},
"devDependencies": {
"prettier": "^2.8.3",
"prettier-plugin-solidity": "^1.1.1"
}
}
}
6 changes: 3 additions & 3 deletions script/Counter.s.sol → script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "forge-std/Script.sol";

contract CounterScript is Script {
contract DeployScript is Script {
function setUp() public {}

function run() public {
Expand Down
15 changes: 15 additions & 0 deletions src/interfaces/ICreatorPermissionControl.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

interface ICreatorPermissionControl {
event UpdatedPermissions(
uint256 tokenId,
address user,
uint256 permissions
);

function getPermissions(uint256 token, address user)
external
view
returns (uint256);
}
12 changes: 12 additions & 0 deletions src/interfaces/IMinter1155.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

interface IMinter1155 {
function requestMint(
address sender,
uint256 tokenId,
uint256 quantity,
address findersRecipient,
bytes calldata minterArguments
) external;
}
48 changes: 48 additions & 0 deletions src/interfaces/IZoraCreator1155.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import {IZoraCreator1155TypesV1} from "../nft/IZoraCreator1155TypesV1.sol";

interface IZoraCreator1155 is IZoraCreator1155TypesV1 {
function PERMISSION_BIT_ADMIN() external returns (uint256);

function PERMISSION_BIT_MINTER() external returns (uint256);

function PERMISSION_BIT_SALES() external returns (uint256);

function PERMISSION_BIT_METADATA() external returns (uint256);

event UpdatedToken(address from, uint256 tokenId, TokenData tokenData);

error UserMissingRoleForToken(address user, uint256 tokenId, uint256 role);

event RoyaltyConfigurationUpdated(
uint256 tokenId,
address sender,
RoyaltyConfiguration royaltyConfiguration
);

// TODO: maybe add more context
error CannotMintMoreTokens(uint256 tokenId);

// Only allow minting one token id at time
function purchase(
address minter,
uint256 tokenId,
uint256 quantity,
address findersRecipient,
bytes calldata minterArguments
) external payable;

function setupNewToken(string memory _uri, uint256 maxSupply)
external
returns (uint256 tokenId);

event ContractURIUpdated(address updater, string newURI);

event UpdatedMetadataRendererForToken(
uint256 tokenId,
address user,
address metadataRenderer
);
}
57 changes: 0 additions & 57 deletions src/nft/CreatorNFT.sol

This file was deleted.

2 changes: 0 additions & 2 deletions src/nft/CreatorNFTStorageV1.sol

This file was deleted.

28 changes: 0 additions & 28 deletions src/nft/ICreatorNFT.sol

This file was deleted.

21 changes: 21 additions & 0 deletions src/nft/IZoraCreator1155TypesV1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

interface IZoraCreator1155TypesV1 {
struct RoyaltyConfiguration {
uint32 royaltyBPS;
address royaltyRecipient;
}

struct TokenData {
string uri;
uint256 maxSupply;
uint256 totalSupply;
}

struct Command {
uint256 blank;
// type
// args
}
}
Loading

0 comments on commit 6515a1f

Please sign in to comment.