Skip to content

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) external

Initializes 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

NameTypeDescription
_hooksstruct IPropsBaseFacet.Hook[]Array of Hook structs defining callback functions for various operations
approvedDiamondsaddress[]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

NameTypeDescription
supplyuint256Current token supply in the system
amountuint256Amount of tokens being bought or sold

Return Values

NameTypeDescription
[0]uint256The price in base currency units for the specified amount