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

feat(across): Add Setter for LP Fee %/second in BridgePool #3622

Merged
merged 6 commits into from Nov 18, 2021

Conversation

nicholaspai
Copy link
Member

Motivation

This rate is not easy to set and forget and should be configurable by Bridge admin.

Testing

Check a box to describe how you tested these changes and list the steps for reviewers to test.

  • Ran end-to-end test, running the code as in production
  • New unit tests created
  • Existing tests adequate, no new tests required
  • All existing tests pass
  • Untested

@nicholaspai nicholaspai added the insured-bridge Optimism-Ethereum insured bridge contracts label Nov 17, 2021
* @param _newLpFeeRatePerSecond The new rate to set.
*/
function changeLpFeeRatePerSecond(uint64 _newLpFeeRatePerSecond) public override nonReentrant() {
require(msg.sender == address(bridgeAdmin));
Copy link
Member

Choose a reason for hiding this comment

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

nit: should we make this a modifier?
nit: this should have a require message?
nit: should the natspec say only the admin can call this?

Copy link
Member Author

Choose a reason for hiding this comment

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

nit: should we make this a modifier?

yeah, slightly improves readability let's do that.

nit: this should have a require message?

It definitely should have a require message, will add.

nit: should the natspec say only the admin can call this?

Will add

Copy link
Member

@chrismaree chrismaree left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@mrice32 mrice32 left a comment

Choose a reason for hiding this comment

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

LGTM!

*/
function changeLpFeeRatePerSecond(uint64 _newLpFeeRatePerSecond) public override onlyBridgeAdmin() nonReentrant() {
lpFeeRatePerSecond = _newLpFeeRatePerSecond;
emit LpFeeRateChanged(lpFeeRatePerSecond);
Copy link
Member

Choose a reason for hiding this comment

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

Do you think it'd be useful to include the old LP fee rate in this event?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really because all historical LP fee rates are captured by this event, since its also emitted in the constructor.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you?

Copy link
Member

@mrice32 mrice32 Nov 18, 2021

Choose a reason for hiding this comment

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

I think it's fine the way it is. When digging through events in the past, I remember wanting this info (for instance, in the store), but I think this is fine, as you can always find the event before if you need to as you said.

Copy link
Member

@mrice32 mrice32 left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -130,6 +130,11 @@ contract BridgeAdmin is BridgeAdminInterface, Ownable, Lockable {
emit BridgePoolsAdminTransferred(bridgePools, newAdmin);
}

function changeLpFeeRatePerSecond(address bridgePool, uint64 newLpFeeRate) public onlyOwner nonReentrant() {
Copy link
Member

Choose a reason for hiding this comment

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

nit: NatSpec

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed

@nicholaspai nicholaspai merged commit 76be217 into master Nov 18, 2021
dmitry-vsl pushed a commit to unisxapp/protocol that referenced this pull request Dec 28, 2021
…ol#3622)

* feat(across): Add Setter for LP Fee %/second in BridgePool

* Update BridgePool.sol

* Add natspec comments

* Change name from Change to Set

* Update BridgePool.sol

Signed-off-by: Dmitry Vasilev <dmitry.vasil@gmail.com>
@chrismaree chrismaree deleted the npai/bridge-admin-lp-fee-rate-setter branch December 19, 2022 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
insured-bridge Optimism-Ethereum insured bridge contracts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants