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
Insert your private key in an .env file using
cargo stylus check
cargo stylus deploy --private-key-path=./.env
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
Forkers
yjshi2015erc4626-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
self.erc20.burn(msg::sender(), shares)?; instead of self.erc20.burn(msg::sender(), amount)?;
use wrong param for burn method
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google â¤ď¸ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.