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

Axelar Relayer 1st version #5

Merged
merged 44 commits into from
Jun 18, 2024
Merged

Axelar Relayer 1st version #5

merged 44 commits into from
Jun 18, 2024

Conversation

raress96
Copy link
Collaborator

@raress96 raress96 commented Jan 8, 2024

This supports:

  1. MultiversX -> Other chain cross chain transactions
    • Events Notifier used to listen for CGP Gateway contract events
    • store data in the database
    • submits data to Axelar Amplifier gRPC (WIP, real API not available yet)
    • also processes gas service events and saves them in the database (nothing else done regarding gas at the moment, gas won't be handled for 1st version)
    • NOTE: still need to process express gas service events (out of scope currently)
  2. MultiversX contract calls
    • uses Events Notifier to handle approve contract calls events from CGP Gateway
    • the respective transaction is executed on MultiversX and retried up to 3 times if it fails
    • payload is retrieved from Axelar Amplifier gRPC (WIP)
  3. Other chain -> MultiversX cross chain transactions
    • listens to CosmWASM contract events using Axelar Amplifier gRPC (WIP)
    • executes transaction on MultiversX (calls CGP Gateway contract)
  4. Gas monitoring
    • checks the Gas Service contract and claims funds if above a certain threshold
    • checks the wallet used to execute transactions that is has enough gas, if not it raises an alert
    • NOTE: The relayer wallet is the same account that can interact with the Gas Service

For reference:
https://docs.axelar.dev/learn/network/flow
https://github.com/buidly/sc-axelar-cgp-rs/blob/develop/gateway/README.md

raress96 and others added 30 commits December 5, 2023 16:45
…r and axelar event processor and add prisma.
Process gateway call contract event and save data into database.
Collect gas service fees & check wallet balance cron
Process axelar chain events & trigger gateway execute transaction
Process contract call approved event & send MultiversX transactions

const txHash = await this.transactionsHelper.signAndSendTransaction(transaction, this.walletSigner);

await this.redisCacheService.set<PendingTransaction>(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just nitpicking and maybe overthinking it, but what happens if Redis crashes and the transaction went through? - or what happens if we execute multiple times with the same executeData?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is safe to re-execute a transaction since the contract keeps track internally of which commands are executed. We use Redis to retry the transaction in case it fails since I found this to be the easiest way.

Theoretically the executeData received will lead to a successful transaction, the only reason this can fail is because of out of gas in case transaction/cost api does not work properly, hence the increasing gas costs for each retry.

@raress96 raress96 requested a review from ccorcoveanu April 11, 2024 11:54
@raress96 raress96 merged commit ec754d5 into main Jun 18, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants