Quadratic Decay Exponential Surge
Quadratic Decay Exponential Surge (QDES), is a simple adaptive price mechanism for selling NFTs.
When the demand is high, the price of each NFT increases.
When the demand is low, the price of each NFT decreases.
It is an approximate version of Constant Rate Issuance Sales Protocol (CRISP).
Generalizable to projects.
block.timestamp
instead of block.number
.Enable price discovery.
FUD resistant.
Minimal gas fees.
SLOAD
and SSTORE
overhead per tx.Simple.
Flexible.
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/access/Ownable.sol';
import "erc721a/contracts/ERC721A.sol";
import "./QDES.sol";
contract Something is ERC721A, Ownable, QDES {
constructor() ERC721A("Something", "SMTH") {}
function startSale() external onlyOwner {
_qdesStart();
}
function mint(uint256 quantity) external payable {
_safeMint(msg.sender, quantity);
// This will automatically charge payment, refund excess,
// and re-adjust prices.
_qdesPurchase(quantity);
}
}
Because the price can fluctuate upwards, your UI must include an extra field to allow users to specify the maximum price per token (e.g. 2x the currentPrice).
This repo uses Foundry.
forge install
forge test
Feel free to help on any of the points.
This is experimental software and is provided on an "as is" and "as available" basis.
The code is still under heavy development and testing, and is not audited.
The author(s) will not be liable for any damages or losses.
MIT