GithubHelp home page GithubHelp logo

erc4626-rs's Introduction

🤖ML-ERC46 for Arbitrum Stylus

Overview

Sample implementation of OpenZeppelin ERC4626 contract in Stylus using Rust which aims to enable heavy AI/ML computation for DeFi projects that want to enrich their smart vaults with machine learning capabilites that are historically performed offchain.

It provides a library with augmented ML capabilites thanks to the rustlearn crate, a machine learning package for Rust as seen in the rebalance function.

Smart Vault deployment address: https://stylus-testnet-explorer.arbitrum.io/address/0x6982aA8dB18E7153c614765dA4A581135e9Bf4a8

How to use

Insert your private key in an .env file using

 cargo stylus check   
 cargo stylus deploy --private-key-path=./.env

Test

You can interact with the smart contract on Arbitrum Stylus Testnet.

  cd hardhat
  yarn install
  yarn hardhat run scripts/initialize.js   

erc4626-rs's People

Contributors

solidoracle avatar yjshi2015 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

yjshi2015

erc4626-rs's Issues

same result for if and else in deposit function

let shares = if supply == U256::ZERO { 
            amount 
        } else { 
            amount.checked_mul(supply).ok_or("Overflow")?.checked_div(self.totalAssets()?).ok_or("Divide by zero")?
        };

supply = self.totalSupply.get();
pub fn totalAssets(&self) -> Result<U256, Vec> {
Ok(self.totalSupply.get())
}

which means amount multiply totalSupply and then divide total supply, result is amount, the same in if block

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.