Giter Site home page Giter Site logo

public-allocator's Introduction

Public Allocator

Overview

MetaMorpho is a protocol for funds allocations and risk management on top of Morpho Blue. The Public Allocator is a contract that MetaMorpho vault owners can enable as allocator to let anybody reallocate the vault's funds to fill their liquidity needs.

The Public Allocator's function reallocateTo (source, interface) reallocates some liquidity from multiple markets to one market. It takes as input withdrawals, a list of pairs, which will be the markets and amounts that will be reallocated, and supplyMarketParams, a MarketParams, which is the market in which to supply the reallocated funds. Note that the id of the markets in withdrawals must be sorted, and that supplyMarketParams cannot be a market of withdrawals.

The Public Allocator provides the possibility to the vault owner or a per vault settable admin to constrain the public reallocation:

  • Max flows: Each market has a max inflow (maxIn) and max outflow (maxOut), that can be set by the vault owner or the Public Allocator vault admin. The markets from which funds are withdrawn through reallocateTo increase their maxIn and decrease their maxOut, and the market in which funds are deposited decrease their maxOut and increase their maxIn.
  • Fee: If set, user must pay a fee in ETH to be able to call reallocateTo. The vault owner or the Public Allocator vault admin can set this fee, as well as taking the accumulated fees out by calling transferFee.

Testing

To run tests: forge test. Note that running the tests this way will use this repository's compilation settings for dependencies (Morpho & MetaMorpho), potentially different from the settings used for deployment of those dependencies.

Audits

All audits are stored in the audits' folder.

License

All files are licenced under GPL-2.0-or-later, see LICENSE.

public-allocator's People

Contributors

mathisgd avatar adhusson avatar qgarchery avatar merlinegalite avatar

Stargazers

Bastien Vélitchkine avatar Anton Cheng avatar  avatar

Watchers

 avatar Romain Milon avatar  avatar  avatar

public-allocator's Issues

dual license?

          let's merge this and open an issue
This software is available under your choice of the GNU General Public
License, version 2 or later.

Originally posted by @MathisGD in #37 (comment)

Update readme

  • Explain the purpose of the public allocator
  • Explain how to set it up

add test edge case

          If `allocations[i].assets` is exactly 0 after this line, then metamorpho triggers a special case by withdrawing with shares. I think it works out in the end because Morpho.withdraw will do the exact same computation, but I would rest easier if there was a test for it. So the test would pass an amount to withdraw that is equal to the expected supply assets of the vault

Originally posted by @QGarchery in #5 (comment)

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.