From 73d1097ddfa3d236a4a474f826a61ccee3a2f0be Mon Sep 17 00:00:00 2001 From: "nicoacosta.eth" Date: Tue, 5 Nov 2024 19:21:15 -0300 Subject: [PATCH] feat: update points children --- src/points/FollowerSincePoints.sol | 10 ++++++++-- src/points/MultipleFollowerSincePoints.sol | 11 ++++++++--- src/points/MultipleFollowerSincePointsQuadratic.sol | 5 +++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/points/FollowerSincePoints.sol b/src/points/FollowerSincePoints.sol index ef82836..fc8f126 100644 --- a/src/points/FollowerSincePoints.sol +++ b/src/points/FollowerSincePoints.sol @@ -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); } @@ -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; } diff --git a/src/points/MultipleFollowerSincePoints.sol b/src/points/MultipleFollowerSincePoints.sol index 8215d85..cbb65d3 100644 --- a/src/points/MultipleFollowerSincePoints.sol +++ b/src/points/MultipleFollowerSincePoints.sol @@ -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])); @@ -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; } diff --git a/src/points/MultipleFollowerSincePointsQuadratic.sol b/src/points/MultipleFollowerSincePointsQuadratic.sol index a7282fb..4c254b9 100644 --- a/src/points/MultipleFollowerSincePointsQuadratic.sol +++ b/src/points/MultipleFollowerSincePointsQuadratic.sol @@ -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: