/x-earn

Primary LanguageTypeScriptMIT LicenseMIT

X-Earn

Money legos for Scaling algorithmic crypto portfolio to Cross-Chain using #Connext!!!

  • Money Legos
  • High Security
  • UX friendly: one-click only
  • Cross-Chain (xcall me)

TLDR; Sommelier reads 1000x earning positions from multiple domains (chains, rollups etc.) sends the request at Cellar, and HubAdapter sends funds at best position using connext bridge and it will open it in 2-3mins. Real time monitoring happens through FileCoin and callbacks are enables at bridge to periodically send updates on position on Mainnet.


flowchart


UI

  • Connect Wallet
  • Click on preferred position, and complete transaction on wallet
  • Vola!! After 2-3mins, we are earning the best APY from whole ecosystem.

flowchart


Foundry Starter Kit is a repo that shows developers how to quickly build, test, and deploy smart contracts with one of the fastest frameworks out there, foundry!

Getting Started

Requirements

Please install the following:

  • Git
    • You'll know you've done it right if you can run git --version
  • Foundry / Foundryup
    • This will install forge, cast, and anvil
    • You can test you've installed them right by running forge --version and get an output like: forge 0.2.0 (f016135 2022-07-04T00:15:02.930499Z)
    • To get the latest of each, just run foundryup

And you probably already have make installed... but if not try looking here.

Quickstart

git clone https://github.com/sanchaymittal/x-earn
cd x-earn
yarn # This installs the project's dependencies.
yarn setup

Testing

make test

or

forge test

Deploying to a network

Deploying to a network uses the foundry scripting system, where you write your deploy scripts in solidity!

Setup

We'll demo using the Goerli testnet. (Go here for testnet goerli ETH.)

You'll need to add the following variables to a .env file:

  • GOERLI_RPC_URL: A URL to connect to the blockchain. You can get one for free from Alchemy.
  • PRIVATE_KEY: A private key from your wallet. You can get a private key from a new Metamask account
    • Additionally, if you want to deploy to a testnet, you'll need test ETH and/or LINK. You can get them from faucets.chain.link.
  • Optional ETHERSCAN_API_KEY: If you want to verify on etherscan

Deploying at Goerli

make deploy-goerli contract=<CONTRACT_NAME>

For example:

make deploy-goerli contract=CellarAdapter
make deploy-goerli contract=HubAdapter

This will run the forge script, the script it's running is:

@forge script script/${contract}.s.sol:Deploy${contract} --rpc-url ${GOERLI_RPC_URL}  --private-key ${PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${ETHERSCAN_API_KEY}  -vvvv

If you don't have an ETHERSCAN_API_KEY, you can also just run:

@forge script script/${contract}.s.sol:Deploy${contract} --rpc-url ${GOERLI_RPC_URL}  --private-key ${PRIVATE_KEY} --broadcast 

These pull from the files in the script folder.

Deploying at CRONOS

make deploy-target-cronos contract=<CONTRACT_NAME> hub=<HubAdapter_ADDRESS>

For example:

make deploy-target-cronos contract=TargetAdapter hub="0x131072b27dFE13d37878D584E055350696Ae987A"

Working with a local network

Foundry comes with local network anvil baked in, and allows us to deploy to our local network for quick testing locally.

To start a local network run:

make anvil

This will spin up a local blockchain with a determined private key, so you can use the same private key each time.

Then, you can deploy to it with:

make deploy-anvil contract=<CONTRACT_NAME>

Similar to deploy-goerli

Working with other chains

To add a chain, you'd just need to make a new entry in the Makefile, and replace <YOUR_CHAIN> with whatever your chain's information is.

deploy-<YOUR_CHAIN> :; @forge script script/${contract}.s.sol:Deploy${contract} --rpc-url ${<YOUR_CHAIN>_RPC_URL}  --private-key ${PRIVATE_KEY} --broadcast -vvvv

Security

This framework comes with slither parameters, a popular security framework from Trail of Bits. To use slither, you'll first need to install python and install slither.

Then, you can run:

make slither

And get your slither output.

Contributing

Contributions are always welcome! Open a PR or an issue!

Thank You!