@gooddollar/goodprotocol 1.0.29-beta.3 → 1.0.29-beta.5

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 (339) hide show
  1. package/artifacts/abis/ERC20PresetMinterPauserUpgradeable.min.json +1 -0
  2. package/artifacts/abis/ERC677.min.json +1 -0
  3. package/artifacts/abis/ERC677Receiver.min.json +1 -0
  4. package/artifacts/abis/GoodDollar.min.json +1 -0
  5. package/artifacts/abis/IFeesFormula.min.json +1 -0
  6. package/artifacts/abis/IIdentity.min.json +1 -1
  7. package/artifacts/abis/IIdentityV2.min.json +1 -1
  8. package/artifacts/abis/IdentityV2.min.json +1 -1
  9. package/artifacts/abis/InvitesV2.min.json +1 -1
  10. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  11. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  12. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  13. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  14. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  15. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  16. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  17. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  18. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  19. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  20. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  21. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/IIdentity.json +19 -0
  28. package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/IIdentityV2.json +19 -0
  30. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  31. package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
  32. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  33. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  34. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  35. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  36. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  37. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  38. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  39. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  40. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  41. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  42. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.json +2 -2
  43. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  44. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.json +2 -2
  45. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  46. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.json +2 -2
  47. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  48. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.json +2 -2
  49. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  50. package/artifacts/contracts/governance/GReputation.sol/GReputation.json +2 -2
  51. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
  52. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.json +2 -2
  53. package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
  54. package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
  55. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  56. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.json +2 -2
  57. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  58. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  59. package/artifacts/contracts/governance/Reputation.sol/Reputation.json +2 -2
  60. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  61. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
  62. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  63. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.json +33 -2
  64. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  65. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.json +2 -2
  66. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  67. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.json +38 -10
  68. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  69. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  70. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  71. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
  72. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.json +2 -2
  73. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  74. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.json +2 -2
  75. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  76. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.json +2 -2
  77. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  78. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +2 -2
  79. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
  80. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.json +2 -2
  81. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  82. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.json +2 -2
  83. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  84. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  85. package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
  87. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.json +2 -2
  88. package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
  89. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  90. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.json +2 -2
  91. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  92. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.json +2 -2
  93. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  94. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
  95. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  96. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.json +2 -2
  97. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  98. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  99. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.json +2 -2
  100. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  101. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.json +2 -2
  102. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  103. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.json +2 -2
  104. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  105. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.json +2 -2
  106. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  107. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  108. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  109. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  110. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  111. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  112. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  113. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  114. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  115. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.json +2 -2
  116. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  117. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.json +2 -2
  118. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  119. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.json +2 -2
  120. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  121. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  122. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +2 -2
  123. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  124. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.json +2 -2
  125. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  126. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.json +2 -2
  127. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  128. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.json +2 -2
  129. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  130. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.json +2 -2
  131. package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
  132. package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
  133. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  134. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.json +2 -2
  135. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  136. package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
  137. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  138. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.json +2 -2
  139. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  140. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.json +2 -2
  141. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  142. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.json +2 -2
  143. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
  144. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.json +2 -2
  145. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  146. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.json +2 -2
  147. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  148. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +2 -2
  149. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
  150. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.json +2 -2
  151. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
  152. package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
  153. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +4 -0
  154. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.json +755 -0
  155. package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +4 -0
  156. package/artifacts/contracts/token/ERC677.sol/ERC677.json +66 -0
  157. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +4 -0
  158. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.json +40 -0
  159. package/artifacts/contracts/token/FeesFormula.sol/IFeesFormula.dbg.json +4 -0
  160. package/artifacts/contracts/token/FeesFormula.sol/IFeesFormula.json +45 -0
  161. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +4 -0
  162. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.json +1180 -0
  163. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  164. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +2 -2
  165. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  166. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.json +2 -2
  167. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  168. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  169. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.json +2 -2
  170. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  171. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.json +2 -2
  172. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  173. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.json +2 -2
  174. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  175. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  176. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  177. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.json +2 -2
  178. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  179. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  180. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  181. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.json +2 -2
  182. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  183. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.json +2 -2
  184. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  185. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  186. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  187. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.json +2 -2
  188. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  189. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.json +2 -2
  190. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  191. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.json +2 -2
  192. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  193. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.json +2 -2
  194. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  195. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  196. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  197. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.json +2 -2
  198. package/contracts/Interfaces.sol +2 -0
  199. package/contracts/fuseFaucet/Faucet.sol +5 -3
  200. package/contracts/fuseFaucet/FuseFaucet.sol +1 -2
  201. package/contracts/governance/GReputation.sol +24 -10
  202. package/contracts/identity/IdentityV2.sol +79 -28
  203. package/contracts/invite/InvitesV1.sol +5 -24
  204. package/contracts/invite/InvitesV2.sol +8 -15
  205. package/contracts/mocks/UpgradableMocks.sol +5 -3
  206. package/contracts/token/ERC20PresetMinterPauserUpgradeable.sol +140 -0
  207. package/contracts/token/ERC677.sol +74 -0
  208. package/contracts/token/FeesFormula.sol +10 -0
  209. package/contracts/token/GoodDollar.sol +234 -0
  210. package/hardhat.config.ts +5 -5
  211. package/package.json +3 -2
  212. package/releases/deployment.json +9 -5
  213. package/scripts/multichain-deploy/1_basicdao-deploy.ts +45 -28
  214. package/scripts/multichain-deploy/2_helpers-deploy.ts +1 -7
  215. package/scripts/multichain-deploy/verifyEtherscan.ts +33 -5
  216. package/test/faucet/Faucet.test.ts +184 -0
  217. package/test/{FuseFaucet.test.ts → faucet/FuseFaucet.test.ts} +4 -3
  218. package/test/governance/ClaimersDistribution.test.ts +3 -2
  219. package/test/governance/CompoundVotingMachine.castvote.test.ts +3 -2
  220. package/test/governance/CompoundVotingMachine.crossblockchain.ts +3 -2
  221. package/test/governance/CompoundVotingMachine.daoscheme.ts +3 -2
  222. package/test/governance/CompoundVotingMachine.delegate.test.ts +3 -2
  223. package/test/governance/CompoundVotingMachine.guardian.test.ts +3 -2
  224. package/test/governance/CompoundVotingMachine.propose.test.ts +3 -2
  225. package/test/governance/CompoundVotingMachine.state.test.ts +3 -2
  226. package/test/governance/GReputation.test.ts +22 -14
  227. package/test/governance/GoodDollarStaking.gd.test.ts +2 -1
  228. package/test/governance/GoodDollarStaking.good.test.ts +2 -1
  229. package/test/governance/GovernanceStaking.test.ts +4 -3
  230. package/test/governance/Reputation.test.ts +2 -1
  231. package/test/governance/StakersDistribution.test.ts +26 -12
  232. package/test/helpers.ts +61 -29
  233. package/test/identity/IdentityV2.test.ts +481 -0
  234. package/test/{InvitesV1.test.ts → invite/InvitesV1.test.ts} +4 -3
  235. package/test/invite/InvitesV2.test.ts +355 -0
  236. package/test/reserve/DistributionHelper.test.ts +2 -1
  237. package/test/reserve/GoodMarketMaker.test.ts +15 -8
  238. package/test/reserve/GoodReserveCDai.cap.test.ts +8 -1
  239. package/test/reserve/GoodReserveCDai.distribution.test.ts +2 -1
  240. package/test/reserve/GoodReserveCDai.gdx.test.ts +2 -1
  241. package/test/reserve/GoodReserveCDai.pause.test.ts +2 -1
  242. package/test/reserve/GoodReserveCDai.test.ts +11 -28
  243. package/test/reserve/GoodReserveCDai.uniswap.test.ts +20 -18
  244. package/test/staking/CompoundStakingFactory.test.ts +8 -4
  245. package/test/staking/DifferentStakingTokens.test.ts +3 -2
  246. package/test/staking/DonationsStaking.test.ts +33 -24
  247. package/test/staking/FuseStaking.test.ts +2 -2
  248. package/test/staking/GoodAaveStakingFactory.test.ts +36 -30
  249. package/test/staking/SimpleDAIStaking.test.ts +12 -16
  250. package/test/staking/StakingRewards.test.ts +22 -18
  251. package/test/staking/StakingRewardsFixedAPY.test.ts +2 -1
  252. package/test/staking/SwapHelper.test.ts +20 -17
  253. package/test/staking/UsdcAaveStaking.test.ts +36 -33
  254. package/test/token/GoodDollar.test.ts +277 -0
  255. package/test/ubi/UBIScheme.e2e.test.ts +4 -3
  256. package/test/ubi/UBIScheme.test.ts +3 -2
  257. package/test/ubi/UBISchemeCycle.test.ts +2 -1
  258. package/test/utils/AdminWallet.test.ts +2 -1
  259. package/test/utils/DAOUpgradeableContract.test.ts +3 -2
  260. package/test/utils/GoodDollarMintBurnWrapper.test.ts +2 -1
  261. package/test/utils/NameService.test.ts +37 -21
  262. package/test/utils/ProtocolUpgrade.test.ts +1 -0
  263. package/test/utils/ProxyFactory.test.ts +1 -0
  264. package/types/ERC20PermitUpgradeable.ts +522 -0
  265. package/types/ERC20PresetMinterPauserUpgradeable.ts +105 -1
  266. package/types/ERC677.ts +131 -0
  267. package/types/ERC677Receiver.ts +115 -0
  268. package/types/GoodDollar.ts +1705 -0
  269. package/types/IERC20PermitUpgradeable.ts +176 -0
  270. package/types/IFeesFormula.ts +111 -0
  271. package/types/IIdentity.ts +31 -0
  272. package/types/IIdentityV2.ts +31 -0
  273. package/types/IdentityV2.ts +69 -5
  274. package/types/InvitesV2.ts +61 -7
  275. package/types/factories/AaveStakingFactory__factory.ts +1 -1
  276. package/types/factories/AdminWallet__factory.ts +1 -1
  277. package/types/factories/BaseShareFieldV2__factory.ts +1 -1
  278. package/types/factories/BaseShareField__factory.ts +1 -1
  279. package/types/factories/ClaimersDistribution__factory.ts +1 -1
  280. package/types/factories/CompoundStakingFactory__factory.ts +1 -1
  281. package/types/factories/CompoundVotingMachine__factory.ts +1 -1
  282. package/types/factories/DAOContract__factory.ts +1 -1
  283. package/types/factories/DAOUpgradeableContract__factory.ts +1 -1
  284. package/types/factories/DistributionBridgeMock__factory.ts +1 -1
  285. package/types/factories/DistributionHelperTestHelper__factory.ts +1 -1
  286. package/types/factories/DistributionHelperTest__factory.ts +1 -1
  287. package/types/factories/DistributionHelper__factory.ts +1 -1
  288. package/types/factories/DonationsStaking__factory.ts +1 -1
  289. package/types/factories/ERC20PermitUpgradeable__factory.ts +375 -0
  290. package/types/factories/ERC20PresetMinterPauserUpgradeable__factory.ts +83 -2
  291. package/types/factories/ERC677Receiver__factory.ts +55 -0
  292. package/types/factories/ERC677__factory.ts +75 -0
  293. package/types/factories/ExchangeHelper__factory.ts +1 -1
  294. package/types/factories/Faucet__factory.ts +1 -1
  295. package/types/factories/FuseFaucet__factory.ts +1 -1
  296. package/types/factories/FuseStakingV3__factory.ts +1 -1
  297. package/types/factories/GReputation__factory.ts +1 -1
  298. package/types/factories/GoodAaveStakingV2__factory.ts +1 -1
  299. package/types/factories/GoodAaveStaking__factory.ts +1 -1
  300. package/types/factories/GoodCompoundStakingTest__factory.ts +1 -1
  301. package/types/factories/GoodCompoundStakingV2__factory.ts +1 -1
  302. package/types/factories/GoodCompoundStaking__factory.ts +1 -1
  303. package/types/factories/GoodDollarMintBurnWrapper__factory.ts +1 -1
  304. package/types/factories/GoodDollarStakingMock__factory.ts +1 -1
  305. package/types/factories/GoodDollarStaking__factory.ts +1 -1
  306. package/types/factories/GoodDollar__factory.ts +1228 -0
  307. package/types/factories/GoodFundManagerTest__factory.ts +1 -1
  308. package/types/factories/GoodFundManager__factory.ts +1 -1
  309. package/types/factories/GoodMarketMaker__factory.ts +1 -1
  310. package/types/factories/GoodReserveCDai__factory.ts +1 -1
  311. package/types/factories/GovernanceStaking__factory.ts +1 -1
  312. package/types/factories/IERC20PermitUpgradeable__factory.ts +105 -0
  313. package/types/factories/IFeesFormula__factory.ts +57 -0
  314. package/types/factories/IIdentityV2__factory.ts +19 -0
  315. package/types/factories/IIdentity__factory.ts +19 -0
  316. package/types/factories/IdentityV2__factory.ts +32 -1
  317. package/types/factories/InvitesV1__factory.ts +1 -1
  318. package/types/factories/InvitesV2__factory.ts +37 -9
  319. package/types/factories/MultichainBridgeHelper__factory.ts +1 -1
  320. package/types/factories/MultichainRouterMock__factory.ts +1 -1
  321. package/types/factories/OverMintTesterRegularStake__factory.ts +1 -1
  322. package/types/factories/OverMintTester__factory.ts +1 -1
  323. package/types/factories/ProtocolUpgradeFuseRecover__factory.ts +1 -1
  324. package/types/factories/ProtocolUpgradeFuse__factory.ts +1 -1
  325. package/types/factories/ProtocolUpgradeRecover__factory.ts +1 -1
  326. package/types/factories/ProtocolUpgrade__factory.ts +1 -1
  327. package/types/factories/ReputationTestHelper__factory.ts +1 -1
  328. package/types/factories/Reputation__factory.ts +1 -1
  329. package/types/factories/StakersDistribution__factory.ts +1 -1
  330. package/types/factories/SwapHelperTest__factory.ts +1 -1
  331. package/types/factories/UBIScheme__factory.ts +1 -1
  332. package/types/factories/UniswapV2SwapHelper__factory.ts +1 -1
  333. package/types/factories/UpgradableMock2__factory.ts +1 -1
  334. package/types/factories/UpgradableMock3__factory.ts +1 -1
  335. package/types/factories/UpgradableMock4__factory.ts +1 -1
  336. package/types/factories/UpgradableMock__factory.ts +1 -1
  337. package/types/hardhat.d.ts +63 -0
  338. package/types/index.ts +12 -0
  339. package/yarn.lock +11 -29
@@ -74,8 +74,8 @@
74
74
  "type": "function"
75
75
  }
76
76
  ],
77
- "bytecode": "0x608060405234801561001057600080fd5b5060405161035c38038061035c83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6102c9806100936000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80635653eeeb1461004657806391d61f3e1461005b578063c52164c61461006e575b600080fd5b6100596100543660046101e7565b61009d565b005b6100596100693660046101e7565b610145565b600054610081906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b60005b8181101561013f576000546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906100da9087908790600401610228565b602060405180830381600087803b1580156100f457600080fd5b505af1158015610108573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012c9190610241565b50806101378161026a565b9150506100a0565b50505050565b60005b8181101561013f57600054604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906101829087908790600401610228565b602060405180830381600087803b15801561019c57600080fd5b505af11580156101b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d49190610241565b50806101df8161026a565b915050610148565b6000806000606084860312156101fc57600080fd5b83356001600160a01b038116811461021357600080fd5b95602085013595506040909401359392505050565b6001600160a01b03929092168252602082015260400190565b60006020828403121561025357600080fd5b8151801515811461026357600080fd5b9392505050565b600060001982141561028c57634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220bf5af15fd554b440d628427d634d0ac3eb559002d7f37b7154c4e720322a9e9c64736f6c63430008080033",
78
- "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80635653eeeb1461004657806391d61f3e1461005b578063c52164c61461006e575b600080fd5b6100596100543660046101e7565b61009d565b005b6100596100693660046101e7565b610145565b600054610081906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b60005b8181101561013f576000546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906100da9087908790600401610228565b602060405180830381600087803b1580156100f457600080fd5b505af1158015610108573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012c9190610241565b50806101378161026a565b9150506100a0565b50505050565b60005b8181101561013f57600054604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906101829087908790600401610228565b602060405180830381600087803b15801561019c57600080fd5b505af11580156101b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d49190610241565b50806101df8161026a565b915050610148565b6000806000606084860312156101fc57600080fd5b83356001600160a01b038116811461021357600080fd5b95602085013595506040909401359392505050565b6001600160a01b03929092168252602082015260400190565b60006020828403121561025357600080fd5b8151801515811461026357600080fd5b9392505050565b600060001982141561028c57634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220bf5af15fd554b440d628427d634d0ac3eb559002d7f37b7154c4e720322a9e9c64736f6c63430008080033",
77
+ "bytecode": "0x608060405234801561001057600080fd5b5060405161035c38038061035c83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6102c9806100936000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80635653eeeb1461004657806391d61f3e1461005b578063c52164c61461006e575b600080fd5b6100596100543660046101e7565b61009d565b005b6100596100693660046101e7565b610145565b600054610081906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b60005b8181101561013f576000546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906100da9087908790600401610228565b602060405180830381600087803b1580156100f457600080fd5b505af1158015610108573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012c9190610241565b50806101378161026a565b9150506100a0565b50505050565b60005b8181101561013f57600054604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906101829087908790600401610228565b602060405180830381600087803b15801561019c57600080fd5b505af11580156101b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d49190610241565b50806101df8161026a565b915050610148565b6000806000606084860312156101fc57600080fd5b83356001600160a01b038116811461021357600080fd5b95602085013595506040909401359392505050565b6001600160a01b03929092168252602082015260400190565b60006020828403121561025357600080fd5b8151801515811461026357600080fd5b9392505050565b600060001982141561028c57634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220d7dec133dbc80e0ba934e5c9af3ba8763a46048ca50ee6ee036988d616d4edc364736f6c63430008080033",
78
+ "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80635653eeeb1461004657806391d61f3e1461005b578063c52164c61461006e575b600080fd5b6100596100543660046101e7565b61009d565b005b6100596100693660046101e7565b610145565b600054610081906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b60005b8181101561013f576000546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906100da9087908790600401610228565b602060405180830381600087803b1580156100f457600080fd5b505af1158015610108573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012c9190610241565b50806101378161026a565b9150506100a0565b50505050565b60005b8181101561013f57600054604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906101829087908790600401610228565b602060405180830381600087803b15801561019c57600080fd5b505af11580156101b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d49190610241565b50806101df8161026a565b915050610148565b6000806000606084860312156101fc57600080fd5b83356001600160a01b038116811461021357600080fd5b95602085013595506040909401359392505050565b6001600160a01b03929092168252602082015260400190565b60006020828403121561025357600080fd5b8151801515811461026357600080fd5b9392505050565b600060001982141561028c57634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220d7dec133dbc80e0ba934e5c9af3ba8763a46048ca50ee6ee036988d616d4edc364736f6c63430008080033",
79
79
  "linkReferences": {},
80
80
  "deployedLinkReferences": {}
81
81
  }
@@ -276,6 +276,8 @@ interface IIdentity {
276
276
 
277
277
  function addrToDID(address account) external view returns (string memory);
278
278
 
279
+ function didHashToAddress(bytes32 hash) external view returns (address);
280
+
279
281
  event WhitelistedAdded(address user);
280
282
  }
281
283
 
@@ -9,8 +9,7 @@ import "../Interfaces.sol";
9
9
  import "../utils/NameService.sol";
10
10
 
11
11
  /**
12
- * @title DonationStaking contract that receives funds in ETH/DAI
13
- * and stake them in the SimpleStaking contract
12
+ * @title FuseFaucet contract that can top up users wallets
14
13
  */
15
14
  contract Faucet is Initializable, UUPSUpgradeable, AccessControlUpgradeable {
16
15
  bytes32 public constant RELAYER_ROLE = keccak256("relayer");
@@ -99,7 +98,8 @@ contract Faucet is Initializable, UUPSUpgradeable, AccessControlUpgradeable {
99
98
  require(
100
99
  getIdentity().getWhitelistedRoot(toTop) != address(0) ||
101
100
  getIdentity().getWhitelistedRoot(msg.sender) != address(0) ||
102
- hasRole(RELAYER_ROLE, msg.sender)
101
+ hasRole(RELAYER_ROLE, msg.sender),
102
+ "not authorized"
103
103
  );
104
104
  _;
105
105
  }
@@ -155,6 +155,8 @@ contract Faucet is Initializable, UUPSUpgradeable, AccessControlUpgradeable {
155
155
  }
156
156
 
157
157
  function canTop(address _user) external view returns (bool) {
158
+ if (toppingAmount < address(_user).balance) return false;
159
+
158
160
  address whitelistedRoot = getIdentity().getWhitelistedRoot(_user);
159
161
  _user = whitelistedRoot == address(0) ? _user : whitelistedRoot;
160
162
 
@@ -6,8 +6,7 @@ import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
6
6
  import "../Interfaces.sol";
7
7
 
8
8
  /**
9
- * @title DonationStaking contract that receives funds in ETH/DAI
10
- * and stake them in the SimpleStaking contract
9
+ * @title FuseFaucet contract that can top up users wallets
11
10
  */
12
11
  contract FuseFaucet is Initializable {
13
12
  event WalletTopped(address indexed user, uint256 amount);
@@ -99,25 +99,36 @@ contract GReputation is Reputation {
99
99
 
100
100
  function _canMint() internal view override {
101
101
  require(
102
- _msgSender() == nameService.getAddress("GDAO_CLAIMERS") ||
103
- _msgSender() == nameService.getAddress("GDAO_STAKING") ||
104
- _msgSender() == nameService.getAddress("GDAO_STAKERS") ||
105
- hasRole(MINTER_ROLE, _msgSender()),
102
+ hasRole(MINTER_ROLE, _msgSender()) ||
103
+ (address(nameService) != address(0) &&
104
+ (_msgSender() == nameService.getAddress("GDAO_CLAIMERS") ||
105
+ _msgSender() == nameService.getAddress("GDAO_STAKING") ||
106
+ _msgSender() == nameService.getAddress("GDAO_STAKERS"))),
106
107
  "GReputation: need minter role or be GDAO contract"
107
108
  );
108
109
  }
109
110
 
110
- /// @notice internal function that overrides Reputation.sol with consideration to delegation
111
- /// @param _user the address to mint for
112
- /// @param _amount the amount of rep to mint
113
- /// @return the actual amount minted
114
111
  function _mint(address _user, uint256 _amount)
115
112
  internal
116
113
  override
117
114
  returns (uint256)
118
115
  {
116
+ return _mint(_user, _amount, false);
117
+ }
118
+
119
+ /// @notice internal function that overrides Reputation.sol with consideration to delegation
120
+ /// @param _user the address to mint for
121
+ /// @param _amount the amount of rep to mint
122
+ /// @return the actual amount minted
123
+ function _mint(
124
+ address _user,
125
+ uint256 _amount,
126
+ bool ignoreRepTarget
127
+ ) internal returns (uint256) {
119
128
  address repTarget = reputationRecipients[_user];
120
- repTarget = repTarget != address(0) ? repTarget : _user;
129
+ repTarget = ignoreRepTarget == false && repTarget != address(0)
130
+ ? repTarget
131
+ : _user;
121
132
 
122
133
  super._mint(repTarget, _amount);
123
134
 
@@ -414,7 +425,10 @@ contract GReputation is Reputation {
414
425
  //if initiial state then set real balance
415
426
  if (idHash == ROOT_STATE) {
416
427
  uint256 curTotalSupply = totalSupplyLocalAt(block.number);
417
- _mint(_user, _balance);
428
+ // on proof for ROOT_HASH we force to ignore the repTarget, so it is the same wallet address receiving the reputation (prevent double voting power on snapshot)
429
+ // also it should behave the same as blockchain sync proof which also doesnt use repTarget, but updates the same address as in the proof
430
+ _mint(_user, _balance, true);
431
+
418
432
  updateValueAtNow(totalSupplyHistory, curTotalSupply); // we undo the totalsupply, as we alredy set the totalsupply of the airdrop
419
433
  }
420
434
 
@@ -4,6 +4,7 @@ pragma solidity >=0.8.0;
4
4
  import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
5
5
  import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
6
6
  import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
7
+ import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
7
8
 
8
9
  import "../utils/DAOUpgradeableContract.sol";
9
10
  import "../utils/NameService.sol";
@@ -160,7 +161,7 @@ contract IdentityV2 is
160
161
 
161
162
  /* @dev Renounces message sender from whitelisted
162
163
  */
163
- function renounceWhitelisted() external whenNotPaused {
164
+ function renounceWhitelisted() external whenNotPaused onlyWhitelisted {
164
165
  _removeWhitelisted(msg.sender);
165
166
  }
166
167
 
@@ -217,7 +218,7 @@ contract IdentityV2 is
217
218
  whenNotPaused
218
219
  {
219
220
  if (address(oldIdentity) != address(0))
220
- try oldIdentity.removeBlacklisted(account) {} catch {}
221
+ oldIdentity.removeBlacklisted(account);
221
222
 
222
223
  identities[account].status = 0;
223
224
  emit BlacklistRemoved(account);
@@ -233,7 +234,7 @@ contract IdentityV2 is
233
234
  {
234
235
  require(isContract(account), "Given address is not a contract");
235
236
  _addWhitelisted(account, _chainId());
236
- identities[account].status = 2;
237
+ identities[account].status = 2; //this must come after _addWhitelisted
237
238
 
238
239
  emit ContractAdded(account);
239
240
  }
@@ -246,6 +247,9 @@ contract IdentityV2 is
246
247
  onlyRole(IDENTITY_ADMIN_ROLE)
247
248
  whenNotPaused
248
249
  {
250
+ if (address(oldIdentity) != address(0)) {
251
+ oldIdentity.removeContract(account);
252
+ }
249
253
  _removeWhitelisted(account);
250
254
 
251
255
  emit ContractRemoved(account);
@@ -271,6 +275,7 @@ contract IdentityV2 is
271
275
  * @param account the address to add
272
276
  */
273
277
  function _addWhitelisted(address account, uint256 orgChain) internal {
278
+ require(identities[account].status == 0, "already has status");
274
279
  whitelistedCount += 1;
275
280
  identities[account].status = 1;
276
281
  identities[account].dateAdded = block.timestamp;
@@ -307,25 +312,25 @@ contract IdentityV2 is
307
312
  * @param account the address to add
308
313
  */
309
314
  function _removeWhitelisted(address account) internal {
310
- whitelistedCount -= 1;
315
+ if (identities[account].status == 1 || identities[account].status == 2) {
316
+ whitelistedCount -= 1;
311
317
 
312
- if (isContract(account)) {
313
- whitelistedContracts -= 1;
314
- if (address(oldIdentity) != address(0)) {
315
- try oldIdentity.removeContract(account) {} catch {}
318
+ if (isContract(account)) {
319
+ whitelistedContracts -= 1;
316
320
  }
317
- }
318
- if (address(oldIdentity) != address(0)) {
319
- try oldIdentity.removeWhitelisted(account) {} catch {}
320
- }
321
321
 
322
- string memory did = identities[account].did;
323
- bytes32 pHash = keccak256(bytes(did));
322
+ string memory did = identities[account].did;
323
+ bytes32 pHash = keccak256(bytes(did));
324
324
 
325
- delete identities[account];
326
- delete didHashToAddress[pHash];
325
+ delete identities[account];
326
+ delete didHashToAddress[pHash];
327
+
328
+ emit WhitelistedRemoved(account);
329
+ }
327
330
 
328
- emit WhitelistedRemoved(account);
331
+ if (address(oldIdentity) != address(0)) {
332
+ oldIdentity.removeWhitelisted(account);
333
+ }
329
334
  }
330
335
 
331
336
  /// @notice helper function to get current chain id
@@ -349,6 +354,7 @@ contract IdentityV2 is
349
354
  return false;
350
355
  }
351
356
  }
357
+ return false;
352
358
  }
353
359
 
354
360
  /* @dev Function to see if given address is a contract
@@ -376,7 +382,9 @@ contract IdentityV2 is
376
382
  require(
377
383
  SignatureChecker.isValidSignatureNow(
378
384
  _account,
379
- keccak256(abi.encode(msg.sender, _account)),
385
+ ECDSA.toEthSignedMessageHash(
386
+ keccak256(abi.encode(msg.sender, _account))
387
+ ),
380
388
  signature
381
389
  ),
382
390
  "invalid signature"
@@ -384,6 +392,14 @@ contract IdentityV2 is
384
392
  connectedAccounts[_account] = msg.sender;
385
393
  }
386
394
 
395
+ function disconnectAccount(address _connected) external {
396
+ require(
397
+ connectedAccounts[_connected] == msg.sender || msg.sender == _connected,
398
+ "unauthorized"
399
+ );
400
+ delete connectedAccounts[_connected];
401
+ }
402
+
387
403
  function getWhitelistedRoot(address _account)
388
404
  external
389
405
  view
@@ -401,14 +417,41 @@ contract IdentityV2 is
401
417
  else _unpause();
402
418
  }
403
419
 
404
- function setDID(string calldata did) external onlyWhitelisted {
420
+ function setDID(address account, string calldata did)
421
+ external
422
+ onlyRole(IDENTITY_ADMIN_ROLE)
423
+ {
424
+ _setDID(account, did);
425
+ }
426
+
427
+ function setDID(string calldata did) external {
428
+ _setDID(msg.sender, did);
429
+ }
430
+
431
+ function _setDID(address account, string memory did) internal {
432
+ require(isWhitelisted(account), "not whitelisted");
433
+ require(bytes(did).length > 0, "did empty");
405
434
  bytes32 pHash = keccak256(bytes(did));
406
435
  require(didHashToAddress[pHash] == address(0), "DID already registered");
407
436
 
408
- bytes32 oldHash = keccak256(bytes(identities[msg.sender].did));
437
+ if (address(oldIdentity) != address(0)) {
438
+ address oldDIDOwner;
439
+ try oldIdentity.didHashToAddress(pHash) returns (address _didOwner) {
440
+ oldDIDOwner = _didOwner;
441
+ } catch {}
442
+ //if owner not the same and doesnt have a new did set then revert
443
+ require(
444
+ oldDIDOwner == address(0) ||
445
+ oldDIDOwner == account ||
446
+ bytes(identities[oldDIDOwner].did).length > 0,
447
+ "DID already registered oldIdentity"
448
+ );
449
+ }
450
+
451
+ bytes32 oldHash = keccak256(bytes(identities[account].did));
409
452
  delete didHashToAddress[oldHash];
410
- identities[msg.sender].did = did;
411
- didHashToAddress[pHash] = msg.sender;
453
+ identities[account].did = did;
454
+ didHashToAddress[pHash] = account;
412
455
  }
413
456
 
414
457
  function addrToDID(address account)
@@ -416,13 +459,21 @@ contract IdentityV2 is
416
459
  view
417
460
  returns (string memory did)
418
461
  {
419
- did = identities[msg.sender].did;
420
- if (bytes(did).length > 0) return did;
421
- try oldIdentity.addrToDID(account) returns (string memory _did) {
422
- return _did;
423
- } catch {
424
- return "";
462
+ did = identities[account].did;
463
+ bytes32 pHash = keccak256(bytes(did));
464
+
465
+ //if did was set in this contract return it, otherwise check oldidentity
466
+ if (didHashToAddress[pHash] == account) return did;
467
+
468
+ if (address(oldIdentity) != address(0)) {
469
+ try oldIdentity.addrToDID(account) returns (string memory _did) {
470
+ return _did;
471
+ } catch {
472
+ return "";
473
+ }
425
474
  }
475
+
476
+ return "";
426
477
  }
427
478
 
428
479
  /**
@@ -2,7 +2,6 @@
2
2
 
3
3
  pragma solidity >=0.8;
4
4
 
5
-
6
5
  import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
7
6
  import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
8
7
  import "../Interfaces.sol";
@@ -75,16 +74,8 @@ contract InvitesV1 is Initializable {
75
74
  _;
76
75
  }
77
76
 
78
- modifier onlyAvatar() {
79
- require(
80
- msg.sender == avatar,
81
- "Only DAO avatar can perform this action"
82
- );
83
- _;
84
- }
85
-
86
77
  modifier isActive() {
87
- require(active);
78
+ require(active, "not active");
88
79
  _;
89
80
  }
90
81
 
@@ -110,8 +101,7 @@ contract InvitesV1 is Initializable {
110
101
 
111
102
  function join(bytes32 _myCode, bytes32 _inviterCode) public isActive {
112
103
  require(
113
- codeToUser[_myCode] == address(0) ||
114
- codeToUser[_myCode] == msg.sender,
104
+ codeToUser[_myCode] == address(0) || codeToUser[_myCode] == msg.sender,
115
105
  "invite code already in use"
116
106
  );
117
107
  User storage user = users[msg.sender]; // this is not expensive as user is new
@@ -143,9 +133,7 @@ contract InvitesV1 is Initializable {
143
133
  bool isLevelExpired = levelExpirationEnabled == true &&
144
134
  daysToComplete > 0 &&
145
135
  daysToComplete <
146
- users[_invitee].joinedAt.sub(users[invitedBy].levelStarted).div(
147
- 1 days
148
- );
136
+ users[_invitee].joinedAt.sub(users[invitedBy].levelStarted).div(1 days);
149
137
 
150
138
  return
151
139
  invitedBy != address(0) &&
@@ -189,11 +177,7 @@ contract InvitesV1 is Initializable {
189
177
  return result;
190
178
  }
191
179
 
192
- function getPendingBounties(address _inviter)
193
- public
194
- view
195
- returns (uint256)
196
- {
180
+ function getPendingBounties(address _inviter) public view returns (uint256) {
197
181
  address[] memory pending = users[_inviter].pending;
198
182
  uint256 total = 0;
199
183
  for (uint256 i; i < pending.length; i++) {
@@ -213,10 +197,7 @@ contract InvitesV1 is Initializable {
213
197
  isActive
214
198
  returns (uint256 bounty)
215
199
  {
216
- require(
217
- canCollectBountyFor(_invitee),
218
- "user not elligble for bounty yet"
219
- );
200
+ require(canCollectBountyFor(_invitee), "user not elligble for bounty yet");
220
201
  return _bountyFor(_invitee, true);
221
202
  }
222
203
 
@@ -7,6 +7,7 @@ import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
7
7
  import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
8
8
  import "../Interfaces.sol";
9
9
  import "../utils/NameService.sol";
10
+ import "../utils/DAOUpgradeableContract.sol";
10
11
 
11
12
  // import "hardhat/console.sol";
12
13
 
@@ -15,7 +16,7 @@ import "../utils/NameService.sol";
15
16
  * 1.1 adds invitee bonus
16
17
  * 2 uses uups upgradeable - not compatible upgrade for v1
17
18
  */
18
- contract InvitesV2 is Initializable, UUPSUpgradeable {
19
+ contract InvitesV2 is DAOUpgradeableContract {
19
20
  using SafeMathUpgradeable for uint256;
20
21
 
21
22
  struct Stats {
@@ -48,12 +49,10 @@ contract InvitesV2 is Initializable, UUPSUpgradeable {
48
49
 
49
50
  mapping(bytes32 => address) public codeToUser;
50
51
  mapping(address => User) public users;
51
- address payable public avatar;
52
52
 
53
53
  mapping(uint256 => Level) public levels;
54
54
 
55
55
  address public owner;
56
- NameService public nameService;
57
56
  cERC20 public goodDollar;
58
57
  bool public active;
59
58
  Stats public stats;
@@ -77,30 +76,23 @@ contract InvitesV2 is Initializable, UUPSUpgradeable {
77
76
  _;
78
77
  }
79
78
 
80
- modifier onlyAvatar() {
81
- require(msg.sender == avatar, "Only DAO avatar can perform this action");
82
- _;
83
- }
84
-
85
79
  modifier isActive() {
86
- require(active);
80
+ require(active, "not active");
87
81
  _;
88
82
  }
89
83
 
90
84
  function initialize(
91
- address payable _avatar,
92
- address _ns,
85
+ INameService _ns,
93
86
  address _gd,
94
87
  uint256 _level0Bounty,
95
88
  address _owner
96
89
  ) public initializer {
90
+ setDAO(_ns);
97
91
  owner = _owner;
98
- nameService = NameService(_ns);
99
92
  active = true;
100
93
  Level storage lvl = levels[0];
101
94
  lvl.bounty = _level0Bounty;
102
95
  goodDollar = cERC20(_gd);
103
- avatar = _avatar;
104
96
  levelExpirationEnabled = false;
105
97
  }
106
98
 
@@ -299,7 +291,7 @@ contract InvitesV2 is Initializable, UUPSUpgradeable {
299
291
  function end() public ownerOrAvatar isActive {
300
292
  uint256 gdBalance = goodDollar.balanceOf(address(this));
301
293
  goodDollar.transfer(avatar, gdBalance);
302
- avatar.transfer(address(this).balance);
294
+ payable(msg.sender).transfer(address(this).balance);
303
295
  active = false;
304
296
  }
305
297
 
@@ -309,8 +301,9 @@ contract InvitesV2 is Initializable, UUPSUpgradeable {
309
301
  * 1.3.0 - allow to set inviter later
310
302
  * 1.4.0 - improve gas for bounty collection
311
303
  * 1.5.0 - more gas improvements
304
+ * 2 uses uups upgradeable - not compatible upgrade for v1
312
305
  */
313
306
  function version() public pure returns (string memory) {
314
- return "1.5.0";
307
+ return "2.0";
315
308
  }
316
309
  }
@@ -34,8 +34,9 @@ contract UpgradableMock3 is DAOUpgradeableContract {
34
34
  function decimals() public pure returns (uint256) {
35
35
  return 3;
36
36
  }
37
+
37
38
  function initialize(INameService _ns) public initializer {
38
- setDAO(_ns);
39
+ setDAO(_ns);
39
40
  }
40
41
  }
41
42
 
@@ -43,7 +44,8 @@ contract UpgradableMock4 is DAOUpgradeableContract {
43
44
  function decimals() public pure returns (uint256) {
44
45
  return 4;
45
46
  }
47
+
46
48
  function initialize(INameService _ns) public initializer {
47
- setDAO(_ns);
49
+ setDAO(_ns);
48
50
  }
49
- }
51
+ }
@@ -0,0 +1,140 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // we use a custom file and not openzeppelin directly since the DAOStack Controller expects `mint` to return bool
3
+ // we also add the erc20 permit
4
+
5
+ pragma solidity ^0.8.0;
6
+
7
+ import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol";
8
+ import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol";
9
+ import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PausableUpgradeable.sol";
10
+ import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
11
+ import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
12
+ import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
13
+
14
+ /**
15
+ * @dev {ERC20} token, including:
16
+ *
17
+ * - ability for holders to burn (destroy) their tokens
18
+ * - a minter role that allows for token minting (creation)
19
+ * - a pauser role that allows to stop all token transfers
20
+ *
21
+ * This contract uses {AccessControl} to lock permissioned functions using the
22
+ * different roles - head to its documentation for details.
23
+ *
24
+ * The account that deploys the contract will be granted the minter and pauser
25
+ * roles, as well as the default admin role, which will let it grant both minter
26
+ * and pauser roles to other accounts.
27
+ */
28
+ contract ERC20PresetMinterPauserUpgradeable is
29
+ Initializable,
30
+ ContextUpgradeable,
31
+ AccessControlEnumerableUpgradeable,
32
+ ERC20PermitUpgradeable,
33
+ ERC20BurnableUpgradeable,
34
+ ERC20PausableUpgradeable
35
+ {
36
+ function initialize(string memory name, string memory symbol)
37
+ public
38
+ virtual
39
+ initializer
40
+ {
41
+ __ERC20PresetMinterPauser_init(name, symbol);
42
+ }
43
+
44
+ bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
45
+ bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
46
+
47
+ /**
48
+ * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the
49
+ * account that deploys the contract.
50
+ *
51
+ * See {ERC20-constructor}.
52
+ */
53
+ function __ERC20PresetMinterPauser_init(
54
+ string memory name,
55
+ string memory symbol
56
+ ) internal initializer {
57
+ __Context_init_unchained();
58
+ __ERC165_init_unchained();
59
+ __AccessControl_init_unchained();
60
+ __AccessControlEnumerable_init_unchained();
61
+ __ERC20_init_unchained(name, symbol);
62
+ __ERC20Burnable_init_unchained();
63
+ __Pausable_init_unchained();
64
+ __ERC20Pausable_init_unchained();
65
+ __ERC20PresetMinterPauser_init_unchained(name, symbol);
66
+ __ERC20Permit_init_unchained(name);
67
+ }
68
+
69
+ function __ERC20PresetMinterPauser_init_unchained(
70
+ string memory name,
71
+ string memory symbol
72
+ ) internal initializer {
73
+ _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
74
+
75
+ _setupRole(MINTER_ROLE, _msgSender());
76
+ _setupRole(PAUSER_ROLE, _msgSender());
77
+ }
78
+
79
+ /**
80
+ * @dev Creates `amount` new tokens for `to`.
81
+ *
82
+ * See {ERC20-_mint}.
83
+ *
84
+ * Requirements:
85
+ *
86
+ * - the caller must have the `MINTER_ROLE`.
87
+ */
88
+ function mint(address to, uint256 amount) public virtual returns (bool) {
89
+ require(
90
+ hasRole(MINTER_ROLE, _msgSender()),
91
+ "ERC20PresetMinterPauser: must have minter role to mint"
92
+ );
93
+ _mint(to, amount);
94
+ return true;
95
+ }
96
+
97
+ /**
98
+ * @dev Pauses all token transfers.
99
+ *
100
+ * See {ERC20Pausable} and {Pausable-_pause}.
101
+ *
102
+ * Requirements:
103
+ *
104
+ * - the caller must have the `PAUSER_ROLE`.
105
+ */
106
+ function pause() public virtual {
107
+ require(
108
+ hasRole(PAUSER_ROLE, _msgSender()),
109
+ "ERC20PresetMinterPauser: must have pauser role to pause"
110
+ );
111
+ _pause();
112
+ }
113
+
114
+ /**
115
+ * @dev Unpauses all token transfers.
116
+ *
117
+ * See {ERC20Pausable} and {Pausable-_unpause}.
118
+ *
119
+ * Requirements:
120
+ *
121
+ * - the caller must have the `PAUSER_ROLE`.
122
+ */
123
+ function unpause() public virtual {
124
+ require(
125
+ hasRole(PAUSER_ROLE, _msgSender()),
126
+ "ERC20PresetMinterPauser: must have pauser role to unpause"
127
+ );
128
+ _unpause();
129
+ }
130
+
131
+ function _beforeTokenTransfer(
132
+ address from,
133
+ address to,
134
+ uint256 amount
135
+ ) internal virtual override(ERC20Upgradeable, ERC20PausableUpgradeable) {
136
+ super._beforeTokenTransfer(from, to, amount);
137
+ }
138
+
139
+ uint256[50] private __gap;
140
+ }