Coder Social home page Coder Social logo

0xfuje / astaria-core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from astariaxyz/astaria-core

0.0 0.0 0.0 2.23 MB

NFT Collateralized Lending Market levearing our novel 3AM Model.

Home Page: https://www.astaria.xyz

License: Other

Shell 0.72% JavaScript 0.55% Python 0.11% Dockerfile 0.27% Solidity 98.34%

astaria-core's Introduction

Contracts

All contracts in src/ have accompanying interfaces in the interfaces folder.

Contract Name SLOC Purpose
src/AstariaRouter.sol 556 A router contract for handling universal protocol behavior and endpoints into other core contracts.
src/AstariaVaultBase.sol 33 Contract with pointers to vault constants and contract implementations.
src/VaultImplementation.sol 243 Base vault contract with behavior for validating and issuing loan terms.
src/Vault.sol 37 PrivateVault contract, where only permissioned lenders can deposit funds.
src/PublicVault.sol 442 Contract for permissionless-lending Vaults, handling liquidations and withdrawals according to the epoch system.
src/LienToken].sol 594 LienTokens are non-fungible tokenized debt owned by Vaults. This contract handles the accounting and liquidation of loans throughout their lifecycle.
src/CollateralToken.sol 428 CollateralTokens are ERC721 certificates of deposit for NFTs being borrowed against on Astaria, giving the owner the right to the underlying asset when all debt is paid off.
src/WithdrawVaultBase.sol 23 Base contract for WithdrawProxy.
src/WithdrawProxy.sol 166 A new WithdrawProxy is deployed for each PublicVault when at least one LP wants to withdraw by the end of the next epoch. It handles funds from loan repayments and auction funds.
src/ClearingHouse.sol 134 ClearingHouses are deployed for each new loan and settle payments between Seaport auctions and Astaria Vaults if a liquidation occurs. It also stores NFTs that borrowers deposit to take out a loan.
src/BeaconProxy.sol 33 Beacon contract for upgradeability.
src/TransferProxy.sol 12 The TransferProxy handles payments to loans (LienTokens).
lib/gpl/src/ERC20-Cloned.sol 126 Custom base ERC20 implementation.
lib/gpl/src/ERC721.sol 155 Slightly modified base ERC721 implementation.
lib/gpl/src/ERC4626-Cloned.sol 93 Custom base ERC4626 implementation.
lib/gpl/src/ERC4626RouterBase.sol 33 ERC4626 base router contract.
lib/gpl/src/ERC4626Router.sol 27 ERC4626 router contract.
lib/gpl/src/Multicall.sol 18 Multicall contract.
Total 3153
 src
 ├─ AstariaRouter.sol
 ├─ AstariaVaultBase.sol
 ├─ BeaconProxy.sol
 ├─ ClearingHouse.sol
 ├─ CollateralToken.sol
 ├─ LienToken.sol
 ├─ PublicVault.sol
 ├─ TransferProxy.sol
 ├─ Vault.sol
 ├─ VaultImplementation.sol
 ├─ WithdrawProxy.sol
 ├─ WithdrawVaultBase.sol
 └─ actions
    └─ UNIV3
       └─ClaimFees.sol
 └─ libraries
    └─ Base64.sol
    └─ CollateralLookup.sol
 └─ security
    └─ V3SecurityHook.sol
 └─ strategies
    └─ CollectionValidator.sol
       ├─ UNI_V3Validator.sol
       └─ UniqueValidator.sol
 └─ utils
    ├─ Math.sol
    ├─ MerkleProofLib.sol
    └─ Pausable.sol

For more details on the Astaria protocol and its contracts, please see the docs.

Astaria Contracts Setup

Astaria runs on Foundry. If you don't have it installed, follow the installation instructions here.

To install contract dependencies, run:

forge install
yarn

To Deploy on a forked network, update your RPC in docker-compose.yml first and then run:

sh scripts/boot-system.sh

Tests are located in src/test. To run tests, run:

forge test --ffi

To target integration tests following common use paths, run:

forge test --ffi --match-contract AstariaTest

To target tests following disallowed behavior, run:

forge test --ffi --match-contract RevertTesting

Edge cases around withdrawing and other complex protocol usage are found in the WithdrawTest and IntegrationTest contracts.

To view a gas report, run:

forge snapshot --gas-report --ffi

astaria-core's People

Contributors

santiagogregory avatar androolloyd avatar dangerousfood avatar 0xgregthedev avatar justingreenberg avatar jrhea avatar

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.