Skip to content

Commit

Permalink
Merge branch 'main' into chore/update-generated-files
Browse files Browse the repository at this point in the history
  • Loading branch information
leovct committed Jan 14, 2025
2 parents 039db5e + 55b2659 commit b9f466e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
39 changes: 27 additions & 12 deletions cmd/ulxly/ulxly.go
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ var ulxlyBridgeAndClaimCmd = &cobra.Command{
Hidden: true,
}

var ulxlxBridgeCmd = &cobra.Command{
var ulxlyBridgeCmd = &cobra.Command{
Use: "bridge",
Short: "Commands for moving funds and sending messages from one chain to another",
Args: cobra.NoArgs,
Expand All @@ -1200,6 +1200,7 @@ type ulxlyArgs struct {
tokenAddress *string
forceUpdate *bool
callData *string
callDataFile *string
timeout *uint64
depositCount *uint64
depositNetwork *uint64
Expand Down Expand Up @@ -1243,6 +1244,7 @@ const (
ArgDestAddress = "destination-address"
ArgForceUpdate = "force-update-root"
ArgCallData = "call-data"
ArgCallDataFile = "call-data-file"
ArgTimeout = "transaction-receipt-timeout"
ArgDepositCount = "deposit-count"
ArgDepositNetwork = "deposit-network"
Expand Down Expand Up @@ -1283,6 +1285,18 @@ func prepInputs(cmd *cobra.Command, args []string) error {
*inputUlxlyArgs.destAddress = fromAddress.String()
log.Info().Stringer("destAddress", fromAddress).Msg("No destination address specified. Using private key's address")
}

if *inputUlxlyArgs.callDataFile != "" {
rawCallData, err := os.ReadFile(*inputUlxlyArgs.callDataFile)
if err != nil {
return err
}
if *inputUlxlyArgs.callData != "0x" {
return fmt.Errorf("both %s and %s flags were provided", ArgCallData, ArgCallDataFile)
}
stringCallData := string(rawCallData)
inputUlxlyArgs.callData = &stringCallData
}
return nil
}

Expand Down Expand Up @@ -1400,12 +1414,13 @@ or if it's actually an intermediate hash.`,
fatalIfError(ulxlyBridgeAndClaimCmd.MarkPersistentFlagRequired(ArgBridgeAddress))

// bridge specific args
inputUlxlyArgs.forceUpdate = ulxlxBridgeCmd.PersistentFlags().Bool(ArgForceUpdate, true, "indicates if the new global exit root is updated or not")
inputUlxlyArgs.value = ulxlxBridgeCmd.PersistentFlags().String(ArgValue, "", "the amount in wei to be sent along with the transaction")
inputUlxlyArgs.destNetwork = ulxlxBridgeCmd.PersistentFlags().Uint32(ArgDestNetwork, 0, "the rollup id of the destination network")
inputUlxlyArgs.tokenAddress = ulxlxBridgeCmd.PersistentFlags().String(ArgTokenAddress, "0x0000000000000000000000000000000000000000", "the address of an ERC20 token to be used")
inputUlxlyArgs.callData = ulxlxBridgeCmd.PersistentFlags().String(ArgCallData, "0x", "call data to be passed directly with bridge-message or as an ERC20 Permit")
fatalIfError(ulxlxBridgeCmd.MarkPersistentFlagRequired(ArgDestNetwork))
inputUlxlyArgs.forceUpdate = ulxlyBridgeCmd.PersistentFlags().Bool(ArgForceUpdate, true, "indicates if the new global exit root is updated or not")
inputUlxlyArgs.value = ulxlyBridgeCmd.PersistentFlags().String(ArgValue, "", "the amount in wei to be sent along with the transaction")
inputUlxlyArgs.destNetwork = ulxlyBridgeCmd.PersistentFlags().Uint32(ArgDestNetwork, 0, "the rollup id of the destination network")
inputUlxlyArgs.tokenAddress = ulxlyBridgeCmd.PersistentFlags().String(ArgTokenAddress, "0x0000000000000000000000000000000000000000", "the address of an ERC20 token to be used")
inputUlxlyArgs.callData = ulxlyBridgeCmd.PersistentFlags().String(ArgCallData, "0x", "call data to be passed directly with bridge-message or as an ERC20 Permit")
inputUlxlyArgs.callDataFile = ulxlyBridgeCmd.PersistentFlags().String(ArgCallDataFile, "", "a file containing hex encoded call data")
fatalIfError(ulxlyBridgeCmd.MarkPersistentFlagRequired(ArgDestNetwork))

// Claim specific args
inputUlxlyArgs.depositCount = ulxlyClaimCmd.PersistentFlags().Uint64(ArgDepositCount, 0, "the deposit count of the bridge transaction")
Expand Down Expand Up @@ -1443,19 +1458,19 @@ or if it's actually an intermediate hash.`,
ULxLyCmd.AddCommand(proofCommand)
ULxLyCmd.AddCommand(getDepositCommand)

ULxLyCmd.AddCommand(ulxlxBridgeCmd)
ULxLyCmd.AddCommand(ulxlyBridgeCmd)
ULxLyCmd.AddCommand(ulxlyClaimCmd)
ULxLyCmd.AddCommand(claimEverythingCommand)

// Bridge and Claim
ulxlyBridgeAndClaimCmd.AddCommand(ulxlxBridgeCmd)
ulxlyBridgeAndClaimCmd.AddCommand(ulxlyBridgeCmd)
ulxlyBridgeAndClaimCmd.AddCommand(ulxlyClaimCmd)
ulxlyBridgeAndClaimCmd.AddCommand(claimEverythingCommand)

// Bridge
ulxlxBridgeCmd.AddCommand(bridgeAssetCommand)
ulxlxBridgeCmd.AddCommand(bridgeMessageCommand)
ulxlxBridgeCmd.AddCommand(bridgeMessageWETHCommand)
ulxlyBridgeCmd.AddCommand(bridgeAssetCommand)
ulxlyBridgeCmd.AddCommand(bridgeMessageCommand)
ulxlyBridgeCmd.AddCommand(bridgeMessageWETHCommand)

// Claim
ulxlyClaimCmd.AddCommand(claimAssetCommand)
Expand Down
1 change: 1 addition & 0 deletions doc/polycli_ulxly__bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Commands for moving funds and sending messages from one chain to another

```bash
--call-data string call data to be passed directly with bridge-message or as an ERC20 Permit (default "0x")
--call-data-file string a file containing hex encoded call data
--destination-network uint32 the rollup id of the destination network
--force-update-root indicates if the new global exit root is updated or not (default true)
-h, --help help for bridge
Expand Down
1 change: 1 addition & 0 deletions doc/polycli_ulxly__bridge_asset.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ The command also inherits flags from parent commands.
```bash
--bridge-address string the address of the lxly bridge
--call-data string call data to be passed directly with bridge-message or as an ERC20 Permit (default "0x")
--call-data-file string a file containing hex encoded call data
--chain-id string set the chain id to be used in the transaction
--config string config file (default is $HOME/.polygon-cli.yaml)
--destination-address string the address where the bridge will be sent to
Expand Down
1 change: 1 addition & 0 deletions doc/polycli_ulxly__bridge_message.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ The command also inherits flags from parent commands.
```bash
--bridge-address string the address of the lxly bridge
--call-data string call data to be passed directly with bridge-message or as an ERC20 Permit (default "0x")
--call-data-file string a file containing hex encoded call data
--chain-id string set the chain id to be used in the transaction
--config string config file (default is $HOME/.polygon-cli.yaml)
--destination-address string the address where the bridge will be sent to
Expand Down
1 change: 1 addition & 0 deletions doc/polycli_ulxly__bridge_weth.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The command also inherits flags from parent commands.
```bash
--bridge-address string the address of the lxly bridge
--call-data string call data to be passed directly with bridge-message or as an ERC20 Permit (default "0x")
--call-data-file string a file containing hex encoded call data
--chain-id string set the chain id to be used in the transaction
--config string config file (default is $HOME/.polygon-cli.yaml)
--destination-address string the address where the bridge will be sent to
Expand Down

0 comments on commit b9f466e

Please sign in to comment.