$ ./scripts/install.sh
The Partial Common Ownership business logic is fairly complex and, in alignment with best practices, you should consider gas usage during development. To make this easier, hardhat-gas-reporter
is included.
When tests are run, it calculates the average gas usage of frequently used methods and prints these figures to stdout. Viewing gas costs as USD requires setting the COINMARKETCAP_API_KEY
environment variable in .env
.
The Solidity compiler will raise "unused function parameter" warnings because we are overriding the ERC721 public transfer methods to ensure that purchasing and foreclosure are the only way tokens can be transferred. These warnings are to be expected and ignored.
Business logic is split up into a set of modules in order to reduce complexity and make the library more extensible to alternative implementations (e.g. depreciating licenses).
The beneficiary of a given token is the recipient of the Harberger taxation. The module handles state management of the beneficiary registry.
The module handles takeover and valuation assessments for a token's perpetual lease.
A few important notes:
- If a lease is being taken over for the first time, or out of foreclosure, the transaction's entire value is deposited. Otherwise, the message value pays the current leasee their self-assessed valuation and the remainder is deposited.
- If the beneficiary of a token is taking over a token's lease:
- No deposit is necessary (taxes would be going to itself in a convoluted loop at the cost of gas). As such, transactions with value will be rejected.
- Because of this, the beneficiary is able to effectively monopolize the token: by taking over the lease at the current owner's self-assessed valuation (or for free out of foreclosure) then self-assessing a prohibitively high valuation.
The module handles sending and withdrawing (failed) remittances. By default, an active "push" strategy is employed, which alleviates the need for the tax collector to actively check and collect.
The module handles taxation, leasee deposits, and lease foreclosures.
The module handles state management of the chain of title registry.
The module is a light wrapper on top of ERC721 that exposes permissions modifiers.
The module handles state management of the self-assessed valuations registry.