Commit Graph

97 Commits

Author SHA1 Message Date
Felipe Mendes 3fbbb08cf9
test: add exception for address 0 on fuzz tests (#234) 2023-04-20 10:10:47 -03:00
Felipe Mendes fdedc18b02
fix: linting issues on contracts folder (#212) 2023-04-17 11:27:39 -03:00
Shredder 8eb73f1fd9
chore: update config and commands to deploy to goerli (#195)
* chore: update config and commands to deploy to goerli

* feat: bring changes from other deployment branches into this branch. Including sepolia configs.

* chore: update ci to copy .env

* chore: add goerli api to .env.example.

* chore: update on UI readme

* feat: apply the requested changes

* chore: change verify-contract to verify.js and remove the other file

* chore: make the final requested changes on config files and readme.

* fix: missed comma

* docs: add the "setting contract address and abi" section to the README file in the UI directory

---------

Co-authored-by: janison <jsonsivar@gmail.com>
Co-authored-by: Camila Sosa Morales <camisosa@fleek.co>
2023-04-10 11:33:47 -04:00
Felipe Mendes 389d6511b3
refactor: change _billings from public to private (#207) 2023-04-05 16:41:09 -03:00
Felipe Mendes 83cd36dfc3
feat: design ens verification flow (#193)
* wip: add base solidity functions to try ens validation

* chore: add hardhat fork setup with env variable

* wip: setup ens verification for FleekERC721

* wip: add ens namehash generation

* chore: gas report setting

* feat: add ens verification on setTokenENS function

* test: hardhat transfer ens owner to set new ens

* test: fix foundry tests to enable ens validation

* refactor: change back ens to calldata and split out a public function for namehash testing

* refactor: move FleekENS.sol to util folder

* test: add ens validation tests for not owner attempts

* chore: add mainnet api key env in ci

* chore: fix .env.example

* fix: remove extra unused file
2023-04-05 11:48:56 -03:00
Felipe Mendes 2225b301ff
chore: prevent direct calls to implementation contract (#194)
* feat: disable initializers and set paused state for implementation contracts

* test: add deploy guarantee tests for interaction with implementation contracts

* chore: add buildId and implementationAddress to deployStore script

* test: reset initialized state on store of deployed contract for foundry tests

* test: optmize deployUninitialized function

* test: test if is possible to mint in implementation contract
2023-04-04 16:19:06 -03:00
Felipe Mendes 779cf3bb14
feat: contracts add verified field and allow verifier (#184)
* feat: add token verified flag

* feat: add verified flag on tokenURI

* feat: add isTokenVerified function

* test: add foundry tests for token verified

* test: add hardhat tests for token verified
2023-03-31 16:13:34 -03:00
Shredder 2eca4be8f0
feat: update subgraph and its new mint handler + test refactor (#186)
* feat: update newMint and add verifier and apAutoApproval, update subgraph accordingly.

* remove: bugged tests.
2023-03-17 19:08:17 +03:30
Felipe Mendes ce71790c17
feat: contract when minting can set verifier (#164)
* feat: add token verifier token data and requirement

* feat: add verifier argument on mint function

* test: fix current foundry tests

* test: fix current hardhat tests

* test: add test for non token verifier with verifier role

* fix: mint signature on hardhat tests

* refactor: single mint function

* fix: overloaded mint calls on javascript side
2023-03-16 11:23:50 -03:00
Felipe Mendes c3fe09c1a6
feat: UI fetch mint price on contract (#166)
* chore: update deployment

* feat: add fleekERC721 redux state and billing states

* feat: add billing price to mint flow
2023-03-13 14:07:37 -03:00
Felipe Mendes df6fbea5c0
feat: erc interface and split out access points to single module (#151)
* wip: compilant version of interface

* refactor: split out access point to single module

* test: fix mint call on hardhat tests

* fix: remove auto approval from NewMint event
2023-03-13 11:07:40 -03:00
Felipe Mendes d6f8d047c8
feat: review linting for all subfolders (#169)
* chore: setup root eslint

* fix: fix .eslintignore to root folder
2023-03-13 10:21:54 -03:00
Felipe Mendes e74e5595da
feat: add verifier role (#148)
* feat: add verifier collection role

* refactor: apply verifier role to verify ap functions

* test: hardhat tests for verifier role

* refactor: grant verifier role for deployer

* test: foundry tests for verifier role

* test: fix fixture after changing deployer to be verifier

* test: change token owner to match connected account on verifier role check
2023-03-07 10:28:31 -03:00
Felipe Mendes 8e309ee04c
refactor: deployment script to accept argument inputs (#146) 2023-03-07 08:23:34 -03:00
Felipe Mendes b1887765c1
refactor: remove mint collection owner requirement (#149)
* refactor: remove mint acl modifier

* test: fix tests for mint owner requirement
2023-03-01 11:31:46 -03:00
Shredder a6123d4c22
feat: access point integration with the subgraph (#141)
* feat: define entities, add handlers for access points.

* feat: change ChangeAccessPointAutoApproval event to metadataUpdate with boolean value (new event), and also add NewMint handler again.

* test: rename ChangeAccessPointStatus to ChangeAccessPointCreationStatus in hardhat tests.

* refactor: deploy the new version of the contract and update the proxy address and block number in the subgraph config file.

* refactor: change name of status to creationStatus in schema.

Co-authored-by: Janison Sivarajah <jsonsivar@gmail.com>

* refactor: remove commented handlers for ACL.

* feat: add the condition for deploying proxy again

* refactor: remove newAccessPoint from subgraph.yaml

---------

Co-authored-by: Janison Sivarajah <jsonsivar@gmail.com>
2023-02-27 19:11:03 -05:00
Felipe Mendes b8b8cb28ea
feature: conditional payment as setting (#134)
* feat: add base contract for billing

* feat: add withdraw function

* feat: add billing requirement to mint

* test: add foundry tests for minting with billing

* refactor: remove transfer billing and add access point

* test: add access point billing foundry tests

* test: add test for billing value change

* test: add hardhat test setup for billing

* test: add hardhat tests for billing

* feat: add withdrawn event and add public withdraw function

* test: add tests for withdrawing founds and access control for billing

* refactor: fix misspells and change variable names

* feat: add initialize params for billing

* feat: add gap to FleekBilling

* fix: testname misspell
2023-02-27 17:30:19 -03:00
Felipe Mendes 969cd12d92
refactor: use custom errors in solidity (#127)
* refactor: change ap reverts to custom error

* test: fix tests for custom errors

* refactor: change setApprovalForAccessPoint string reverts to custom error
2023-02-27 12:42:41 -03:00
Shredder b3b9f30f05
chore: remove counters library from the contract code. (#137)
* chore: remove the counters lib from the contract and create private vars instead.

* merge: develop. fix conflicts.

* style: remove unnecessary white space
2023-02-24 16:51:21 +03:30
Shredder d7841717ff
feat: metadata update and token changes on subgraph (#135)
* feat: add entity and handler.

* merge: reverse lookup and ap auto approval.

* feat: update the token entity on metadata changes.

* merge: develop. fix conflicts.

* fix: tests.
2023-02-24 16:39:25 +03:30
Shredder 2ae7666648
feat: subgraph reverse lookup (gitRepo -> NFA) (#131)
* feat: define the GithubRepository entity and update the Token entity to include it.

* feat: add NewMint event to the contract and emit it in the mint function.

* feat: add newmint entity, update token and gitrepository entities. add handler for entities. update transfer entity handler. update subgraph.yaml config.

* chore: deployment update

* chore: fix proxy file with before deployments

* fix: remove constructor args in verify-polyscan.js file and update contract address at subgraph.yaml

* fix: remove develop from subgraph.yaml gh action.

* merge: develop with auto approval settings into reverse lookup branch

* fix: remove the word settings from acesspointautoapproval param.

* fix: error in hardhat last token id test

* fix: solidity tests.

* fix: proxy contract address in subgraph.yaml.

* chore: run subgraph tests only on main PRs

---------

Co-authored-by: Felipe Mendes <zo.fmendes@gmail.com>
2023-02-24 16:22:18 +03:30
Camila Sosa Morales 70df262d94
feat: UI connect kit integration (#136)
* chore: connectkit poc

* feat: add connection on wallet step;

* chore: add info on readme and new env variable

* chore: add continue button if the user is connected

* chore: added constanst env file

* Update ui/src/views/mint/wallet-step/connect-wallet-button.tsx

Co-authored-by: Felipe Mendes <zo.fmendes@gmail.com>

* chore: rename env variables. remove unneccesary files. add connect button

* feat: create providers folder to keep clean code

* ed

* chore: add TODO comment

---------

Co-authored-by: Felipe Mendes <zo.fmendes@gmail.com>
2023-02-23 14:54:01 -05:00
Shredder cfea9a90ea
feat: access point auto approval settings for tokens (#121)
* feat: add accessPointAutoApprovalSettings field to mint, app struct, and expose a function for changing the field later + an event.

* feat: add checks for the autoapproval settings on function addAccessPoint.

* feat: add setApprovalForAccessPoint function and ChangeAccessPointApprovalStatus event.

* test: add new constant variables to the hardhat tests and update mint tests.

* feat: update removeAccessPoint function to check the status and also update getAccessPointJSON to include status.

* test: add two access point test files and fix errors and mismatches in them with the auto approval set up

* feat: remove the access point mapping in the App struct and wherever it was used.

* chore: update foundry tests to match the new interface of the contract.

* test: add new tests for the approval settings

* chore: update foundry tests to match new interface.

* test: update foundry tests and the settings for auto approvals

* feat: keep history of removed APs. Update tests.

* fix: make changes to the contract and tests to fix the tests.

* chore: apply changes Zoruka requested.

* fix: change name of setAutoApprovalSettings function in foundry tests.

* perf: revert back to enums, update hardhat and foundry tests.

* fix: apply requested changes by janison.

* fix: error in hardhat test.

* fix: mint params of a foundry test.

* fix: merge errors.

* fix: revert back to tokenOwner for setAutoApproval functions.

* chore: remove comment for accessPointAutoApproval
2023-02-23 12:29:53 +03:30
Felipe Mendes 770ab78668
refactor: clean up acl remove our redundant owner (#114)
* refactor: clean up code, remove address arrays, fix minimal amount of collection owners

* refactor: apply refactored acl functions in main contract

* test: fix tests after refactor

* test: add edge case foundry tests for acl

* test: fix hardhat tests for token roles

* test: fix hardhat tests for collection roles

* test: fix hardhat tests for minting

* test: add new hardhat tests for access control

* refactor: role change events
2023-02-21 14:02:30 -03:00
Felipe Mendes 0f05a912a7
feature: make main contract pausable (#110)
* feat: add FleekPausable

* feat: add FleekPausable functions in FleekERC721

* fix: requirePaused logic

* feat: add pause modifiers in FleekERC721

* refactor: move functions to the main contract to add pause modifier

* test: add unpause to test setups

* fix: revokeTokenRole modifier

* test: add initial tests and setup for pausable

* test: all test for pause and pausable states

* test: add test for functions when contract is paused

* test: add pausable hardhat tests

* test: foundry access control test for pausable

* refactor: function names

* fix: remove virtual keywords for functions that must not be overriden

* refactor: set inital state for unpaused
2023-02-21 10:56:26 -03:00
Felipe Mendes 197a7a28c5
test: add and change tests to fuzz test (#128) 2023-02-20 11:46:46 -03:00
Felipe Mendes 70e9c14b05
feature: expose last token id function in the contract (#124)
* feat: add function to get the last token id

* test: add getLastTokenId tests
2023-02-20 11:44:59 -03:00
Felipe Mendes a86c30a8da
refactor: make a single event for token metadata changes (#111)
* refactor: add new unified events and remove old multiple ones

* fix: remove indexed from string params on events

* test: add hardhat tests for metadata update changes

* refactor: change event name

* test: add foundry tests for event emits in metadata changes

* refactor: undo changes on accespoint events

* chore: remove subgraph ci tests on prs for develop

* refactor: overload MetadataUpdate event to have multiple type of parameters

---------

Co-authored-by: Shredder <110225819+EmperorOrokuSaki@users.noreply.github.com>
2023-02-17 09:59:55 -03:00
Shredder 60af583479
feat: expose a function that returns all non-nested values of an App (#119)
* feat: expose a getToken function that returns all non-nested values of an app. Remove the access point mapping in the App struct.

* test: add test for getToken to hardhat

* test: add test cases for getToken (forge tests).

* docs: update header comments for getToken

* fix: apply Zoruka's suggestion

* fix: apply Zoruka's suggestion for expectingRevert

* fix: revert expectRevert
2023-02-11 00:59:25 +03:30
Shredder 7f1aca15dd
test: init subgraph unit tests (#117)
* test: add unit tests for the subgraph for events transfer, NewTokenName, NewTokenDescription, NewTokenExternalURL, NewTokenENS, NewTokenBuild

* fix: import errors

* fix: remove keyword "indexed" for strings in events.

* fix: update subgraph.yaml, schema.graphql, and all generated files with the test files to match the new interface of the contract events.

* fix: expose a makeEventId function to avoid repeating code for id generation and also change logIndex before handling events. Update tests to match the new  changes.

* chore: remove Holder.

* fix: wrong import for newLogoEvent
2023-02-10 21:13:43 +03:30
Felipe Mendes 18d3319fd7
chore: refactor hardhat tests (#103)
* chore: rearrange hardhat tests folder structure

* chore: add FleekERC721 hardhat test helpers

* test: split out deployment tests

* test: split out minting tests

* test: split out token uri tests

* test: split out token roles tests

* test: split out collection roles tests

* test: split out access points tests

* test: split out update properties tests

* test: improve test setup for aps and deployment

* test: move test resultant base64 logos to constants file
2023-02-09 17:44:57 -03:00
Felipe Mendes 3e1373682f
test: improve foundry test with best practices (#102)
* test: add FleekERC721 test base mint and uri

* chore: update forge-std version

* test: add FleekERC721 burn tests

* test: fix role getter

* test: add access tests for random address

* test: add access tests for owner address

* test: add test revert assertions

* test: apply revert assertions

* test: remove already split tests

* fix: wrong renamed file

* test: move access point tests

* test: refactor access control tests

* test: add deploy test cases

* test: add balance before and after mint test

* test: remove old testsuit

* chore: update foundry test folder strcture

* test: add assertion to verify added role for random address

* test: fix test functions names

* test: remove test_addAccessPoint

* test: add assertion for appAccessPoints length

* test: remove unnecessary assertions on test_tokenURI

* test: rename test files

* test: refactor testFail to test
2023-02-08 17:27:39 -03:00
Janison Sivarajah 6a827263b7
chore: change top level folder structure (#105)
* folder restructure init - WIP

* Update husky for folder change

* Properly ignore local zeppelin file

* change folder strucutre: update readme and contribution files

* remove chakra from readme list of key dependencies

* run contract workflow steps in contract dir

* Cleanup readmes, split contract into it's own

* Apply some suggestions from code review

Co-authored-by: Shredder <110225819+EmperorOrokuSaki@users.noreply.github.com>
Co-authored-by: Felipe Mendes <zo.fmendes@gmail.com>

* Move .env.example to contracts folder, and use consistent format for directory references in docs

* More readme dir ref fixes

* Update poc note in readme, and removed deploy folder from readme

* Prettier refactor

* Revert "Prettier refactor"

This reverts commit 82249e32aaf6a6e9a4d432c4f89ca365c18972f8.

* Clean up package.json and add prettier ignore

---------

Co-authored-by: Shredder <110225819+EmperorOrokuSaki@users.noreply.github.com>
Co-authored-by: Felipe Mendes <zo.fmendes@gmail.com>
2023-02-06 15:15:44 -05:00
Felipe Mendes 94e8ba3856
refactor: change svg generation to match design and update how it is write/read in contract (#95)
* refactor: update contract with logo and color, add new svg styling

* refactor: fix color storaging

* test: fix tests for new app metadata

* test: fix solidity tests

* chore: update latest deployment files

* feat: update mint script and add assets files

* refactor: move assets files

* refactor: update svg generation styling

* feat: add library deployment storage

* test: fix contract tests

* feat: add setTokenLogo and setTokenColor contract functions

* test: add hardhat tests for new set functions

* test: add foundry tests for new set functions, split out constant strings to constants library

* chore: remove leftover comment

* feat: add setTokenLogoAndColor function

* test: add test for setTokenLogoAndColor function

* test: add test for setTokenLogoAndColor function on foundry
2023-01-31 14:12:48 -03:00
Felipe Mendes 91aeb47aef
chore: prepare the contracts to be upgradable using openzeppelin proxy plugin (#76)
* feat: add proxy upgradable base setting

* refactor: upgrade contracts to fit upgradable pattern

* fix: hardhat test default fixture

* test: trying to fix foundry tests

* fix: remove wrong modifier from FleekAccessControl initializer

* refactor: change __FleekAccessControl_init function from public to internal

* refactor: add __FleekAccessControl_init modifier

* feat: proxy store script

* chore: add .openzeppelin development files in gitignore

* refactor: update local deploy script to use proxy

* refactor: mumbai deployment with proxy and fix interaction scripts

* test: fix proxy storing values

* refactor: proxy storage deploy order

* test: move proxy test to deploy folder

* refactor: deployment scripts

* docs: fix local deploy command

* refactor: add more logs in deploy scripts

* feat: write deployment files script

* refactor: use file scripts in proxy-deploy

* refactor: deployment files for mumbai
2023-01-31 12:09:12 -03:00
Shredder e81132a9b8
test: foundry tests for access points (#79)
* feat: add mirror mapping and management

* test: add mirrors tests

* chore: add new functions header comments

* feat: add isMirrorVerified function

* feat: add a list of mirrors to token

* feat: add require minted to appMirrors function

* chore: update solidity compiler on hardhat config

* refactor: add token id to other mirror events

* refactor: change from mirror to access point and update its metadata

* test: updates tests due to contract changes

* refactor: clean up string parser from main contract

* refactor: remove wronge requirement comments

* refactor: strings library (#71)

* refactor: move string parse functions to a library

* refactor: remove not used modifier

* refactor: move svg generation to library

* refactor: remove source from aps

* refactor: rename accessPoint function

* test: fix two foundry test cases

* test: fix tests that were not working.

* fix: apply requested changes.

---------

Co-authored-by: zoruka <zo.fmendes@gmail.com>
2023-01-27 22:00:50 +03:30
Felipe Mendes fc20f02b7f
feat: add app access points and libraries clean up (#69)
* feat: add mirror mapping and management

* test: add mirrors tests

* chore: add new functions header comments

* feat: add isMirrorVerified function

* feat: add list of mirrors to token

* feat: add require minted to appMirrors function

* chore: update solidity compiler on hardhat config

* refactor: add token id to other mirror events

* refactor: change from mirror to access point and update its metadata

* test: updates tests due to contract changes

* refactor: clean up string parser from main contract

* refactor: remove wronge requirement comments

* refactor: strings library (#71)

* refactor: move string parse functions to a library

* refactor: remove not used modifier

* refactor: move svg generation to library

* refactor: remove source from aps

* refactor: rename accessPoint function
2023-01-18 11:39:44 -03:00
EmperorOrokuSaki 69de99467f Fix the HardHat decoding bug by adding base URI to _generateSVG() and updating foundry tests 2023-01-11 18:55:51 +03:30
EmperorOrokuSaki 9013bd9faf Change _generateSVG() mutability to pure from view 2023-01-11 17:46:33 +03:30
EmperorOrokuSaki 75ae5fa440 Move calling _genenrateSVG() to tokenURI() from mint() 2023-01-11 17:36:50 +03:30
EmperorOrokuSaki 810739c740 Add optimization to hardhat config & comment the tokenURI hardhat test 2023-01-09 19:48:17 +03:30
EmperorOrokuSaki 090c1e1477 Add SVG generation test and function. 2023-01-09 18:52:04 +03:30
Felipe Mendes 6c901a6001
Release/0.0.1 fixes (#60)
* Update LICENSE

* Update README.md

* Update local_deploy.js

* Update FleekERC721.sol

* fix: mumbai deploy args

* fix: fix comments release (#61)

Co-authored-by: Janison Sivarajah <jsonsivar@gmail.com>
Co-authored-by: Camila Sosa Morales <camisosa@fleek.co>
2022-12-22 14:21:00 -03:00
EmperorOrokuSaki 90dc8c3bfc add header docs for modifiers and constructors. 2022-12-22 17:38:24 +03:30
EmperorOrokuSaki 3ec0827ac1 add function headers for accesscontrole.sol 2022-12-20 18:17:43 +03:30
zoruka 5956cb7be9 chore: merge develop 2022-12-20 08:34:40 -03:00
Felipe Mendes 22198e76e3
refactor: remove extension AccessControl from FleekAccessControl (#28)
* refactor: remove extension AccessControl from FleekAccessControl

* refactor: add version for roles

* test: add collection roles tests

* test: add more token role hardhat tests

* refactor: remove lib/forge-std

* feat: add role grant and revoke events

* test: add access control role event emit tests

* refactor: remove abstract keyword from FleekAccessControl

* Merge conflicts for #28 (#49)

* Add msg.sender to the triggered_by field in events

* Document methods and make everything camelCase

* Make event params all camelCase

* fix: forge-std submodule

* make vars camelCase, remove baseURI header, remove addTokenController and removeTokenController, update tests

Co-authored-by: EmperorOrokuSaki <artie.eth@gmail.com>
Co-authored-by: Shredder <110225819+EmperorOrokuSaki@users.noreply.github.com>
Co-authored-by: zoruka <zo.fmendes@gmail.com>

Co-authored-by: Janison Sivarajah <jsonsivar@gmail.com>
Co-authored-by: EmperorOrokuSaki <artie.eth@gmail.com>
Co-authored-by: Shredder <110225819+EmperorOrokuSaki@users.noreply.github.com>
2022-12-19 15:45:15 -03:00
zoruka 4dd1442e9d chore: merge develop 2022-12-17 09:03:08 -03:00
Felipe Mendes 4836dd0436
chore: precommit hooks (#18)
* chore: add husky and lint-staged

* chore: add postinstall script

* chore: add prepush test hook

* chore: add skip tests flag

* chore: remove skip tests flag

* chore: fix format command to verify json files
2022-12-16 14:57:49 -03:00
EmperorOrokuSaki d151b80319 fix tokenURI return json 2022-12-15 21:46:29 +03:30