@gooddollar/goodprotocol 2.0.31 → 2.0.32

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 (303) hide show
  1. package/artifacts/abis/CeloDistributionHelper.min.json +1 -0
  2. package/artifacts/abis/CeloDistributionHelperTest.min.json +1 -0
  3. package/artifacts/abis/CeloDistributionHelperTestHelper.min.json +1 -0
  4. package/artifacts/abis/IBancorExchangeProvider.min.json +1 -0
  5. package/artifacts/abis/IBroker.min.json +1 -0
  6. package/artifacts/abis/IGoodDollarExchangeProvider.min.json +1 -0
  7. package/artifacts/abis/IGoodDollarExpansionController.min.json +1 -0
  8. package/artifacts/abis/IMentoReserve.min.json +1 -0
  9. package/artifacts/abis/ITradingLimits.min.json +1 -0
  10. package/artifacts/abis/MentoExchange.min.json +1 -0
  11. package/artifacts/abis/ProtocolUpgradeV4Mento.min.json +1 -0
  12. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  13. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  14. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  15. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  16. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  17. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  18. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  19. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  20. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  21. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  28. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
  30. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  31. package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
  32. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  33. package/artifacts/contracts/Interfaces.sol/IQuoterV2.dbg.json +1 -1
  34. package/artifacts/contracts/Interfaces.sol/ISwapRouter.dbg.json +1 -1
  35. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  36. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  37. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  38. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  39. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  40. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  41. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  42. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  43. package/artifacts/contracts/MentoInterfaces.sol/IBancorExchangeProvider.dbg.json +4 -0
  44. package/artifacts/contracts/MentoInterfaces.sol/IBancorExchangeProvider.json +282 -0
  45. package/artifacts/contracts/MentoInterfaces.sol/IBroker.dbg.json +4 -0
  46. package/artifacts/contracts/MentoInterfaces.sol/IBroker.json +491 -0
  47. package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.dbg.json +4 -0
  48. package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.json +164 -0
  49. package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.dbg.json +4 -0
  50. package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.json +333 -0
  51. package/artifacts/contracts/MentoInterfaces.sol/IMentoReserve.dbg.json +4 -0
  52. package/artifacts/contracts/MentoInterfaces.sol/IMentoReserve.json +927 -0
  53. package/artifacts/contracts/MentoInterfaces.sol/ITradingLimits.dbg.json +4 -0
  54. package/artifacts/contracts/MentoInterfaces.sol/ITradingLimits.json +10 -0
  55. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  56. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  57. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
  58. package/artifacts/contracts/fuseFaucet/SuperfluidFacuet.sol/SuperfluidFaucet.dbg.json +1 -1
  59. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  60. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  61. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  62. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
  63. package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
  64. package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
  65. package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
  66. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  67. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  68. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  69. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  70. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
  71. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  72. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
  73. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  74. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  75. package/artifacts/contracts/invite/OneTimeReward.sol/OneTimeReward.dbg.json +1 -1
  76. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  77. package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
  78. package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
  79. package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest.dbg.json +4 -0
  80. package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest.json +864 -0
  81. package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper.dbg.json +4 -0
  82. package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper.json +890 -0
  83. package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
  84. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  85. package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  87. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
  88. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  89. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.json +2 -2
  90. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  91. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.json +2 -2
  92. package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
  93. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
  94. package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
  95. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  96. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +2 -2
  97. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
  98. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  99. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.json +2 -2
  100. package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
  101. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  102. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  103. package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
  104. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
  105. package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
  106. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  107. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  108. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.json +2 -2
  109. package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
  110. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  111. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
  112. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  113. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  114. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  115. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  116. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  117. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  118. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  119. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  120. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  121. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  122. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  123. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  124. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  125. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  126. package/artifacts/contracts/reserve/CeloDistributionHelper.sol/CeloDistributionHelper.dbg.json +4 -0
  127. package/artifacts/contracts/reserve/CeloDistributionHelper.sol/CeloDistributionHelper.json +864 -0
  128. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  129. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.json +2 -2
  130. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  131. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.json +2 -2
  132. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  133. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.json +2 -2
  134. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  135. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  136. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +2 -2
  137. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  138. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  139. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  140. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.json +2 -2
  141. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  142. package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
  143. package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
  144. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  145. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.json +2 -2
  146. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  147. package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
  148. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  149. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  150. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.json +2 -2
  151. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  152. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.json +2 -2
  153. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
  154. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.json +2 -2
  155. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  156. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.json +2 -2
  157. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  158. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +2 -2
  159. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
  160. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.json +2 -2
  161. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
  162. package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
  163. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
  164. package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
  165. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
  166. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
  167. package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
  168. package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
  169. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
  170. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
  171. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
  172. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
  173. package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
  174. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
  175. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
  176. package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
  177. package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
  178. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
  179. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
  180. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
  181. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  182. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
  183. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  184. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
  185. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  186. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  187. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.json +2 -2
  188. package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.dbg.json +1 -1
  189. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
  190. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.json +2 -2
  191. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
  192. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
  193. package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
  194. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  195. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  196. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  197. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  198. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/EternalStorage.dbg.json +1 -1
  199. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/FuseOldBridgeKill.dbg.json +1 -1
  200. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/IUpgradeabilityOwnerStorage.dbg.json +1 -1
  201. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Initializable.dbg.json +1 -1
  202. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Ownable.dbg.json +1 -1
  203. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Upgradeable.dbg.json +1 -1
  204. package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
  205. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  206. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  207. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  208. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  209. package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
  210. package/artifacts/contracts/utils/LastauthReduction.sol/LastauthReduction.dbg.json +1 -1
  211. package/artifacts/contracts/utils/LastauthReduction.sol/LastauthReduction.json +2 -2
  212. package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
  213. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  214. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  215. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
  216. package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
  217. package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange.dbg.json +4 -0
  218. package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange.json +24 -0
  219. package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.dbg.json +4 -0
  220. package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.json +92 -0
  221. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  222. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  223. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  224. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  225. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  226. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  227. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  228. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  229. package/artifacts/contracts/utils/ReserveRestore.sol/ReserveRestore.dbg.json +1 -1
  230. package/artifacts/contracts/utils/ReserveRestore.sol/ReserveRestore.json +2 -2
  231. package/contracts/MentoInterfaces.sol +746 -0
  232. package/contracts/mocks/CeloDistributionHelperTest.sol +25 -0
  233. package/contracts/reserve/CeloDistributionHelper.sol +286 -0
  234. package/contracts/reserve/GoodMarketMaker.sol +11 -1
  235. package/contracts/staking/GoodFundManager.sol +5 -2
  236. package/contracts/utils/ProtoclUpgradeV4Mento.sol +99 -0
  237. package/contracts/utils/ReserveRestore.sol +171 -147
  238. package/hardhat.config.ts +4 -4
  239. package/package.json +5 -2
  240. package/releases/deployment.json +25 -13
  241. package/scripts/multichain-deploy/helpers.ts +45 -24
  242. package/scripts/proposals/reserveRestore.ts +130 -85
  243. package/scripts/proposals/v4Upgrade.ts +845 -0
  244. package/test/reserve/CeloDistributionHelper.test.ts +377 -0
  245. package/test/reserve/GoodMarketMaker.test.ts +98 -35
  246. package/test/zzz - e2e/CeloDistributionHelper.e2e.test.ts +0 -0
  247. package/types/contracts/MentoInterfaces.sol/IBancorExchangeProvider.ts +422 -0
  248. package/types/contracts/MentoInterfaces.sol/IBroker.ts +727 -0
  249. package/types/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.ts +341 -0
  250. package/types/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.ts +617 -0
  251. package/types/contracts/MentoInterfaces.sol/IMentoReserve.ts +1700 -0
  252. package/types/contracts/MentoInterfaces.sol/index.ts +8 -0
  253. package/types/contracts/index.ts +2 -0
  254. package/types/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest.ts +1226 -0
  255. package/types/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper.ts +1279 -0
  256. package/types/contracts/mocks/CeloDistributionHelperTest.sol/index.ts +5 -0
  257. package/types/contracts/mocks/index.ts +2 -0
  258. package/types/contracts/reserve/CeloDistributionHelper.ts +1226 -0
  259. package/types/contracts/reserve/index.ts +1 -0
  260. package/types/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange.ts +81 -0
  261. package/types/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.ts +161 -0
  262. package/types/contracts/utils/ProtoclUpgradeV4Mento.sol/index.ts +5 -0
  263. package/types/contracts/utils/index.ts +2 -0
  264. package/types/factories/contracts/MentoInterfaces.sol/IBancorExchangeProvider__factory.ts +301 -0
  265. package/types/factories/contracts/MentoInterfaces.sol/IBroker__factory.ts +506 -0
  266. package/types/factories/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider__factory.ts +183 -0
  267. package/types/factories/contracts/MentoInterfaces.sol/IGoodDollarExpansionController__factory.ts +352 -0
  268. package/types/factories/contracts/MentoInterfaces.sol/IMentoReserve__factory.ts +942 -0
  269. package/types/factories/contracts/MentoInterfaces.sol/index.ts +8 -0
  270. package/types/factories/contracts/governance/StakersDistribution__factory.ts +1 -1
  271. package/types/factories/contracts/index.ts +1 -0
  272. package/types/factories/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper__factory.ts +949 -0
  273. package/types/factories/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest__factory.ts +919 -0
  274. package/types/factories/contracts/mocks/CeloDistributionHelperTest.sol/index.ts +5 -0
  275. package/types/factories/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper__factory.ts +1 -1
  276. package/types/factories/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest__factory.ts +1 -1
  277. package/types/factories/contracts/mocks/GoodCompoundStakingTest__factory.ts +1 -1
  278. package/types/factories/contracts/mocks/GoodFundManagerTest__factory.ts +1 -1
  279. package/types/factories/contracts/mocks/OverMintTesterRegularStake__factory.ts +1 -1
  280. package/types/factories/contracts/mocks/index.ts +1 -0
  281. package/types/factories/contracts/reserve/CeloDistributionHelper__factory.ts +919 -0
  282. package/types/factories/contracts/reserve/DistributionHelper__factory.ts +1 -1
  283. package/types/factories/contracts/reserve/ExchangeHelper__factory.ts +1 -1
  284. package/types/factories/contracts/reserve/GoodMarketMaker__factory.ts +1 -1
  285. package/types/factories/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai__factory.ts +1 -1
  286. package/types/factories/contracts/reserve/index.ts +1 -0
  287. package/types/factories/contracts/staking/DonationsStaking__factory.ts +1 -1
  288. package/types/factories/contracts/staking/GoodFundManager__factory.ts +1 -1
  289. package/types/factories/contracts/staking/aave/AaveStakingFactory__factory.ts +1 -1
  290. package/types/factories/contracts/staking/aave/GoodAaveStakingV2__factory.ts +1 -1
  291. package/types/factories/contracts/staking/aave/GoodAaveStaking__factory.ts +1 -1
  292. package/types/factories/contracts/staking/compound/CompoundStakingFactory__factory.ts +1 -1
  293. package/types/factories/contracts/staking/compound/GoodCompoundStakingV2__factory.ts +1 -1
  294. package/types/factories/contracts/staking/compound/GoodCompoundStaking__factory.ts +1 -1
  295. package/types/factories/contracts/utils/BuyAndBridgeHelper__factory.ts +1 -1
  296. package/types/factories/contracts/utils/LastauthReduction__factory.ts +1 -1
  297. package/types/factories/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange__factory.ts +39 -0
  298. package/types/factories/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento__factory.ts +152 -0
  299. package/types/factories/contracts/utils/ProtoclUpgradeV4Mento.sol/index.ts +5 -0
  300. package/types/factories/contracts/utils/ReserveRestore__factory.ts +1 -1
  301. package/types/factories/contracts/utils/index.ts +1 -0
  302. package/types/hardhat.d.ts +90 -0
  303. package/types/index.ts +20 -0
@@ -0,0 +1,746 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.8;
3
+ pragma experimental ABIEncoderV2;
4
+
5
+ interface IMentoReserve {
6
+ function setTobinTaxStalenessThreshold(uint256) external;
7
+
8
+ function addToken(address) external returns (bool);
9
+
10
+ function removeToken(address, uint256) external returns (bool);
11
+
12
+ function transferGold(address payable, uint256) external returns (bool);
13
+
14
+ function transferExchangeGold(
15
+ address payable,
16
+ uint256
17
+ ) external returns (bool);
18
+
19
+ function transferCollateralAsset(
20
+ address collateralAsset,
21
+ address payable to,
22
+ uint256 value
23
+ ) external returns (bool);
24
+
25
+ function getReserveGoldBalance() external view returns (uint256);
26
+
27
+ function getUnfrozenReserveGoldBalance() external view returns (uint256);
28
+
29
+ function getOrComputeTobinTax() external returns (uint256, uint256);
30
+
31
+ function getTokens() external view returns (address[] memory);
32
+
33
+ function getReserveRatio() external view returns (uint256);
34
+
35
+ function addExchangeSpender(address) external;
36
+
37
+ function removeExchangeSpender(address, uint256) external;
38
+
39
+ function addSpender(address) external;
40
+
41
+ function removeSpender(address) external;
42
+
43
+ function isStableAsset(address) external view returns (bool);
44
+
45
+ function isCollateralAsset(address) external view returns (bool);
46
+
47
+ function getDailySpendingRatioForCollateralAsset(
48
+ address collateralAsset
49
+ ) external view returns (uint256);
50
+
51
+ function isExchangeSpender(address exchange) external view returns (bool);
52
+
53
+ function addCollateralAsset(address asset) external returns (bool);
54
+
55
+ function transferExchangeCollateralAsset(
56
+ address collateralAsset,
57
+ address payable to,
58
+ uint256 value
59
+ ) external returns (bool);
60
+
61
+ function initialize(
62
+ address registryAddress,
63
+ uint256 _tobinTaxStalenessThreshold,
64
+ uint256 _spendingRatioForCelo,
65
+ uint256 _frozenGold,
66
+ uint256 _frozenDays,
67
+ bytes32[] calldata _assetAllocationSymbols,
68
+ uint256[] calldata _assetAllocationWeights,
69
+ uint256 _tobinTax,
70
+ uint256 _tobinTaxReserveRatio,
71
+ address[] calldata _collateralAssets,
72
+ uint256[] calldata _collateralAssetDailySpendingRatios
73
+ ) external;
74
+
75
+ /// @notice IOwnable:
76
+ function transferOwnership(address newOwner) external;
77
+
78
+ function renounceOwnership() external;
79
+
80
+ function owner() external view returns (address);
81
+
82
+ /// @notice Getters:
83
+ function registry() external view returns (address);
84
+
85
+ function tobinTaxStalenessThreshold() external view returns (uint256);
86
+
87
+ function tobinTax() external view returns (uint256);
88
+
89
+ function tobinTaxReserveRatio() external view returns (uint256);
90
+
91
+ function getDailySpendingRatio() external view returns (uint256);
92
+
93
+ function checkIsCollateralAsset(
94
+ address collateralAsset
95
+ ) external view returns (bool);
96
+
97
+ function isToken(address) external view returns (bool);
98
+
99
+ function getOtherReserveAddresses() external view returns (address[] memory);
100
+
101
+ function getAssetAllocationSymbols() external view returns (bytes32[] memory);
102
+
103
+ function getAssetAllocationWeights() external view returns (uint256[] memory);
104
+
105
+ function collateralAssetSpendingLimit(
106
+ address
107
+ ) external view returns (uint256);
108
+
109
+ function getExchangeSpenders() external view returns (address[] memory);
110
+
111
+ function getUnfrozenBalance() external view returns (uint256);
112
+
113
+ function isOtherReserveAddress(
114
+ address otherReserveAddress
115
+ ) external view returns (bool);
116
+
117
+ function isSpender(address spender) external view returns (bool);
118
+
119
+ /// @notice Setters:
120
+ function setRegistry(address) external;
121
+
122
+ function setTobinTax(uint256) external;
123
+
124
+ function setTobinTaxReserveRatio(uint256) external;
125
+
126
+ function setDailySpendingRatio(uint256 spendingRatio) external;
127
+
128
+ function setDailySpendingRatioForCollateralAssets(
129
+ address[] calldata _collateralAssets,
130
+ uint256[] calldata collateralAssetDailySpendingRatios
131
+ ) external;
132
+
133
+ function setFrozenGold(uint256 frozenGold, uint256 frozenDays) external;
134
+
135
+ function setAssetAllocations(
136
+ bytes32[] calldata symbols,
137
+ uint256[] calldata weights
138
+ ) external;
139
+
140
+ function removeCollateralAsset(
141
+ address collateralAsset,
142
+ uint256 index
143
+ ) external returns (bool);
144
+
145
+ function addOtherReserveAddress(
146
+ address otherReserveAddress
147
+ ) external returns (bool);
148
+
149
+ function removeOtherReserveAddress(
150
+ address otherReserveAddress,
151
+ uint256 index
152
+ ) external returns (bool);
153
+
154
+ function collateralAssets(uint256 index) external view returns (address);
155
+
156
+ function collateralAssetLastSpendingDay(
157
+ address collateralAsset
158
+ ) external view returns (uint256);
159
+ }
160
+
161
+ interface IBancorExchangeProvider {
162
+ struct PoolExchange {
163
+ address reserveAsset;
164
+ address tokenAddress;
165
+ uint256 tokenSupply;
166
+ uint256 reserveBalance;
167
+ uint32 reserveRatio;
168
+ uint32 exitContribution;
169
+ }
170
+
171
+ /* ------- Events ------- */
172
+
173
+ /**
174
+ * @notice Emitted when the broker address is updated.
175
+ * @param newBroker The address of the new broker.
176
+ */
177
+ event BrokerUpdated(address indexed newBroker);
178
+
179
+ /**
180
+ * @notice Emitted when the reserve contract is set.
181
+ * @param newReserve The address of the new reserve.
182
+ */
183
+ event ReserveUpdated(address indexed newReserve);
184
+
185
+ /**
186
+ * @notice Emitted when a new PoolExchange has been created.
187
+ * @param exchangeId The id of the new PoolExchange
188
+ * @param reserveAsset The address of the reserve asset
189
+ * @param tokenAddress The address of the token
190
+ */
191
+ event ExchangeCreated(
192
+ bytes32 indexed exchangeId,
193
+ address indexed reserveAsset,
194
+ address indexed tokenAddress
195
+ );
196
+
197
+ /**
198
+ * @notice Emitted when a PoolExchange has been destroyed.
199
+ * @param exchangeId The id of the PoolExchange
200
+ * @param reserveAsset The address of the reserve asset
201
+ * @param tokenAddress The address of the token
202
+ */
203
+ event ExchangeDestroyed(
204
+ bytes32 indexed exchangeId,
205
+ address indexed reserveAsset,
206
+ address indexed tokenAddress
207
+ );
208
+
209
+ /**
210
+ * @notice Emitted when the exit contribution for a pool is set.
211
+ * @param exchangeId The id of the pool
212
+ * @param exitContribution The exit contribution
213
+ */
214
+ event ExitContributionSet(
215
+ bytes32 indexed exchangeId,
216
+ uint256 exitContribution
217
+ );
218
+
219
+ /* ------- Functions ------- */
220
+
221
+ /**
222
+ * @notice Retrieves the pool with the specified exchangeId.
223
+ * @param exchangeId The id of the pool to be retrieved.
224
+ * @return exchange The PoolExchange with that ID.
225
+ */
226
+ function getPoolExchange(
227
+ bytes32 exchangeId
228
+ ) external view returns (PoolExchange memory exchange);
229
+
230
+ /**
231
+ * @notice Get all exchange IDs.
232
+ * @return exchangeIds List of the exchangeIds.
233
+ */
234
+ function getExchangeIds()
235
+ external
236
+ view
237
+ returns (bytes32[] memory exchangeIds);
238
+
239
+ /**
240
+ * @notice Create a PoolExchange with the provided data.
241
+ * @param exchange The PoolExchange to be created.
242
+ * @return exchangeId The id of the exchange.
243
+ */
244
+ function createExchange(
245
+ PoolExchange calldata exchange
246
+ ) external returns (bytes32 exchangeId);
247
+
248
+ /**
249
+ * @notice Delete a PoolExchange.
250
+ * @param exchangeId The PoolExchange to be created.
251
+ * @param exchangeIdIndex The index of the exchangeId in the exchangeIds array.
252
+ * @return destroyed - true on successful delition.
253
+ */
254
+ function destroyExchange(
255
+ bytes32 exchangeId,
256
+ uint256 exchangeIdIndex
257
+ ) external returns (bool destroyed);
258
+
259
+ /**
260
+ * @notice Set the exit contribution for a given exchange
261
+ * @param exchangeId The id of the exchange
262
+ * @param exitContribution The exit contribution to be set
263
+ */
264
+ function setExitContribution(
265
+ bytes32 exchangeId,
266
+ uint32 exitContribution
267
+ ) external;
268
+
269
+ /**
270
+ * @notice gets the current price based of the bancor formula
271
+ * @param exchangeId The id of the exchange to get the price for
272
+ * @return price the current continious price
273
+ */
274
+ function currentPrice(
275
+ bytes32 exchangeId
276
+ ) external view returns (uint256 price);
277
+ }
278
+
279
+ interface IGoodDollarExpansionController {
280
+ /**
281
+ * @notice Struct holding the configuration for the expansion of an exchange.
282
+ * @param expansionRate The rate of expansion in percentage with 1e18 being 100%.
283
+ * @param expansionfrequency The frequency of expansion in seconds.
284
+ * @param lastExpansion The last timestamp an expansion was done.
285
+ */
286
+ struct ExchangeExpansionConfig {
287
+ uint64 expansionRate;
288
+ uint32 expansionFrequency;
289
+ uint32 lastExpansion;
290
+ }
291
+
292
+ /* ------- Events ------- */
293
+
294
+ /**
295
+ * @notice Emitted when the GoodDollarExchangeProvider is updated.
296
+ * @param exchangeProvider The address of the new GoodDollarExchangeProvider.
297
+ */
298
+ event GoodDollarExchangeProviderUpdated(address indexed exchangeProvider);
299
+
300
+ /**
301
+ * @notice Emitted when the distribution helper is updated.
302
+ * @param distributionHelper The address of the new distribution helper.
303
+ */
304
+ event DistributionHelperUpdated(address indexed distributionHelper);
305
+
306
+ /**
307
+ * @notice Emitted when the Reserve address is updated.
308
+ * @param reserve The address of the new Reserve.
309
+ */
310
+ event ReserveUpdated(address indexed reserve);
311
+
312
+ /**
313
+ * @notice Emitted when the AVATAR address is updated.
314
+ * @param avatar The address of the new AVATAR.
315
+ */
316
+ event AvatarUpdated(address indexed avatar);
317
+
318
+ /**
319
+ * @notice Emitted when the expansion config is set for an exchange.
320
+ * @param exchangeId The id of the exchange.
321
+ * @param expansionRate The rate of expansion.
322
+ * @param expansionfrequency The frequency of expansion.
323
+ */
324
+ event ExpansionConfigSet(
325
+ bytes32 indexed exchangeId,
326
+ uint64 expansionRate,
327
+ uint32 expansionfrequency
328
+ );
329
+
330
+ /**
331
+ * @notice Emitted when a reward is minted.
332
+ * @param exchangeId The id of the exchange.
333
+ * @param to The address of the recipient.
334
+ * @param amount The amount of tokens minted.
335
+ */
336
+ event RewardMinted(
337
+ bytes32 indexed exchangeId,
338
+ address indexed to,
339
+ uint256 amount
340
+ );
341
+
342
+ /**
343
+ * @notice Emitted when UBI is minted through collecting reserve interest.
344
+ * @param exchangeId The id of the exchange.
345
+ * @param amount Amount of tokens minted.
346
+ */
347
+ event InterestUBIMinted(bytes32 indexed exchangeId, uint256 amount);
348
+
349
+ /**
350
+ * @notice Emitted when UBI is minted through expansion.
351
+ * @param exchangeId The id of the exchange.
352
+ * @param amount Amount of tokens minted.
353
+ */
354
+ event ExpansionUBIMinted(bytes32 indexed exchangeId, uint256 amount);
355
+
356
+ /* ------- Functions ------- */
357
+
358
+ /**
359
+ * @notice Initializes the contract with the given parameters.
360
+ * @param _goodDollarExchangeProvider The address of the GoodDollarExchangeProvider contract.
361
+ * @param _distributionHelper The address of the distribution helper contract.
362
+ * @param _reserve The address of the Reserve contract.
363
+ * @param _avatar The address of the GoodDollar DAO contract.
364
+ */
365
+ function initialize(
366
+ address _goodDollarExchangeProvider,
367
+ address _distributionHelper,
368
+ address _reserve,
369
+ address _avatar
370
+ ) external;
371
+
372
+ /**
373
+ * @notice Sets the GoodDollarExchangeProvider address.
374
+ * @param _goodDollarExchangeProvider The address of the GoodDollarExchangeProvider contract.
375
+ */
376
+ function setGoodDollarExchangeProvider(
377
+ address _goodDollarExchangeProvider
378
+ ) external;
379
+
380
+ /**
381
+ * @notice Sets the distribution helper address.
382
+ * @param _distributionHelper The address of the distribution helper contract.
383
+ */
384
+ function setDistributionHelper(address _distributionHelper) external;
385
+
386
+ /**
387
+ * @notice Sets the reserve address.
388
+ * @param _reserve The address of the reserve contract.
389
+ */
390
+ function setReserve(address _reserve) external;
391
+
392
+ /**
393
+ * @notice Sets the AVATAR address.
394
+ * @param _avatar The address of the AVATAR contract.
395
+ */
396
+ function setAvatar(address _avatar) external;
397
+
398
+ /**
399
+ * @notice Sets the expansion config for the given exchange.
400
+ * @param exchangeId The id of the exchange to set the expansion config for.
401
+ * @param expansionRate The rate of expansion.
402
+ * @param expansionFrequency The frequency of expansion.
403
+ */
404
+ function setExpansionConfig(
405
+ bytes32 exchangeId,
406
+ uint64 expansionRate,
407
+ uint32 expansionFrequency
408
+ ) external;
409
+
410
+ /**
411
+ * @notice Mints UBI for the given exchange from collecting reserve interest.
412
+ * @param exchangeId The id of the exchange to mint UBI for.
413
+ * @param reserveInterest The amount of reserve tokens collected from interest.
414
+ */
415
+ function mintUBIFromInterest(
416
+ bytes32 exchangeId,
417
+ uint256 reserveInterest
418
+ ) external;
419
+
420
+ /**
421
+ * @notice Mints UBI for the given exchange by comparing the reserve Balance of the contract to the virtual balance.
422
+ * @param exchangeId The id of the exchange to mint UBI for.
423
+ * @return amountMinted The amount of UBI tokens minted.
424
+ */
425
+ function mintUBIFromReserveBalance(
426
+ bytes32 exchangeId
427
+ ) external returns (uint256 amountMinted);
428
+
429
+ /**
430
+ * @notice Mints UBI for the given exchange by calculating the expansion rate.
431
+ * @param exchangeId The id of the exchange to mint UBI for.
432
+ * @return amountMinted The amount of UBI tokens minted.
433
+ */
434
+ function mintUBIFromExpansion(
435
+ bytes32 exchangeId
436
+ ) external returns (uint256 amountMinted);
437
+
438
+ /**
439
+ * @notice Mints a reward of tokens for the given exchange.
440
+ * @param exchangeId The id of the exchange to mint reward.
441
+ * @param to The address of the recipient.
442
+ * @param amount The amount of tokens to mint.
443
+ */
444
+ function mintRewardFromRR(
445
+ bytes32 exchangeId,
446
+ address to,
447
+ uint256 amount
448
+ ) external;
449
+ }
450
+
451
+ interface IGoodDollarExchangeProvider {
452
+ /* ------- Events ------- */
453
+
454
+ /**
455
+ * @notice Emitted when the ExpansionController address is updated.
456
+ * @param expansionController The address of the ExpansionController contract.
457
+ */
458
+ event ExpansionControllerUpdated(address indexed expansionController);
459
+
460
+ /**
461
+ * @notice Emitted when the AVATAR address is updated.
462
+ * @param AVATAR The address of the AVATAR contract.
463
+ */
464
+ // solhint-disable-next-line var-name-mixedcase
465
+ event AvatarUpdated(address indexed AVATAR);
466
+
467
+ /**
468
+ * @notice Emitted when reserve ratio for exchange is updated.
469
+ * @param exchangeId The id of the exchange.
470
+ * @param reserveRatio The new reserve ratio.
471
+ */
472
+ event ReserveRatioUpdated(bytes32 indexed exchangeId, uint32 reserveRatio);
473
+
474
+ /* ------- Functions ------- */
475
+
476
+ /**
477
+ * @notice Initializes the contract with the given parameters.
478
+ * @param _broker The address of the Broker contract.
479
+ * @param _reserve The address of the Reserve contract.
480
+ * @param _expansionController The address of the ExpansionController contract.
481
+ * @param _avatar The address of the GoodDollar DAO contract.
482
+ */
483
+ function initialize(
484
+ address _broker,
485
+ address _reserve,
486
+ address _expansionController,
487
+ address _avatar
488
+ ) external;
489
+
490
+ /**
491
+ * @notice calculates the amount of tokens to be minted as a result of expansion.
492
+ * @param exchangeId The id of the pool to calculate expansion for.
493
+ * @param expansionScaler Scaler for calculating the new reserve ratio.
494
+ * @return amountToMint amount of tokens to be minted as a result of the expansion.
495
+ */
496
+ function mintFromExpansion(
497
+ bytes32 exchangeId,
498
+ uint256 expansionScaler
499
+ ) external returns (uint256 amountToMint);
500
+
501
+ /**
502
+ * @notice calculates the amount of tokens to be minted as a result of the reserve interest.
503
+ * @param exchangeId The id of the pool the reserve interest is added to.
504
+ * @param reserveInterest The amount of reserve tokens collected from interest.
505
+ * @return amount of tokens to be minted as a result of the reserve interest.
506
+ */
507
+ function mintFromInterest(
508
+ bytes32 exchangeId,
509
+ uint256 reserveInterest
510
+ ) external returns (uint256);
511
+
512
+ /**
513
+ * @notice calculates the reserve ratio needed to mint the reward.
514
+ * @param exchangeId The id of the pool the reward is minted from.
515
+ * @param reward The amount of tokens to be minted as a reward.
516
+ */
517
+ function updateRatioForReward(bytes32 exchangeId, uint256 reward) external;
518
+
519
+ /**
520
+ * @notice pauses the Exchange disables minting.
521
+ */
522
+ function pause() external;
523
+
524
+ /**
525
+ * @notice unpauses the Exchange enables minting again.
526
+ */
527
+ function unpause() external;
528
+ }
529
+
530
+ /*
531
+ * @title Broker Interface for trader functions
532
+ * @notice The broker is responsible for executing swaps and keeping track of trading limits.
533
+ */
534
+
535
+ interface ITradingLimits {
536
+ /**
537
+ * @dev The State struct contains the current state of a trading limit config.
538
+ * @param lastUpdated0 The timestamp of the last reset of netflow0.
539
+ * @param lastUpdated1 The timestamp of the last reset of netflow1.
540
+ * @param netflow0 The current netflow of the asset for limit0.
541
+ * @param netflow1 The current netflow of the asset for limit1.
542
+ * @param netflowGlobal The current netflow of the asset for limitGlobal.
543
+ */
544
+ struct State {
545
+ uint32 lastUpdated0;
546
+ uint32 lastUpdated1;
547
+ int48 netflow0;
548
+ int48 netflow1;
549
+ int48 netflowGlobal;
550
+ }
551
+
552
+ /**
553
+ * @dev The Config struct contains the configuration of trading limits.
554
+ * @param timestep0 The time window in seconds for limit0.
555
+ * @param timestep1 The time window in seconds for limit1.
556
+ * @param limit0 The limit0 for the asset.
557
+ * @param limit1 The limit1 for the asset.
558
+ * @param limitGlobal The global limit for the asset.
559
+ * @param flags A bitfield of flags to enable/disable the individual limits.
560
+ */
561
+ struct Config {
562
+ uint32 timestep0;
563
+ uint32 timestep1;
564
+ int48 limit0;
565
+ int48 limit1;
566
+ int48 limitGlobal;
567
+ uint8 flags;
568
+ }
569
+ }
570
+
571
+ /*
572
+ * @title Broker Interface for trader functions
573
+ * @notice The broker is responsible for executing swaps and keeping track of trading limits.
574
+ */
575
+ interface IBroker {
576
+ /**
577
+ * @notice Emitted when a swap occurs.
578
+ * @param exchangeProvider The exchange provider used.
579
+ * @param exchangeId The id of the exchange used.
580
+ * @param trader The user that initiated the swap.
581
+ * @param tokenIn The address of the token that was sold.
582
+ * @param tokenOut The address of the token that was bought.
583
+ * @param amountIn The amount of token sold.
584
+ * @param amountOut The amount of token bought.
585
+ */
586
+ event Swap(
587
+ address exchangeProvider,
588
+ bytes32 indexed exchangeId,
589
+ address indexed trader,
590
+ address indexed tokenIn,
591
+ address tokenOut,
592
+ uint256 amountIn,
593
+ uint256 amountOut
594
+ );
595
+
596
+ /**
597
+ * @notice Emitted when a new trading limit is configured.
598
+ * @param exchangeId the exchangeId to target.
599
+ * @param token the token to target.
600
+ * @param config the new trading limits config.
601
+ */
602
+ event TradingLimitConfigured(bytes32 exchangeId, address token, ITradingLimits.Config config);
603
+
604
+ /**
605
+ * @notice Allows the contract to be upgradable via the proxy.
606
+ * @param _exchangeProviders The addresses of the ExchangeProvider contracts.
607
+ * @param _reserves The address of the Reserve contract.
608
+ */
609
+ function initialize(address[] calldata _exchangeProviders, address[] calldata _reserves) external;
610
+
611
+ /**
612
+ * @notice Set the reserves for the exchange providers.
613
+ * @param _exchangeProviders The addresses of the ExchangeProvider contracts.
614
+ * @param _reserves The addresses of the Reserve contracts.
615
+ */
616
+ function setReserves(address[] calldata _exchangeProviders, address[] calldata _reserves) external;
617
+
618
+ /**
619
+ * @notice Add an exchange provider to the list of providers.
620
+ * @param exchangeProvider The address of the exchange provider to add.
621
+ * @param reserve The address of the reserve used by the exchange provider.
622
+ * @return index The index of the newly added specified exchange provider.
623
+ */
624
+ function addExchangeProvider(address exchangeProvider, address reserve) external returns (uint256 index);
625
+
626
+ /**
627
+ * @notice Remove an exchange provider from the list of providers.
628
+ * @param exchangeProvider The address of the exchange provider to remove.
629
+ * @param index The index of the exchange provider being removed.
630
+ */
631
+ function removeExchangeProvider(address exchangeProvider, uint256 index) external;
632
+
633
+ /**
634
+ * @notice Calculate amountIn of tokenIn needed for a given amountOut of tokenOut.
635
+ * @param exchangeProvider the address of the exchange provider for the pair.
636
+ * @param exchangeId The id of the exchange to use.
637
+ * @param tokenIn The token to be sold.
638
+ * @param tokenOut The token to be bought.
639
+ * @param amountOut The amount of tokenOut to be bought.
640
+ * @return amountIn The amount of tokenIn to be sold.
641
+ */
642
+ function getAmountIn(
643
+ address exchangeProvider,
644
+ bytes32 exchangeId,
645
+ address tokenIn,
646
+ address tokenOut,
647
+ uint256 amountOut
648
+ ) external view returns (uint256 amountIn);
649
+
650
+ /**
651
+ * @notice Calculate amountOut of tokenOut received for a given amountIn of tokenIn.
652
+ * @param exchangeProvider the address of the exchange provider for the pair.
653
+ * @param exchangeId The id of the exchange to use.
654
+ * @param tokenIn The token to be sold.
655
+ * @param tokenOut The token to be bought.
656
+ * @param amountIn The amount of tokenIn to be sold.
657
+ * @return amountOut The amount of tokenOut to be bought.
658
+ */
659
+ function getAmountOut(
660
+ address exchangeProvider,
661
+ bytes32 exchangeId,
662
+ address tokenIn,
663
+ address tokenOut,
664
+ uint256 amountIn
665
+ ) external view returns (uint256 amountOut);
666
+
667
+ /**
668
+ * @notice Execute a token swap with fixed amountIn.
669
+ * @param exchangeProvider the address of the exchange provider for the pair.
670
+ * @param exchangeId The id of the exchange to use.
671
+ * @param tokenIn The token to be sold.
672
+ * @param tokenOut The token to be bought.
673
+ * @param amountIn The amount of tokenIn to be sold.
674
+ * @param amountOutMin Minimum amountOut to be received - controls slippage.
675
+ * @return amountOut The amount of tokenOut to be bought.
676
+ */
677
+ function swapIn(
678
+ address exchangeProvider,
679
+ bytes32 exchangeId,
680
+ address tokenIn,
681
+ address tokenOut,
682
+ uint256 amountIn,
683
+ uint256 amountOutMin
684
+ ) external returns (uint256 amountOut);
685
+
686
+ /**
687
+ * @notice Execute a token swap with fixed amountOut.
688
+ * @param exchangeProvider the address of the exchange provider for the pair.
689
+ * @param exchangeId The id of the exchange to use.
690
+ * @param tokenIn The token to be sold.
691
+ * @param tokenOut The token to be bought.
692
+ * @param amountOut The amount of tokenOut to be bought.
693
+ * @param amountInMax Maximum amount of tokenIn that can be traded.
694
+ * @return amountIn The amount of tokenIn to be sold.
695
+ */
696
+ function swapOut(
697
+ address exchangeProvider,
698
+ bytes32 exchangeId,
699
+ address tokenIn,
700
+ address tokenOut,
701
+ uint256 amountOut,
702
+ uint256 amountInMax
703
+ ) external returns (uint256 amountIn);
704
+
705
+ /**
706
+ * @notice Permissionless way to burn stables from msg.sender directly.
707
+ * @param token The token getting burned.
708
+ * @param amount The amount of the token getting burned.
709
+ * @return True if transaction succeeds.
710
+ */
711
+ function burnStableTokens(address token, uint256 amount) external returns (bool);
712
+
713
+ /**
714
+ * @notice Configure trading limits for an (exchangeId, token) tuple.
715
+ * @dev Will revert if the configuration is not valid according to the TradingLimits library.
716
+ * Resets existing state according to the TradingLimits library logic.
717
+ * Can only be called by owner.
718
+ * @param exchangeId the exchangeId to target.
719
+ * @param token the token to target.
720
+ * @param config the new trading limits config.
721
+ */
722
+ function configureTradingLimit(bytes32 exchangeId, address token, ITradingLimits.Config calldata config) external;
723
+
724
+ /**
725
+ * @notice Get the list of registered exchange providers.
726
+ * @dev This can be used by UI or clients to discover all pairs.
727
+ * @return exchangeProviders the addresses of all exchange providers.
728
+ */
729
+ function getExchangeProviders() external view returns (address[] memory);
730
+
731
+ /**
732
+ * @notice Get the address of the exchange provider at a given index.
733
+ * @dev Auto-generated getter for the exchangeProviders array.
734
+ * @param index The index of the exchange provider.
735
+ * @return exchangeProvider The address of the exchange provider.
736
+ */
737
+ function exchangeProviders(uint256 index) external view returns (address exchangeProvider);
738
+
739
+ /**
740
+ * @notice Check if a given address is an exchange provider.
741
+ * @dev Auto-generated getter for the isExchangeProvider mapping.
742
+ * @param exchangeProvider The address to check.
743
+ * @return isExchangeProvider True if the address is an exchange provider, false otherwise.
744
+ */
745
+ function isExchangeProvider(address exchangeProvider) external view returns (bool);
746
+ }