-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Liquidity Manager #66
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed. Left most as comments. Would like you to also structure the liquidity folder the way the rest of the project is, particularly the bullmq/queue/processor objects should be outside that dir. also you need to add tests for all your services and logic
case TokenState.SURPLUS: | ||
return balance.current - balance.target | ||
case TokenState.DEFICIT: | ||
return balance.target - balance.current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would Math.abs() work better here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those values are BigInts and Math.abs
doesn't support them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, didnt know that, can add a util like
export class Mathb {
static abs(x: bigint): bigint {
return x < 0 ? -x : x;
}
}
...iquidity-manager/services/liquidity-providers/LiFi/providers/evm/custom-evm-step-executor.ts
Outdated
Show resolved
Hide resolved
import { TokenBalance, TokenConfig } from '@/balance/types' | ||
import * as LiFi from '@lifi/sdk' | ||
|
||
type TokenState = 'DEFICIT' | 'SURPLUS' | 'IN_RANGE' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u define this as an enum src/liquidity-manager/types/token-state.enum.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, enums couldn't be used from type definition files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cant you define the type from the enum like so:
type TokenStateType = keyof typeof TokenState
that way you dont duplicate keys and risk forgetting to update both in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that'd be an issue, if an item in the enum doesn't match the TokenState type TypeScript will return an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea but y have 2 places where u need to update?
refactoring code and mongo record for new AUDIT protocol
src/transaction/smart-wallets/kernel/kernel-account-client-v2.service.ts
Show resolved
Hide resolved
* move bigint conversion * disabling storage prover from being accepted by solver
* move bigint conversion * disabling storage prover from being accepted by solver * add sameChainFulfill check to validate intent
* move bigint conversion * disabling storage prover from being accepted by solver * updating routes-ts to ~0.2.10-beta update only on patch
* move bigint conversion * moving watch services into own module. adding watch fulfill intent service * creating watch fulfillment event * refactoring watch create intent to use same abstract parent * adding tests for watch fulfillment adding inbox processor adding intent utils method for update - > needs more work and tests * adding default intervals, intentconfigs, and liquiditymanager to config defaults.ts removing eventemitter from app modules adding interval modeule and service adding interval processor and queue adding retry_intent to source intent queue * adding skeleton of retry infeasable * disabling storage prover from being accepted by solver * updating routes-ts to ~0.2.10-beta update only on patch * fixing merge * adding retry infeasable intents tests
No description provided.