Skip to content

Commit

Permalink
exchange rate labeling updates (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimalinux authored Jun 25, 2023
1 parent 9c4801c commit 485d133
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/swapcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func cliApp() *cli.App {
},
&cli.StringFlag{
Name: flagExchangeRate,
Usage: "Desired exchange rate of XMR:ETH, eg. --exchange-rate=0.1 means 10XMR = 1ETH",
Usage: "Desired exchange rate of XMR/ETH, eg. --exchange-rate=0.08 means 1 XMR = 0.08 ETH",
Required: true,
},
&cli.BoolFlag{
Expand Down Expand Up @@ -853,7 +853,7 @@ func runGetOngoingSwap(ctx *cli.Context) error {
fmt.Printf("Start time: %s\n", info.StartTime.Format(common.TimeFmtSecs))
fmt.Printf("Provided: %s %s\n", info.ProvidedAmount.Text('f'), providedCoin)
fmt.Printf("Receiving: %s %s\n", info.ExpectedAmount.Text('f'), receivedCoin)
fmt.Printf("Exchange Rate: %s ETH/XMR\n", info.ExchangeRate)
fmt.Printf("Exchange Rate: %s XMR/ETH\n", info.ExchangeRate)
fmt.Printf("Status: %s\n", info.Status)
fmt.Printf("Time status was last updated: %s\n", info.LastStatusUpdateTime.Format(common.TimeFmtSecs))
if info.Timeout1 != nil && info.Timeout2 != nil {
Expand Down Expand Up @@ -925,7 +925,7 @@ func runGetPastSwap(ctx *cli.Context) error {
)
}
fmt.Printf("\n")
fmt.Printf("Exchange Rate: %s ETH/XMR\n", info.ExchangeRate)
fmt.Printf("Exchange Rate: %s XMR/ETH\n", info.ExchangeRate)
fmt.Printf("Status: %s\n", info.Status)
}

Expand Down
6 changes: 6 additions & 0 deletions pricefeed/pricefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ func GetXMRUSDPrice(ctx context.Context, ec *ethclient.Client) (*PriceFeed, erro
return nil, err
}

// Temporary hack to return a better error until the issue is resolved.
switch chainID.Uint64() {
case common.MainnetChainID, common.SepoliaChainID:
return nil, errors.New("https://github.com/AthanorLabs/atomic-swap/issues/492")
}

switch chainID.Uint64() {
case common.MainnetChainID:
// No extra work to do
Expand Down
1 change: 1 addition & 0 deletions pricefeed/pricefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestGetETHUSDPrice_dev(t *testing.T) {
}

func TestGetXMRUSDPrice_mainnet(t *testing.T) {
t.Skip("Chainlink XMR price feed is down: https://github.com/AthanorLabs/atomic-swap/issues/492")
ec := tests.NewEthMainnetClient(t)

feed, err := GetXMRUSDPrice(context.Background(), ec)
Expand Down

0 comments on commit 485d133

Please sign in to comment.