Giter Club home page Giter Club logo

linear's Introduction

LiNEAR - Liquid Staking on NEAR Protocol

LiNEAR Protocol is a liquid staking solution built on the NEAR Protocol. LiNEAR unlocks liquidity of the staked NEAR by creating a staking derivative to be engaged with various DeFi protocols on NEAR and Aurora, while also enjoying over 10% APY staking rewards of the underlying base tokens. LiNEAR is the cornerstone piece of the NEAR-Aurora DeFi ecosystem.

Contracts

The LiNEAR smart contracts are implemented with NEAR Rust SDK. The core contract is located in contracts/linear, and several mock contracts were made for testing various scenarios via simulation test.

The v1.0.0 contract release has been audited by BlockSec. According to BlockSec's auditing report, no critical issues were found, and few low-risk minor issues were reported and have been fixed.

Deployment

Mainnet

Testnet

Development

Build

  • Build all artifacts: make
  • Build linear only: make linear

Test

We adopt unit tests and heavily used the workspace-js test framework to test the major scenarios and workflow of the LiNEAR smart contract in the Sandbox environment

  • Run all tests: make test
  • Run LiNEAR simulation tests:
    • Run all: make test-linear
    • Run specific test file: TEST_FILE={filename} make test-linear
    • Print contract logs: LOGS=1 make test-linear

Deploy

A CLI tool is made to help deploy and manage the contract. In order to use it, run npm i first.

All CLI arguments could be passed as environment variables as well, with LI prefix.

  • deploy contract:

    • ./bin/cli.js deploy linear.testnet
  • init contract:

    • ./bin/cli.js init linear.testnet --signer owner.testnet --owner_id owner.testnet

Release

  • Checkout a release branch from main
    • git checkout -b release/v1.0.x
  • Make sure all tests pass:
    • make test
  • Update version in contracts/linear/Cargo.toml
  • Git commit version update and push the release branch:
    • git commit -m 'v1.0.x'
    • git push origin release/v1.0.x
  • Create a PR from the release branch
  • Once the PR is merged, publish a new release on GitHub

Design

Terminologies

  • total_share_amount: Total amount of LiNEAR that was minted (minus burned).
  • total_staked_near_amount: Total amount of NEAR that was staked by users to this contract.
    This is effectively 1) amount of NEAR that was deposited to this contract but hasn't yet been staked on any validators + 2) amount of NEAR that has already been staked on validators.
    Note that the amount of NEAR that is pending release or is already released by hasn't been withdrawn is not considered.
  • stake_share_price: how much NEAR does one stake share (LiNEAR) worth. equals to : total_near_amount / total_share_amount.

linear's People

Contributors

dongcool avatar linguists 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.