# Cosmos Pricing Module The goal of the application is to provide a trustless pricing oracle for calculating the token price for any set of token bonding curve parameters. [Hayek famously said](http://reason.com/archives/1992/07/01/the-road-from-serfdom): *“…understand that prices are an instrument of communication and guidance which embody more information than we directly have.”* We want to do the best we can to put this principle into practical application, using the information technology capabilities that are now available to us. ## Token bonding curves Using algorithmic functions (aka *token bonding curves*) to deterministically calculate the price at which tokens are minted or burned has many potential use-case applications. The design space has been well described in a recent [article by Paul Kohlhaas](https://medium.com/molecule-blog/token-bonding-curve-design-parameters-95d365cbec4f). ## Pricing functions The curve parameters (algorithms) for token bonding curves can be implemented using a wide [variety of functions](https://blog.aventus.io/more-price-functions-for-token-bonding-curves-cfb1ebb5b659). Examples include: *exponential, logarithmic, negative exponential, constant product, positive initial price, quasi-polynomial, and reserved Supply (Augmented bonding curves)*. Most current implementations of Bonding Curves only support **invariant power functions**. Variant parameters are constrained to token supply and point-in-time demand. This may reduce complexity, compared to multi-dimensional ~~(manifold)~~ curves. However, this limitation comes at the cost of informational asymmetries. > Uni-dimensional bonding curves are unable to adapt to changes in complex economies. These token mechanisms cannot account for external systems changes over time, even when such changes can be calculated and have demonstrable probabilistic impacts or create emergent shifts in the economy. *I am not sure that I agree with the above, its more nuanced than that and i feel the statements above could be easily refuted with examples where unidimensional curves are sufficient. Its just that the cases you care about have include accounting for externalities that need to be internalized (which includes the notion of risk as an externality to be adjusted for). The unidimensional curves cannot handle that well.* - Z As a consequence, participants in a uni-dimensional token economy are effectively ‘trading blind’. Buy and sell decisions can only made on the basis of price and calculations are (intentionally) constrained to unrealistic parameters. Risks are therefore externalised and must be paid for outside of the crypto-economic system. This has negative impacts on the broader economy in which the crypto-economic system is operating and integrally dependant. ## Crypto-engineering token pricing To-date most implementations of token bonding curves take prospective design decisions (best guesses) about which pricing function to use. Token engineers make (largely untested) assumptions about how incentives will play out in the real-world. This typically starts with sketching out a curve that represents the desired behaviour of the crypto-economic system. Thereafter a function is identified that seems to best fit this behavioural pattern. At best, these designs have been formally modelled. A fine demonstration is engineering work on [Augmented Bonding Curves](https://medium.com/search?q=augmented%20bonding) by M. Zargham and his Blockscience team. Computer-aided design modeling enables us to identify the mechanisms and policies that will define the ‘safe space’ in which a given crypto-economic design can play out. But this is an abstraction of complex adaptive systems that leaves open a large (even if bounded) uncontrollable space, within which there is no information feedback loop mechanism built into the system - other than market demand. ## Solving real-world problems To try fix this, let’s take a real-world example such as Impact Bonds. The ixo foundation is researching a [tokenised impact bond mechanism](https://medium.com/@shaunconway/smart-impact-bonds-b96ba85a88d8) to provide next-generation financing for development outcomes. This work is being done in the context of a very large institutionally-financed development impact bond for primary education in India. Impact bonds transfer the operational risks of a development intervention to capital investors. In return, these investors receive financial returns as compensation for the risks. This only fully pays out if the bond delivers predetermined outcomes. The risk premium is accepted as an ‘impact’ contribution (hence the parochial term ‘impact investing’). The mechanism can also reward intervention implementers with bonus payments for achieving outcomes targets. This could be an effective use of behavioural economics, when the incentive mechanism actually works in practice. Traditional impact bonds - such as the Development Impact Bond (DIB) for education, typically have invariant terms for duration, coupon value and performance triggers. Bonds are only issued after the full capital subscription has been realised. This can delay implementation of the intervention whilst capital is being formed. It also requires ex-ante conviction that the operational risks will be contained within acceptable (predictable) bounds. Risks may incur underwriting costs based on assumptions that may or may not be valid. Life teaches us that prior expectations often don’t play out in complex real-world contexts. Therefore, almost all interventions funded by instruments such as impact bonds could (or should?) be seen as start-up initiatives with unproven assumptions. This includes replicated interventions which are implemented in a different place, time or with any with any other untested variables. ## A new financing mechanism We need a financing mechanism that responds to new information and changes in risks over time. A financing mechanism that adapts to complex systems with variable, risk-adjusted pricing. Ideally, this should enable startup (=seed) capital to be raised to demonstrate the feasibility and promise of the intervention. After the startup phase, this mechanism should provide continuous funding (or a series of funding) for the project to scale towards achieving its desired future-state outcomes. ## Alpha Bonds We describe this adaptive impact financing mechanism as an *alpha-bond*. The implementation requires a risk-adjusted bonding curve for token pricing that uses a variant co-efficient (alpha) to statistically determine the probability of the bond achieving its targets. Recall that achieving the targets by delivering pre-programmed future-state outcomes triggers a payout to investors (and implementors). Using this risk calculation at a given point in time (or at a specific block height, in blockchain parlance), should produce a risk-adjusted price for an alpha bond token by integrating the alpha coefficient as a modifier on the bonding curve. As an added feature, participation in the bond could be liquid, so that investors can enter and exit the investment pool by trading their debt tokens (against an automated market-maker smart contracts, for instance), at a price that incorporates this risk information. ## A novel pricing function Variable power functions that are adjusted by an alpha coefficient could be a novel way of implementing Token Bonding Curves *(please let me know if anyone has already done something similar)*. We want to build this as a trustless generic pricing oracle that can be called as a function by any application. The first software client will be developed and tested as a module in the Cosmos SDK. This will make the pricing oracle available to any application that implements the module in an application blockchain. For now, let us park the question of how risk is calculated to derive the alpha coefficient, as this is the topic for a future stage of work and another Cosmos module. ## Cosmos pricing module design The design separates logic from transactions (state transitions), by implementing a module in the Cosmos SDK which can be called to receive and send signed messages from other Cosmos modules. The input message will include key parameters such as: ``` Token Reserve Token Supply (market cap) Derived Mint equation Derived Burn equation Exponent constant Slope constant Alpha (risk coefficient) Order size ? ``` The module computes an integral price, using integer arithmetic, given the input parameters. The output message will include parameters such as: ``` Mint Token price Burn Token price Block height ? ``` Messages will be validated and recorded in the Cosmos key-value store. ## Hackathon objectives The concept will be further iterated and prototyped at the Cosmos Hackatom in Berlin over the coming weekend, to achieve the following objectives: 1. Design requirements (referenced against prototype use-case/s) 2. Define message parameters 3. Define the equations 4. Simulate the system using cadCAD 5. Code a Cosmos SDK module 6. Demonstrate how this works as an application using the ixo-Cosmos blockchain for the education impact bond use-case ## Cautionary note This oracle should be versatile enough to integrate into any application. However, this must be seen as only one component in a crypto-economic system. It does not control the emergent properties and behaviours of the system :-|