Skip to content

Conversation

@0xfirefist
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Feb 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated
example-oracle-amm ⬜️ Ignored (Inspect) Feb 24, 2023 at 6:04PM (UTC)
xc-admin-frontend ⬜️ Ignored (Inspect) Feb 24, 2023 at 6:04PM (UTC)


const argv = yargs(hideBin(process.argv))
.option("evm-endpoint", {
.option("network", {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update the readme with this new configs and values? You would need to update the compose files too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this file is final yet.
I have added the code to it just so that injective pieces are working fine.
I will refactor this file too and then will update the README

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

command line options will be annoying as the configuration becomes more complicated. I suggest moving this stuff to a config file. I note that there's already a price config file, so maybe it goes in there.

"jest": "^27.5.1",
"prettier": "^2.6.2",
"ts-jest": "^27.1.4",
"typescript": "^4.6.3"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to bump version as major for this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will send a pr with readme and version changes. which will be the final one after refactoring.

const priceConfigs = readPriceConfigFile(argv.priceConfigFile);

async function run() {
async function injectiveRun() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: I think injective and evm can have the same run function (or use a common function for running controller, ...) as many things are similar in your code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned above
will clean this file in separate PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI if you want to do this stuff in a separate PR, i suggest leaving a code comment like

// FIXME: unify with evmRun() below once the interfaces are figured out.

then people will understand what you're trying to do when reading the PR and won't leave comments about it

};

// this use price without leading 0x
export class InjectivePriceListener implements PriceListener {
Copy link
Collaborator

@ali-behjati ali-behjati Feb 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this is very similar to EVM. Maybe it's good to extract common identical methods (that will be the same for other networks too) to PriceListener.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree with this. i think the latestPriceInfo / update / get methods could be moved up to priceListener

I wouldn't move the pollPrices method even though it is very similar to the evm method, as you want to give implementations the flexibility to implement the reading logic in different ways.

Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome. I really appreciate that you are improving the quality of this code. I left some comments and will approve once you address them.

Copy link
Contributor

@jayantk jayantk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think extracting common methods like @ali-bahjati says is a good thing to do. If ali is happy, then I am; no need to wait for me to approve.

};

// this use price without leading 0x
export class InjectivePriceListener implements PriceListener {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree with this. i think the latestPriceInfo / update / get methods could be moved up to priceListener

I wouldn't move the pollPrices method even though it is very similar to the evm method, as you want to give implementations the flexibility to implement the reading logic in different ways.

const priceConfigs = readPriceConfigFile(argv.priceConfigFile);

async function run() {
async function injectiveRun() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI if you want to do this stuff in a separate PR, i suggest leaving a code comment like

// FIXME: unify with evmRun() below once the interfaces are figured out.

then people will understand what you're trying to do when reading the PR and won't leave comments about it

@0xfirefist 0xfirefist merged commit fd0257d into main Feb 24, 2023
@0xfirefist 0xfirefist deleted the add-injective-listener branch February 24, 2023 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants