GithubHelp home page GithubHelp logo

bookcliff / arbor-contracts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alwaysbegrowing/arbor-contracts

0.0 0.0 0.0 3.07 MB

πŸŒ³πŸ“ Smart contracts for the Arbor Protocol

Home Page: https://app.arbor.finance

License: GNU Affero General Public License v3.0

Shell 0.64% JavaScript 0.31% TypeScript 64.24% Solidity 34.81%

arbor-contracts's Introduction

Arbor Smart Contracts

app testnet landing docs discord blog twitter

Security

Please report any security issues to [email protected]

Bug Bounty

Both the Bond and BondFactory contracts have an open Bug Bounty on Immunefi.

V1

Smart Contracts powering the Arbor protocol.

Contracts

Mainnet GΓΆrli
BondFactory 0x1533Eb8c6cc510863b496D182596AB0e9E77A00c 0xBE9A5b24dbEB65b21Fc91BD825257f5c4FE9c01D
Bond Implementation 0x6285D6b0Ccac4ecaF4f7a2738fEc03330809B162 0xF457Fcb60F761c98b23b4edDe638E99711476FF7

What does it do? How does it work?

The Arbor protocol allows a borrower to create a Bond. Each minted bond share has some amount of collateral backing and will be redeemable 1 share for 1 stablecoin at maturity. To incentivize lenders, the bond shares will be sold at a discount either OTC or through an auction.

For more information on this process, the documentation site gives an overview of what the protocol does and some of the concepts like zero coupon bonds and the difference between "Simple" and "Convert" Bond types. For how the protocol works, check out the spec:

  • overview β€”Β An overview of the Bond and BondFactory as well as what actions Borrowers and Lenders can perform.
    • bond β€” More detailed look at the Bond actions and design decisions.
  • architecture β€” A technical document explaining how the Contracts interact and the lifecycle from deployment, creating a bond, and actions performed on that bond.
  • permissions β€” The trust model and implementation of that model.
  • state machine β€” The Bond represented as distinct states.

Development

For local development there are environment variables necessary to enable some hardhat plugins. To interact with the frontend, you will also need to update your wallet with a new network pointing to hardhat's network.

Network Name: Hardhat
RPC URL: http://localhost:8545
Chain ID: 31337
Currency: ETH

Then, run the local node with npx hardhat node. If forking a blockchain, avoid deploying dependencies with the --no-deploy flag: npx hardhat node --no-deploy.

Deployment

Using hardhat-deploy all of the scripts in the ./deploy folder are run. This will run the whole integration flow as well which includes deploying of the factory, tokens, creating bonds, doing bond actions, and starting auctions. If that is not desired, add a tags flag with what you want to deploy.

npx hardhat deploy --tags main-deployment # deploy bond factory
npx hardhat deploy --tags test-deployment # and deploy tokens
npx hardhat deploy --tags permissions # and grant roles & permissions
npx hardhat deploy --tags e2e # and run e2e test
npx hardhat deploy --tags bonds # and deploy test bonds
npx hardhat deploy --tags auctions # and start bond auctions
npx hardhat deploy --tags actions # and do bond actions

Additionally, all of the above commands can be run with --network goerli to deploy to the GΓΆrli test network.

Note: The deploy script will run with the npx hardhat node as well as the npx hardhat test tasks.

Verification

The deployment script will automatically verify the BondFactory, Implementation contract, and TestERC20 token. To verify a contract not deployed within that script, use the hardhat-etherscan task.

npx hardhat verify <address>

Testing

Running the hardhat test suite

npx hardhat test

Fork testing requires first running the mainnet-fork

npx hardhat node

and making the target for testing the local node

npx hardhat test --network localhost

Running the fuzzing test suite with Echidna

Other useful commands

npx hardhat help
npx hardhat compile # create contract artifacts
npx hardhat clean # removes artifacts and maybe other things
npx hardhat coverage # runs the contract coverage report
npx hardhat integration # runs the integration task
npx hardhat settle-auction --auctionId <auctionId> # settles an auction
npx eslint '**/*.{js,ts}' --fix
npx prettier '**/*.{json,sol,md,ts}' --write
npx solhint 'contracts/**/*.sol' --fix

arbor-contracts's People

Contributors

namaskar-1f64f avatar russeii avatar luckyrobot avatar bookcliff avatar emersoncloud 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.