Giter Site home page Giter Site logo

composablefi / composable Goto Github PK

View Code? Open in Web Editor NEW
113.0 17.0 66.0 199.63 MB

Picasso Kusama and Composable Polkadot parachains

Home Page: https://www.composable.finance

Rust 93.94% Shell 0.06% Nix 4.97% Dockerfile 0.07% TypeScript 0.96%
ibc blockchain rust substrate parachain polkadot

composable's Introduction


Composable Finance


Composable Finance | Picasso

Latest Release Build Discord

Composable Finance is dedicated to building the infrastructure for trust-minimized interoperability and decentralised block building for efficient cross-chain execution. Within this repository, you'll find the codebase for Composable Polkadot and Picasso. Additionally, it houses pallets included in their respective runtimes.

Among the noteworthy pallets included are:

Composable's core technology extends beyond this repository. It includes key components such as CVM and MANTIS, the first IBC implementation on Substrate โ€“ Pallet-ibc, the Composable Cosmos chain, and Solana IBC.

Join Composable Networks

To supply price feeds for Apollo or run a collator on Picasso, check out our documentation here.

To become a validator on Composable Cosmos mainnet or testnet, see the instructions here.

Audits

Within the audits folder, you'll discover a collection of audit reports, along with any corresponding fixes. This includes any audit reports that have been published for any in-production code, and not just limited to this repository.

Documentation

This repository serves as a hub for contributions to the Composable documentation. Composable uses Docusauras, for insights into major structural contributions, please refer to their documentation. Should you encounter broken links within the docs, submit an issue or PR to address the matter.

Visit our docs to learn more about our vision and technology.

Installation

Refer to the Releases page.

Release Process

Refer to RELEASE.md.

Nix

Use nix to run and build Composable developer environments.

composable's People

Contributors

aeryz avatar andor0 avatar andresmechali avatar benluelo avatar blasrodri avatar bors[bot] avatar comfi01 avatar cor avatar dominique-roth avatar dzmitry-lahoda avatar easteregg avatar flipchan avatar haroldsphinx avatar hussein-aitlahcen avatar jafaraz avatar kaiserkarel avatar kkast avatar kkx avatar martin-kiss avatar mergify[bot] avatar mikolaichuk avatar mina86 avatar poisonphang avatar radupopa2010 avatar rustninja avatar saadjhk avatar scruffy-dev avatar seunlanlege avatar vimukthi-git avatar vivekvpandya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

composable's Issues

Use orml_tokens for Currencies/Tokens

Rationale

At Composable, we do not differentiate fungibles tokens from currencies.
For instance, both native tokens and LP tokens (e.g. generated by a vault) can be lent, re-wrapped within a vault (possibility of having a cascade of LP tokens) and exchanged between users. We could even later say that a user can pay fees with any tokens that can have a price derived for.

Implementation

Extra

In order to make pallet expectation more explicit, we favor the usage of traits composition (e.g. Inspect + Hold + ...) instead of a single trait containing extra functions the pallet is not interested in (e.g. look at Currency trait).

Update Readme.md

Update readme to Composable's Node's readme instead of generic substrate template readme

Picasso Testnet

This is a meta issue, essentially a check list for our picasso test net.

Implement Customized Vector library

Todo:
right now BribeDAO is using the sortedvec library, which is a small library used in order to create its auto sorting function for sorting the bribe requests, after further investigations, it would be best and easiest to semi-fork this library and increase the current wrapper of it into a full vector library implementation.

I will look into this

Current Customized Vec:
https://github.com/ComposableFi/composable/blob/bribe_new/frame/bribedao/src/vecstorage.rs

Install yarn on a CI self-hosted worker

Motivation

There is Markdown linter (https://github.com/remarkjs/remark), it requires yarn.
I plan to add remark check in CI (#220).

Suggested Solution

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn

or

npm install --global yarn

Lending Feedback

traits/oracle.rs

  • The oracle trait does not specify how to handle decimal point. perhaps it should be altered to:

https://github.com/ComposableFi/composable-pallets/blob/649cf366adffa53f8ab1d1c593b3b34cca3b4dff/frame/composable-traits/src/oracle.rs#L3-L16

        /// How much `in` currency should one have to get `amount` unit `of` currency
	/// Error is returned if currency not supported or price information not available.
	/// `in` currency some well known shared (stable) currency.
	/// Consumers may assume can get price of wrapped tokens:
	/// ```python
	/// price(wrap_1(wrap_2(wrap_3((btc))) = price(btc) * stock_dilution_1_ratio * stock_dilution_2_ratio * stock_dilution_3_ratio
	/// ``
	fn get_price(of: &Self::AssetId, amount: Self::Balance) -> Result<(Self::Balance, Self::Timestamp), DispatchError>;

traits/lending.rs

  • Some minor spelling/style, will make a PR with my suggestions.

traits/liquidation

  • Spelling of filename is incorrect ;)

  • I do not think that the lending protocol is capable of determining the fee, as that is dex specific.

https://github.com/ComposableFi/composable-pallets/blob/649cf366adffa53f8ab1d1c593b3b34cca3b4dff/frame/composable-traits/src/liquidatation.rs#L14-L16

  • Should the Liquidate trait also handle routing? If so, it could be simplified to a single method, liquidate, and the implementer handles fee computation etc.

traits/rate_model.rs

  • It seems that all models could implement a single trait, which exposes get_borrow_rate.

https://github.com/ComposableFi/composable-pallets/blob/649cf366adffa53f8ab1d1c593b3b34cca3b4dff/frame/composable-traits/src/rate_model.rs#L386

  • That seems to be related to cargo fmt

https://github.com/ComposableFi/composable-pallets/blob/903c455ef72f84e405b74e1a193d4077bf6bffa4/frame/lending/src/lib.rs#L239

  • Each of the event fields may be named, which avoids confusion:
pub enum Event<T: Config> {
    /// Event emitted when new lending market is created.
    NewMarketCreated {
	market_id: MarketIndex,
	vault_id: T::VaultId,
	manager: T::AccountId,
	borrow_asset_id: T::AssetId,
	collateral_asset_id: T::AssetId,
	reserved_factor: Perquintill,
	collateral_factor: NormalizedCollateralFactor,
    },
    ...
  • How exactly does MarketDebtCurrency work?

Choose MultiCurrency implementation

For the lending protocol and the vaults, we are relying on the MultiCurrency trait, as well as our own trait

pub trait CurrencyFactory<CurrencyId>
where
    CurrencyId: FullCodec + Eq + PartialEq + Copy + MaybeSerializeDeserialize + Debug,
{
    fn create() -> Result<CurrencyId, DispatchError>;
}

to mint LP Tokens. We haven't taken a look at what crate to use for the actual implementation, but orml-tokens should work for us.

Just polling if we can make the assumption that MultiCurrency will be available to us. :)

Continous Deployment V0.1

We'd like to have special branches that once code is merged into it, we have scripts that automatically:

  • If it's a client release:
    • Create a new github tagged release for the client binary signed with gpg signatures,
    • Deploy a new docker image to composable-labs/composable:latest
    • distribute code/binaries to node auto-update strategy
  • If it's a runtime release:
    • create a github tagged release for the runtime wasm, signed with gpg signatures
    • auto propose new runtime wasm on picasso/composable/dali/etc

test [ignore]

Motivation

Describe the need or frustration that motivated you to make this suggestion. Please note that the
goal of this project is to provide a general-purpose template project, so please take care when
suggesting features that may be specific to a particular use case.

Suggested Solution

Describe your suggested solution to the need or frustration that you are experiencing.

Alternatives

Describe any alternative solutions or features you considered and why you believe your suggested
solution is preferable.

Additional Information

Provide any additional information that you believe may help us evaluate your suggestion.

Oneline'r install script

substrate has a really easy to install process thanks to getsubstrate.io(sh curl https://getsubstrate.io -sSf | bash -s -- --fast )

Would be cool to have a similar install script so that a user can get the dependencies and auto compile and install the node

What's needed:
Multiplatform install script
subdomain to host this script so we can do it all in a one liner thanks to curl and shell.

Patch prost-derive

Getting the following error on the latest rust release. Seems Prost was a bit naughty in their API usage (or 0.7.0 is just really old)

error[E0034]: multiple applicable items in scope
   --> /home/karel/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-derive-0.7.0/src/lib.rs:109:14
    |
109 |             .intersperse(quote!(|));
    |              ^^^^^^^^^^^ multiple `intersperse` found
    |
    = note: candidate #1 is defined in an impl of the trait `Iterator` for the type `Map<I, F>`
    = note: candidate #2 is defined in an impl of the trait `Itertools` for the type `T`
help: disambiguate the associated function for candidate #1

Downgrading locally fixes it of course. Aside from that, we should consider upgrading to edition 2021 (or at least see if we can compile with that edition.)

Node binary auto-update strategy

For every distribution method we provide (whether its build from source, docker) we should have a strategy that allows for the binary to be auto-updated and be re executed.

feature OCW fails to compile

cargo check --features=ocw

fails to compile. Seems to be some old code here:

#[cfg(feature = "ocw")]
{
let keystore = keystore_container.sync_keystore();
if parachain_config.offchain_worker.enabled {
// Initialize seed for signing transaction using off-chain workers. This is a
// convenience so learners can see the transactions submitted simply running the node.
// Typically these keys should be inserted with RPC calls to `author_insertKey`.
// TODO: rmeove in prod
{
sp_keystore::SyncCryptoStore::sr25519_generate_new(
&*keystore,
KeyTypeId(*b"orac"),
Some("//Alice"),
)
.expect("Creating key with account Alice should succeed.");
}
}
}

CI Improvement

So we want to have faster CI times.

This would require:

  • having a much faster (32 vcpus/16gb ram?) self-hosted machine (which we can turn on/turn off on demand to save costs).
  • Use machine to use as a runner with all the necessary set up software pre-installed(?).

Extract the oracle/price-feed interface to a separate library

Related to #16

Currently, the interface between the oracle/price-feed server is duplicated in both the oracle pallet and the price-feed project.
Perhaps we should consider extracting this interface (the structure that the oracle offchain worker is expecting from the price-feed server) to a separate library so that the CI will be able to detect breaking changes of this part.

Picasso Runtime

Assemble a suitable runtime for Picasso.

  • #14
  • Aura POA consensus
    • Add initial validators to chain spec

Lending Pallet: Flash loans/Short term loands

The lending pallet does not yet handle loans being paid back within the same block (it uses the on_initialize and on_finalize hooks to compute interest). Currently someone can take out a loan, do stuff, and pay it back within the s same block without paying interest. We can of course disallow this, but it is a neat feature for arbitrage. Better would be to charge a minimum interest fee, say three blocks worth for any loan if we want to disincentive this, or just the regular block fee if we want to incentive.

Will write/think a bit more about this. Using the on_initialize and on_finalize hooks means that the funds are calculated as if in use for the entire block, however if the funds are returned within the same block, someone else could use them as well

| ------------------------ block 1 ---------------------------------------------------|---------------------------------------------| 
|TX a ( take loan -> Do Stuff -> return loan) ----> TX b ( take loan)                 | TX c ( return loan                          |

TX a does not loan the funds for an entire block, just for a part of it.

CI Infrastructure Setup

Continuous Integration with Github Action

Setting up a Highly Performant and Cost optimized CI Infrastructure for our continuous integration processes, To achieve this, we need to create the infrastructure that will enable it, this means that we have to setup components like:

  • GCP Project to use
  • Iac tool to automate this process
  • CI Framework that can be reusable by other projects in the organization

Tasks

  • Setup GCP Project
  • Setup User and Groups
  • Setup Terraform Integration
  • Provision GCP Instances with Terraform

Output

  • Authorized Users should be able to provision GCP resources using Terraform
  • Provision Github Action Runners using Terraform

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.