Skip to content

Commit

Permalink
Fix/bitmap (#600)
Browse files Browse the repository at this point in the history
* fix: bitmap

* fix: id not zero based
  • Loading branch information
grothem authored Oct 24, 2024
1 parent b9eef23 commit a46aa13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ export class UiPoolDataProvider implements UiPoolDataProviderInterface {
collateralBitmap: eMode.eMode.collateralBitmap
.toBigInt()
.toString(2)
.padEnd(256, '0'),
.padStart(256, '0'),
label: eMode.eMode.label,
borrowableBitmap: eMode.eMode.borrowableBitmap
.toBigInt()
.toString(2)
.padEnd(256, '0'),
.padStart(256, '0'),
},
}));
}
Expand Down
7 changes: 5 additions & 2 deletions packages/math-utils/src/formatters/emode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ export function getReservesEModes(
eModes: EModeData[],
): ReserveEMode[] {
return eModes.reduce<ReserveEMode[]>((acc, eMode) => {
const borrowingEnabled = eMode.eMode.borrowableBitmap[reserveId] === '1';
const collateralEnabled = eMode.eMode.collateralBitmap[reserveId] === '1';
const { borrowableBitmap, collateralBitmap } = eMode.eMode;
const borrowingEnabled =
borrowableBitmap[borrowableBitmap.length - reserveId - 1] === '1';
const collateralEnabled =
collateralBitmap[collateralBitmap.length - reserveId - 1] === '1';
if (borrowingEnabled || collateralEnabled) {
acc.push({
id: eMode.id,
Expand Down

0 comments on commit a46aa13

Please sign in to comment.