Skip to content

Commit

Permalink
Fix inverse pair handling on shade
Browse files Browse the repository at this point in the history
  • Loading branch information
starsquidnodes committed Jan 26, 2024
1 parent 086f133 commit e865379
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion oracle/provider/shade.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (p *ShadeProvider) Poll() error {
"token_code_hash": "%s"
}
},
"amount":"%d"
"amount": "%d"
},
"exclude_fee": true
}
Expand All @@ -166,6 +166,11 @@ func (p *ShadeProvider) Poll() error {

price := strToDec(response.Simulation.Price)

_, found = p.pairs[pair.String()]
if !found {
price = uintToDec(1).Quo(price)
}

factor, err := computeDecimalsFactor(base.Decimals, quote.Decimals)
if err != nil {
continue
Expand Down Expand Up @@ -261,6 +266,11 @@ func (p *ShadeProvider) init() {
continue
}

_, found := p.pairs[pair.String()]
if !found {
pair = pair.Swap()
}

denoms := []string{
pair.Base,
pair.Quote,
Expand Down

0 comments on commit e865379

Please sign in to comment.