Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Conversation

@felix2feng
Copy link
Contributor

@felix2feng felix2feng commented Oct 25, 2018

Completes this card.

Add new functions: addPriceLibrary and removePriceLibrary so that only approved price libraries can be used.

@felix2feng felix2feng requested review from asoong and bweick October 25, 2018 15:30
@felix2feng felix2feng changed the title Felix/add price lib tracking Add price lib tracking in Core Oct 25, 2018
@coveralls
Copy link

coveralls commented Oct 25, 2018

Pull Request Test Coverage Report for Build 2373

  • 6 of 6 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 2292: 0.0%
Covered Lines: 570
Relevant Lines: 570

💛 - Coveralls

*
* @param _priceLibrary The address of the Price Library to disable
*/
function disablePriceLibrary(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we also need a disable method? Can we instead have one setter method where we set whether a price library is enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could. I was just following the pattern we already have in place.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it doesn't make sense to have two methods, lets add a card to get the other ones changed as well (also making disableSet bi directional). I'm also not sure we need the array and the map.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you make the changes for price library for this PR? No point merging this in and changing it later

*
* @param _priceLibrary The address of the PriceLibrary to enable/disable
*/
function setPriceLibrary(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we exposing this/other setters again? Not sure we ever need to expose the owner-only setters. I think this adds to the runtime gas cost by having them all in a single core interface. @bweick, we should do an exercise on that and confirm. If true, we should definitely have logic specific interfaces that expose 1-2 methods at a time.

*
* @param _priceLibrary The address of the Price Library to enable or disable
*/
function setPriceLibrary(
Copy link
Contributor

Choose a reason for hiding this comment

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

setPriceLibraryValid(address _priceLibrary, boolean _valid) or setPriceLibraryEnabled(address _priceLibrary, boolean _enabled)?

// Mark as true or false in validPriceLibraries mapping
state.validPriceLibraries[_priceLibrary] = !state.validPriceLibraries[_priceLibrary];

if (state.validPriceLibraries[_priceLibrary]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Then you can save on a lot of lookups here, not that this is a function we're going to be calling often.

onlyOwner
{
// Mark as true or false in validPriceLibraries mapping
state.validPriceLibraries[_priceLibrary] = !state.validPriceLibraries[_priceLibrary];
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, a ton of lookups there. I'll be using one of the interfaces above for the other methods.

@asoong asoong self-requested a review October 28, 2018 18:14
@asoong asoong merged commit e727740 into master Oct 28, 2018
@asoong asoong deleted the felix/add-price-lib-tracking branch October 28, 2018 18:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants