Skip to content

Commit

Permalink
Merge branch 'release-ghostnet-beta' into 410-further-split-out-batch…
Browse files Browse the repository at this point in the history
…er-and-mm-contracts-to-avoid-size-constraint
  • Loading branch information
glottologist committed Nov 27, 2023
2 parents 8ba5dec + c76897d commit 5b405b4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion batcher-ui/src/commands/exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ const fetchOraclePriceCmd = (
console.info('Rates', rates);
const rate = rates[0];
const tokensMapped = ensureMapTypeOnTokens(tokens);
console.info('Tokens', tokensMapped);
const to = tokensMapped.get(rate.swap.to);
const from = tokensMapped.get(rate.swap.from);
return computeOraclePrice(rate.rate, {
Expand Down
3 changes: 3 additions & 0 deletions batcher-ui/src/components/batcher/SelectPair.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ const SelectPair = ({ isFrom }: SelectPairProps) => {
};

useEffect(() => {

const mappedSwaps = ensureMapTypeOnSwaps(swaps);
const mappedDisplayTokens = ensureMapTypeOnDisplayTokens(displayTokens);
const swapPairs = Array.from(mappedSwaps).map(([k, v]) => {
const to = mappedDisplayTokens.get(v.swap.to);
const from = mappedDisplayTokens.get(v.swap.from);

let ds: DisplaySwap = {
pair: k,
to: to || emptyDisplayToken(),
Expand All @@ -64,6 +66,7 @@ const SelectPair = ({ isFrom }: SelectPairProps) => {
}, [dispatch, swaps, displayTokens]);



const displayValue = useCallback(() => {
if (isReverse && isFrom) return swap.to?.name;
if (isReverse && !isFrom) return swap.from?.name;
Expand Down
1 change: 1 addition & 0 deletions batcher-ui/src/utils/token-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export const getPairsInformation = async (
const storage = await getTokenManagerStorage();
const validTokens = storage['valid_tokens'];
const pairs = pair.split('-');

if (!pairs) {
console.trace();
}
Expand Down
2 changes: 2 additions & 0 deletions batcher-ui/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ export const ensureMapTypeOnDisplayTokens = (
Object.values(displayTokens).forEach(v => {
console.info('v', v);
const dt = v as unknown as DisplayToken;

console.info('dt', dt);
dsp.set(dt.name, dt);
});
Expand Down Expand Up @@ -462,6 +463,7 @@ export const computeOraclePrice = (
console.info('#### Oracle Rate ######', rate);
console.info('#### Buy Decimals ######', buyDecimals);
console.info('#### Sell Decimals ######', sellDecimals);

const scaledPow = sellDecimals - buyDecimals;
return scaleAmountUp(numerator / denominator, scaledPow);
};
Expand Down

0 comments on commit 5b405b4

Please sign in to comment.