@gooddollar/goodprotocol 2.0.7-beta.2 → 2.0.7-beta.4

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 (227) hide show
  1. package/artifacts/abis/BuyGDClone.min.json +1 -0
  2. package/artifacts/abis/BuyGDCloneFactory.min.json +1 -0
  3. package/artifacts/abis/IStaticOracle.min.json +1 -0
  4. package/artifacts/abis/ISwapRouter.min.json +1 -0
  5. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  6. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  7. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  8. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  9. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  10. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  11. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  12. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  13. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  14. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  15. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  16. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  17. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  18. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  19. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  20. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  21. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  28. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  30. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  31. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  32. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  33. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  34. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  35. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  36. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
  37. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  38. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  39. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  40. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
  41. package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
  42. package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
  43. package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
  44. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  45. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  46. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  47. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  48. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
  49. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  50. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
  51. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.json +2 -2
  52. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  53. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  54. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.json +2 -2
  55. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  56. package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
  57. package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
  58. package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
  59. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  60. package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
  61. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  62. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
  63. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  64. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.json +2 -2
  65. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  66. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.json +2 -2
  67. package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
  68. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
  69. package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
  70. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  71. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +2 -2
  72. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
  73. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  74. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.json +2 -2
  75. package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
  76. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  77. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  78. package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
  79. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
  80. package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
  81. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  82. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  83. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.json +2 -2
  84. package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
  85. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
  87. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  88. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  89. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  90. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  91. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  92. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  93. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  94. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  95. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  96. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  97. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  98. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  99. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  100. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  101. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  102. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.json +2 -2
  103. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  104. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.json +2 -2
  105. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  106. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  107. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  108. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +2 -2
  109. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  110. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  111. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  112. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.json +2 -2
  113. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  114. package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
  115. package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
  116. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  117. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.json +2 -2
  118. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  119. package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
  120. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  121. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  122. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.json +2 -2
  123. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  124. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.json +2 -2
  125. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
  126. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.json +2 -2
  127. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  128. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.json +2 -2
  129. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  130. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +2 -2
  131. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
  132. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.json +2 -2
  133. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
  134. package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
  135. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
  136. package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
  137. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
  138. package/artifacts/contracts/token/FeesFormula.sol/IFeesFormula.dbg.json +1 -1
  139. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
  140. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
  141. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
  142. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
  143. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
  144. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
  145. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
  146. package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
  147. package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
  148. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
  149. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
  150. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
  151. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  152. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
  153. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  154. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
  155. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  156. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  157. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.json +2 -2
  158. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
  159. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.json +2 -2
  160. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +4 -0
  161. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.json +250 -0
  162. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +4 -0
  163. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.json +75 -0
  164. package/artifacts/contracts/utils/BuyGDClone.sol/IStaticOracle.dbg.json +4 -0
  165. package/artifacts/contracts/utils/BuyGDClone.sol/IStaticOracle.json +79 -0
  166. package/artifacts/contracts/utils/BuyGDClone.sol/ISwapRouter.dbg.json +4 -0
  167. package/artifacts/contracts/utils/BuyGDClone.sol/ISwapRouter.json +205 -0
  168. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  169. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  170. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  171. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  172. package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
  173. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  174. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  175. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  176. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  177. package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
  178. package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
  179. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  180. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  181. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
  182. package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
  183. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  184. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  185. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  186. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  187. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  188. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  189. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  190. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  191. package/contracts/invite/InvitesFuseV2.sol +5 -3
  192. package/contracts/invite/InvitesV2.sol +5 -3
  193. package/contracts/reserve/DistributionHelper.sol +12 -9
  194. package/contracts/utils/BuyGDClone.sol +309 -0
  195. package/package.json +1 -1
  196. package/scripts/upgrades/multichain-temp-fix.ts +129 -0
  197. package/truffle-config.js +4 -0
  198. package/types/BuyGDClone.ts +353 -0
  199. package/types/BuyGDCloneFactory.ts +112 -0
  200. package/types/IStaticOracle.ts +170 -0
  201. package/types/ISwapRouter.ts +298 -0
  202. package/types/factories/AaveStakingFactory__factory.ts +1 -1
  203. package/types/factories/BuyAndBridgeHelper__factory.ts +1 -1
  204. package/types/factories/BuyGDCloneFactory__factory.ts +146 -0
  205. package/types/factories/BuyGDClone__factory.ts +318 -0
  206. package/types/factories/CompoundStakingFactory__factory.ts +1 -1
  207. package/types/factories/DistributionHelperTestHelper__factory.ts +1 -1
  208. package/types/factories/DistributionHelperTest__factory.ts +1 -1
  209. package/types/factories/DistributionHelper__factory.ts +1 -1
  210. package/types/factories/DonationsStaking__factory.ts +1 -1
  211. package/types/factories/ExchangeHelper__factory.ts +1 -1
  212. package/types/factories/GoodAaveStakingV2__factory.ts +1 -1
  213. package/types/factories/GoodAaveStaking__factory.ts +1 -1
  214. package/types/factories/GoodCompoundStakingTest__factory.ts +1 -1
  215. package/types/factories/GoodCompoundStakingV2__factory.ts +1 -1
  216. package/types/factories/GoodCompoundStaking__factory.ts +1 -1
  217. package/types/factories/GoodFundManagerTest__factory.ts +1 -1
  218. package/types/factories/GoodFundManager__factory.ts +1 -1
  219. package/types/factories/GoodReserveCDai__factory.ts +1 -1
  220. package/types/factories/IStaticOracle__factory.ts +91 -0
  221. package/types/factories/ISwapRouter__factory.ts +217 -0
  222. package/types/factories/InvitesFuseV2__factory.ts +1 -1
  223. package/types/factories/InvitesV2__factory.ts +1 -1
  224. package/types/factories/OverMintTesterRegularStake__factory.ts +1 -1
  225. package/types/factories/StakersDistribution__factory.ts +1 -1
  226. package/types/hardhat.d.ts +36 -0
  227. package/types/index.ts +8 -0
@@ -0,0 +1,309 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.8;
4
+ import "@openzeppelin/contracts-upgradeable/proxy/ClonesUpgradeable.sol";
5
+ import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
6
+ import "../Interfaces.sol";
7
+
8
+ //@mean-finance/uniswap-v3-oracle
9
+ interface IStaticOracle {
10
+ /// @notice Will increase observations for all existing pools for the given pair, so they start accruing information for twap calculations
11
+ /// @dev Will revert if there are no pools available for the pair and period combination
12
+ /// @param tokenA One of the pair's tokens
13
+ /// @param tokenB The other of the pair's tokens
14
+ /// @param cardinality The cardinality that will be guaranteed when quoting
15
+ /// @return preparedPools The pools that were prepared
16
+ function prepareAllAvailablePoolsWithCardinality(
17
+ address tokenA,
18
+ address tokenB,
19
+ uint16 cardinality
20
+ ) external returns (address[] memory preparedPools);
21
+
22
+ /// @notice Returns a quote, based on the given tokens and amount, by querying all of the pair's pools
23
+ /// @dev If some pools are not configured correctly for the given period, then they will be ignored
24
+ /// @dev Will revert if there are no pools available/configured for the pair and period combination
25
+ /// @param baseAmount Amount of token to be converted
26
+ /// @param baseToken Address of an ERC20 token contract used as the baseAmount denomination
27
+ /// @param quoteToken Address of an ERC20 token contract used as the quoteAmount denomination
28
+ /// @param period Number of seconds from which to calculate the TWAP
29
+ /// @return quoteAmount Amount of quoteToken received for baseAmount of baseToken
30
+ /// @return queriedPools The pools that were queried to calculate the quote
31
+ function quoteAllAvailablePoolsWithTimePeriod(
32
+ uint128 baseAmount,
33
+ address baseToken,
34
+ address quoteToken,
35
+ uint32 period
36
+ ) external view returns (uint256 quoteAmount, address[] memory queriedPools);
37
+ }
38
+
39
+ // @uniswap/v3-core
40
+ interface ISwapRouter {
41
+ struct ExactInputSingleParams {
42
+ address tokenIn;
43
+ address tokenOut;
44
+ uint24 fee;
45
+ address recipient;
46
+ uint256 amountIn;
47
+ uint256 amountOutMinimum;
48
+ uint160 sqrtPriceLimitX96;
49
+ }
50
+
51
+ /// @notice Swaps `amountIn` of one token for as much as possible of another token
52
+ /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
53
+ /// and swap the entire amount, enabling contracts to send tokens before calling this function.
54
+ /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
55
+ /// @return amountOut The amount of the received token
56
+ function exactInputSingle(
57
+ ExactInputSingleParams calldata params
58
+ ) external payable returns (uint256 amountOut);
59
+
60
+ struct ExactInputParams {
61
+ bytes path;
62
+ address recipient;
63
+ uint256 amountIn;
64
+ uint256 amountOutMinimum;
65
+ }
66
+
67
+ /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
68
+ /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
69
+ /// and swap the entire amount, enabling contracts to send tokens before calling this function.
70
+ /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
71
+ /// @return amountOut The amount of the received token
72
+ function exactInput(
73
+ ExactInputParams calldata params
74
+ ) external payable returns (uint256 amountOut);
75
+
76
+ struct ExactOutputSingleParams {
77
+ address tokenIn;
78
+ address tokenOut;
79
+ uint24 fee;
80
+ address recipient;
81
+ uint256 amountOut;
82
+ uint256 amountInMaximum;
83
+ uint160 sqrtPriceLimitX96;
84
+ }
85
+
86
+ /// @notice Swaps as little as possible of one token for `amountOut` of another token
87
+ /// that may remain in the router after the swap.
88
+ /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
89
+ /// @return amountIn The amount of the input token
90
+ function exactOutputSingle(
91
+ ExactOutputSingleParams calldata params
92
+ ) external payable returns (uint256 amountIn);
93
+
94
+ struct ExactOutputParams {
95
+ bytes path;
96
+ address recipient;
97
+ uint256 amountOut;
98
+ uint256 amountInMaximum;
99
+ }
100
+
101
+ /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
102
+ /// that may remain in the router after the swap.
103
+ /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
104
+ /// @return amountIn The amount of the input token
105
+ function exactOutput(
106
+ ExactOutputParams calldata params
107
+ ) external payable returns (uint256 amountIn);
108
+ }
109
+
110
+ /*
111
+ * @title BuyGDClone
112
+ * @notice This contract allows users to swap Celo or cUSD for GoodDollar (GD) tokens.
113
+ * @dev This contract is a clone of the BuyGD contract, which is used to buy GD tokens on the GoodDollar platform.
114
+ * @dev This contract uses the SwapRouter contract to perform the swaps.
115
+ */
116
+ contract BuyGDClone is Initializable {
117
+ error REFUND_FAILED(uint256);
118
+ error NO_BALANCE();
119
+
120
+ ISwapRouter public immutable router;
121
+ address public constant celo = 0x471EcE3750Da237f93B8E339c536989b8978a438;
122
+ uint32 public immutable twapPeriod;
123
+ address public immutable cusd;
124
+ address public immutable gd;
125
+ IStaticOracle public immutable oracle;
126
+
127
+ address public owner;
128
+
129
+ receive() external payable {}
130
+
131
+ constructor(
132
+ ISwapRouter _router,
133
+ address _cusd,
134
+ address _gd,
135
+ IStaticOracle _oracle
136
+ ) {
137
+ router = _router;
138
+ cusd = _cusd;
139
+ gd = _gd;
140
+ oracle = _oracle;
141
+ twapPeriod = 300; //5 minutes
142
+ }
143
+
144
+ /**
145
+ * @notice Initializes the contract with the owner's address.
146
+ * @param _owner The address of the owner of the contract.
147
+ */
148
+ function initialize(address _owner) external initializer {
149
+ owner = _owner;
150
+ }
151
+
152
+ /**
153
+ * @notice Swaps either Celo or cUSD for GD tokens.
154
+ * @dev If the contract has a balance of Celo, it will swap Celo for GD tokens.
155
+ * @dev If the contract has a balance of cUSD, it will swap cUSD for GD tokens.
156
+ * @param _minAmount The minimum amount of GD tokens to receive from the swap.
157
+ */
158
+ function swap(uint256 _minAmount) external payable {
159
+ uint256 balance = address(this).balance;
160
+ if (balance > 0) return swapCelo(_minAmount);
161
+
162
+ balance = ERC20(cusd).balanceOf(address(this));
163
+ if (balance > 0) return swapCusd(_minAmount);
164
+
165
+ revert NO_BALANCE();
166
+ }
167
+
168
+ /**
169
+ * @notice Swaps Celo for GD tokens.
170
+ * @param _minAmount The minimum amount of GD tokens to receive from the swap.
171
+ */
172
+ function swapCelo(uint256 _minAmount) public payable {
173
+ uint256 gasCosts = msg.sender == owner ? 0 : (block.basefee + 1e9) * 400000;
174
+ uint256 balance = address(this).balance;
175
+
176
+ uint256 minByTwap = minAmountByTWAP(balance, celo);
177
+ _minAmount = _minAmount > minByTwap ? _minAmount : minByTwap;
178
+
179
+ ERC20(celo).approve(address(router), balance);
180
+ ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({
181
+ path: abi.encodePacked(celo, uint24(3000), cusd, uint24(10000), gd),
182
+ recipient: owner,
183
+ amountIn: balance - gasCosts,
184
+ amountOutMinimum: _minAmount
185
+ });
186
+ router.exactInput(params);
187
+ if (msg.sender != owner) {
188
+ (bool sent, ) = msg.sender.call{ value: gasCosts }("");
189
+ if (!sent) revert REFUND_FAILED(gasCosts);
190
+ }
191
+ }
192
+
193
+ /**
194
+ * @notice Swaps cUSD for GD tokens.
195
+ * @param _minAmount The minimum amount of GD tokens to receive from the swap.
196
+ */
197
+ function swapCusd(uint256 _minAmount) public {
198
+ uint256 gasCosts = msg.sender != owner ? 1e17 : 0; //fixed 0.1$
199
+ uint balance = ERC20(cusd).balanceOf(address(this));
200
+
201
+ uint256 minByTwap = minAmountByTWAP(balance, cusd);
202
+ _minAmount = _minAmount > minByTwap ? _minAmount : minByTwap;
203
+
204
+ ERC20(cusd).approve(address(router), balance);
205
+ ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({
206
+ path: abi.encodePacked(cusd, uint24(10000), gd),
207
+ recipient: owner,
208
+ amountIn: balance - gasCosts,
209
+ amountOutMinimum: _minAmount
210
+ });
211
+ router.exactInput(params);
212
+ if (msg.sender != owner) {
213
+ ERC20(cusd).transfer(msg.sender, gasCosts);
214
+ }
215
+ }
216
+
217
+ /**
218
+ * @notice Calculates the minimum amount of tokens that can be received for a given amount of base tokens,
219
+ * based on the time-weighted average price (TWAP) of the token pair over a specified period of time.
220
+ * @param baseAmount The amount of base tokens to swap.
221
+ * @param baseToken The address of the base token.
222
+ * @return minTwap The minimum amount of G$ expected to receive by twap
223
+ */
224
+ function minAmountByTWAP(
225
+ uint256 baseAmount,
226
+ address baseToken
227
+ ) public view returns (uint256 minTwap) {
228
+ uint128 toConvert = uint128(baseAmount);
229
+ uint256 quote;
230
+ if (baseToken == celo) {
231
+ (quote, ) = oracle.quoteAllAvailablePoolsWithTimePeriod(
232
+ toConvert,
233
+ baseToken,
234
+ cusd,
235
+ twapPeriod
236
+ );
237
+ toConvert = uint128(quote);
238
+ }
239
+ (quote, ) = oracle.quoteAllAvailablePoolsWithTimePeriod(
240
+ toConvert,
241
+ cusd,
242
+ gd,
243
+ twapPeriod
244
+ );
245
+ //minAmount should not be 5% under twap (ie we dont expect price movement > 5% in timePeriod)
246
+ return (quote * 95) / 100;
247
+ }
248
+
249
+ /**
250
+ * @notice Recovers tokens accidentally sent to the contract.
251
+ * @param token The address of the token to recover. Use address(0) to recover ETH.
252
+ */
253
+ function recover(address token) external {
254
+ if (token == address(0)) {
255
+ (bool sent, ) = payable(owner).call{ value: address(this).balance }("");
256
+ if (!sent) revert REFUND_FAILED(address(this).balance);
257
+ } else {
258
+ ERC20(token).transfer(owner, ERC20(token).balanceOf(address(this)));
259
+ }
260
+ }
261
+ }
262
+
263
+ /**
264
+ * @title BuyGDCloneFactory
265
+ * @notice Factory contract for creating clones of BuyGDClone contract
266
+ */
267
+ contract BuyGDCloneFactory {
268
+ address immutable impl;
269
+
270
+ /**
271
+ * @notice Initializes the BuyGDCloneFactory contract with the provided parameters.
272
+ * @param _router The address of the SwapRouter contract.
273
+ * @param _cusd The address of the cUSD token contract.
274
+ * @param _gd The address of the GD token contract.
275
+ * @param _oracle The address of the StaticOracle contract.
276
+ */
277
+ constructor(
278
+ ISwapRouter _router,
279
+ address _cusd,
280
+ address _gd,
281
+ IStaticOracle _oracle
282
+ ) {
283
+ impl = address(new BuyGDClone(_router, _cusd, _gd, _oracle));
284
+ }
285
+
286
+ /**
287
+ * @notice Creates a new clone of the BuyGDClone contract with the provided owner address.
288
+ * @param owner The address of the owner of the new BuyGDClone contract.
289
+ * @return The address of the new BuyGDClone contract.
290
+ */
291
+ function create(address owner) external returns (address) {
292
+ bytes32 salt = keccak256(abi.encode(owner));
293
+ address clone = ClonesUpgradeable.cloneDeterministic(impl, salt);
294
+ BuyGDClone(payable(clone)).initialize(owner);
295
+ return clone;
296
+ }
297
+
298
+ /**
299
+ * @notice Predicts the address of a new clone of the BuyGDClone contract with the provided owner address.
300
+ * @param owner The address of the owner of the new BuyGDClone contract.
301
+ * @return The predicted address of the new BuyGDClone contract.
302
+ */
303
+ function predict(address owner) external view returns (address) {
304
+ bytes32 salt = keccak256(abi.encode(owner));
305
+
306
+ return
307
+ ClonesUpgradeable.predictDeterministicAddress(impl, salt, address(this));
308
+ }
309
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddollar/goodprotocol",
3
- "version": "2.0.7-beta.2",
3
+ "version": "2.0.7-beta.4",
4
4
  "description": "GoodDollar Protocol",
5
5
  "engines": {
6
6
  "node": "18.x"
@@ -0,0 +1,129 @@
1
+ /***
2
+ * Disable UBI bridge via multichain
3
+ * Upgrade Plan:
4
+ * - deploy new DistHelper
5
+ * - disable multichain distribution
6
+ * - create new distribution instead to guardians
7
+ */
8
+
9
+ import { network, ethers } from "hardhat";
10
+ import { Contract } from "ethers";
11
+ import { defaultsDeep } from "lodash";
12
+ import { printDeploy, executeViaGuardian, executeViaSafe, verifyProductionSigner } from "../multichain-deploy/helpers";
13
+
14
+ import ProtocolSettings from "../../releases/deploy-settings.json";
15
+
16
+ import dao from "../../releases/deployment.json";
17
+ import { verifyContract } from "../multichain-deploy/helpers";
18
+ let { name: networkName } = network;
19
+
20
+ export const upgrade = async () => {
21
+ const isProduction = networkName.includes("production");
22
+ let [root, ...signers] = await ethers.getSigners();
23
+
24
+ if (isProduction) verifyProductionSigner(root);
25
+
26
+ let guardian = root;
27
+ // simulate on fork
28
+ if (network.name === "hardhat") {
29
+ networkName = "production-mainnet";
30
+ root = await ethers.getImpersonatedSigner("0x5128E3C1f8846724cc1007Af9b4189713922E4BB");
31
+ }
32
+
33
+ let release: { [key: string]: any } = dao[networkName];
34
+ let protocolSettings = defaultsDeep({}, ProtocolSettings[networkName], ProtocolSettings["default"]);
35
+ //make sure safe has enough eth to simulate txs
36
+ if (network.name === "hardhat") {
37
+ guardian = await ethers.getImpersonatedSigner(protocolSettings.guardiansSafe);
38
+ await root.sendTransaction({ value: ethers.constants.WeiPerEther, to: protocolSettings.guardiansSafe });
39
+ }
40
+
41
+ console.log("got signers:", {
42
+ networkName,
43
+ root: root.address,
44
+ guardian: guardian.address,
45
+ balance: await ethers.provider.getBalance(root.address).then(_ => _.toString()),
46
+ guardianBalance: await ethers.provider.getBalance(guardian.address).then(_ => _.toString())
47
+ });
48
+
49
+ let networkEnv = networkName.split("-")[0];
50
+ const fuseNetwork = networkEnv;
51
+ if (networkEnv === "fuse") networkEnv = "development";
52
+ const celoNetwork = networkEnv + "-celo";
53
+
54
+ let f = await ethers.getContractFactory("GoodFundManager");
55
+ console.log("bytecode", f.bytecode.length);
56
+ // let newDistHelper = (await ethers
57
+ // .deployContract("DistributionHelper", { maxFeePerGas: 22e9, nonce: 118 })
58
+ // .then(printDeploy)) as Contract;
59
+ let newDistHelper = (await (await ethers.getContractFactory("DistributionHelper"))
60
+ .deploy({ maxFeePerGas: 15e9, maxPriorityFeePerGas: 1e9 })
61
+ .then(printDeploy)) as Contract;
62
+ if (isProduction) await verifyContract(newDistHelper, "GoodReserveCDai", networkName);
63
+
64
+ const proposalContracts = [
65
+ release.DistributionHelper, //controller -> upgrade disthelper
66
+ release.DistributionHelper, //set new distribution params
67
+ release.DistributionHelper //set new distribution params
68
+ ];
69
+
70
+ const proposalEthValues = proposalContracts.map(_ => 0);
71
+
72
+ const proposalFunctionSignatures = [
73
+ "upgradeTo(address)", //upgrade disthelper
74
+ "addOrUpdateRecipient((uint32,uint32,address,uint8))", // remove multichain
75
+ "addOrUpdateRecipient((uint32,uint32,address,uint8))" // guardians distribution
76
+ ];
77
+
78
+ const proposalFunctionInputs = [
79
+ ethers.utils.defaultAbiCoder.encode(["address"], [newDistHelper.address]),
80
+ ethers.utils.defaultAbiCoder.encode(
81
+ ["uint32", "uint32", "address", "uint8"],
82
+ [0, 42220, dao[celoNetwork].UBIScheme, 1]
83
+ ),
84
+ ethers.utils.defaultAbiCoder.encode(
85
+ ["uint32", "uint32", "address", "uint8"],
86
+ [8182, 42220, release.GuardiansSafe, 3] //ubi to guardians
87
+ )
88
+ ];
89
+
90
+ if (isProduction) {
91
+ await executeViaSafe(
92
+ proposalContracts,
93
+ proposalEthValues,
94
+ proposalFunctionSignatures,
95
+ proposalFunctionInputs,
96
+ protocolSettings.guardiansSafe,
97
+ "mainnet"
98
+ );
99
+ } else {
100
+ //simulation or dev envs
101
+ await executeViaGuardian(
102
+ proposalContracts,
103
+ proposalEthValues,
104
+ proposalFunctionSignatures,
105
+ proposalFunctionInputs,
106
+ guardian,
107
+ networkName
108
+ );
109
+ }
110
+
111
+ if (!isProduction) {
112
+ //check simulation results
113
+ let fm = await ethers.getContractAt("GoodFundManager", release.GoodFundManager);
114
+ let dh = await ethers.getContractAt("DistributionHelper", release.DistributionHelper);
115
+
116
+ console.log(await dh.distributionRecipients(0));
117
+ console.log(await dh.distributionRecipients(1));
118
+ console.log(await dh.distributionRecipients(2));
119
+ let tx = await (await fm.collectInterest(["0x7b7246c78e2f900d17646ff0cb2ec47d6ba10754"], true)).wait();
120
+ let gd = await ethers.getContractAt("IGoodDollar", "0x67C5870b4A41D4Ebef24d2456547A03F1f3e094B");
121
+ const safeBalance = await gd.balanceOf("0xE0c5daa7CC6F88d29505f702a53bb5E67600e7Ec");
122
+ console.log({ safeBalance }, tx.events);
123
+ }
124
+ };
125
+
126
+ export const main = async () => {
127
+ await upgrade().catch(console.log);
128
+ };
129
+ if (process.argv[1].includes("multichain-temp-fix")) main();
package/truffle-config.js CHANGED
@@ -58,6 +58,10 @@ module.exports = {
58
58
  // },
59
59
  // Useful for deploying to a public network.
60
60
  // NB: It's important to wrap the provider as a function.
61
+ "production-mainnet": {
62
+ provider: () => new Web3.providers.HttpProvider(`https://cloudflare-eth.com`),
63
+ network_id: 1
64
+ },
61
65
  kovan: {
62
66
  provider: () => new Web3.providers.HttpProvider(`https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),
63
67
  network_id: 42, // Ropsten's id