Skip to content

Commit

Permalink
feat: update points children
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoAcosta committed Nov 5, 2024
1 parent 3581f8d commit 73d1097
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
10 changes: 8 additions & 2 deletions src/points/FollowerSincePoints.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ contract FollowerSincePoints is IFollowerSincePoints, Points {
/// @param _followerStamp Address of the IFollowerSinceStamp contract
/// @param _name Name of the token
/// @param _symbol Symbol of the token
constructor(address _followerStamp, string memory _name, string memory _symbol) Points(_name, _symbol, 18) {
/// @param _plasaContract Address of the Plasa contract
constructor(
address _followerStamp,
string memory _name,
string memory _symbol,
address _plasaContract
) Points(_name, _symbol, 18, _plasaContract) {
followerStamp = IFollowerSinceStamp(_followerStamp);
}

Expand Down Expand Up @@ -93,7 +99,7 @@ contract FollowerSincePoints is IFollowerSincePoints, Points {
uint256 balance = _balanceAtTimestamp(owner, currentTimestamp);

if (balance > 0) {
holders[actualHolderCount] = Holder({ user: owner, balance: balance });
holders[actualHolderCount] = Holder({ user: owner, name: _getUsername(owner), balance: balance });
unchecked {
++actualHolderCount;
}
Expand Down
11 changes: 8 additions & 3 deletions src/points/MultipleFollowerSincePoints.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ contract MultipleFollowerSincePoints is Points, IMultipleFollowerSincePoints {
address[] memory _stampAddresses,
uint256[] memory _multipliers,
string memory _name,
string memory _symbol
) Points(_name, _symbol, 18) {
string memory _symbol,
address _plasaContract
) Points(_name, _symbol, 18, _plasaContract) {
if (_stampAddresses.length != _multipliers.length) revert ArrayLengthMismatch();
for (uint256 i = 0; i < _stampAddresses.length; ++i) {
_stamps.push(StampInfo(IFollowerSinceStamp(_stampAddresses[i]), _multipliers[i]));
Expand Down Expand Up @@ -255,7 +256,11 @@ contract MultipleFollowerSincePoints is Points, IMultipleFollowerSincePoints {

// Add new holder with their balance
if (!found) {
holders[totalHolders] = Holder({ user: owner, balance: balanceOf(owner) });
holders[totalHolders] = Holder({
user: owner,
name: _getUsername(owner),
balance: balanceOf(owner)
});
unchecked {
++totalHolders;
}
Expand Down
5 changes: 3 additions & 2 deletions src/points/MultipleFollowerSincePointsQuadratic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ contract MultipleFollowerSincePointsQuadratic is MultipleFollowerSincePoints {
address[] memory _stampAddresses,
uint256[] memory _multipliers,
string memory _name,
string memory _symbol
) MultipleFollowerSincePoints(_stampAddresses, _multipliers, _name, _symbol) {}
string memory _symbol,
address _plasaContract
) MultipleFollowerSincePoints(_stampAddresses, _multipliers, _name, _symbol, _plasaContract) {}

/// @notice Calculates points based on the duration of following using a square root formula
/// @dev Uses a square root calculation for non-linear growth curve:
Expand Down

0 comments on commit 73d1097

Please sign in to comment.