Time Weighted Asset Mints
TWAM • A minting harness enabling time-weighted assets to determine minting prices.
How it works
Requirements: maxMintingAmount
number of erc721 tokens are minted to the TWAM
contract in advance.
For a given mint's allocationPeriod
(let's use 24 hours), a given type of asset can be deposited into the twam contract. Note: during the allocationPeriod
, the deposit token can be withdrawn.
Once the allocationPeriod
ends, a cooldown period begins with a length of mintingStart
- allocationEnd
.
Note: the cooldown may be 0.
At the beginning of the minting period mintingStart
, each erc721 can be minted at the price equal to (total allocated assets) / (maximum supply erc721 tokens) as long as it exceeds the minimumPrice
.
If the minimumPrice
is not reached, minting is prohibited, and nothing happens during the minting period.
If all tokens are minted at the end of the minting period, the session is completed.
Otherwise (when the minimumPrice
isn't met or not all tokens are minted), one of three options are available:
- The TWAM process starts over again.
- Minting is enabled at the max{
resultPrice
,minimumPrice
}. - The session is ended.
This option is denoted as the session's rolloverOption
.
Blueprint
lib
├─ ds-test — https://github.com/dapphub/ds-test
├─ forge-std — https://github.com/brockelmore/forge-std
├─ solmate — https://github.com/Rari-Capital/solmate
src
├─ tests
│ └─ TWAM.t — "TWAM Tests"
└─ TWAM — "Time Weighted Asset Mint Contract"
Development
Install DappTools
Install DappTools using their installation guide.
First time with Forge/Foundry?
Don't have rust installed? Run
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Then, install foundry with:
cargo install --git https://github.com/gakonst/foundry --bin forge --locked
Setup and Build
make
Run Tests
make test
License
- foundry
- solmate
- forge-std
- foundry-toolchain by onbjerg.
- forge-starter by abigger87.
- forge-template by FrankieIsLost.
- Georgios Konstantopoulos for forge-template resource.
Disclaimer
Acknowledgements
These smart contracts are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the user interface or the smart contracts. They have not been audited and as such there can be no assurance they will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. The creators are not liable for any of the foregoing. Users should proceed with caution and use at their own risk.