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

[Proxy colonies M3] feat: simple payments cross chain #4207

Open
wants to merge 1 commit into
base: feat/M3-proxy-colonies
Choose a base branch
from

Conversation

bassgeta
Copy link
Contributor

@bassgeta bassgeta commented Jan 29, 2025

Description

This PR adds rudimentary functionality for making a simple payment cross chain.
There is no form validation for balances here, so don't test that!
Additionally, don't try to pay out from domains other than General for now :') We'll iron that out in a separate PR.

Block ingestor PR

Testing

Prerequisites

  1. Import leela's account into Metamask (gimme a shout if you need help with it).
  2. Add the Ganache 2 network and switch to it (RPC URL: https://localhost:8546)
    image

Don't login as this user, you can login with Dev wallet 1, we'll just use this wallet to send funds to the proxy colony!

  1. Run your dev env and the create data script

  2. Deploy a new proxy colony on Local proxy chain 1
    image
    image

  3. Now when it's deployed send over 1 ETH to the proxy colony. Copy the colony address and send over some funds via metamask
    image

  4. Go to the incoming funds page and refresh it. You should see some incoming ETH on chain 265669101! Accept it and go back to the dashboard.
    image

  5. Open up the simple payment form. Verify that when on Ganache we don't get 2 ETH tokens in the token dropdown:
    image

  6. When choosing a different chain it should choose that chain's ETH token automatically.
    image

  7. When going back to Ganache ETH stays (for now, we'll change that if need be).
    image

  8. Anyhow let's test ordinary simple payments. Pay a user 4 of your colony's token on Ganache and verify that the balance is updated and everything still works.
    image
    image

  9. Run the following query and confirm that it has no multichain info.

query MyQuery {
  getColonyAction(
    id: "<TX_HASH>"
  ) {
    type
    tokenAddress
    targetChainId
    multiChainInfoId
    multiChainInfo {
      id
      completedOnProxyChain
      completedOnMainChain
      wormholeInfo {
        emitterAddress
        emitterChainId
        sequence
      }
    }
    token {
      name
    }
    amount
  }
}

image
6. Check that you balance is updated 👁️
image
7. Now it's time to cross chains! Create a simple payment paying out somebody 0.03 ETH on Local proxy chain 1. Verify that the completed action view shows the ETH token (fixed that bug didn't we 😎 ). Verify that the chain badge shows up.
image
image
8. Run the query above and verify that it has multichain info 👁️
image

This should be it! This should unblock work on motions, versioning and everything else, so if you spot smaller issues, lemme know and we'll probably tackle them on a separate issue.

Diffs

New stuff

  • Chain selector on simple payment action
  • block-ingestor OneTxPayment handler is now versioned
  • if a simple payment isn't done on the main chain, we treat it as a cross-chain action

Changes 🏗

  • The token select dropdown now filters tokens per chain
  • The simple payment saga now uses new contracts and does all payments with a chainId
  • FIxed ETH lookup on the completed action screen
  • Updated the PayoutClaimed events on the block-ingestor to include chainId
  • unified multichain info syncing on the block-ingestor

Resolves #4189

@bassgeta bassgeta self-assigned this Jan 29, 2025
@bassgeta bassgeta changed the base branch from master to feat/M2-proxy-colonies January 29, 2025 15:12
@bassgeta bassgeta force-pushed the feat/4189-simple-payment-proxies branch from 871d5ec to 56e68f4 Compare January 30, 2025 11:18
@bassgeta bassgeta changed the base branch from feat/M2-proxy-colonies to feat/M3-proxy-colonies January 30, 2025 12:04
@bassgeta bassgeta force-pushed the feat/4189-simple-payment-proxies branch 2 times, most recently from cb84e2e to 83a4a20 Compare January 31, 2025 11:21
@bassgeta bassgeta force-pushed the feat/M3-proxy-colonies branch from 74294ad to af57d65 Compare January 31, 2025 15:32
@bassgeta bassgeta force-pushed the feat/4189-simple-payment-proxies branch 2 times, most recently from d7f8a9c to 59c55b0 Compare February 3, 2025 15:41
@bassgeta bassgeta force-pushed the feat/4189-simple-payment-proxies branch from 59c55b0 to e7f942b Compare February 4, 2025 11:20
@bassgeta bassgeta marked this pull request as ready for review February 4, 2025 14:56
@bassgeta bassgeta requested a review from a team as a code owner February 4, 2025 14:56
@bassgeta bassgeta force-pushed the feat/4189-simple-payment-proxies branch from e7f942b to 3cc865c Compare February 4, 2025 14:57
Copy link
Member

@rdig rdig left a comment

Choose a reason for hiding this comment

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

Massive amount of work!!1

Very nice! 💯

Tested and everything just works flawlessly

Screenshot from 2025-02-04 23-55-53
Screenshot from 2025-02-04 23-56-54
Screenshot from 2025-02-04 23-58-21
Screenshot from 2025-02-04 23-58-39
Screenshot from 2025-02-04 23-59-21
Screenshot from 2025-02-04 23-59-29

Copy link
Contributor

@mmioana mmioana left a comment

Choose a reason for hiding this comment

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

This is such a great feature @bassgeta that you unlocked for the new proxy colonies milestone 🎉

Tested everything and it works perfectly 💯

Deployed a proxy colony
Screenshot 2025-02-05 at 10 29 05

Transferred 1 ETH to the proxy chain and accepted the incoming funds
Screenshot 2025-02-05 at 10 32 49

The chain dropdown included the current chain and the active proxy chain
Screenshot 2025-02-05 at 10 33 39

The tokens list updates properly based on the selected chain
Screenshot 2025-02-05 at 10 34 02
Screenshot 2025-02-05 at 10 34 11

Tested a Simple payment on the main chain
Screenshot 2025-02-05 at 10 35 21
Screenshot 2025-02-05 at 10 35 52
Screenshot 2025-02-05 at 10 36 22

And a Simple payment on the proxy chain
Screenshot 2025-02-05 at 10 37 09
Screenshot 2025-02-05 at 10 37 28

And everything is working perfectly 💯 Great job!

});

const filterFn = ({ value: chainId }: SearchSelectOption<IconOption>) => {
// remove the default chain from the select
Copy link
Contributor

Choose a reason for hiding this comment

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

I think here we should change the comment to keep the default chain in the select

@bassgeta bassgeta force-pushed the feat/4189-simple-payment-proxies branch from 3cc865c to 6fb858c Compare February 5, 2025 10:50
@bassgeta bassgeta force-pushed the feat/4189-simple-payment-proxies branch from 6fb858c to 80b78e2 Compare February 5, 2025 13:05
Copy link
Contributor

@davecreaser davecreaser left a comment

Choose a reason for hiding this comment

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

Very nice @bassgeta! Huge feature, really cool to see it working 📈

Tested following the steps and it all worked perfectly:

Screenshot 2025-02-05 at 14 41 09 Screenshot 2025-02-05 at 14 42 06 Screenshot 2025-02-05 at 14 42 54 Screenshot 2025-02-05 at 14 43 40 Screenshot 2025-02-05 at 14 43 52 Screenshot 2025-02-05 at 15 00 45 Screenshot 2025-02-05 at 15 01 36 Screenshot 2025-02-05 at 15 02 08 Screenshot 2025-02-05 at 15 03 39 Screenshot 2025-02-05 at 15 04 08

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.

4 participants