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

multi: USDC Bridge between eth and polygon #2797

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martonp
Copy link
Contributor

@martonp martonp commented Jun 3, 2024

Implements the CCTP protocol to bridge native USDC between eth and polygon.

This will be used to support running market making bots doing rebalances between the local wallet and a centralized exchange when the exchange does not support withdrawing USDC to Polygon. Binance supports neither deposits nor withdrawals to Polygon. Coinbase (coming soon) supports deposits, but not withdrawals.

Implements the CCTP protocol to bridge native USDC between eth and polygon.
Comment on lines +1317 to +1319
fmt.Println("~~~~~~", tokenCfg.AssetID, usdcEthID, usdcPolygonID)
if tokenCfg.AssetID == usdcEthID || tokenCfg.AssetID == usdcPolygonID {
fmt.Println("returning bridge wallet")
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to leave in these prints? Can trace log?

Comment on lines 673 to +674

type Bridger interface {
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment for Bridger.

value (int): The amount of tokens to bridge.
burnTxID (string): The transaction ID of the burn transaction. Returned from the burn command.
mintInfo (string): The information needed to mint tokens. Returned from the getmintinfo command.`,
},
Copy link
Member

Choose a reason for hiding this comment

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

Can you add returns? Whats 2?

$ ./bwctl -p abc -p "" --testnet bridge checkbridgeapproval 60001
2

return createResponse(bridgeRoute, approvalStatus, nil)
}

func handleApproveBridge(s *RPCServer, params *RawParams) *msgjson.ResponsePayload {
Copy link
Member

Choose a reason for hiding this comment

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

Could also unlock the wallet in this method if locked by requiring password params. It looks like we haven't been doing that though, so feel free to ignore.

Comment on lines +1269 to +1271
if len(params.Args) != 2 {
return usage(bridgeRoute, fmt.Errorf("expected 1 args, got %d", len(params.Args)))
}
Copy link
Member

@JoeGruffins JoeGruffins Jun 14, 2024

Choose a reason for hiding this comment

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

$ ./bwctl -p abc -p "" --testnet bridge getmintinfo ed90645fc6058b27e11c71060b0b55d5f55db55f7365610359c6f5768f4cffd5
expected 1 args, got 1

@JoeGruffins
Copy link
Member

I guess it would be bad to lose the txids between burn and mint. Need to log them alot and also save in a db somewhere at some point?

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.

2 participants