Skip to content
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

Find a nice way to remove this hack from Worker #47

Open
haydenshively opened this issue Aug 24, 2020 · 1 comment
Open

Find a nice way to remove this hack from Worker #47

haydenshively opened this issue Aug 24, 2020 · 1 comment
Labels
architecture Changes that result in better architecture or typing v3

Comments

@haydenshively
Copy link
Owner

// TODO TxManager isn't hooked into the Database logic, so we have
// to pass along the repay and seize addresses here
if (!String(c.ctokenidpay).startsWith("0x")) {
  const repay = `0x${await this._tCTokens.getAddress(c.ctokenidpay)}`;
  this._candidates[i].ctokenidpay = repay;
}
if (!String(c.ctokenidseize).startsWith("0x")) {
  const seize = `0x${await this._tCTokens.getAddress(c.ctokenidseize)}`;
  this._candidates[i].ctokenidseize = seize;
}
@haydenshively
Copy link
Owner Author

Not only is the data structure poor (sticking two differently-typed things into the ctokenidpay and ctokenidseize variables depending on circumstance) but we can also make this more efficient by keeping a mapping from id-> address in memory, rather than asking the database to retrieve it every single time. The mapping would only change when new markets are added or if the database is reset/reinitialized, in which case we'd be restarting the code anyway.

@haydenshively haydenshively added architecture Changes that result in better architecture or typing v3 labels Oct 31, 2020
@haydenshively haydenshively added this to the Christmas Overhaul milestone Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture Changes that result in better architecture or typing v3
Projects
None yet
Development

No branches or pull requests

1 participant