Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arbitrage bot #958

Open
rndquu opened this issue Sep 11, 2024 · 36 comments · May be fixed by #976
Open

Arbitrage bot #958

rndquu opened this issue Sep 11, 2024 · 36 comments · May be fixed by #976

Comments

@rndquu
Copy link
Member

rndquu commented Sep 11, 2024

In order to maintain Dollar token USD peg LibUbiquityPool provides the following arbitrage mechanic:

  1. If Dollar token USD price >1$ (on a secondary market) then arbitragers are incentivised to
    a) Mint 1 Dollar token for 1 USD of collateral in the LibUbiquityPool
    b) Sell 1 Dollar token on a secondary market
  2. On the contrary, If Dollar token USD price <1$ (on a secondary market) then arbitragers are incentivised to:
    a) Buy cheap Dollar token on a secondary market
    b) Redeem Dollar token for collateral worth 1 USD in the LibUbiquityPool

On early project stage any large swap may affect the Dollar token price greatly and the pool (where the swap occurred) may remain unbalanced for a long time which in turn depegs the Dollar token.

As a part of this issue we should create an arbitrage bot (i.e. nodejs app) which could be run on VPS or any suitable PAAS (heroku, cloudflare, etc...) to catch arbitrage opportunities in order to keep the Dollar token USD pegged on early project stage.

What should be done:

  1. Create a new nodejs app that will catch arbitrage opportunities for the Dollar token
  2. Add unit tests for basic functionality
  3. Prepare a clear README of how to run the bot

Notes:

  • It makes sense to create the arbitrage bot in a separate repository.
  • Deployed contract addresses (mainnet): here
@0x4007
Copy link
Member

0x4007 commented Sep 12, 2024

Perhaps we can fork a bot dropping the time estimate down to a day?

It could be interesting to have a worker spawn on transaction events to the market. Webhook style. But maybe too complicated due to nodejs limitations

@rndquu
Copy link
Member Author

rndquu commented Sep 12, 2024

It could be interesting to have a worker spawn on transaction events to the market. Webhook style. But maybe too complicated due to nodejs limitations

Exactly. We need a simple "fork and run" solution because current version of the arbitrage bot will viable only until more sophisticated MEV bots add Dollar token pools to their platforms.

Perhaps we can fork a bot dropping the time estimate down to a day?

If there already exists a solution, then yes, time estimate can be reduced.

have a worker spawn on transaction events to the market

Current version of the arbitrage bot could be run on github cron schedule.

So the flow for an end user would be:

  1. Fork arbitrage bot
  2. Set env variables in github secrets
  3. On github cron schedule the bot will check available arbitrage opportunities

@FibrinLab
Copy link
Contributor

/start

Copy link

ubiquity-os bot commented Oct 3, 2024

Deadline Fri, Oct 4, 1:23 PM UTC
Beneficiary 0x3EFFe91C62d1864C3B791Bc7bbD43b68B899d12A

Tip

  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

@rndquu
Copy link
Member Author

rndquu commented Oct 3, 2024

@FibrinLab Did you check the expected flow here (the bot should be able to run as a github action)?

@FibrinLab
Copy link
Contributor

@FibrinLab Did you check the expected flow here (the bot should be able to run as a github action)?

Yes. Working on this

@FibrinLab
Copy link
Contributor

@rndquu I understand this would need a new repo. Where do I make a draft pull request?

@rndquu
Copy link
Member Author

rndquu commented Oct 4, 2024

@rndquu I understand this would need a new repo. Where do I make a draft pull request?

https://github.com/ubiquity/arbitrage-bot

@0x4007
Copy link
Member

0x4007 commented Oct 4, 2024

@rndquu I understand this would need a new repo. Where do I make a draft pull request?

https://github.com/ubiquity/arbitrage-bot

In the future you should make a new repo using our ts-template and host on your own org. Next you work on a pull to your own org but link this task using a closing keyword.

I don't want to make new repositories until work is completed because I had to delete eight "ts-templates" across our organization due to all the non completes last week.

@FibrinLab
Copy link
Contributor

@rndquu Some updates, created draft pool with arbitrage contract modified to work with Ubq pool. Working on Cron job.

@surafeldev
Copy link

/help

Copy link

ubiquity-os bot commented Nov 2, 2024

Available Commands

Command Description Example
/help List all available commands. /help
/allow Allows the user to modify the given label. /allow @user1 label
/query Returns the user's wallet, access, and multiplier information. /query @ubiquibot
/start Assign yourself to the issue. /start
/stop Unassign yourself from the issue. /stop
/wallet Register your wallet address for payments. /wallet ubq.eth

@surafeldev
Copy link

/wallet 0x0013f4217f6a8B48A92f7EA5d811A5F8D8364B93

Copy link

ubiquity-os bot commented Nov 2, 2024

+ Successfully registered wallet address

@surafeldev
Copy link

/start

Copy link

ubiquity-os bot commented Nov 2, 2024

Warning! This task was created over 51 days ago. Please confirm that this issue specification is accurate before starting.
Deadline Sun, Nov 3, 1:28 PM UTC
Beneficiary 0x0013f4217f6a8B48A92f7EA5d811A5F8D8364B93

Tip

  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

@kingsley-einstein
Copy link

/start

Copy link

ubiquity-os bot commented Nov 3, 2024

! This issue is already assigned. Please choose another unassigned task.

@surafeldev
Copy link

https://github.com/surafeldev/arbitrage_bot

I made this implementation for this task, let me know if there is any thing I have to consider

@0x4007
Copy link
Member

0x4007 commented Nov 3, 2024

@surafeldev You need to do a pull to your own default branch and link this issue so all of us including the bot can track progress

@surafeldev
Copy link

surafeldev commented Nov 3, 2024

as it is stated in the description I have created a separated Repo for the Bot, Do I need to create a PA from bot repo or this repo ?

@0x4007
Copy link
Member

0x4007 commented Nov 3, 2024

Yes you link this issue

@surafeldev
Copy link

surafeldev commented Nov 4, 2024

am just confused, How can I do that ?

do I need to create separate branch and add the bots repo link with this issue

surafeldev added a commit to surafeldev/ubiquity-dollar that referenced this issue Nov 4, 2024
@surafeldev surafeldev linked a pull request Nov 4, 2024 that will close this issue
@surafeldev
Copy link

#976
take a look at the repo inside the PA

@0x4007
Copy link
Member

0x4007 commented Nov 4, 2024

You're not using our template and you linked this wrong. I'm not optimistic about the success of this deliverable.

@surafeldev
Copy link

surafeldev commented Nov 4, 2024

I'll take a look at the template and rebuild the deliverable alongside it to ensure it meets the project's standards. I appreciate your guidance and will make the necessary adjustments.

@surafeldev
Copy link

I couldn`t find the dollar token in Dex to implement the price feature; where can I find the secondary market API? or should I have to build it by expecting it will be implemented ?

Copy link

ubiquity-os bot commented Nov 12, 2024

Passed the deadline and no activity is detected, removing assignees: @surafeldev.

@henalolp
Copy link

/help

Copy link

ubiquity-os bot commented Nov 12, 2024

Available Commands

Command Description Example
/help List all available commands. /help
/allow Allows the user to modify the given label. /allow @user1 label
/query Returns the user's wallet, access, and multiplier information. /query @ubiquibot
/start Assign yourself to the issue. /start
/stop Unassign yourself from the issue. /stop
/wallet Register your wallet address for payments. /wallet ubq.eth

@henalolp
Copy link

/wallet 0x226AAE6Db84dca652818400750b8BF96a077349e

Copy link

ubiquity-os bot commented Nov 12, 2024

+ Successfully registered wallet address

@kingsley-einstein
Copy link

/start

Copy link

ubiquity-os bot commented Nov 12, 2024

! This task does not reflect a business priority at the moment and cannot be started. This will be reassessed in the coming weeks.

@henalolp
Copy link

/start

1 similar comment
@henalolp
Copy link

/start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants