This is a collection of contracts aiming to implement tokenized timeshare access to land projects.
This contracts include:
-
ERC20 token
-
Booking System:
Implemented a locking mechanism to reuse the tokens every year preventing doble spending by locking those tokens in a Diamond contract
-
Sale Contract: minting operation from sale contract:
sequenceDiagram
participant User
participant SaleContract
participant TDFDiamond
participant TDFToken
User->>+SaleContract: `buy`
SaleContract->>TDFDiamond: mint
Note left of TDFDiamond: Access Control
TDFDiamond->>TDFToken: mint
Note left of TDFToken: onlyOwner or DAO
TDFToken-->>TDFDiamond: approveTransfer
TDFDiamond-->>TDFToken: allowsMinting
TDFToken-->>SaleContract: transferTokens
SaleContract-->>User: Finish Operation
If you find critical security gaps in our smart contract code, please reach sam@closer.earth. We are offering a bounty of 1000CUSD + our eternal gratitute + free tickets for an event of your choice at Traditional Dream Factory (Maybe join us at the Regenerative Network State Summit?). For smaller issues you can create tickets in our open source code repositories and we will happily consider an appropriate reward.
yarn
- duplicate .env.example
- fill the required env variables. Most importantly
PRIVATE_KEY
You should had been given DEFAULT_ADMIN_ROLE
in the Diamond to be able to execute any of this functions
grant minting role: recommended only for alfajores network
npx hardhat diamond:grant-role [ADDRESS] --minter --network alfajores
You can give different roles by changing the --minter
flag
Once your .env
PRIVATE_KEY
has minter
role you can just mint like this:
npx hardhat diamond:mint --address [ADDRESS] --amount [amount] --network alfajores
# ex:
#
# npx hardhat diamond:mint --address 0x661Ac71bbe43fe56935c1CA4d62e62ed380950A3 --amount 32 --network alfajores
- One using hardhat that can leverage hardhat-deploy to reuse deployment procedures and named accounts:
yarn test
npx hardhat deploy --network alfajores
npx hardhat diamond:grant-role 0xbE5B7A0F27e7Ec296670c3fc7c34BE652303e716 --network alfajores
Here is the list of npm scripts you can execute:
Some of them relies on ./_scripts.js to allow parameterizing it via command line argument (have a look inside if you need modifications)
As a standard lifecycle npm script, it is executed automatically upon install. It generate config file and typechain to get you started with type safe contract interactions
These will lint and format check your code. the :fix
version will modifiy the files to match the requirement specified in .eslintrc
and .prettierrc.
These will compile your contracts
This will deploy your contracts on the in-memory hardhat network and exit, leaving no trace. quick way to ensure deployments work as intended without consequences
These will execute your tests using mocha. you can pass extra arguments to mocha
hh --network alfajores sourcify
These will produce a coverage report in the coverage/
folder
These will produce a gas report for function used in the tests
These will run a local hardhat network on localhost:8545
and deploy your contracts on it. Plus it will watch for any changes and redeploy them.
This assumes a local node it running on localhost:8545
. It will deploy your contracts on it. Plus it will watch for any changes and redeploy them.
This will execute the script <file.ts>
against the specified network
This will deploy the contract on the specified network.
Behind the scene it uses hardhat deploy
command so you can append any argument for it
This will export the abi+address of deployed contract to <file.json>
This will execute the script <file.ts>
against a temporary fork of the specified network
if --deploy
is used, deploy scripts will be executed
This will deploy the contract against a temporary fork of the specified network.
Behind the scene it uses hardhat deploy
command so you can append any argument for it
This will test the contract against a temporary fork of the specified network.
This will deploy the contract against a fork of the specified network and it will keep running as a node.
Behind the scene it uses hardhat node
command so you can append any argument for it
All rights reserved.