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

Configurator code skeleton #12

Closed
wants to merge 12 commits into from
Closed

Configurator code skeleton #12

wants to merge 12 commits into from

Conversation

toninorair
Copy link
Contributor

@toninorair toninorair commented Dec 1, 2021

  1. Add immutable admin to OZ standard transparent upgradeable proxy contracts, this commit b28e823
  2. Implement config contract with 2 immutable fields
  3. Add mock protocol contract with upgradable config
  4. Test upgrade with hardhat script config-script.ts

@toninorair toninorair changed the title Toni/configurator Configurator Dec 1, 2021
@toninorair toninorair changed the title Configurator Configurator code skeleton Dec 1, 2021
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
Copy link
Contributor

Choose a reason for hiding this comment

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

can we delete the AdminChanged event?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

definitely, good catch

Copy link
Contributor

Choose a reason for hiding this comment

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

removed 👍

@toninorair toninorair requested a review from hayesgm December 1, 2021 18:47
@@ -4,19 +4,19 @@

"@cspotcode/source-map-consumer@0.8.0":
version "0.8.0"
resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b"
resolved "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz"
Copy link
Contributor

@scott-silver scott-silver Dec 1, 2021

Choose a reason for hiding this comment

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

Just noticed these changes to yarn.lock; did you intend to include this in the PR?

@toninorair toninorair requested a review from jflatow December 2, 2021 19:02
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 Does this mean everything vendored needs to have the same license?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure it's in the scope of this task, but definitely great question for license discussion

Copy link
Contributor

Choose a reason for hiding this comment

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

Nah, you're just following the rules of the MIT license, which is to retain it and nothing else. You can include this within any other license of code (including commercial only or unlicensed)


// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder can't we just use top-level await now with the version of node we are on?


import "./Config.sol";

contract ConfigFactory {
Copy link
Contributor

Choose a reason for hiding this comment

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

ProtocolFactory

@@ -0,0 +1,11 @@
pragma solidity ^0.8.0;

contract Config {
Copy link
Contributor

Choose a reason for hiding this comment

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

Configurator


event Values(uint targetReserves, uint borrowMin);

constructor(address config_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

uint alpha_, uint beta_, uint gramma_

}

contract Protocol {
ConfigInterface immutable config;
Copy link
Contributor

Choose a reason for hiding this comment

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

uint immutable alpha;
...


event NewConfig(address newConfig);

function createConfig(uint targetReserves, uint borrowMin) external returns (address) {
Copy link
Contributor

Choose a reason for hiding this comment

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

createProtocol()

Copy link
Contributor

Choose a reason for hiding this comment

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

new Protocol(config.targetReserves, config.borrowMin, ...)

pragma solidity ^0.8.0;

contract Config {
uint immutable public targetReserves;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe these aren't immutable. and instead we have a "setTargetReserves()" function here.


event NewProtocol(address newProtocol);

Configurator immutable configurator;
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit curious if this should just be inlined?

@hayesgm
Copy link
Contributor

hayesgm commented Mar 31, 2022

Closing in lieu of #160

@hayesgm hayesgm closed this Mar 31, 2022
@jflatow jflatow deleted the toni/configurator branch May 26, 2022 05:02
dmitriy-woof-software referenced this pull request in woof-software/comet Apr 10, 2024
* Preliminary CometRewardsV2 functionality with MerkleProof

* feat: restructorized contract storage, fixed all compilaion errors

* fix: multiple assets compaign

* fix: compaigns functionality

* feat: Add finishAccrued and startAccrued bug fix (#5)

* feat: claimed calculation fix

* feat: claimed calculation fix

* feat: add CometRewards V1 interaction

* wip: tests and new contract version

* wip: contract update with more tests

* wip: new contract update and revert changes to CometRewards

* wip: cover most of the contract and fix some bugs

* wip: coverage improvement

* feat: complited contract changes and test coverage

* feat: remove package-lock

* feat: set yarn file to the main branch version

* feat: update yarn file
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