-
Notifications
You must be signed in to change notification settings - Fork 40
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
Contract redesign #931
base: main
Are you sure you want to change the base?
Contract redesign #931
Conversation
/// @notice Checks if the component is bootstrapped | ||
function bootstrapped() external view returns(bool); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is better placed in a Lifecycle facet and generalized as a stage()
method that returns the lifecycle stage of a subnet.
contracts/src/interfaces/ISubnet.sol
Outdated
/// @title Subnet interface | ||
interface ISubnet { | ||
/// @notice Checks if the subnet is now bootstrapped | ||
function bootstrapped() external view returns(bool); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate on what responsibility/scope this interface would hold going forward?
/// @notice Deposit into the genesis balance of the address | ||
function deposit(SubnetGenesis storage self, address addr, uint256 amount) internal { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This OOP-style pattern is nice, since LibSubnetGenesis
can be associated with the SubnetGenesis
type via using
to write code like this:
using LibSubnetGenesis for SubnetGenesis;
genesis.deposit(addr, amount);
if (exists) { | ||
self.balances.set(addr, existingAmount + amount); | ||
} else { | ||
self.balances.set(addr, amount); | ||
} | ||
|
||
self.circSupply += amount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified by doing the addition to circSupply sooner, and using an early return in the if. But it's probably clearer this way.
@@ -6,3 +6,7 @@ pragma solidity ^0.8.23; | |||
enum ConsensusType { | |||
Fendermint | |||
} | |||
|
|||
enum Consensus { | |||
ProofOfPower |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is ProofOfPower?
Initial POC for contract redesign. Refer to
contract-redesign.md
for the high level idea and please comment.This PR partially implements the ideas:
LibStaking
toLibPowerChange
that usepower
to replacecollateral
andfederatedPower
. The caller facet can decide whatpower
is