@gooddollar/goodprotocol 2.0.13 → 2.0.14-beta.0

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 (489) hide show
  1. package/artifacts/abis/DistributionBridgeMock.min.json +1 -1
  2. package/artifacts/abis/DistributionHelper.min.json +1 -1
  3. package/artifacts/abis/DistributionHelperTest.min.json +1 -1
  4. package/artifacts/abis/DistributionHelperTestHelper.min.json +1 -1
  5. package/artifacts/abis/GasPriceMockOracle.min.json +1 -1
  6. package/artifacts/abis/GoodCompoundStakingTest.min.json +1 -1
  7. package/artifacts/abis/GoodReserveCDai.min.json +1 -1
  8. package/artifacts/abis/IFeesFormula.min.json +1 -1
  9. package/artifacts/abis/ISuperGoodDollar.min.json +1 -1
  10. package/artifacts/abis/ISuperToken.min.json +1 -0
  11. package/artifacts/abis/MultichainFeeFormula.min.json +1 -0
  12. package/artifacts/abis/SuperGoodDollar.min.json +1 -1
  13. package/artifacts/abis/SuperToken.min.json +1 -1
  14. package/artifacts/abis/UBIScheme.min.json +1 -1
  15. package/artifacts/abis/UBISchemeV2.min.json +1 -1
  16. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  17. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  18. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  19. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  20. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  21. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  28. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  30. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  31. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  32. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  33. package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
  34. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  35. package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
  36. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  37. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  38. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  39. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  40. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  41. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  42. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  43. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  44. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  45. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  46. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.json +2 -2
  47. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  48. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.json +2 -2
  49. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
  50. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.json +2 -2
  51. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  52. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.json +2 -2
  53. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  54. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.json +2 -2
  55. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  56. package/artifacts/contracts/governance/GReputation.sol/GReputation.json +2 -2
  57. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
  58. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.json +2 -2
  59. package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
  60. package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
  61. package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
  62. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  63. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.json +2 -2
  64. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  65. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  66. package/artifacts/contracts/governance/Reputation.sol/Reputation.json +2 -2
  67. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  68. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
  69. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  70. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.json +2 -2
  71. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
  72. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.json +2 -2
  73. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  74. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.json +2 -2
  75. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  76. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.json +2 -2
  77. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  78. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.json +2 -2
  79. package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
  80. package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.json +2 -2
  81. package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
  82. package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.json +2 -2
  83. package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
  84. package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.json +2 -2
  85. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.json +2 -2
  87. package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
  88. package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.json +2 -2
  89. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  90. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.json +2 -2
  91. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
  92. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.json +122 -17
  93. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  94. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.json +242 -17
  95. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  96. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.json +256 -18
  97. package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
  98. package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.json +2 -2
  99. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
  100. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.json +2 -2
  101. package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
  102. package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.json +15 -2
  103. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  104. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +6 -6
  105. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
  106. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.json +2 -2
  107. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  108. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.json +2 -2
  109. package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
  110. package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.json +2 -2
  111. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  112. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.json +2 -2
  113. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  114. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.json +2 -2
  115. package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
  116. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
  117. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.json +2 -2
  118. package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
  119. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  120. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.json +2 -2
  121. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  122. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.json +2 -2
  123. package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
  124. package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.json +2 -2
  125. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  126. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.json +2 -2
  127. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
  128. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.json +2 -2
  129. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  130. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.json +2 -2
  131. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  132. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.json +2 -2
  133. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  134. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.json +2 -2
  135. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  136. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.json +2 -2
  137. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  138. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.json +2 -2
  139. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  140. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.json +2 -2
  141. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  142. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.json +2 -2
  143. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  144. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.json +2 -2
  145. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  146. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.json +2 -2
  147. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  148. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.json +2 -2
  149. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  150. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.json +2 -2
  151. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  152. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.json +2 -2
  153. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  154. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.json +2 -2
  155. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  156. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.json +2 -2
  157. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  158. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.json +242 -17
  159. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  160. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.json +2 -2
  161. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  162. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.json +2 -2
  163. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  164. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  165. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +45 -19
  166. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  167. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.json +2 -2
  168. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  169. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.json +2 -2
  170. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  171. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.json +2 -2
  172. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  173. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.json +2 -2
  174. package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
  175. package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
  176. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  177. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.json +2 -2
  178. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  179. package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
  180. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  181. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.json +2 -2
  182. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  183. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.json +2 -2
  184. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  185. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.json +2 -2
  186. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
  187. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.json +2 -2
  188. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  189. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.json +2 -2
  190. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  191. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +2 -2
  192. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
  193. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.json +2 -2
  194. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
  195. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.json +2 -2
  196. package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
  197. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
  198. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.json +2 -2
  199. package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
  200. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
  201. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
  202. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.json +2 -2
  203. package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +4 -0
  204. package/artifacts/contracts/token/{FeesFormula.sol → IFeesFormula.sol}/IFeesFormula.json +1 -1
  205. package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +4 -0
  206. package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.json +58 -0
  207. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
  208. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
  209. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
  210. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
  211. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.json +159 -5
  212. package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +4 -0
  213. package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.json +1609 -0
  214. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
  215. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.json +233 -190
  216. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
  217. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.json +198 -193
  218. package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
  219. package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
  220. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
  221. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
  222. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.json +2 -2
  223. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
  224. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.json +2 -2
  225. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  226. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +20 -2
  227. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
  228. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.json +20 -2
  229. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  230. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.json +2 -2
  231. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
  232. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.json +2 -2
  233. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  234. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.json +2 -2
  235. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  236. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.json +2 -2
  237. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
  238. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.json +2 -2
  239. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
  240. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.json +2 -2
  241. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
  242. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.json +2 -2
  243. package/artifacts/contracts/utils/BuyGDClone.sol/ISwapRouter.dbg.json +1 -1
  244. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  245. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.json +2 -2
  246. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  247. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.json +2 -2
  248. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  249. package/artifacts/contracts/utils/DSMath.sol/DSMath.json +2 -2
  250. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  251. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.json +2 -2
  252. package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
  253. package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.json +2 -2
  254. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  255. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.json +2 -2
  256. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  257. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  258. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  259. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.json +2 -2
  260. package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
  261. package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.json +2 -2
  262. package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
  263. package/artifacts/contracts/utils/MultiCall.sol/Multicall.json +2 -2
  264. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  265. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.json +2 -2
  266. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  267. package/artifacts/contracts/utils/NameService.sol/NameService.json +2 -2
  268. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
  269. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.json +2 -2
  270. package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
  271. package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.json +2 -2
  272. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  273. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  274. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.json +2 -2
  275. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  276. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.json +2 -2
  277. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  278. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.json +2 -2
  279. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  280. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.json +2 -2
  281. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  282. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.json +2 -2
  283. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  284. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.json +2 -2
  285. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  286. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.json +2 -2
  287. package/contracts/invite/InvitesFuseV2.sol +3 -2
  288. package/contracts/mocks/DistributionBridgeMock.sol +42 -15
  289. package/contracts/mocks/DistributionHelperTest.sol +6 -2
  290. package/contracts/mocks/FeesFormularMock.sol +14 -14
  291. package/contracts/mocks/GasPriceMockOracle.sol +7 -1
  292. package/contracts/reserve/DistributionHelper.sol +147 -23
  293. package/contracts/reserve/GoodReserveCDai.sol +39 -47
  294. package/contracts/staking/GoodFundManager.sol +18 -37
  295. package/contracts/token/GoodDollar.sol +11 -16
  296. package/contracts/token/MultichainFeeFormula.sol +34 -0
  297. package/contracts/token/superfluid/ConstantFlowNFTs.sol +3 -0
  298. package/contracts/token/superfluid/ISuperGoodDollar.sol +4 -5
  299. package/contracts/token/superfluid/ISuperToken.sol +464 -0
  300. package/contracts/token/superfluid/SuperGoodDollar.sol +408 -376
  301. package/contracts/token/superfluid/SuperToken.sol +144 -144
  302. package/contracts/ubi/UBIScheme.sol +9 -5
  303. package/contracts/ubi/UBISchemeV2.sol +6 -0
  304. package/contracts/utils/AdminWallet.sol +2 -1
  305. package/contracts/utils/AdminWalletFuse.sol +2 -1
  306. package/contracts/utils/BuyAndBridgeHelper.sol +13 -13
  307. package/contracts/utils/MultiCall.sol +8 -10
  308. package/dist/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.json +2 -2
  309. package/dist/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.json +233 -190
  310. package/dist/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.json +2 -2
  311. package/dist/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.json +2 -2
  312. package/hardhat.config.ts +46 -15
  313. package/package.json +7 -7
  314. package/releases/deploy-settings.json +3 -1
  315. package/releases/deployment.json +6 -2
  316. package/scripts/analytics/faucetStats.ts +19 -15
  317. package/scripts/fv.ts +305 -0
  318. package/scripts/multichain-deploy/1_basicdao-deploy.ts +18 -9
  319. package/scripts/multichain-deploy/helpers.ts +204 -64
  320. package/scripts/proposals/gip-15.ts +427 -0
  321. package/scripts/upgrades/multichain-formula-upgrade.ts +140 -0
  322. package/scripts/upgrades/restoreFunds.ts +91 -0
  323. package/scripts/upgrades/superfluid-nft-celo-gas-token.ts +159 -0
  324. package/scripts/utils.ts +15 -0
  325. package/test/helpers.ts +73 -10
  326. package/test/reserve/DistributionHelper.test.ts +183 -218
  327. package/test/reserve/GoodReserveCDai.distribution.test.ts +21 -144
  328. package/test/reserve/GoodReserveCDai.test.ts +98 -302
  329. package/test/staking/StakingRewards.test.ts +324 -936
  330. package/test/token/CeloGasToken.test.ts +108 -0
  331. package/test/token/SuperGoodDollar.test.ts +15 -6
  332. package/test/utils/AdminWallet.test.ts +97 -38
  333. package/test/utils/BuyAndBridgeHelper.test.ts +9 -33
  334. package/truffle-config.js +24 -6
  335. package/types/ConstantInflowNFT.ts +969 -0
  336. package/types/ConstantOutflowNFT.ts +1031 -0
  337. package/types/DistributionBridgeMock.ts +203 -70
  338. package/types/DistributionHelper.ts +325 -30
  339. package/types/DistributionHelperTest.ts +325 -30
  340. package/types/DistributionHelperTestHelper.ts +355 -35
  341. package/types/FlowNFTBase.ts +887 -0
  342. package/types/GasPriceMockOracle.ts +29 -0
  343. package/types/GoodReserveCDai.ts +79 -20
  344. package/types/IConstantFlowAgreementV1.ts +1391 -0
  345. package/types/IConstantInflowNFT.ts +772 -0
  346. package/types/IConstantOutflowNFT.ts +834 -0
  347. package/types/IERC721.ts +487 -0
  348. package/types/IERC721Metadata.ts +538 -0
  349. package/types/IFlowNFTBase.ts +711 -0
  350. package/types/IInstantDistributionAgreementV1.ts +1183 -0
  351. package/types/ILayerZeroFeeEstimator.ts +136 -0
  352. package/types/IMessagePassingBridge.ts +774 -0
  353. package/types/ISETH.ts +2668 -0
  354. package/types/ISETHCustom.ts +161 -0
  355. package/types/ISuperGoodDollar.ts +277 -25
  356. package/types/ISuperToken.ts +202 -346
  357. package/types/ISuperfluid.ts +7 -2
  358. package/types/ISuperfluidGovernance.ts +40 -5
  359. package/types/MultichainFeeFormula.ts +130 -0
  360. package/types/SuperGoodDollar.ts +383 -349
  361. package/types/SuperToken.ts +319 -344
  362. package/types/UBIScheme.ts +36 -0
  363. package/types/UBISchemeV2.ts +36 -0
  364. package/types/factories/AaveMock__factory.ts +1 -1
  365. package/types/factories/AaveStakingFactory__factory.ts +1 -1
  366. package/types/factories/AaveUSDMockOracle__factory.ts +1 -1
  367. package/types/factories/AdminWalletFuse__factory.ts +1 -1
  368. package/types/factories/AdminWallet__factory.ts +1 -1
  369. package/types/factories/BancorFormula__factory.ts +1 -1
  370. package/types/factories/BaseShareFieldV2__factory.ts +1 -1
  371. package/types/factories/BaseShareField__factory.ts +1 -1
  372. package/types/factories/BatUSDMockOracle__factory.ts +1 -1
  373. package/types/factories/BuyAndBridgeHelper__factory.ts +1 -1
  374. package/types/factories/BuyGDCloneFactory__factory.ts +1 -1
  375. package/types/factories/BuyGDClone__factory.ts +1 -1
  376. package/types/factories/CBATMock__factory.ts +1 -1
  377. package/types/factories/CDAILowWorthMock__factory.ts +1 -1
  378. package/types/factories/CDAIMock__factory.ts +1 -1
  379. package/types/factories/CDAINonMintableMock__factory.ts +1 -1
  380. package/types/factories/CDecimalsMock__factory.ts +1 -1
  381. package/types/factories/CSDTMock__factory.ts +1 -1
  382. package/types/factories/CUSDCMock__factory.ts +1 -1
  383. package/types/factories/ClaimersDistribution__factory.ts +1 -1
  384. package/types/factories/CompUSDMockOracle__factory.ts +1 -1
  385. package/types/factories/CompoundStakingFactory__factory.ts +1 -1
  386. package/types/factories/CompoundVotingMachine__factory.ts +1 -1
  387. package/types/factories/ConstantInflowNFT__factory.ts +758 -0
  388. package/types/factories/ConstantOutflowNFT__factory.ts +817 -0
  389. package/types/factories/DAIMock__factory.ts +1 -1
  390. package/types/factories/DAOContract__factory.ts +1 -1
  391. package/types/factories/DAOUpgradeableContract__factory.ts +1 -1
  392. package/types/factories/DaiEthPriceMockOracle__factory.ts +1 -1
  393. package/types/factories/DecimalsMock__factory.ts +1 -1
  394. package/types/factories/DistributionBridgeMock__factory.ts +121 -16
  395. package/types/factories/DistributionHelperTestHelper__factory.ts +255 -17
  396. package/types/factories/DistributionHelperTest__factory.ts +241 -16
  397. package/types/factories/DistributionHelper__factory.ts +241 -16
  398. package/types/factories/DonationsStaking__factory.ts +1 -1
  399. package/types/factories/ERC1967Proxy__factory.ts +1 -1
  400. package/types/factories/ERC20PresetMinterPauserUpgradeable__factory.ts +1 -1
  401. package/types/factories/ERC20Upgradeable__factory.ts +1 -1
  402. package/types/factories/EthUSDMockOracle__factory.ts +1 -1
  403. package/types/factories/EventsEmitter__factory.ts +1 -1
  404. package/types/factories/ExchangeHelper__factory.ts +1 -1
  405. package/types/factories/Faucet__factory.ts +1 -1
  406. package/types/factories/FeesFormulaMock__factory.ts +1 -1
  407. package/types/factories/FlowNFTBase__factory.ts +642 -0
  408. package/types/factories/FuseFaucetV2__factory.ts +1 -1
  409. package/types/factories/FuseFaucet__factory.ts +1 -1
  410. package/types/factories/FuseStakingV3__factory.ts +1 -1
  411. package/types/factories/GDFaucet__factory.ts +1 -1
  412. package/types/factories/GReputation__factory.ts +1 -1
  413. package/types/factories/GasPriceMockOracle__factory.ts +14 -1
  414. package/types/factories/GoodAaveStakingV2__factory.ts +1 -1
  415. package/types/factories/GoodAaveStaking__factory.ts +1 -1
  416. package/types/factories/GoodCompoundStakingTest__factory.ts +1 -1
  417. package/types/factories/GoodCompoundStakingV2__factory.ts +1 -1
  418. package/types/factories/GoodCompoundStaking__factory.ts +1 -1
  419. package/types/factories/GoodDollarMintBurnWrapper__factory.ts +1 -1
  420. package/types/factories/GoodDollarStakingMock__factory.ts +1 -1
  421. package/types/factories/GoodDollarStaking__factory.ts +1 -1
  422. package/types/factories/GoodDollar__factory.ts +1 -1
  423. package/types/factories/GoodFundManagerTest__factory.ts +1 -1
  424. package/types/factories/GoodFundManager__factory.ts +1 -1
  425. package/types/factories/GoodMarketMaker__factory.ts +1 -1
  426. package/types/factories/GoodReserveCDai__factory.ts +44 -18
  427. package/types/factories/GovernanceStaking__factory.ts +1 -1
  428. package/types/factories/IConstantFlowAgreementV1__factory.ts +1064 -0
  429. package/types/factories/IConstantInflowNFT__factory.ts +551 -0
  430. package/types/factories/IConstantOutflowNFT__factory.ts +614 -0
  431. package/types/factories/IERC721Metadata__factory.ts +356 -0
  432. package/types/factories/IERC721__factory.ts +308 -0
  433. package/types/factories/IFlowNFTBase__factory.ts +512 -0
  434. package/types/factories/IInstantDistributionAgreementV1__factory.ts +1015 -0
  435. package/types/factories/ILayerZeroFeeEstimator__factory.ts +79 -0
  436. package/types/factories/IMessagePassingBridge__factory.ts +446 -0
  437. package/types/factories/ISETHCustom__factory.ts +56 -0
  438. package/types/factories/ISETH__factory.ts +1866 -0
  439. package/types/factories/ISuperGoodDollar__factory.ts +159 -5
  440. package/types/factories/ISuperTokenFactory__factory.ts +5 -0
  441. package/types/factories/ISuperToken__factory.ts +130 -191
  442. package/types/factories/ISuperfluidGovernance__factory.ts +23 -5
  443. package/types/factories/ISuperfluid__factory.ts +10 -0
  444. package/types/factories/IdentityFix__factory.ts +1 -1
  445. package/types/factories/IdentityMock__factory.ts +1 -1
  446. package/types/factories/IdentityV2__factory.ts +1 -1
  447. package/types/factories/IncentiveControllerMock__factory.ts +1 -1
  448. package/types/factories/InvitesFuseV2__factory.ts +1 -1
  449. package/types/factories/InvitesV1__factory.ts +1 -1
  450. package/types/factories/InvitesV2__factory.ts +1 -1
  451. package/types/factories/LendingPoolMock__factory.ts +1 -1
  452. package/types/factories/Multicall__factory.ts +1 -1
  453. package/types/factories/MultichainBridgeHelper__factory.ts +1 -1
  454. package/types/factories/MultichainFeeFormula__factory.ts +113 -0
  455. package/types/factories/MultichainRouterMock__factory.ts +1 -1
  456. package/types/factories/NameService__factory.ts +1 -1
  457. package/types/factories/OneTimePaymentsV2__factory.ts +1 -1
  458. package/types/factories/OneTimePayments__factory.ts +1 -1
  459. package/types/factories/OverMintTesterRegularStake__factory.ts +1 -1
  460. package/types/factories/OverMintTester__factory.ts +1 -1
  461. package/types/factories/PayableMock__factory.ts +1 -1
  462. package/types/factories/ProtocolUpgradeFuseRecover__factory.ts +1 -1
  463. package/types/factories/ProtocolUpgradeFuse__factory.ts +1 -1
  464. package/types/factories/ProtocolUpgradeRecover__factory.ts +1 -1
  465. package/types/factories/ProtocolUpgrade__factory.ts +1 -1
  466. package/types/factories/ProxyFactory1967__factory.ts +1 -1
  467. package/types/factories/ReputationTestHelper__factory.ts +1 -1
  468. package/types/factories/Reputation__factory.ts +1 -1
  469. package/types/factories/SixteenDecimalsTokenMock__factory.ts +1 -1
  470. package/types/factories/StakersDistribution__factory.ts +1 -1
  471. package/types/factories/StakingMockFixedAPY__factory.ts +1 -1
  472. package/types/factories/SuperGoodDollar__factory.ts +230 -187
  473. package/types/factories/SuperToken__factory.ts +197 -192
  474. package/types/factories/SwapHelperTest__factory.ts +1 -1
  475. package/types/factories/TwentyDecimalsTokenMock__factory.ts +1 -1
  476. package/types/factories/UBISchemeV2__factory.ts +19 -1
  477. package/types/factories/UBIScheme__factory.ts +19 -1
  478. package/types/factories/USDCMock__factory.ts +1 -1
  479. package/types/factories/UUPSProxy__factory.ts +1 -1
  480. package/types/factories/UniswapV2SwapHelper__factory.ts +1 -1
  481. package/types/factories/UpgradableMock2__factory.ts +1 -1
  482. package/types/factories/UpgradableMock3__factory.ts +1 -1
  483. package/types/factories/UpgradableMock4__factory.ts +1 -1
  484. package/types/factories/UpgradableMock__factory.ts +1 -1
  485. package/types/hardhat.d.ts +166 -4
  486. package/types/index.ts +34 -4
  487. package/yarn.lock +1288 -719
  488. package/artifacts/contracts/token/FeesFormula.sol/IFeesFormula.dbg.json +0 -4
  489. /package/contracts/token/{FeesFormula.sol → IFeesFormula.sol} +0 -0
@@ -15,8 +15,12 @@ contract DistributionHelperTest is DistributionHelper {
15
15
  }
16
16
 
17
17
  contract DistributionHelperTestHelper is DistributionHelper {
18
- function setBridges(address _fuseBridge, address _multiBridge) external {
18
+ function setOracle(IStaticOracle oracle) external {
19
+ STATIC_ORACLE = oracle;
20
+ }
21
+
22
+ function setBridges(address _fuseBridge, address _mpbBridge) external {
19
23
  fuseBridge = _fuseBridge;
20
- multiChainBridge = IMultichainRouter(_multiBridge);
24
+ mpbBridge = IMessagePassingBridge(_mpbBridge);
21
25
  }
22
26
  }
@@ -1,21 +1,21 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity >=0.8;
3
3
 
4
- import "../token/FeesFormula.sol";
4
+ import "../token/IFeesFormula.sol";
5
5
 
6
6
  contract FeesFormulaMock is IFeesFormula {
7
- uint256 public immutable feePerMillion;
7
+ uint256 public immutable feePerMillion;
8
8
 
9
- constructor(uint256 feePerMillion_) {
10
- require(feePerMillion_ <= 1e6, "fee higher than 100%");
11
- feePerMillion = feePerMillion_;
12
- }
9
+ constructor(uint256 feePerMillion_) {
10
+ require(feePerMillion_ <= 1e6, "fee higher than 100%");
11
+ feePerMillion = feePerMillion_;
12
+ }
13
13
 
14
- function getTxFees(
15
- uint256 value,
16
- address sender,
17
- address recipient
18
- ) external view returns (uint256 fee, bool senderPays) {
19
- return (value * feePerMillion / 1E6, true);
20
- }
21
- }
14
+ function getTxFees(
15
+ uint256 value,
16
+ address sender,
17
+ address recipient
18
+ ) external view returns (uint256 fee, bool senderPays) {
19
+ return ((value * feePerMillion) / 1E6, true);
20
+ }
21
+ }
@@ -3,7 +3,13 @@
3
3
  pragma solidity >=0.8.0;
4
4
 
5
5
  contract GasPriceMockOracle {
6
+ int price = 2500000000;
7
+
6
8
  function latestAnswer() public view returns (int256) {
7
- return 2500000000;
9
+ return price;
10
+ }
11
+
12
+ function setPrice(int _price) external {
13
+ price = _price;
8
14
  }
9
15
  }
@@ -5,8 +5,11 @@ pragma solidity ^0.8;
5
5
  import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
6
6
  import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
7
7
  import "@openzeppelin/contracts/utils/math/Math.sol";
8
+ import "@mean-finance/uniswap-v3-oracle/solidity/interfaces/IStaticOracle.sol";
9
+ import "@gooddollar/bridge-contracts/contracts/messagePassingBridge/IMessagePassingBridge.sol";
8
10
 
9
11
  import "../utils/DAOUpgradeableContract.sol";
12
+ import "./ExchangeHelper.sol";
10
13
 
11
14
  // import "hardhat/console.sol";
12
15
 
@@ -19,11 +22,29 @@ contract DistributionHelper is
19
22
  DAOUpgradeableContract,
20
23
  AccessControlEnumerableUpgradeable
21
24
  {
25
+ bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");
26
+
27
+ error FEE_LIMIT(uint256 fee);
28
+
29
+ //IStaticOracle(0xB210CE856631EeEB767eFa666EC7C1C57738d438); //@mean-finance/uniswap-v3-oracle
30
+
31
+ address public constant CELO_TOKEN =
32
+ 0x3294395e62F4eB6aF3f1Fcf89f5602D90Fb3Ef69;
33
+
34
+ address public constant FUSE_TOKEN =
35
+ 0x970B9bB2C0444F5E81e9d0eFb84C8ccdcdcAf84d;
36
+
37
+ address public constant USDC_TOKEN =
38
+ 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
39
+
40
+ address public constant WETH_TOKEN =
41
+ 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
42
+
22
43
  enum TransferType {
23
44
  FuseBridge,
24
- MultichainBridge,
25
- TransferAndCall,
26
- Transfer
45
+ LayerZeroBridge,
46
+ AxelarBridge,
47
+ Contract
27
48
  }
28
49
 
29
50
  struct DistributionRecipient {
@@ -33,11 +54,22 @@ contract DistributionHelper is
33
54
  TransferType transferType;
34
55
  }
35
56
 
57
+ struct FeeSettings {
58
+ uint128 axelarBaseFeeUSD;
59
+ uint128 bridgeExecuteGas;
60
+ uint128 targetChainGasPrice;
61
+ uint128 maxFee;
62
+ uint128 minBalanceForFees;
63
+ uint8 percentageToSellForFee;
64
+ }
65
+
36
66
  DistributionRecipient[] public distributionRecipients;
37
67
 
38
68
  address public fuseBridge;
39
- IMultichainRouter public multiChainBridge;
40
- address public anyGoodDollar; //G$ multichain wrapper on ethereum
69
+ IMessagePassingBridge public mpbBridge;
70
+ FeeSettings public feeSettings; //previously anyGoodDollar_unused; //kept for storage layout upgrades
71
+
72
+ IStaticOracle public STATIC_ORACLE;
41
73
 
42
74
  event Distribution(
43
75
  uint256 distributed,
@@ -48,19 +80,81 @@ contract DistributionHelper is
48
80
  event RecipientUpdated(DistributionRecipient recipient, uint256 index);
49
81
  event RecipientAdded(DistributionRecipient recipient, uint256 index);
50
82
 
83
+ receive() external payable {}
84
+
51
85
  function initialize(INameService _ns) external initializer {
52
86
  __AccessControlEnumerable_init();
53
87
  setDAO(_ns);
54
88
  _setupRole(DEFAULT_ADMIN_ROLE, avatar); //this needs to happen after setDAO for avatar to be non empty
89
+ _setupRole(GUARDIAN_ROLE, avatar);
55
90
  updateAddresses();
56
91
  }
57
92
 
58
93
  function updateAddresses() public {
59
94
  fuseBridge = nameService.getAddress("BRIDGE_CONTRACT");
60
- multiChainBridge = IMultichainRouter(
61
- nameService.getAddress("MULTICHAIN_ROUTER")
95
+ mpbBridge = IMessagePassingBridge(
96
+ nameService.getAddress("MPBBRIDGE_CONTRACT")
97
+ );
98
+ STATIC_ORACLE = IStaticOracle(0xB210CE856631EeEB767eFa666EC7C1C57738d438); //@mean-finance/uniswap-v3-oracle
99
+ _setupRole(GUARDIAN_ROLE, avatar);
100
+ _setupRole(GUARDIAN_ROLE, 0xE0c5daa7CC6F88d29505f702a53bb5E67600e7Ec); //guardians on ethereum
101
+ }
102
+
103
+ function setFeeSettings(
104
+ FeeSettings memory _feeData
105
+ ) external onlyRole(GUARDIAN_ROLE) {
106
+ feeSettings = _feeData;
107
+ }
108
+
109
+ function getTargetChainRefundAddress(
110
+ uint256 chainId
111
+ ) public pure returns (address) {
112
+ if (chainId == 122) return 0xf96dADc6D71113F6500e97590760C924dA1eF70e; //avatar on fuse
113
+ if (chainId == 42220) return 0x495d133B938596C9984d462F007B676bDc57eCEC; //avatar on celo
114
+
115
+ revert("refund chainId");
116
+ }
117
+
118
+ function getTargetChainGasInEth(
119
+ uint256 gasCostWei,
120
+ uint256 chainId
121
+ ) public view returns (uint256 quote) {
122
+ address baseToken;
123
+ if (chainId == 122) baseToken = FUSE_TOKEN;
124
+ else if (chainId == 42220) baseToken = CELO_TOKEN;
125
+ else revert("baseToken chainId");
126
+
127
+ uint24[] memory fees = new uint24[](1);
128
+ fees[0] = 3000;
129
+ (quote, ) = STATIC_ORACLE.quoteSpecificFeeTiersWithTimePeriod(
130
+ uint128(gasCostWei),
131
+ baseToken,
132
+ WETH_TOKEN,
133
+ fees,
134
+ 60 //last 1 minute
62
135
  );
63
- anyGoodDollar = nameService.getAddress("MULTICHAIN_ANYGOODDOLLAR");
136
+ }
137
+
138
+ function getAxelarFee(
139
+ uint256 targetChainId
140
+ ) public view returns (uint256 feeInEth) {
141
+ uint256 executeFeeInEth = getTargetChainGasInEth(
142
+ feeSettings.bridgeExecuteGas * feeSettings.targetChainGasPrice,
143
+ targetChainId
144
+ );
145
+
146
+ uint24[] memory fees = new uint24[](1);
147
+ fees[0] = 500;
148
+ (uint256 baseFeeInEth, ) = STATIC_ORACLE
149
+ .quoteSpecificFeeTiersWithTimePeriod(
150
+ uint128(feeSettings.axelarBaseFeeUSD) / 1e12, //reduce to usdc 6 decimals
151
+ USDC_TOKEN,
152
+ WETH_TOKEN,
153
+ fees,
154
+ 60 //last 1 minute
155
+ );
156
+
157
+ feeInEth = ((baseFeeInEth + executeFeeInEth) * 110) / 100; //add 10%
64
158
  }
65
159
 
66
160
  /**
@@ -73,6 +167,13 @@ contract DistributionHelper is
73
167
  uint256 toDistribute = nativeToken().balanceOf(address(this));
74
168
  if (toDistribute == 0) return;
75
169
 
170
+ if (address(this).balance < feeSettings.minBalanceForFees) {
171
+ uint256 gdToSellfForFee = (toDistribute *
172
+ feeSettings.percentageToSellForFee) / 100;
173
+ toDistribute -= gdToSellfForFee;
174
+ buyNativeWithGD(gdToSellfForFee);
175
+ }
176
+
76
177
  uint256 totalDistributed;
77
178
  for (uint256 i = 0; i < distributionRecipients.length; i++) {
78
179
  DistributionRecipient storage r = distributionRecipients[i];
@@ -98,14 +199,7 @@ contract DistributionHelper is
98
199
  function addOrUpdateRecipient(
99
200
  DistributionRecipient memory _recipient
100
201
  ) external onlyRole(DEFAULT_ADMIN_ROLE) {
101
- // console.log("addOrUpdate addr: %s", _recipient.addr);
102
202
  for (uint256 i = 0; i < distributionRecipients.length; i++) {
103
- // console.log(
104
- // "addOrUpdate addr: %s idx: %s, recipient: %s",
105
- // _recipient.addr,
106
- // i,
107
- // distributionRecipients[i].addr
108
- // );
109
203
  if (distributionRecipients[i].addr == _recipient.addr) {
110
204
  distributionRecipients[i] = _recipient;
111
205
  emit RecipientUpdated(_recipient, i);
@@ -132,18 +226,48 @@ contract DistributionHelper is
132
226
  _amount,
133
227
  abi.encodePacked(_recipient.addr)
134
228
  );
135
- } else if (_recipient.transferType == TransferType.MultichainBridge) {
136
- nativeToken().approve(address(multiChainBridge), _amount);
137
- multiChainBridge.anySwapOutUnderlying(
138
- anyGoodDollar,
229
+ } else if (_recipient.transferType == TransferType.LayerZeroBridge) {
230
+ nativeToken().approve(address(mpbBridge), _amount);
231
+ (uint256 lzFee, ) = ILayerZeroFeeEstimator(address(mpbBridge))
232
+ .estimateSendFee(
233
+ mpbBridge.toLzChainId(_recipient.chainId),
234
+ address(this),
235
+ _recipient.addr,
236
+ _amount,
237
+ false,
238
+ abi.encodePacked(uint16(1), uint256(400000)) // 400k gas to execute bridge at target chain
239
+ );
240
+ if (lzFee > feeSettings.maxFee) revert FEE_LIMIT(lzFee);
241
+
242
+ mpbBridge.bridgeToWithLz{ value: lzFee }(
139
243
  _recipient.addr,
244
+ _recipient.chainId,
140
245
  _amount,
141
- _recipient.chainId
246
+ ""
142
247
  );
143
- } else if (_recipient.transferType == TransferType.TransferAndCall) {
248
+ } else if (_recipient.transferType == TransferType.AxelarBridge) {
249
+ nativeToken().approve(address(mpbBridge), _amount);
250
+ uint256 axlFee = getAxelarFee(_recipient.chainId);
251
+
252
+ if (axlFee > feeSettings.maxFee) revert FEE_LIMIT(axlFee);
253
+
254
+ mpbBridge.bridgeToWithAxelar{ value: axlFee }(
255
+ _recipient.addr,
256
+ _recipient.chainId,
257
+ _amount,
258
+ getTargetChainRefundAddress(_recipient.chainId)
259
+ );
260
+ } else if (_recipient.transferType == TransferType.Contract) {
144
261
  nativeToken().transferAndCall(_recipient.addr, _amount, "");
145
- } else if (_recipient.transferType == TransferType.Transfer) {
146
- nativeToken().transfer(_recipient.addr, _amount);
147
262
  }
148
263
  }
264
+
265
+ function buyNativeWithGD(uint256 amountToSell) internal {
266
+ address[] memory path = new address[](2);
267
+ path[0] = nameService.getAddress("DAI");
268
+ path[1] = address(0);
269
+ address exchg = nameService.getAddress("EXCHANGE_HELPER");
270
+ nativeToken().approve(exchg, amountToSell);
271
+ ExchangeHelper(exchg).sell(path, amountToSell, 0, 0, address(this));
272
+ }
149
273
  }
@@ -54,9 +54,11 @@ contract GoodReserveCDai is
54
54
  /// @dev mark if user claimed his GDX
55
55
  mapping(address => bool) public isClaimedGDX;
56
56
 
57
- uint32 public nonUbiBps; //how much of expansion G$ to allocate for non Ubi causes
57
+ uint32 private unused_nonUbiBps; //keep for storage structure upgrades. //how much of expansion G$ to allocate for non Ubi causes
58
58
  DistributionHelper public distributionHelper; //in charge of distributing non UBI to different recipients
59
59
 
60
+ bool public gdxDisabled;
61
+ bool public discountDisabled;
60
62
  // Emits when new GD tokens minted
61
63
  event UBIMinted(
62
64
  //epoch of UBI
@@ -123,11 +125,10 @@ contract GoodReserveCDai is
123
125
 
124
126
  event DistributionHelperSet(address distributionHelper, uint32 bps);
125
127
 
126
- function initialize(INameService _ns, bytes32 _gdxAirdrop)
127
- public
128
- virtual
129
- initializer
130
- {
128
+ function initialize(
129
+ INameService _ns,
130
+ bytes32 _gdxAirdrop
131
+ ) public virtual initializer {
131
132
  __ERC20PresetMinterPauser_init("GDX", "G$X");
132
133
  setDAO(_ns);
133
134
 
@@ -148,12 +149,6 @@ contract GoodReserveCDai is
148
149
  gdxAirdrop = _gdxAirdrop;
149
150
  }
150
151
 
151
- //no longer required
152
- // function setGDXAirdrop(bytes32 _airdrop) external {
153
- // _onlyAvatar();
154
- // gdxAirdrop = _airdrop;
155
- // }
156
-
157
152
  /// @dev GDX decimals
158
153
  function decimals() public pure override returns (uint8) {
159
154
  return 2;
@@ -264,11 +259,15 @@ contract GoodReserveCDai is
264
259
  }
265
260
  _target = _target == address(0x0) ? msg.sender : _target;
266
261
  //discount on exit contribution based on gdx
267
- uint256 gdx = balanceOf(_seller);
268
- uint256 discount = gdx <= _gdAmount ? gdx : _gdAmount;
269
262
 
270
- //burn gdx used for discount
271
- if (discount > 0) _burn(_seller, discount);
263
+ uint256 discount;
264
+ if (discountDisabled == false) {
265
+ uint256 gdx = balanceOf(_seller);
266
+ discount = gdx <= _gdAmount ? gdx : _gdAmount;
267
+
268
+ //burn gdx used for discount
269
+ if (discount > 0) _burn(_seller, discount);
270
+ }
272
271
 
273
272
  uint256 contributionAmount = 0;
274
273
  uint256 gdAmountTemp = _gdAmount; // to prevent stack too deep errors
@@ -352,7 +351,7 @@ contract GoodReserveCDai is
352
351
 
353
352
  /// @dev helper to mint GDX to make _mint more verbose
354
353
  function _mintGDX(address _to, uint256 _gdx) internal {
355
- _mint(_to, _gdx);
354
+ if (gdxDisabled == false) _mint(_to, _gdx);
356
355
  }
357
356
 
358
357
  /**
@@ -377,31 +376,15 @@ contract GoodReserveCDai is
377
376
  );
378
377
  uint256 gdExpansionToMint = getMarketMaker().mintExpansion(_interestToken);
379
378
 
380
- uint256 nonUBI;
381
-
382
379
  lastMinted = block.number;
383
380
  uint256 gdUBI = gdInterestToMint + gdExpansionToMint;
384
381
 
385
- // console.log(
386
- // "nonubi %s, sender: %s, fundManager: %s",
387
- // nonUbiBps,
388
- // _msgSender(),
389
- // nameService.getAddress("FUND_MANAGER")
390
- // );
391
-
392
- if (nonUbiBps > 0 && address(distributionHelper) != address(0)) {
393
- nonUBI = (gdExpansionToMint * nonUbiBps) / 10000;
394
- gdUBI -= nonUBI;
395
- _mintGoodDollars(address(distributionHelper), nonUBI, false);
396
- bool success = true;
397
- try distributionHelper.onDistribution(nonUBI) {} catch {
398
- success = false;
399
- } //should not prevent mintUBI from completing
400
- emit NonUBIMinted(address(distributionHelper), nonUBI, success);
401
- }
382
+ require(address(distributionHelper) != address(0), "helper not set");
383
+ _mintGoodDollars(address(distributionHelper), gdUBI, false); //mintGoodDollars enforces that only minter can call mintUBI
384
+
385
+ // if bridging fails this will revert. this is expected behavior
386
+ distributionHelper.onDistribution(gdUBI);
402
387
 
403
- //this enforces who can call the public mintUBI method. only an address with permissions at reserve of RESERVE_MINTER_ROLE
404
- _mintGoodDollars(nameService.getAddress("FUND_MANAGER"), gdUBI, false);
405
388
  emit UBIMinted(
406
389
  lastMinted,
407
390
  address(_interestToken),
@@ -417,15 +400,11 @@ contract GoodReserveCDai is
417
400
  /**
418
401
  * @notice allows Avatar to change or set the distribution helper
419
402
  * @param _helper address of distributionhelper contract
420
- * @param _bps how much of UBI to transfer in basis points
421
403
  */
422
- function setDistributionHelper(DistributionHelper _helper, uint32 _bps)
423
- external
424
- {
404
+ function setDistributionHelper(DistributionHelper _helper) external {
425
405
  _onlyAvatar();
426
406
  distributionHelper = _helper;
427
- nonUbiBps = _bps;
428
- emit DistributionHelperSet(address(_helper), _bps);
407
+ emit DistributionHelperSet(address(_helper), 10000);
429
408
  }
430
409
 
431
410
  /**
@@ -436,13 +415,26 @@ contract GoodReserveCDai is
436
415
  * @param _nom The numerator to calculate the global `reserveRatioDailyExpansion` from
437
416
  * @param _denom The denominator to calculate the global `reserveRatioDailyExpansion` from
438
417
  */
439
- function setReserveRatioDailyExpansion(uint256 _nom, uint256 _denom)
440
- external
441
- {
418
+ function setReserveRatioDailyExpansion(
419
+ uint256 _nom,
420
+ uint256 _denom
421
+ ) external {
442
422
  _onlyAvatar();
443
423
  getMarketMaker().setReserveRatioDailyExpansion(_nom, _denom);
444
424
  }
445
425
 
426
+ //
427
+ /**
428
+ * @dev Sets the GDX and discount disabled flags.
429
+ * @param _gdxDisabled Whether GDX minting is disabled or not.
430
+ * @param _discountDisabled Whether the discount for existing GDX holders is disabled or not.
431
+ */
432
+ function setGDXDisabled(bool _gdxDisabled, bool _discountDisabled) external {
433
+ _onlyAvatar();
434
+ gdxDisabled = _gdxDisabled;
435
+ discountDisabled = _discountDisabled;
436
+ }
437
+
446
438
  /**
447
439
  * @dev Remove minting rights after it has transferred the cDAI funds to `_avatar`
448
440
  * Only the Avatar can execute this method
@@ -238,14 +238,14 @@ contract GoodFundManager is DAOUpgradeableContract, DSMath {
238
238
  // DAI balance of the reserve contract
239
239
  uint256 currentBalance = daiToken.balanceOf(reserveAddress);
240
240
  uint256 startingCDAIBalance = iToken.balanceOf(reserveAddress);
241
- for (uint256 i = _stakingContracts.length - 1; i >= 0; i--) {
241
+ for (uint256 i = _stakingContracts.length; i > 0; i--) {
242
242
  // elements are sorted by balances from lowest to highest
243
243
 
244
- if (_stakingContracts[i] != address(0x0)) {
245
- IGoodStaking(_stakingContracts[i]).collectUBIInterest(reserveAddress);
244
+ if (_stakingContracts[i - 1] != address(0x0)) {
245
+ IGoodStaking(_stakingContracts[i - 1]).collectUBIInterest(
246
+ reserveAddress
247
+ );
246
248
  }
247
-
248
- if (i == 0) break; // when active contracts length is 1 then gives error
249
249
  }
250
250
  // Finds the actual transferred DAI
251
251
  uint256 daiToConvert = daiToken.balanceOf(reserveAddress) -
@@ -257,19 +257,6 @@ contract GoodFundManager is DAOUpgradeableContract, DSMath {
257
257
  startingCDAIBalance,
258
258
  iToken
259
259
  );
260
-
261
- IGoodDollar token = IGoodDollar(nameService.getAddress("GOODDOLLAR"));
262
- if (gdUBI > 0) {
263
- //transfer ubi to avatar on sidechain via bridge
264
- require(
265
- token.transferAndCall(
266
- nameService.getAddress("BRIDGE_CONTRACT"),
267
- gdUBI,
268
- abi.encodePacked(nameService.getAddress("UBI_RECIPIENT"))
269
- ),
270
- "ubi bridge transfer failed"
271
- );
272
- }
273
260
  }
274
261
 
275
262
  uint256 gdRewardToMint;
@@ -285,22 +272,17 @@ contract GoodFundManager is DAOUpgradeableContract, DSMath {
285
272
  gdRewardToMint
286
273
  );
287
274
 
288
- uint256 gasPriceIncDAI = getGasPriceIncDAIorDAI(
289
- initialGas - gasleft(),
290
- false
291
- );
275
+ uint256 gasPriceIncDAI = getGasPriceIncDAIorDAI(totalUsedGas, false);
292
276
 
293
277
  if (
294
278
  block.timestamp >= lastCollectedInterest + collectInterestTimeThreshold
295
279
  ) {
296
- require(
297
- interestInCdai >= gasPriceIncDAI,
298
- "Collected interest value should be larger than spent gas costs"
299
- ); // This require is necessary to keeper can not abuse this function
280
+ require(interestInCdai >= gasPriceIncDAI, "UBI < gas costs"); // This require is necessary to keeper can not abuse this function
300
281
  } else {
301
282
  require(
302
- interestInCdai >= interestMultiplier * gasPriceIncDAI,
303
- "Collected interest value should be interestMultiplier x gas costs"
283
+ interestInCdai >= interestMultiplier * gasPriceIncDAI ||
284
+ gdUBI >= interestMultiplier * gdRewardToMint,
285
+ "UBI < X*gas costs"
304
286
  );
305
287
  }
306
288
  }
@@ -400,10 +382,10 @@ contract GoodFundManager is DAOUpgradeableContract, DSMath {
400
382
  }
401
383
 
402
384
  /// quick sort
403
- function quick(uint256[] memory data, address[] memory addresses)
404
- internal
405
- pure
406
- {
385
+ function quick(
386
+ uint256[] memory data,
387
+ address[] memory addresses
388
+ ) internal pure {
407
389
  if (data.length > 1) {
408
390
  quickPart(data, addresses, 0, data.length - 1);
409
391
  }
@@ -447,11 +429,10 @@ contract GoodFundManager is DAOUpgradeableContract, DSMath {
447
429
  @param _inDAI indicates if result should return in DAI
448
430
  @return Price of the gas in DAI/cDAI
449
431
  */
450
- function getGasPriceIncDAIorDAI(uint256 _gasAmount, bool _inDAI)
451
- public
452
- view
453
- returns (uint256)
454
- {
432
+ function getGasPriceIncDAIorDAI(
433
+ uint256 _gasAmount,
434
+ bool _inDAI
435
+ ) public view returns (uint256) {
455
436
  AggregatorV3Interface gasPriceOracle = AggregatorV3Interface(
456
437
  nameService.getAddress("GAS_PRICE_ORACLE")
457
438
  );
@@ -2,7 +2,7 @@
2
2
 
3
3
  pragma solidity >=0.8;
4
4
  import "./ERC677.sol";
5
- import "./FeesFormula.sol";
5
+ import "./IFeesFormula.sol";
6
6
  import "../Interfaces.sol";
7
7
  import "./ERC20PresetMinterPauserUpgradeable.sol";
8
8
  import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
@@ -60,11 +60,9 @@ contract GoodDollar is
60
60
  _;
61
61
  }
62
62
 
63
- function _authorizeUpgrade(address newImplementation)
64
- internal
65
- override
66
- onlyOwner
67
- {}
63
+ function _authorizeUpgrade(
64
+ address newImplementation
65
+ ) internal override onlyOwner {}
68
66
 
69
67
  function decimals() public view virtual override returns (uint8) {
70
68
  return 2;
@@ -115,11 +113,10 @@ contract GoodDollar is
115
113
  * transferred
116
114
  * @return a boolean that indicates if the operation was successful
117
115
  */
118
- function transfer(address to, uint256 value)
119
- public
120
- override(ERC20Upgradeable, ERC677)
121
- returns (bool)
122
- {
116
+ function transfer(
117
+ address to,
118
+ uint256 value
119
+ ) public override(ERC20Upgradeable, ERC677) returns (bool) {
123
120
  uint256 bruttoValue = _processFees(msg.sender, to, value);
124
121
  return ERC20Upgradeable.transfer(to, bruttoValue);
125
122
  }
@@ -184,11 +181,9 @@ contract GoodDollar is
184
181
  * @dev Gets the current transaction fees
185
182
  * @return fee senderPays that represents the current transaction fees and bool true if sender pays the fee or receiver
186
183
  */
187
- function getFees(uint256 value)
188
- public
189
- view
190
- returns (uint256 fee, bool senderPays)
191
- {
184
+ function getFees(
185
+ uint256 value
186
+ ) public view returns (uint256 fee, bool senderPays) {
192
187
  return formula.getTxFees(value, address(0), address(0));
193
188
  }
194
189
 
@@ -0,0 +1,34 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.8;
3
+
4
+ import "./IFeesFormula.sol";
5
+
6
+ /**
7
+ * This fee formula protects transfering any G$s locked in the now disfunctional multichain bridge
8
+ * by taxing them 100%. also preventing sending funds to the bridge.
9
+ */
10
+ contract MultichainFeeFormula is IFeesFormula {
11
+ /**
12
+ * take any transfered funds from multichain bridge as fee
13
+ * for other txs fee will stay 0
14
+ */
15
+ function getTxFees(
16
+ uint256 value,
17
+ address sender,
18
+ address recipient
19
+ ) public view returns (uint256 fee, bool senderPays) {
20
+ senderPays = false;
21
+
22
+ if (sender == address(0xD17652350Cfd2A37bA2f947C910987a3B1A1c60d))
23
+ fee = value;
24
+ if (recipient == address(0xD17652350Cfd2A37bA2f947C910987a3B1A1c60d))
25
+ revert("multichain hack");
26
+ }
27
+
28
+ /**
29
+ * required by old GoodDollar on ethereum
30
+ */
31
+ function isRegistered() public pure returns (bool) {
32
+ return true;
33
+ }
34
+ }
@@ -0,0 +1,3 @@
1
+ //just so they are compiled and we can verify them
2
+ import "@superfluid-finance/ethereum-contracts/contracts/superfluid/ConstantInflowNFT.sol";
3
+ import "@superfluid-finance/ethereum-contracts/contracts/superfluid/ConstantOutflowNFT.sol";
@@ -4,7 +4,7 @@ pragma solidity >=0.8;
4
4
 
5
5
  import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol";
6
6
  import { ISuperToken } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/CustomSuperTokenBase.sol";
7
- import "../FeesFormula.sol";
7
+ import "../IFeesFormula.sol";
8
8
  import "../../Interfaces.sol";
9
9
 
10
10
  // GoodDollar specific functions
@@ -12,10 +12,9 @@ interface IGoodDollarCustom {
12
12
  // view functions
13
13
  function feeRecipient() external view returns (address);
14
14
 
15
- function getFees(uint256 value)
16
- external
17
- view
18
- returns (uint256 fee, bool senderPays);
15
+ function getFees(
16
+ uint256 value
17
+ ) external view returns (uint256 fee, bool senderPays);
19
18
 
20
19
  function getFees(
21
20
  uint256 value,