Appearance
Solidity API
PropsERC7649
Diamond facet implementing the ERC7649 bonding curve token standard
Implements ERC7649 functionality for continuous token models with price functions Works within the Diamond proxy architecture as a facet Extends ERC7649Base for core bonding curve logic while adding Diamond-specific functionality Actual pricing mechanisms can be customized through implementation of getPrice
init
solidity
function init(struct IPropsBaseFacet.Hook[] _hooks, address[] approvedDiamonds) externalInitializes the ERC7649 facet
Sets up interface support and configures the contract for operation Can only be called once by the diamond owner or factory during deployment Registers hooks for lifecycle events and approved diamonds for cross-facet calls
Parameters
| Name | Type | Description |
|---|---|---|
| _hooks | struct IPropsBaseFacet.Hook[] | Array of Hook structs defining callback functions for various operations |
| approvedDiamonds | address[] | Array of addresses that are approved to interact with this contract |
getPrice
solidity
function getPrice(uint256 supply, uint256 amount) external pure returns (uint256)Calculates the price for a given token amount at the current supply
Pure function that implements the bonding curve price calculation Currently returns a fixed price of 1, but can be replaced with a more complex curve This function is the core of the bonding curve mechanics
Parameters
| Name | Type | Description |
|---|---|---|
| supply | uint256 | Current token supply in the system |
| amount | uint256 | Amount of tokens being bought or sold |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The price in base currency units for the specified amount |