# Curation Module ## 1. Introduction (Summary) The Curation module contains contracts that facilitate the signaling of new and existing subgraphs to Indexers and distributes Graph Curation Shares (GCS) to Curators. ## 2. Module Details The Curation Module has 3 core components consisting of the `Curation`, `GraphCurationToken` and `BancorFormula` contracts. ### Glossary - `signaling` - is the process of depositing GRT into a bonding curve for a subgraph to indicate Indexers what subgraph should be indexed. - `bonding curve` - a type of algorithmic market maker where price is determined by a function. ## 3. Key Mechanisms and Concepts **Summary of the Curation module** - `GraphCurationToken` - The GraphCurationToken smart contract is an ERC20 compliant token used to represent shares in curation pools to reward Curators for signaling subgraphs. - `Curation` - Allows curators to signal subgraphs that might be relevant to Indexers. - `BancorFormula` - Bonding curve used by the _Curation_ contract to distribute Graph Curation Shares (GCS) to Curators of a signaled subgraph. **Contract** - [Curation] - [GraphCurationToken](https://hackmd.io/_TEMf3PxRpO3xA1KZgNefg) - [BancorFormula](https://github.com/graphprotocol/contracts/blob/dev/contracts/bancor/BancorFormula.sol) ---- ## BancorFormula Is the bonding curve used by the _Curation_ contract to distribute Graph Curation Shares (GCS) to Curators for signaling on a subgraph, and then used to exchange those shares for GRT when they return the signal. ### Key functionalities #### calculatePurchaseReturn() ```solidity calculatePurchaseReturn( uint256 _supply, uint256 _reserveBalance, uint32 _reserveRatio, uint256 _depositAmount ) ``` Given a token supply, reserve balance, ratio and a deposit amount (in the reserve token), calculates the return for a given conversion (in the main token). ##### Formula: $$ Return = \_supply * (\frac{1 + \_depositAmount}{\_reserveBalance} )^{(\frac{\_reserveRatio}{1000000} - 1)} $$ ##### Arguments - `_supply` token total supply - `_reserveBalance` total reserve balance - `_reserveRatio` reserve ratio, represented in ppm (i.e. 1-1000000) - `_depositAmount` deposit amount, in reserve token #### calculateSaleReturn() ```solidity calculateSaleReturn( uint256 _supply, uint256 _reserveBalance, uint32 _reserveRatio, uint256 _sellAmount ) ``` Given a token supply, reserve balance, ratio and a sell amount (in the main token), calculates the return for a given conversion (in the reserve token) ##### Formula: $$ Return = \_reserveBalance * (1 - (\frac{1 - \_sellAmount}{\_supply}) ^{ (\frac{1000000}{\_reserveRatio})}) $$ ##### Arguments - `_supply` token total supply - `_reserveBalance` total reserve - `_reserveRatio` constant reserve Ratio, represented in ppm, 1-1000000 - `_sellAmount` sell amount, in the token itself