@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
@@ -0,0 +1,74 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.8;
4
+
5
+ /* @title ERC677Receiver interface
6
+ */
7
+ interface ERC677Receiver {
8
+ function onTokenTransfer(
9
+ address _from,
10
+ uint256 _value,
11
+ bytes calldata _data
12
+ ) external returns (bool);
13
+ }
14
+
15
+ abstract contract ERC677 {
16
+ event Transfer(
17
+ address indexed from,
18
+ address indexed to,
19
+ uint256 value,
20
+ bytes data
21
+ );
22
+
23
+ function transfer(address to, uint256 value) public virtual returns (bool);
24
+
25
+ /**
26
+ * @dev transfer token to a contract address with additional data if the recipient is a contact.
27
+ * @param _to The address to transfer to.
28
+ * @param _value The amount to be transferred.
29
+ * @param _data The extra data to be passed to the receiving contract.
30
+ * @return true if transfer is successful
31
+ */
32
+ function _transferAndCall(
33
+ address _to,
34
+ uint256 _value,
35
+ bytes memory _data
36
+ ) internal returns (bool) {
37
+ bool res = transfer(_to, _value);
38
+ emit Transfer(msg.sender, _to, _value, _data);
39
+
40
+ if (isContract(_to)) {
41
+ require(contractFallback(_to, _value, _data), "Contract fallback failed");
42
+ }
43
+ return res;
44
+ }
45
+
46
+ /* @dev Contract fallback function. Is called if transferAndCall is called
47
+ * to a contract
48
+ */
49
+ function contractFallback(
50
+ address _to,
51
+ uint256 _value,
52
+ bytes memory _data
53
+ ) private returns (bool) {
54
+ ERC677Receiver receiver = ERC677Receiver(_to);
55
+ require(
56
+ receiver.onTokenTransfer(msg.sender, _value, _data),
57
+ "Contract Fallback failed"
58
+ );
59
+ return true;
60
+ }
61
+
62
+ /* @dev Function to check if given address is a contract
63
+ * @param _addr Address to check
64
+ * @return true if given address is a contract
65
+ */
66
+
67
+ function isContract(address _addr) internal view returns (bool) {
68
+ uint256 length;
69
+ assembly {
70
+ length := extcodesize(_addr)
71
+ }
72
+ return length > 0;
73
+ }
74
+ }
@@ -0,0 +1,10 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.8;
3
+
4
+ interface IFeesFormula {
5
+ function getTxFees(
6
+ uint256 value,
7
+ address sender,
8
+ address recipient
9
+ ) external view returns (uint256 fee, bool senderPays);
10
+ }
@@ -0,0 +1,234 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.8;
4
+ import "./ERC677.sol";
5
+ import "./FeesFormula.sol";
6
+ import "../Interfaces.sol";
7
+ import "./ERC20PresetMinterPauserUpgradeable.sol";
8
+ import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
9
+ import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
10
+
11
+ /**
12
+ * @title The GoodDollar V2 ERC677 token contract
13
+ */
14
+
15
+ contract GoodDollar is
16
+ UUPSUpgradeable,
17
+ ERC677,
18
+ ERC20PresetMinterPauserUpgradeable
19
+ {
20
+ address public feeRecipient;
21
+
22
+ IFeesFormula public formula;
23
+
24
+ IIdentity public identity;
25
+
26
+ uint256 public cap;
27
+
28
+ /**
29
+ * @dev constructor
30
+ * @param _name The name of the token
31
+ * @param _symbol The symbol of the token
32
+ * @param _cap the cap of the token. no cap if 0
33
+ * @param _formula the fee formula contract
34
+ * @param _identity the identity contract
35
+ * @param _feeRecipient the address that receives transaction fees
36
+ */
37
+ function initialize(
38
+ string memory _name,
39
+ string memory _symbol,
40
+ uint256 _cap,
41
+ IFeesFormula _formula,
42
+ IIdentity _identity,
43
+ address _feeRecipient,
44
+ address _owner
45
+ ) public initializer {
46
+ __ERC20PresetMinterPauser_init(_name, _symbol);
47
+ feeRecipient = _feeRecipient;
48
+ identity = _identity;
49
+ formula = _formula;
50
+ cap = _cap;
51
+ if (_owner != _msgSender()) {
52
+ transferOwnership(_owner);
53
+ renounceRole(MINTER_ROLE, _msgSender());
54
+ renounceRole(PAUSER_ROLE, _msgSender());
55
+ }
56
+ }
57
+
58
+ modifier onlyOwner() {
59
+ require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "not owner");
60
+ _;
61
+ }
62
+
63
+ function _authorizeUpgrade(address newImplementation)
64
+ internal
65
+ override
66
+ onlyOwner
67
+ {}
68
+
69
+ function decimals() public view virtual override returns (uint8) {
70
+ return 2;
71
+ }
72
+
73
+ function setFormula(IFeesFormula _formula) external onlyOwner {
74
+ formula = _formula;
75
+ }
76
+
77
+ function setIdentity(IIdentityV2 _identity) external onlyOwner {
78
+ identity = _identity;
79
+ }
80
+
81
+ function transferOwnership(address _owner) public onlyOwner {
82
+ grantRole(DEFAULT_ADMIN_ROLE, _owner);
83
+ renounceRole(DEFAULT_ADMIN_ROLE, _msgSender());
84
+ }
85
+
86
+ function owner() external view returns (address) {
87
+ return getRoleMember(DEFAULT_ADMIN_ROLE, 0);
88
+ }
89
+
90
+ function isMinter(address _minter) external view returns (bool) {
91
+ return hasRole(MINTER_ROLE, _minter);
92
+ }
93
+
94
+ function addMinter(address _minter) external {
95
+ grantRole(MINTER_ROLE, _minter);
96
+ }
97
+
98
+ function renounceMinter() external {
99
+ renounceRole(MINTER_ROLE, _msgSender());
100
+ }
101
+
102
+ function addPauser(address _pauser) external {
103
+ grantRole(PAUSER_ROLE, _pauser);
104
+ }
105
+
106
+ function isPauser(address _pauser) external view returns (bool) {
107
+ return hasRole(PAUSER_ROLE, _pauser);
108
+ }
109
+
110
+ /**
111
+ * @dev Processes fees from given value and sends
112
+ * remainder to given address
113
+ * @param to the address to be sent to
114
+ * @param value the value to be processed and then
115
+ * transferred
116
+ * @return a boolean that indicates if the operation was successful
117
+ */
118
+ function transfer(address to, uint256 value)
119
+ public
120
+ override(ERC20Upgradeable, ERC677)
121
+ returns (bool)
122
+ {
123
+ uint256 bruttoValue = _processFees(msg.sender, to, value);
124
+ return ERC20Upgradeable.transfer(to, bruttoValue);
125
+ }
126
+
127
+ /**
128
+ * @dev Transfer tokens from one address to another
129
+ * @param from The address which you want to send tokens from
130
+ * @param to The address which you want to transfer to
131
+ * @param value the amount of tokens to be transferred
132
+ * @return a boolean that indicates if the operation was successful
133
+ */
134
+ function transferFrom(
135
+ address from,
136
+ address to,
137
+ uint256 value
138
+ ) public override returns (bool) {
139
+ uint256 bruttoValue = _processFees(from, to, value);
140
+ return super.transferFrom(from, to, bruttoValue);
141
+ }
142
+
143
+ /**
144
+ * @dev Processes transfer fees and calls ERC677Token transferAndCall function
145
+ * @param to address to transfer to
146
+ * @param value the amount to transfer
147
+ * @param data The data to pass to transferAndCall
148
+ * @return a bool indicating if transfer function succeeded
149
+ */
150
+ function transferAndCall(
151
+ address to,
152
+ uint256 value,
153
+ bytes calldata data
154
+ ) external returns (bool) {
155
+ uint256 bruttoValue = _processFees(msg.sender, to, value);
156
+ return super._transferAndCall(to, bruttoValue, data);
157
+ }
158
+
159
+ /**
160
+ * @dev Minting function
161
+ * @param to the address that will receive the minted tokens
162
+ * @param value the amount of tokens to mint
163
+ */
164
+ function mint(address to, uint256 value) public override returns (bool) {
165
+ if (cap > 0) {
166
+ require(
167
+ totalSupply() + value <= cap,
168
+ "Cannot increase supply beyond cap"
169
+ );
170
+ }
171
+ return super.mint(to, value);
172
+ }
173
+
174
+ /**
175
+ * @dev Gets the current transaction fees
176
+ * @return fee senderPays that represents the current transaction fees and bool true if sender pays the fee or receiver
177
+ */
178
+ function getFees(uint256 value)
179
+ public
180
+ view
181
+ returns (uint256 fee, bool senderPays)
182
+ {
183
+ return formula.getTxFees(value, address(0), address(0));
184
+ }
185
+
186
+ /**
187
+ * @dev Gets the current transaction fees
188
+ * @return fee senderPays that represents the current transaction fees and bool true if sender pays the fee or receiver
189
+ */
190
+ function getFees(
191
+ uint256 value,
192
+ address sender,
193
+ address recipient
194
+ ) public view returns (uint256 fee, bool senderPays) {
195
+ return formula.getTxFees(value, sender, recipient);
196
+ }
197
+
198
+ /**
199
+ * @dev Sets the address that receives the transactional fees.
200
+ * can only be called by owner
201
+ * @param _feeRecipient The new address to receive transactional fees
202
+ */
203
+ function setFeeRecipient(address _feeRecipient) public onlyOwner {
204
+ feeRecipient = _feeRecipient;
205
+ }
206
+
207
+ /**
208
+ * @dev Sends transactional fees to feeRecipient address from given address
209
+ * @param account The account that sends the fees
210
+ * @param value The amount to subtract fees from
211
+ * @return an uint256 that represents the given value minus the transactional fees
212
+ */
213
+ function _processFees(
214
+ address account,
215
+ address recipient,
216
+ uint256 value
217
+ ) internal returns (uint256) {
218
+ (uint256 txFees, bool senderPays) = getFees(value, account, recipient);
219
+ if (txFees > 0 && !identity.isDAOContract(msg.sender)) {
220
+ require(
221
+ senderPays == false || value + txFees <= balanceOf(account),
222
+ "Not enough balance to pay TX fee"
223
+ );
224
+ if (account == msg.sender) {
225
+ super.transfer(feeRecipient, txFees);
226
+ } else {
227
+ super.transferFrom(account, feeRecipient, txFees);
228
+ }
229
+
230
+ return senderPays ? value : value - txFees;
231
+ }
232
+ return value;
233
+ }
234
+ }
package/hardhat.config.ts CHANGED
@@ -129,20 +129,20 @@ const hhconfig: HardhatUserConfig = {
129
129
  url: "https://rpc.fuse.io/",
130
130
  chainId: 122,
131
131
  gas: 6000000,
132
- gasPrice: 1000000000
132
+ gasPrice: 10000000000
133
133
  },
134
134
  fuseexplorer: {
135
135
  accounts: { mnemonic },
136
136
  url: "https://explorer-node.fuse.io/",
137
137
  chainId: 122,
138
138
  gas: 6000000,
139
- gasPrice: 1000000000
139
+ gasPrice: 10000000000
140
140
  },
141
141
  fusespark: {
142
142
  accounts: { mnemonic },
143
143
  url: "https://rpc.fusespark.io/",
144
144
  gas: 3000000,
145
- gasPrice: 1000000000,
145
+ gasPrice: 10000000000,
146
146
  chainId: 123
147
147
  },
148
148
  "fuse-mainnet": {
@@ -157,7 +157,7 @@ const hhconfig: HardhatUserConfig = {
157
157
  url: "https://rpc.fuse.io/",
158
158
  chainId: 122,
159
159
  gas: 6000000,
160
- gasPrice: 1000000000
160
+ gasPrice: 10000000000
161
161
  },
162
162
  "staging-mainnet": {
163
163
  accounts: { mnemonic },
@@ -170,7 +170,7 @@ const hhconfig: HardhatUserConfig = {
170
170
  accounts: [deployerPrivateKey],
171
171
  url: "https://rpc.fuse.io/",
172
172
  gas: 3000000,
173
- gasPrice: 1000000000,
173
+ gasPrice: 10000000000,
174
174
  chainId: 122
175
175
  },
176
176
  "production-mainnet": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddollar/goodprotocol",
3
- "version": "1.0.29-beta.3",
3
+ "version": "1.0.29-beta.5",
4
4
  "description": "GoodDollar Protocol",
5
5
  "scripts": {
6
6
  "prepack": "npm run minimize",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "homepage": "https://gooddollar.org",
58
58
  "dependencies": {
59
- "@gooddollar/goodcontracts": "^2.6.4",
59
+ "@gooddollar/goodcontracts": "^2.6.6",
60
60
  "@jsier/retrier": "^1.2.4",
61
61
  "@openzeppelin/contracts": "^4.5.0",
62
62
  "@openzeppelin/contracts-upgradeable": "^4.3.2",
@@ -74,6 +74,7 @@
74
74
  "@babel/polyfill": "*",
75
75
  "@babel/preset-env": "*",
76
76
  "@babel/register": "*",
77
+ "@nomicfoundation/hardhat-network-helpers": "^1.0.6",
77
78
  "@nomiclabs/hardhat-ethers": "^2.1.1",
78
79
  "@nomiclabs/hardhat-etherscan": "^3.1.0",
79
80
  "@nomiclabs/hardhat-waffle": "^2.0.3",
@@ -336,7 +336,7 @@
336
336
  "cDAI": "0x0000000000000000000000000000000000000000",
337
337
  "COMP": "0x0000000000000000000000000000000000000000",
338
338
  "GoodDollarMintBurnWrapper": "0x08CaFF2331040c9998a91B50eEee85c4AE953ece",
339
- "GoodDollarStaking": "0xff64BD8b7d730737B39AE831abbc7Afbee13BD8b"
339
+ "GoodDollarStaking": "0x66846F27F86f02b079e9176C7aCc10Cc32d839b2"
340
340
  },
341
341
  "test": {
342
342
  "ProxyFactory": "0x36dE29DB57062A583436Ae071e141404dFE2311C",
@@ -579,10 +579,12 @@
579
579
  "Faucet": "0x256AFcfEcB5C7f62CE46b54492Bb8ac38163672f",
580
580
  "Invites": "0xdC8F0da3f29A3C419a8EEf36665ba2a3EF737B8f",
581
581
  "GoodDollarMintBurnWrapper": "0x3fa553a5a044D5c4f5C70878148568410305f953",
582
- "GoodDollarStaking": "0xCfa54Ad5a00b0AAd3873B4E269Feb331e6293682",
583
582
  "UBIScheme": "0x2d42e6220af2485d1e6E5B4d3661A74671AA9a79",
584
583
  "ClaimersDistribution": "0x80018e6Dd79f6B892Fca6b592746136a3aa5ef6d",
585
- "CompoundVotingMachine": "0x00e44d746F3931cAB775099F4C6451f893BB9378"
584
+ "CompoundVotingMachine": "0x00e44d746F3931cAB775099F4C6451f893BB9378",
585
+ "network": "development-celo",
586
+ "networkId": 42220,
587
+ "GoodDollarStaking": "0x0b13807334C1618D71E5FCe792f40A22007c433A"
586
588
  },
587
589
  "staging-celo": {
588
590
  "ProxyFactory": "0x7e8292481EA8EbEb49e486B7e99c00C50fBa2689",
@@ -599,9 +601,11 @@
599
601
  "Faucet": "0x9803B5811260Bfd1F5b0b0c9eC9aD4bF96D7ea94",
600
602
  "Invites": "0x4E094c2e35e57c90667AbD6D8FE25CE63F4ae00B",
601
603
  "GoodDollarMintBurnWrapper": "0x156Fd9563973EFB94a297B76CFac32CdC92a8d1A",
602
- "GoodDollarStaking": "0xDcB36664440937E4f11002C2471a456AEeD9b7DC",
603
604
  "UBIScheme": "0x04f2Cf8865e2ddfEf0047FdfA7A1b05ade614288",
604
605
  "ClaimersDistribution": "0x83186CE77ef296BA6561096447938AE05D1F026e",
605
- "CompoundVotingMachine": "0xEdde78b850a08B6b8AB3E84f61cD6dC70Cc7f156"
606
+ "CompoundVotingMachine": "0xEdde78b850a08B6b8AB3E84f61cD6dC70Cc7f156",
607
+ "network": "staging-celo",
608
+ "networkId": 42220,
609
+ "GoodDollarStaking": "0x1eF9D3Ed46D4B82E7e8089BDdd00a493e9930f46"
606
610
  }
607
611
  }
@@ -8,10 +8,9 @@ import { network, ethers, upgrades, run } from "hardhat";
8
8
  import { Contract } from "ethers";
9
9
  import { defaultsDeep } from "lodash";
10
10
  // import DAOCreatorABI from "@gooddollar/goodcontracts/build/contracts/DaoCreatorGoodDollar.json";
11
- import DAOCreatorABI from "../../../GoodBootstrap/packages/contracts/build/contracts/DaoCreatorGoodDollarWithRep.json";
11
+ import DAOCreatorABI from "@gooddollar/goodcontracts/build/contracts/DaoCreatorGoodDollarWithTokens.json";
12
12
  // import IdentityABI from "@gooddollar/goodcontracts/build/contracts/Identity.json";
13
13
  import FeeFormulaABI from "@gooddollar/goodcontracts/build/contracts/FeeFormula.json";
14
- import AddFoundersABI from "@gooddollar/goodcontracts/build/contracts/AddFoundersGoodDollarWithRep.json";
15
14
 
16
15
  import { deployDeterministic } from "./helpers";
17
16
  import releaser from "../releaser";
@@ -60,7 +59,8 @@ export const createDAO = async () => {
60
59
  release
61
60
  });
62
61
 
63
- if (network.name.includes("production")) {
62
+ const isProduction = network.name.includes("production");
63
+ if (isProduction) {
64
64
  const txCount = await root.getTransactionCount();
65
65
  if (txCount !== 7) {
66
66
  console.error(
@@ -82,15 +82,6 @@ export const createDAO = async () => {
82
82
  FeeFormulaABI.bytecode,
83
83
  root
84
84
  );
85
- const AddFoundersFactory = new ethers.ContractFactory(
86
- AddFoundersABI.abi,
87
- AddFoundersABI.bytecode,
88
- root
89
- );
90
-
91
- const AddFounders = (await AddFoundersFactory.deploy().then(
92
- printDeploy
93
- )) as Contract;
94
85
 
95
86
  const proxyFactory = await ethers.getContractAt(
96
87
  "ProxyFactory1967",
@@ -112,13 +103,31 @@ export const createDAO = async () => {
112
103
  [daoOwner, ethers.constants.AddressZero]
113
104
  ).then(printDeploy)) as Contract;
114
105
 
115
- const daoCreator = await DAOCreatorFactory.deploy(AddFounders.address);
106
+ const daoCreator = await DAOCreatorFactory.deploy();
116
107
 
117
108
  const FeeFormula = (await deployDeterministic(
118
109
  { name: "FeeFormula", factory: FeeFormulaFactory },
119
110
  [0]
120
111
  ).then(printDeploy)) as Contract;
121
112
 
113
+ const GoodDollar = (await deployDeterministic(
114
+ {
115
+ name: "GoodDollar",
116
+ isUpgradeable: true,
117
+ initializer:
118
+ "initialize(string, string, uint256, address, address, address,address)"
119
+ },
120
+ [
121
+ isProduction ? "GoodDollar" : "GoodDollar Dev",
122
+ "G$",
123
+ 0,
124
+ FeeFormula.address,
125
+ Identity.address,
126
+ ethers.constants.AddressZero,
127
+ daoCreator.address
128
+ ]
129
+ ).then(printDeploy)) as Contract;
130
+
122
131
  const GReputation = (await deployDeterministic(
123
132
  {
124
133
  name: "GReputation",
@@ -138,17 +147,7 @@ export const createDAO = async () => {
138
147
 
139
148
  console.log("creating dao");
140
149
  await daoCreator
141
- .forgeOrg(
142
- "GoodDollar",
143
- "G$",
144
- 0,
145
- FeeFormula.address,
146
- Identity.address,
147
- GReputation.address,
148
- [],
149
- 0,
150
- []
151
- )
150
+ .forgeOrg(GoodDollar.address, GReputation.address, [], 0, [])
152
151
  .then(printDeploy);
153
152
  console.log("forgeOrg done ");
154
153
  const Avatar = new ethers.Contract(
@@ -199,9 +198,8 @@ export const createDAO = async () => {
199
198
 
200
199
  //verifications
201
200
  const Controller = await ethers.getContractAt("Controller", controller);
202
- const GoodDollar = await ethers.getContractAt("IGoodDollar", gd);
203
201
 
204
- if (network.name.includes("production")) {
202
+ if (isProduction) {
205
203
  console.log("renouncing minting rights on production env");
206
204
  await GoodDollar.renounceMinter().then(printDeploy);
207
205
  }
@@ -213,8 +211,12 @@ export const createDAO = async () => {
213
211
 
214
212
  const deployerIsNotGDMinter =
215
213
  (await GoodDollar.isMinter(root.address)) === false;
214
+
216
215
  const avatarIsGDMinter = await GoodDollar.isMinter(Avatar.address);
217
216
 
217
+ const deployerIsNotGDPauser =
218
+ (await GoodDollar.isPauser(root.address)) === false;
219
+
218
220
  const deployerIsNotRepMinter =
219
221
  (await GReputation.hasRole(GReputation.MINTER_ROLE(), root.address)) ===
220
222
  false;
@@ -233,10 +235,26 @@ export const createDAO = async () => {
233
235
  const grepHasDAOSet =
234
236
  (await GReputation.nameService()) === NameService.address;
235
237
 
238
+ const factoryIsNotGoodOwner =
239
+ (await GReputation.hasRole(
240
+ ethers.constants.HashZero,
241
+ proxyFactory.address
242
+ )) === false;
243
+
244
+ const factoryIsNotGDMinter =
245
+ (await GoodDollar.isMinter(proxyFactory.address)) === false;
246
+
247
+ const factoryIsNotGDPauser =
248
+ (await GoodDollar.isPauser(root.address)) === false;
249
+
236
250
  console.log({
237
251
  daoOwnerDaoPermissions,
238
252
  deployerIsNotGDMinter,
239
253
  deployerIsNotRepMinter,
254
+ deployerIsNotGDPauser,
255
+ factoryIsNotGoodOwner,
256
+ factoryIsNotGDMinter,
257
+ factoryIsNotGDPauser,
240
258
  avatarIsRepMinter,
241
259
  daoOwnerIsIdentityOwner,
242
260
  avatarIsGDMinter,
@@ -252,8 +270,7 @@ export const createDAO = async () => {
252
270
  NameService: NameService.address,
253
271
  GReputation: GReputation.address,
254
272
  FeeFormula: FeeFormula.address,
255
- DAOCreator: daoCreator.address,
256
- AddFounders: AddFounders.address
273
+ DAOCreator: daoCreator.address
257
274
  };
258
275
  await releaser(release, network.name, "deployment", false);
259
276
  };
@@ -90,13 +90,7 @@ export const deployHelpers = async () => {
90
90
 
91
91
  const Invites = await deployDeterministic(
92
92
  { name: "InvitesV2", salt: "InvitesV2", isUpgradeable: true },
93
- [
94
- release.Avatar,
95
- release.NameService,
96
- release.GoodDollar,
97
- 10000,
98
- root.address
99
- ]
93
+ [release.NameService, release.GoodDollar, 10000, root.address]
100
94
  );
101
95
 
102
96
  const adminWalletOwner = await AdminWallet.hasRole(
@@ -1,6 +1,7 @@
1
1
  import { run, network, ethers } from "hardhat";
2
- import { omit } from "lodash";
2
+ import { omit, pick, defaultsDeep } from "lodash";
3
3
  import dao from "../../releases/deployment.json";
4
+ import ProtocolSettings from "../../releases/deploy-settings.json";
4
5
 
5
6
  const getImplementationAddress = async addr => {
6
7
  console.log("finding impl for:", addr);
@@ -21,9 +22,15 @@ const getImplementationAddress = async addr => {
21
22
 
22
23
  const main = async () => {
23
24
  const release = dao[network.name];
25
+ let settings = defaultsDeep(
26
+ {},
27
+ ProtocolSettings[network.name],
28
+ ProtocolSettings["default"]
29
+ );
30
+
24
31
  // const impl = await getImplementationAddress(release.AdminWallet);
25
32
  // console.log({ impl, aw: release.AdminWallet });
26
- const toVerify = omit(release, [
33
+ let toVerify = omit(release, [
27
34
  "GoodDollar",
28
35
  "Avatar",
29
36
  "Controller",
@@ -39,7 +46,10 @@ const main = async () => {
39
46
  }).catch(e =>
40
47
  console.log("failed verifying proxy:", identityProxy, e.message)
41
48
  );
49
+
50
+ // toVerify = pick(release, ["GoodDollarStaking"]);
42
51
  for (let key in toVerify) {
52
+ let constructorArguments = [];
43
53
  const address = toVerify[key];
44
54
  // }
45
55
  // const ps = Object.entries(toVerify).map(([key, address]) => {
@@ -66,14 +76,32 @@ const main = async () => {
66
76
  case "Identity":
67
77
  contract = "contracts/identity/IdentityV2.sol:IdentityV2";
68
78
  break;
79
+ case "GoodDollarStaking":
80
+ contract =
81
+ "contracts/governance/GoodDollarStaking.sol:GoodDollarStaking";
82
+ constructorArguments = [
83
+ release.NameService,
84
+ ethers.BigNumber.from(settings.savings.blockAPY),
85
+ ethers.BigNumber.from(settings.savings.blocksPerYear),
86
+ settings.savings.daysUntilUpgrade
87
+ ];
88
+ break;
69
89
  default:
70
90
  contract = undefined;
71
91
  }
72
- console.log("verifying:", address, contract);
73
- await run("verify", {
92
+
93
+ let task = "verify";
94
+ let params = {
74
95
  address,
75
96
  contract
76
- }).catch(e =>
97
+ };
98
+ if (constructorArguments.length > 0) {
99
+ task = "verify:verify";
100
+ params["constructorArguments"] = constructorArguments;
101
+ }
102
+ console.log("verifying:", task, params);
103
+
104
+ await run(task, params).catch(e =>
77
105
  console.log("failed verifying:", address, contract, e.message)
78
106
  );
79
107
  }