Appearance
Solidity API
ERC7649Base
getSharesSubject
solidity
function getSharesSubject() external view virtual returns (struct ITradeableShares.SharesSubject)Shares subject, usually defined as NFT (ERC-721 contract address + NFT ID)
Immutable, client applications may cache this value
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | struct ITradeableShares.SharesSubject | Shares subject as a SharesSubject struct, this is an NFT if all currently known implementations |
getFeePercent
solidity
function getFeePercent() external view virtual returns (uint256)Cumulative fee percent, applied to all the buy and sell operations; the fee percent is defined with the 18 decimals, 10^18 corresponds to 100%
The fee can be combined from multiple fees which are sent to the various destinations
Immutable, client applications may cache this value
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | protocol fee percent with the 18 decimals (10^18 is 100%) |
getSharesIssuer
solidity
function getSharesIssuer() external view virtual returns (address)Shares issuer, the receiver of the shares fees
Mutable, changes (potentially frequently and unpredictably) when the NFT owner changes; subject to the front-run attacks, off-chain client applications must not rely on this address in anyway
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | address |
getSharesBalance
solidity
function getSharesBalance(address holder) external view virtual returns (uint256 balance)Shares balance of the given holder; this function is similar to ERC20.balanceOf()
Parameters
| Name | Type | Description |
|---|---|---|
| holder | address | the address to check the balance for |
Return Values
| Name | Type | Description |
|---|---|---|
| balance | uint256 | number of shares the holder has |
getSharesSupply
solidity
function getSharesSupply() external view virtual returns (uint256 supply)Total amount of the shares in existence, the sum of all individual shares balances; this function is similar to ERC20.totalSupply()
Return Values
| Name | Type | Description |
|---|---|---|
| supply | uint256 | total shares supply |
getBuyPrice
solidity
function getBuyPrice(uint256 supply, uint256 amount) external pure virtual returns (uint256)The price of the amount of shares to buy calculated based on the specified total shares supply
Parameters
| Name | Type | Description |
|---|---|---|
| supply | uint256 | total shares supply |
| amount | uint256 | number of shares to buy |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | the price of the shares to buy |
getSellPrice
solidity
function getSellPrice(uint256 supply, uint256 amount) external pure virtual returns (uint256)The price of the amount of shares to sell calculated based on the specified total shares supply
Parameters
| Name | Type | Description |
|---|---|---|
| supply | uint256 | total shares supply |
| amount | uint256 | number of shares to sell |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | the price of the shares to sell |
getBuyPriceAfterFee
solidity
function getBuyPriceAfterFee(uint256 supply, uint256 amount, uint256 protocolFeePercent, uint256 holdersFeePercent, uint256 subjectFeePercent) external pure virtual returns (uint256)The price of the amount of shares to buy, including all fees; calculated based on the specified total shares supply and fees percentages
Parameters
| Name | Type | Description |
|---|---|---|
| supply | uint256 | total shares supply |
| amount | uint256 | number of shares to buy |
| protocolFeePercent | uint256 | protocol fee percent |
| holdersFeePercent | uint256 | shares holders fee percent |
| subjectFeePercent | uint256 | protocol fee percent |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | the price of the shares to buy |
getSellPriceAfterFee
solidity
function getSellPriceAfterFee(uint256 supply, uint256 amount, uint256 protocolFeePercent, uint256 holdersFeePercent, uint256 subjectFeePercent) external pure virtual returns (uint256)The price of the amount of shares to sell, including all fees; calculated based on the specified total shares supply and fees percentages
Parameters
| Name | Type | Description |
|---|---|---|
| supply | uint256 | total shares supply |
| amount | uint256 | number of shares to sell |
| protocolFeePercent | uint256 | protocol fee percent |
| holdersFeePercent | uint256 | shares holders fee percent |
| subjectFeePercent | uint256 | protocol fee percent |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | the price of the shares to sell |
getBuyPrice
solidity
function getBuyPrice(uint256 amount) external view virtual returns (uint256)Current price of the amount of shares to buy; calculated based on the current total shares supply
Parameters
| Name | Type | Description |
|---|---|---|
| amount | uint256 | number of shares to buy |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | the price of the shares to buy |
getSellPrice
solidity
function getSellPrice(uint256 amount) external view virtual returns (uint256)Current price of the amount of shares to sell; calculated based on the current total shares supply
Parameters
| Name | Type | Description |
|---|---|---|
| amount | uint256 | number of shares to sell |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | the price of the shares to sell |
getBuyPriceAfterFee
solidity
function getBuyPriceAfterFee(uint256 amount) external view virtual returns (uint256)Current price of the amount of shares to buy, including all fees; calculated based on the current total shares supply and fees percentages
Parameters
| Name | Type | Description |
|---|---|---|
| amount | uint256 | number of shares to buy |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | the price of the shares to buy |
getSellPriceAfterFee
solidity
function getSellPriceAfterFee(uint256 amount) external view virtual returns (uint256)Current price of the amount of shares to sell, including all fees; calculated based on the current total shares supply and fees percentages
Parameters
| Name | Type | Description |
|---|---|---|
| amount | uint256 | number of shares to sell |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | the price of the shares to sell |
buyShares
solidity
function buyShares(uint256 amount) external payable virtualBuy amount of shares. Sender has to supply getBuyPriceAfterFee(amount) ETH. First share can be bought only by current subject issuer.
Depending on the implementation, ERC-20 token payment may be required instead of ETH. In such a case, implementation must through if ETH is sent, effectively overriding the function definition as non-payable
Parameters
| Name | Type | Description |
|---|---|---|
| amount | uint256 | amount of the shares to buy |
buySharesTo
solidity
function buySharesTo(uint256 amount, address beneficiary) external payable virtualBuy amount of shares in the favor of the address specified (beneficiary). Sender has to supply getBuyPriceAfterFee(amount) ETH. First share can be bought only by current subject issuer.
Depending on the implementation, ERC-20 token payment may be required instead of ETH. In such a case, implementation must through if ETH is sent, effectively overriding the function definition as non-payable
Parameters
| Name | Type | Description |
|---|---|---|
| amount | uint256 | amount of the shares to buy |
| beneficiary | address | an address receiving the shares |
sellShares
solidity
function sellShares(uint256 amount) external virtualSell amount of shares. Sender gets getSellPriceAfterFee(amount) of ETH. Last share cannot be sold.
Depending on the implementation, ERC-20 token may be payed instead of ETH.
Parameters
| Name | Type | Description |
|---|---|---|
| amount | uint256 | amount of the shares to sell |
sellSharesTo
solidity
function sellSharesTo(uint256 amount, address payable beneficiary) external virtualSell amount of shares in the favor of the address specified (beneficiary). The beneficiary gets getSellPriceAfterFee(amount) of ETH. Last share cannot be sold.
Depending on the implementation, ERC-20 token may be payed instead of ETH.
Parameters
| Name | Type | Description |
|---|---|---|
| amount | uint256 | amount of the shares to sell |
| beneficiary | address payable | an address receiving the funds from the sale |
getTradeVolume
solidity
function getTradeVolume() external view returns (uint256)Cumulative value of all trades; allows to derive cumulative fees paid
This value cannot decrease over time; it can increase or remain constant if no trades are happening
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | Sum of the modulo of all trading operations |