MultiversX Tracker is Live!

Problem of combining contract funds across multiple L2s

Etherum Reddit

More / Etherum Reddit 91 Views

I am planning to make a smart contract. Long story short, I made an AI trading bot and it has been doing pretty well for almost 3 years. The AI is especially good at trading ETH/USDT or ETH/USDC pairs. My plan is to make a smart contract, let people deposit funds in, let the AI trade with those funds, and I take part of the realized gain as commission.

There will be a token representing shares of the pooled funds, I plan to call it JCT. Its value always equals to the total funds in the pool divided by the total JCT supply. When the pool has 500k USDC, 300 ETH and the current supply of JCT is 10k, each JCT can redeem 50 USDC and 0.03 ETH trustlessly. When people deposit money in, the contract issues new JCT based on the current price. When people withdraw money, the contract burns the JCT.

My address will be the admin address. The admin address can only do the following things:

  1. Swap ETH/USDC via Uniswap.
  2. Set commission percentage (between 0 and 1).

So there is no chance I can steal the funds, commission can only be taken from realized gain (the formula will be hardcoded in the contract). The only risk is I (the AI bot) made many bad swaps and run the funds to zero, but that's not likely given it has been performing well for almost 3 years, and when it start to go south, users can always withdraw. The design is to be as trustless as possible.

But here is the problem, how do I implement this across multiple L2s?

Ideally, the value of JCT should equal to the total funds in all networks divided by the total supply of JCT in all networks. But is it even possible to make contract aware of the funds in other networks? If I run this contract independently in each L2, eventually they will drift apart from each other due to different fees and slightly different swap prices. What is the solution to this?

submitted by /u/wood8
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments