Skip to content

Commit

Permalink
fix fees on superOETHb
Browse files Browse the repository at this point in the history
- fix validation issue
  • Loading branch information
apexearth committed Jan 15, 2025
1 parent 1257a8a commit 701d3ec
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 75 deletions.
2 changes: 1 addition & 1 deletion src/templates/otoken/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export async function createRebaseAPY(
}
if (feeOverride) {
// If an override is set, we need to calculate the fee based on the yield.
_fee = (_yield * feeOverride) / (100n - feeOverride)
_fee = (_yield * feeOverride) / 100n
}

if (OUSD_STABLE_OTOKENS.includes(otokenAddress)) {
Expand Down
14 changes: 10 additions & 4 deletions src/validation/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@ import { jsonify } from '@utils/jsonify'
export const compare = (expectation: any, actual: any) => {
// We decide to only care about float decimal accuracy to the 8th.
expectation = JSON.parse(
jsonify(pick(actual, Object.keys(expectation)), (_key, value) =>
jsonify(pick(expectation, Object.keys(expectation)), (_key, value) =>
typeof value === 'number' ? Number(value.toFixed(8)) : value,
),
)
actual = JSON.parse(
jsonify(expectation, (_key, value) => (typeof value === 'number' ? Number(value.toFixed(8)) : value)),
jsonify(pick(actual, Object.keys(expectation)), (_key, value) =>
typeof value === 'number' ? Number(value.toFixed(8)) : value,
),
)
const diff = detailedDiff(expectation, actual)
try {
assert.deepEqual(expectation, actual)
assert(Object.keys(diff.updated).length === 0 && Object.keys(diff.deleted).length === 0)
} catch (err) {
console.log(detailedDiff(expectation, actual))
console.log('Validation failed for:', expectation.id)
console.log('actual', JSON.stringify(actual, null, 2))
console.log('expectation', JSON.stringify(expectation, null, 2))
console.log('diff', JSON.stringify(diff, null, 2))
throw new Error('Expected and actual values do not match')
}
}
Loading

0 comments on commit 701d3ec

Please sign in to comment.