@gooddollar/goodprotocol 2.0.9-beta.0 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/artifacts/abis/InvitesFuseV2.min.json +1 -1
  2. package/artifacts/abis/InvitesV2.min.json +1 -1
  3. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  4. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  5. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  6. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  7. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  8. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  9. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  10. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  11. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  12. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  13. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  14. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  15. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  16. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  17. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  18. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  19. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  20. package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
  21. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  28. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  30. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  31. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  32. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  33. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  34. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
  35. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  36. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  37. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  38. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
  39. package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
  40. package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
  41. package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
  42. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  43. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  44. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  45. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  46. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  47. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
  48. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.json +7 -2
  49. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  50. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  51. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.json +7 -2
  52. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  53. package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
  54. package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
  55. package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
  56. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  57. package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
  58. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  59. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
  60. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  61. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  62. package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
  63. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
  64. package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
  65. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  66. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
  67. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  68. package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
  69. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  70. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  71. package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
  72. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
  73. package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
  74. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  75. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  76. package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
  77. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  78. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
  79. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  80. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  81. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  82. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  83. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  84. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  85. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  87. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  88. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  89. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  90. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  91. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  92. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  93. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  94. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  95. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  96. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  97. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  98. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  99. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  100. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  101. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  102. package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
  103. package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
  104. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  105. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  106. package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
  107. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  108. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  109. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  110. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
  111. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  112. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  113. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
  114. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
  115. package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
  116. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
  117. package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
  118. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
  119. package/artifacts/contracts/token/FeesFormula.sol/IFeesFormula.dbg.json +1 -1
  120. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
  121. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
  122. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
  123. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
  124. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
  125. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
  126. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
  127. package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
  128. package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
  129. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
  130. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
  131. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
  132. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  133. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
  134. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  135. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
  136. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  137. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  138. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
  139. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
  140. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
  141. package/artifacts/contracts/utils/BuyGDClone.sol/IStaticOracle.dbg.json +1 -1
  142. package/artifacts/contracts/utils/BuyGDClone.sol/ISwapRouter.dbg.json +1 -1
  143. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  144. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  145. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  146. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  147. package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
  148. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  149. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  150. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  151. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  152. package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
  153. package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
  154. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  155. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  156. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
  157. package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
  158. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  159. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  160. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  161. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  162. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  163. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  164. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  165. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  166. package/contracts/invite/InvitesFuseV2.sol +22 -6
  167. package/contracts/invite/InvitesV2.sol +24 -8
  168. package/dist/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.json +1099 -0
  169. package/dist/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.json +2627 -0
  170. package/dist/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.json +32 -0
  171. package/dist/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.json +82 -0
  172. package/dist/test-sdk/deploySuperGoodDollar.d.ts +6 -0
  173. package/dist/test-sdk/deploySuperGoodDollar.js +46 -0
  174. package/dist/test-sdk/index.d.ts +1 -0
  175. package/dist/test-sdk/index.js +13 -0
  176. package/package.json +1 -1
  177. package/releases/deployment.json +4 -0
  178. package/scripts/multichain-deploy/verifyEtherscan.ts +16 -36
  179. package/test/invite/InvitesV2.test.ts +1 -1
  180. package/types/InvitesFuseV2.ts +6 -0
  181. package/types/InvitesV2.ts +6 -0
  182. package/types/factories/InvitesFuseV2__factory.ts +6 -1
  183. package/types/factories/InvitesV2__factory.ts +6 -1
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/a06ba67080fcf9812b1cc1a2062deb7e.json"
3
+ "buildInfo": "../../../build-info/5377682aef8e23263485d4b473c2ff7d.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/a06ba67080fcf9812b1cc1a2062deb7e.json"
3
+ "buildInfo": "../../../build-info/5377682aef8e23263485d4b473c2ff7d.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/a06ba67080fcf9812b1cc1a2062deb7e.json"
3
+ "buildInfo": "../../../build-info/5377682aef8e23263485d4b473c2ff7d.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/a06ba67080fcf9812b1cc1a2062deb7e.json"
3
+ "buildInfo": "../../../build-info/5377682aef8e23263485d4b473c2ff7d.json"
4
4
  }
@@ -31,6 +31,7 @@ contract InvitesFuseV2 is Initializable {
31
31
  uint256 totalEarned;
32
32
  uint256 joinedAt;
33
33
  uint256[5] __reserevedSpace;
34
+ uint256 bountyAtJoin;
34
35
  }
35
36
 
36
37
  struct Level {
@@ -134,7 +135,9 @@ contract InvitesFuseV2 is Initializable {
134
135
  users[inviter].invitees.push(msg.sender);
135
136
  users[inviter].pending.push(msg.sender);
136
137
  stats.totalInvited += 1;
138
+ user.bountyAtJoin = levels[users[inviter].level].bounty;
137
139
  }
140
+
138
141
  if (canCollectBountyFor(msg.sender)) {
139
142
  _bountyFor(msg.sender, true);
140
143
  }
@@ -230,6 +233,18 @@ contract InvitesFuseV2 is Initializable {
230
233
  address invitedBy = users[_invitee].invitedBy;
231
234
  uint256 joinedAt = users[_invitee].joinedAt;
232
235
  Level memory level = levels[users[invitedBy].level];
236
+ uint256 bountyToPay = users[_invitee].bountyAtJoin;
237
+
238
+ //hardcoded for users invited before the bountyAtJoin change
239
+ if (bountyToPay == 0) {
240
+ uint precision = 10 ** goodDollar.decimals();
241
+ bountyToPay = joinedAt > 1687878272 ? 1000 * precision : 500 * precision;
242
+ }
243
+
244
+ // if inviter level is now higher than when invitee joined or the base level has changed
245
+ // we give level bounty if it is higher otherwise the original bounty at the time the user registered
246
+
247
+ bountyToPay = level.bounty > bountyToPay ? level.bounty : bountyToPay;
233
248
 
234
249
  bool isLevelExpired = level.daysToComplete > 0 &&
235
250
  joinedAt > users[invitedBy].levelStarted && //prevent overflow in subtraction
@@ -238,9 +253,9 @@ contract InvitesFuseV2 is Initializable {
238
253
 
239
254
  users[_invitee].bountyPaid = true;
240
255
  users[invitedBy].totalApprovedInvites += 1;
241
- users[invitedBy].totalEarned += level.bounty;
256
+ users[invitedBy].totalEarned += bountyToPay;
242
257
  stats.totalApprovedInvites += 1;
243
- stats.totalBountiesPaid += level.bounty;
258
+ stats.totalBountiesPaid += bountyToPay;
244
259
 
245
260
  bool earnedLevel = false;
246
261
  if (
@@ -253,17 +268,17 @@ contract InvitesFuseV2 is Initializable {
253
268
  earnedLevel = true;
254
269
  }
255
270
 
256
- if (isSingleBounty) goodDollar.transfer(invitedBy, level.bounty);
257
- goodDollar.transfer(_invitee, level.bounty / 2); //pay invitee half the bounty
271
+ if (isSingleBounty) goodDollar.transfer(invitedBy, bountyToPay);
272
+ goodDollar.transfer(_invitee, bountyToPay / 2); //pay invitee half the bounty
258
273
  emit InviterBounty(
259
274
  invitedBy,
260
275
  _invitee,
261
- level.bounty,
276
+ bountyToPay,
262
277
  users[invitedBy].level,
263
278
  earnedLevel
264
279
  );
265
280
 
266
- return level.bounty;
281
+ return bountyToPay;
267
282
  }
268
283
 
269
284
  /**
@@ -328,6 +343,7 @@ contract InvitesFuseV2 is Initializable {
328
343
  * 1.5.0 - more gas improvements
329
344
  * 2 uses uups upgradeable - not compatible upgrade for v1
330
345
  * 2.1 prevent multichain claims
346
+ * 2.2 record bounty at join time
331
347
  */
332
348
  function version() public pure returns (string memory) {
333
349
  return "2.1";
@@ -34,7 +34,8 @@ contract InvitesV2 is DAOUpgradeableContract {
34
34
  uint256 totalApprovedInvites;
35
35
  uint256 totalEarned;
36
36
  uint256 joinedAt;
37
- uint256[5] __reserevedSpace;
37
+ uint256 bountyAtJoin;
38
+ uint256[4] __reserevedSpace;
38
39
  }
39
40
 
40
41
  struct Level {
@@ -140,7 +141,9 @@ contract InvitesV2 is DAOUpgradeableContract {
140
141
  users[inviter].invitees.push(msg.sender);
141
142
  users[inviter].pending.push(msg.sender);
142
143
  stats.totalInvited += 1;
144
+ user.bountyAtJoin = levels[users[inviter].level].bounty;
143
145
  }
146
+
144
147
  if (canCollectBountyFor(msg.sender)) {
145
148
  _bountyFor(msg.sender, true);
146
149
  }
@@ -236,6 +239,18 @@ contract InvitesV2 is DAOUpgradeableContract {
236
239
  address invitedBy = users[_invitee].invitedBy;
237
240
  uint256 joinedAt = users[_invitee].joinedAt;
238
241
  Level memory level = levels[users[invitedBy].level];
242
+ uint256 bountyToPay = users[_invitee].bountyAtJoin;
243
+
244
+ //hardcoded for users invited before the bountyAtJoin change
245
+ if (bountyToPay == 0) {
246
+ uint precision = 10 ** goodDollar.decimals();
247
+ bountyToPay = joinedAt > 1687878272 ? 1000 * precision : 500 * precision;
248
+ }
249
+
250
+ // if inviter level is now higher than when invitee joined or the base level has changed
251
+ // we give level bounty if it is higher otherwise the original bounty at the time the user registered
252
+
253
+ bountyToPay = level.bounty > bountyToPay ? level.bounty : bountyToPay;
239
254
 
240
255
  bool isLevelExpired = level.daysToComplete > 0 &&
241
256
  joinedAt > users[invitedBy].levelStarted && //prevent overflow in subtraction
@@ -244,9 +259,9 @@ contract InvitesV2 is DAOUpgradeableContract {
244
259
 
245
260
  users[_invitee].bountyPaid = true;
246
261
  users[invitedBy].totalApprovedInvites += 1;
247
- users[invitedBy].totalEarned += level.bounty;
262
+ users[invitedBy].totalEarned += bountyToPay;
248
263
  stats.totalApprovedInvites += 1;
249
- stats.totalBountiesPaid += level.bounty;
264
+ stats.totalBountiesPaid += bountyToPay;
250
265
 
251
266
  bool earnedLevel = false;
252
267
  if (
@@ -259,17 +274,17 @@ contract InvitesV2 is DAOUpgradeableContract {
259
274
  earnedLevel = true;
260
275
  }
261
276
 
262
- if (isSingleBounty) goodDollar.transfer(invitedBy, level.bounty);
263
- goodDollar.transfer(_invitee, level.bounty / 2); //pay invitee half the bounty
277
+ if (isSingleBounty) goodDollar.transfer(invitedBy, bountyToPay);
278
+ goodDollar.transfer(_invitee, bountyToPay / 2); //pay invitee half the bounty
264
279
  emit InviterBounty(
265
280
  invitedBy,
266
281
  _invitee,
267
- level.bounty,
282
+ bountyToPay,
268
283
  users[invitedBy].level,
269
284
  earnedLevel
270
285
  );
271
286
 
272
- return level.bounty;
287
+ return bountyToPay;
273
288
  }
274
289
 
275
290
  /**
@@ -330,8 +345,9 @@ contract InvitesV2 is DAOUpgradeableContract {
330
345
  * 1.5.0 - more gas improvements
331
346
  * 2 uses uups upgradeable - not compatible upgrade for v1
332
347
  * 2.1 prevent multichain claims
348
+ * 2.2 record bounty at join time
333
349
  */
334
350
  function version() public pure returns (string memory) {
335
- return "2.1";
351
+ return "2.2";
336
352
  }
337
353
  }