@gooddollar/goodprotocol 2.1.3 → 2.2.0-beta.1

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 (318) hide show
  1. package/README.md +0 -2
  2. package/artifacts/abis/IdentityV4.min.json +1 -0
  3. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  4. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  5. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  6. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  7. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  8. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  9. package/artifacts/contracts/IUniswapV3.sol/INonfungiblePositionManager.dbg.json +1 -1
  10. package/artifacts/contracts/IUniswapV3.sol/IUniswapV3Pool.dbg.json +1 -1
  11. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  12. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  13. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  14. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  15. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  16. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  17. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  18. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  19. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  20. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  21. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/IQuoterV2.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/ISwapRouter.dbg.json +1 -1
  28. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  30. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  31. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  32. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  33. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  34. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  35. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  36. package/artifacts/contracts/MentoInterfaces.sol/IBancorExchangeProvider.dbg.json +1 -1
  37. package/artifacts/contracts/MentoInterfaces.sol/IBroker.dbg.json +1 -1
  38. package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.dbg.json +1 -1
  39. package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.dbg.json +1 -1
  40. package/artifacts/contracts/MentoInterfaces.sol/IMentoReserve.dbg.json +1 -1
  41. package/artifacts/contracts/MentoInterfaces.sol/ITradingLimits.dbg.json +1 -1
  42. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  43. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  44. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
  45. package/artifacts/contracts/fuseFaucet/SuperfluidFacuet.sol/SuperfluidFaucet.dbg.json +1 -1
  46. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  47. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  48. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  49. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
  50. package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.json +2 -2
  51. package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
  52. package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
  53. package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
  54. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  55. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  56. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  57. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  58. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  59. package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.dbg.json +1 -1
  60. package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.json +2 -2
  61. package/artifacts/contracts/identity/IdentityV4.sol/IdentityV4.dbg.json +4 -0
  62. package/artifacts/contracts/identity/IdentityV4.sol/IdentityV4.json +1162 -0
  63. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
  64. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  65. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  66. package/artifacts/contracts/invite/OneTimeReward.sol/OneTimeReward.dbg.json +1 -1
  67. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  68. package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
  69. package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
  70. package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest.dbg.json +1 -1
  71. package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper.dbg.json +1 -1
  72. package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
  73. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  74. package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
  75. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  76. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
  77. package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.json +2 -2
  78. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  79. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  80. package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
  81. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
  82. package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
  83. package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest.dbg.json +1 -1
  84. package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper.dbg.json +1 -1
  85. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
  87. package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.json +2 -2
  88. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  89. package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
  90. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  91. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  92. package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
  93. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
  94. package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.json +2 -2
  95. package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
  96. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  97. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  98. package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
  99. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  100. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
  101. package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.json +2 -2
  102. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  103. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  104. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  105. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  106. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  107. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  108. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  109. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  110. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  111. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  112. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  113. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  114. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  115. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  116. package/artifacts/contracts/reserve/CeloDistributionHelper.sol/CeloDistributionHelper.dbg.json +1 -1
  117. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  118. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  119. package/artifacts/contracts/reserve/GenericDistributionHelper.sol/GenericDistributionHelper.dbg.json +1 -1
  120. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  121. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  122. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  123. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  124. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  125. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  126. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  127. package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
  128. package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
  129. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  130. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  131. package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
  132. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  133. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  134. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  135. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
  136. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  137. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  138. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
  139. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
  140. package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
  141. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
  142. package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
  143. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
  144. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
  145. package/artifacts/contracts/token/GoodDollar2.sol/GoodDollar2.dbg.json +1 -1
  146. package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
  147. package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
  148. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
  149. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
  150. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
  151. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
  152. package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
  153. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
  154. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
  155. package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
  156. package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
  157. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
  158. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
  159. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
  160. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  161. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
  162. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  163. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
  164. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  165. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  166. package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.dbg.json +1 -1
  167. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
  168. package/artifacts/contracts/utils/BuyFromReserveHelper.sol/BuyFromReserveHelper.dbg.json +1 -1
  169. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
  170. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
  171. package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
  172. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  173. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  174. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  175. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  176. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/EternalStorage.dbg.json +1 -1
  177. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/FuseOldBridgeKill.dbg.json +1 -1
  178. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/IUpgradeabilityOwnerStorage.dbg.json +1 -1
  179. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Initializable.dbg.json +1 -1
  180. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Ownable.dbg.json +1 -1
  181. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Upgradeable.dbg.json +1 -1
  182. package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
  183. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  184. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  185. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  186. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  187. package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
  188. package/artifacts/contracts/utils/LastauthReduction.sol/LastauthReduction.dbg.json +1 -1
  189. package/artifacts/contracts/utils/LastauthReduction.sol/LastauthReduction.json +2 -2
  190. package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
  191. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  192. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  193. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
  194. package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
  195. package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange.dbg.json +1 -1
  196. package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.dbg.json +1 -1
  197. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  198. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  199. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  200. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  201. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  202. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  203. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  204. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  205. package/artifacts/contracts/utils/ReserveRestore.sol/ReserveRestore.dbg.json +1 -1
  206. package/artifacts/contracts/utils/ReserveRestore.sol/ReserveRestore.json +2 -2
  207. package/contracts/identity/IdentityV3.sol +0 -3
  208. package/contracts/identity/IdentityV4.sol +578 -0
  209. package/hardhat.config.ts +3 -4
  210. package/package.json +8 -4
  211. package/test/governance/ClaimersDistribution.test.ts +1 -1
  212. package/test/governance/CompoundVotingMachine.castvote.test.ts +30 -30
  213. package/test/helpers.ts +76 -195
  214. package/test/identity/IdentityV3.test.ts +53 -129
  215. package/test/identity/IdentityV4.test.ts +454 -0
  216. package/test/reserve/GenericDistributionHelper.e2e.test.ts +445 -0
  217. package/test/utils/AdminWallet.test.ts +14 -15
  218. package/types/contracts/identity/IdentityV4.ts +2001 -0
  219. package/types/contracts/identity/index.ts +1 -0
  220. package/types/contracts/utils/UpdateReserveRatio.sol/MentoExchange.ts +81 -0
  221. package/types/contracts/utils/UpdateReserveRatio.sol/UpdateReserveRatio.ts +134 -0
  222. package/types/contracts/utils/UpdateReserveRatio.sol/index.ts +5 -0
  223. package/types/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.ts +7 -2
  224. package/types/contracts/utils/index.ts +2 -2
  225. package/types/factories/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking__factory.ts +1 -1
  226. package/types/factories/contracts/identity/IdentityV3__factory.ts +1 -1
  227. package/types/factories/contracts/identity/IdentityV4__factory.ts +1213 -0
  228. package/types/factories/contracts/identity/index.ts +1 -0
  229. package/types/factories/contracts/mocks/DistributionBridgeMock__factory.ts +1 -1
  230. package/types/factories/contracts/mocks/GoodDollarStakingMock__factory.ts +1 -1
  231. package/types/factories/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock__factory.ts +1 -1
  232. package/types/factories/contracts/mocks/StakingMockFixedAPY__factory.ts +1 -1
  233. package/types/factories/contracts/utils/LastauthReduction__factory.ts +1 -1
  234. package/types/factories/contracts/utils/ReserveRestore__factory.ts +1 -1
  235. package/types/factories/contracts/utils/UpdateReserveRatio.sol/MentoExchange__factory.ts +39 -0
  236. package/types/factories/contracts/utils/UpdateReserveRatio.sol/UpdateReserveRatio__factory.ts +113 -0
  237. package/types/factories/contracts/utils/UpdateReserveRatio.sol/index.ts +5 -0
  238. package/types/factories/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC__factory.ts +9 -15
  239. package/types/factories/contracts/utils/index.ts +1 -1
  240. package/types/hardhat.d.ts +13 -4
  241. package/types/index.ts +4 -2
  242. package/scripts/ProxyFactory.json +0 -4425
  243. package/scripts/analytics/activeGDStakers.ts +0 -188
  244. package/scripts/analytics/activeStakers.ts +0 -25
  245. package/scripts/analytics/activeUsersCount.ts +0 -156
  246. package/scripts/analytics/activeWalletsStats.ts +0 -301
  247. package/scripts/analytics/checkActiveWallets.ts +0 -60
  248. package/scripts/analytics/checkBridgeBalances.ts +0 -442
  249. package/scripts/analytics/claimIncidentStats.ts +0 -98
  250. package/scripts/analytics/faucetStats.ts +0 -130
  251. package/scripts/analytics/gdinflow.ts +0 -57
  252. package/scripts/analytics/goodHolders.ts +0 -46
  253. package/scripts/analytics/goodgiveback.ts +0 -64
  254. package/scripts/analytics/p2pTxs.ts +0 -564
  255. package/scripts/analytics/stuckgd.ts +0 -70
  256. package/scripts/analytics/tokenInOutStats.ts +0 -48
  257. package/scripts/analytics/whitelistsyncIssue.ts +0 -87
  258. package/scripts/bulkProof.ts +0 -202
  259. package/scripts/bulkWhitelist.ts +0 -31
  260. package/scripts/deployGnosisSafe.ts +0 -111
  261. package/scripts/fetchOrDeployProxyFactory.ts +0 -46
  262. package/scripts/fv.ts +0 -263
  263. package/scripts/gdx/gdxAirdropCalculation.ts +0 -479
  264. package/scripts/getFounders.ts +0 -32
  265. package/scripts/governance/README.md +0 -70
  266. package/scripts/governance/airdropCalculation.ts +0 -1119
  267. package/scripts/governance/airdropCalculationRecover.ts +0 -416
  268. package/scripts/governance/airdropCalculationSorted.ts +0 -438
  269. package/scripts/governance/goodCheckpointSorted.ts +0 -300
  270. package/scripts/keeper/fishInactive.ts +0 -47
  271. package/scripts/minimize.sh +0 -17
  272. package/scripts/multichain-deploy/0_proxyFactory-deploy.ts +0 -131
  273. package/scripts/multichain-deploy/1_basicdao-deploy.ts +0 -294
  274. package/scripts/multichain-deploy/2_helpers-deploy.ts +0 -152
  275. package/scripts/multichain-deploy/2b_otp-deploy.ts +0 -73
  276. package/scripts/multichain-deploy/3_gdSavings-deploy.ts +0 -190
  277. package/scripts/multichain-deploy/4_ubi-deploy.ts +0 -129
  278. package/scripts/multichain-deploy/5_gov-deploy.ts +0 -179
  279. package/scripts/multichain-deploy/6_testnetFaucet.ts +0 -85
  280. package/scripts/multichain-deploy/7_superfluidfaucet-deploy.ts +0 -123
  281. package/scripts/multichain-deploy/8_disthelper-deploy.ts +0 -152
  282. package/scripts/multichain-deploy/createUniswapTestPools.ts +0 -163
  283. package/scripts/multichain-deploy/flattened/Avatar.sol +0 -913
  284. package/scripts/multichain-deploy/flattened/Controller.sol +0 -1891
  285. package/scripts/multichain-deploy/flattened/FeeFormula.sol +0 -1290
  286. package/scripts/multichain-deploy/fulldeploy.sh +0 -26
  287. package/scripts/multichain-deploy/helpers.ts +0 -647
  288. package/scripts/multichain-deploy/multichainWrapper-deploy.ts +0 -59
  289. package/scripts/multichain-deploy/verifyEtherscan.ts +0 -177
  290. package/scripts/proposals/gip-14_1.ts +0 -251
  291. package/scripts/proposals/gip-15.ts +0 -427
  292. package/scripts/proposals/gip-25-xdc-upgrade-ubi.ts +0 -746
  293. package/scripts/proposals/gips-14_1.md +0 -29
  294. package/scripts/proposals/hack-ubi-recovery.ts +0 -414
  295. package/scripts/proposals/identityAuthPeriod.ts +0 -229
  296. package/scripts/proposals/reserveRestore.ts +0 -474
  297. package/scripts/proposals/updateDistHelper.ts +0 -180
  298. package/scripts/proposals/v4Upgrade.ts +0 -845
  299. package/scripts/releaser.js +0 -24
  300. package/scripts/staking/stakersGdRewardsCalculation.ts +0 -64
  301. package/scripts/upgradeScheme.ts +0 -97
  302. package/scripts/upgradeToV2/upgradeToV2.ts +0 -853
  303. package/scripts/upgradeToV2/upgradeToV2Recover.ts +0 -939
  304. package/scripts/upgradeToV3/v3-fix.ts +0 -120
  305. package/scripts/upgradeToV3/v3-fuse-multichain.ts +0 -117
  306. package/scripts/upgradeToV3/v3-upgrade.ts +0 -219
  307. package/scripts/upgrades/celo-defi-ubi-deploy.ts +0 -184
  308. package/scripts/upgrades/identity-upgrade.ts +0 -126
  309. package/scripts/upgrades/multichain-formula-upgrade.ts +0 -143
  310. package/scripts/upgrades/multichain-temp-fix.ts +0 -129
  311. package/scripts/upgrades/restoreFunds.ts +0 -91
  312. package/scripts/upgrades/superfluid-nft-celo-gas-token.ts +0 -159
  313. package/scripts/upgrades/transferDaoToGuardians.ts +0 -80
  314. package/scripts/upgrades/upgradeAdminWallet.ts +0 -29
  315. package/scripts/upgrades/upgradeFaucet.ts +0 -46
  316. package/scripts/utils.ts +0 -50
  317. package/scripts/verify.ts +0 -67
  318. package/scripts/voltageswaps.ts +0 -46
@@ -1,1290 +0,0 @@
1
- pragma solidity ^0.5.4;
2
-
3
- /**
4
- * @title Ownable
5
- * @dev The Ownable contract has an owner address, and provides basic authorization control
6
- * functions, this simplifies the implementation of "user permissions".
7
- */
8
- contract Ownable {
9
- address private _owner;
10
-
11
- event OwnershipTransferred(
12
- address indexed previousOwner,
13
- address indexed newOwner
14
- );
15
-
16
- /**
17
- * @dev The Ownable constructor sets the original `owner` of the contract to the sender
18
- * account.
19
- */
20
- constructor() internal {
21
- _owner = msg.sender;
22
- emit OwnershipTransferred(address(0), _owner);
23
- }
24
-
25
- /**
26
- * @return the address of the owner.
27
- */
28
- function owner() public view returns (address) {
29
- return _owner;
30
- }
31
-
32
- /**
33
- * @dev Throws if called by any account other than the owner.
34
- */
35
- modifier onlyOwner() {
36
- require(isOwner());
37
- _;
38
- }
39
-
40
- /**
41
- * @return true if `msg.sender` is the owner of the contract.
42
- */
43
- function isOwner() public view returns (bool) {
44
- return msg.sender == _owner;
45
- }
46
-
47
- /**
48
- * @dev Allows the current owner to relinquish control of the contract.
49
- * @notice Renouncing to ownership will leave the contract without an owner.
50
- * It will not be possible to call the functions with the `onlyOwner`
51
- * modifier anymore.
52
- */
53
- function renounceOwnership() public onlyOwner {
54
- emit OwnershipTransferred(_owner, address(0));
55
- _owner = address(0);
56
- }
57
-
58
- /**
59
- * @dev Allows the current owner to transfer control of the contract to a newOwner.
60
- * @param newOwner The address to transfer ownership to.
61
- */
62
- function transferOwnership(address newOwner) public onlyOwner {
63
- _transferOwnership(newOwner);
64
- }
65
-
66
- /**
67
- * @dev Transfers control of the contract to a newOwner.
68
- * @param newOwner The address to transfer ownership to.
69
- */
70
- function _transferOwnership(address newOwner) internal {
71
- require(newOwner != address(0));
72
- emit OwnershipTransferred(_owner, newOwner);
73
- _owner = newOwner;
74
- }
75
- }
76
-
77
- /* @dev abstract contract for ensuring that schemes have been registered properly
78
- * Allows setting zero Avatar in situations where the Avatar hasn't been created yet
79
- */
80
- contract SchemeGuard is Ownable {
81
- Avatar avatar;
82
- ControllerInterface internal controller = ControllerInterface(0);
83
-
84
- /** @dev Constructor. only sets controller if given avatar is not null.
85
- * @param _avatar The avatar of the DAO.
86
- */
87
- constructor(Avatar _avatar) public {
88
- avatar = _avatar;
89
-
90
- if (avatar != Avatar(0)) {
91
- controller = ControllerInterface(avatar.owner());
92
- }
93
- }
94
-
95
- /** @dev modifier to check if caller is avatar
96
- */
97
- modifier onlyAvatar() {
98
- require(address(avatar) == msg.sender, "only Avatar can call this method");
99
- _;
100
- }
101
-
102
- /** @dev modifier to check if scheme is registered
103
- */
104
- modifier onlyRegistered() {
105
- require(isRegistered(), "Scheme is not registered");
106
- _;
107
- }
108
-
109
- /** @dev modifier to check if scheme is not registered
110
- */
111
- modifier onlyNotRegistered() {
112
- require(!isRegistered(), "Scheme is registered");
113
- _;
114
- }
115
-
116
- /** @dev modifier to check if call is a scheme that is registered
117
- */
118
- modifier onlyRegisteredCaller() {
119
- require(isRegistered(msg.sender), "Calling scheme is not registered");
120
- _;
121
- }
122
-
123
- /** @dev Function to set a new avatar and controller for scheme
124
- * can only be done by owner of scheme
125
- */
126
- function setAvatar(Avatar _avatar) public onlyOwner {
127
- avatar = _avatar;
128
- controller = ControllerInterface(avatar.owner());
129
- }
130
-
131
- /** @dev function to see if an avatar has been set and if this scheme is registered
132
- * @return true if scheme is registered
133
- */
134
- function isRegistered() public view returns (bool) {
135
- return isRegistered(address(this));
136
- }
137
-
138
- /** @dev function to see if an avatar has been set and if this scheme is registered
139
- * @return true if scheme is registered
140
- */
141
- function isRegistered(address scheme) public view returns (bool) {
142
- require(avatar != Avatar(0), "Avatar is not set");
143
-
144
- if (!(controller.isSchemeRegistered(scheme, address(avatar)))) {
145
- return false;
146
- }
147
- return true;
148
- }
149
- }
150
-
151
- /**
152
- * @title Fee formula abstract contract
153
- */
154
- contract AbstractFees is SchemeGuard {
155
- constructor() public SchemeGuard(Avatar(0)) {}
156
-
157
- function getTxFees(
158
- uint256 _value,
159
- address _sender,
160
- address _recipient
161
- ) public view returns (uint256, bool);
162
- }
163
-
164
- /**
165
- * @title Fee formula contract
166
- * contract that provides a function to calculate
167
- * fees as a percentage of any given value
168
- */
169
- contract FeeFormula is AbstractFees {
170
- using SafeMath for uint256;
171
-
172
- uint256 public percentage;
173
- bool public constant senderPays = false;
174
-
175
- /**
176
- * @dev Constructor. Requires the given percentage parameter
177
- * to be less than 100.
178
- * @param _percentage the percentage to calculate fees of
179
- */
180
- constructor(uint256 _percentage) public {
181
- require(_percentage < 100, "Percentage should be <100");
182
- percentage = _percentage;
183
- }
184
-
185
- /** @dev calculates the fee of given value.
186
- * @param _value the value of the transaction to calculate fees from
187
- * @param _sender address sending.
188
- * @param _recipient address receiving.
189
- * @return the transactional fee for given value
190
- */
191
- function getTxFees(
192
- uint256 _value,
193
- address _sender,
194
- address _recipient
195
- ) public view returns (uint256, bool) {
196
- return (_value.mul(percentage).div(100), senderPays);
197
- }
198
- }
199
-
200
- /**
201
- * Utility library of inline functions on addresses
202
- */
203
- library Address {
204
- /**
205
- * Returns whether the target address is a contract
206
- * @dev This function will return false if invoked during the constructor of a contract,
207
- * as the code is not actually created until after the constructor finishes.
208
- * @param account address of the account to check
209
- * @return whether the target address is a contract
210
- */
211
- function isContract(address account) internal view returns (bool) {
212
- uint256 size;
213
- // XXX Currently there is no better way to check if there is a contract in an address
214
- // than to check the size of the code at that address.
215
- // See https://ethereum.stackexchange.com/a/14016/36603
216
- // for more details about how this works.
217
- // TODO Check this again before the Serenity release, because all addresses will be
218
- // contracts then.
219
- // solhint-disable-next-line no-inline-assembly
220
- assembly {
221
- size := extcodesize(account)
222
- }
223
- return size > 0;
224
- }
225
- }
226
-
227
- /**
228
- * @title ERC20 interface
229
- * @dev see https://github.com/ethereum/EIPs/issues/20
230
- */
231
- interface IERC20 {
232
- function transfer(address to, uint256 value) external returns (bool);
233
-
234
- function approve(address spender, uint256 value) external returns (bool);
235
-
236
- function transferFrom(
237
- address from,
238
- address to,
239
- uint256 value
240
- ) external returns (bool);
241
-
242
- function totalSupply() external view returns (uint256);
243
-
244
- function balanceOf(address who) external view returns (uint256);
245
-
246
- function allowance(
247
- address owner,
248
- address spender
249
- ) external view returns (uint256);
250
-
251
- event Transfer(address indexed from, address indexed to, uint256 value);
252
-
253
- event Approval(address indexed owner, address indexed spender, uint256 value);
254
- }
255
-
256
- /**
257
- * @title Standard ERC20 token
258
- *
259
- * @dev Implementation of the basic standard token.
260
- * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
261
- * Originally based on code by FirstBlood:
262
- * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
263
- *
264
- * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
265
- * all accounts just by listening to said events. Note that this isn't required by the specification, and other
266
- * compliant implementations may not do it.
267
- */
268
- contract ERC20 is IERC20 {
269
- using SafeMath for uint256;
270
-
271
- mapping(address => uint256) private _balances;
272
-
273
- mapping(address => mapping(address => uint256)) private _allowed;
274
-
275
- uint256 private _totalSupply;
276
-
277
- /**
278
- * @dev Total number of tokens in existence
279
- */
280
- function totalSupply() public view returns (uint256) {
281
- return _totalSupply;
282
- }
283
-
284
- /**
285
- * @dev Gets the balance of the specified address.
286
- * @param owner The address to query the balance of.
287
- * @return An uint256 representing the amount owned by the passed address.
288
- */
289
- function balanceOf(address owner) public view returns (uint256) {
290
- return _balances[owner];
291
- }
292
-
293
- /**
294
- * @dev Function to check the amount of tokens that an owner allowed to a spender.
295
- * @param owner address The address which owns the funds.
296
- * @param spender address The address which will spend the funds.
297
- * @return A uint256 specifying the amount of tokens still available for the spender.
298
- */
299
- function allowance(
300
- address owner,
301
- address spender
302
- ) public view returns (uint256) {
303
- return _allowed[owner][spender];
304
- }
305
-
306
- /**
307
- * @dev Transfer token for a specified address
308
- * @param to The address to transfer to.
309
- * @param value The amount to be transferred.
310
- */
311
- function transfer(address to, uint256 value) public returns (bool) {
312
- _transfer(msg.sender, to, value);
313
- return true;
314
- }
315
-
316
- /**
317
- * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
318
- * Beware that changing an allowance with this method brings the risk that someone may use both the old
319
- * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
320
- * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
321
- * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
322
- * @param spender The address which will spend the funds.
323
- * @param value The amount of tokens to be spent.
324
- */
325
- function approve(address spender, uint256 value) public returns (bool) {
326
- require(spender != address(0));
327
-
328
- _allowed[msg.sender][spender] = value;
329
- emit Approval(msg.sender, spender, value);
330
- return true;
331
- }
332
-
333
- /**
334
- * @dev Transfer tokens from one address to another.
335
- * Note that while this function emits an Approval event, this is not required as per the specification,
336
- * and other compliant implementations may not emit the event.
337
- * @param from address The address which you want to send tokens from
338
- * @param to address The address which you want to transfer to
339
- * @param value uint256 the amount of tokens to be transferred
340
- */
341
- function transferFrom(
342
- address from,
343
- address to,
344
- uint256 value
345
- ) public returns (bool) {
346
- _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
347
- _transfer(from, to, value);
348
- emit Approval(from, msg.sender, _allowed[from][msg.sender]);
349
- return true;
350
- }
351
-
352
- /**
353
- * @dev Increase the amount of tokens that an owner allowed to a spender.
354
- * approve should be called when allowed_[_spender] == 0. To increment
355
- * allowed value is better to use this function to avoid 2 calls (and wait until
356
- * the first transaction is mined)
357
- * From MonolithDAO Token.sol
358
- * Emits an Approval event.
359
- * @param spender The address which will spend the funds.
360
- * @param addedValue The amount of tokens to increase the allowance by.
361
- */
362
- function increaseAllowance(
363
- address spender,
364
- uint256 addedValue
365
- ) public returns (bool) {
366
- require(spender != address(0));
367
-
368
- _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(
369
- addedValue
370
- );
371
- emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
372
- return true;
373
- }
374
-
375
- /**
376
- * @dev Decrease the amount of tokens that an owner allowed to a spender.
377
- * approve should be called when allowed_[_spender] == 0. To decrement
378
- * allowed value is better to use this function to avoid 2 calls (and wait until
379
- * the first transaction is mined)
380
- * From MonolithDAO Token.sol
381
- * Emits an Approval event.
382
- * @param spender The address which will spend the funds.
383
- * @param subtractedValue The amount of tokens to decrease the allowance by.
384
- */
385
- function decreaseAllowance(
386
- address spender,
387
- uint256 subtractedValue
388
- ) public returns (bool) {
389
- require(spender != address(0));
390
-
391
- _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(
392
- subtractedValue
393
- );
394
- emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
395
- return true;
396
- }
397
-
398
- /**
399
- * @dev Transfer token for a specified addresses
400
- * @param from The address to transfer from.
401
- * @param to The address to transfer to.
402
- * @param value The amount to be transferred.
403
- */
404
- function _transfer(address from, address to, uint256 value) internal {
405
- require(to != address(0));
406
-
407
- _balances[from] = _balances[from].sub(value);
408
- _balances[to] = _balances[to].add(value);
409
- emit Transfer(from, to, value);
410
- }
411
-
412
- /**
413
- * @dev Internal function that mints an amount of the token and assigns it to
414
- * an account. This encapsulates the modification of balances such that the
415
- * proper events are emitted.
416
- * @param account The account that will receive the created tokens.
417
- * @param value The amount that will be created.
418
- */
419
- function _mint(address account, uint256 value) internal {
420
- require(account != address(0));
421
-
422
- _totalSupply = _totalSupply.add(value);
423
- _balances[account] = _balances[account].add(value);
424
- emit Transfer(address(0), account, value);
425
- }
426
-
427
- /**
428
- * @dev Internal function that burns an amount of the token of a given
429
- * account.
430
- * @param account The account whose tokens will be burnt.
431
- * @param value The amount that will be burnt.
432
- */
433
- function _burn(address account, uint256 value) internal {
434
- require(account != address(0));
435
-
436
- _totalSupply = _totalSupply.sub(value);
437
- _balances[account] = _balances[account].sub(value);
438
- emit Transfer(account, address(0), value);
439
- }
440
-
441
- /**
442
- * @dev Internal function that burns an amount of the token of a given
443
- * account, deducting from the sender's allowance for said account. Uses the
444
- * internal burn function.
445
- * Emits an Approval event (reflecting the reduced allowance).
446
- * @param account The account whose tokens will be burnt.
447
- * @param value The amount that will be burnt.
448
- */
449
- function _burnFrom(address account, uint256 value) internal {
450
- _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
451
- _burn(account, value);
452
- emit Approval(account, msg.sender, _allowed[account][msg.sender]);
453
- }
454
- }
455
-
456
- /**
457
- * @title Burnable Token
458
- * @dev Token that can be irreversibly burned (destroyed).
459
- */
460
- contract ERC20Burnable is ERC20 {
461
- /**
462
- * @dev Burns a specific amount of tokens.
463
- * @param value The amount of token to be burned.
464
- */
465
- function burn(uint256 value) public {
466
- _burn(msg.sender, value);
467
- }
468
-
469
- /**
470
- * @dev Burns a specific amount of tokens from the target address and decrements allowance
471
- * @param from address The address which you want to send tokens from
472
- * @param value uint256 The amount of token to be burned
473
- */
474
- function burnFrom(address from, uint256 value) public {
475
- _burnFrom(from, value);
476
- }
477
- }
478
-
479
- /**
480
- * @title SafeMath
481
- * @dev Unsigned math operations with safety checks that revert on error
482
- */
483
- library SafeMath {
484
- /**
485
- * @dev Multiplies two unsigned integers, reverts on overflow.
486
- */
487
- function mul(uint256 a, uint256 b) internal pure returns (uint256) {
488
- // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
489
- // benefit is lost if 'b' is also tested.
490
- // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
491
- if (a == 0) {
492
- return 0;
493
- }
494
-
495
- uint256 c = a * b;
496
- require(c / a == b);
497
-
498
- return c;
499
- }
500
-
501
- /**
502
- * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
503
- */
504
- function div(uint256 a, uint256 b) internal pure returns (uint256) {
505
- // Solidity only automatically asserts when dividing by 0
506
- require(b > 0);
507
- uint256 c = a / b;
508
- // assert(a == b * c + a % b); // There is no case in which this doesn't hold
509
-
510
- return c;
511
- }
512
-
513
- /**
514
- * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
515
- */
516
- function sub(uint256 a, uint256 b) internal pure returns (uint256) {
517
- require(b <= a);
518
- uint256 c = a - b;
519
-
520
- return c;
521
- }
522
-
523
- /**
524
- * @dev Adds two unsigned integers, reverts on overflow.
525
- */
526
- function add(uint256 a, uint256 b) internal pure returns (uint256) {
527
- uint256 c = a + b;
528
- require(c >= a);
529
-
530
- return c;
531
- }
532
-
533
- /**
534
- * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
535
- * reverts when dividing by zero.
536
- */
537
- function mod(uint256 a, uint256 b) internal pure returns (uint256) {
538
- require(b != 0);
539
- return a % b;
540
- }
541
- }
542
-
543
- /**
544
- * @title Reputation system
545
- * @dev A DAO has Reputation System which allows peers to rate other peers in order to build trust .
546
- * A reputation is use to assign influence measure to a DAO'S peers.
547
- * Reputation is similar to regular tokens but with one crucial difference: It is non-transferable.
548
- * The Reputation contract maintain a map of address to reputation value.
549
- * It provides an onlyOwner functions to mint and burn reputation _to (or _from) a specific address.
550
- */
551
-
552
- contract Reputation is Ownable {
553
- uint8 public decimals = 18; //Number of decimals of the smallest unit
554
- // Event indicating minting of reputation to an address.
555
- event Mint(address indexed _to, uint256 _amount);
556
- // Event indicating burning of reputation for an address.
557
- event Burn(address indexed _from, uint256 _amount);
558
-
559
- /// @dev `Checkpoint` is the structure that attaches a block number to a
560
- /// given value, the block number attached is the one that last changed the
561
- /// value
562
- struct Checkpoint {
563
- // `fromBlock` is the block number that the value was generated from
564
- uint128 fromBlock;
565
- // `value` is the amount of reputation at a specific block number
566
- uint128 value;
567
- }
568
-
569
- // `balances` is the map that tracks the balance of each address, in this
570
- // contract when the balance changes the block number that the change
571
- // occurred is also included in the map
572
- mapping(address => Checkpoint[]) balances;
573
-
574
- // Tracks the history of the `totalSupply` of the reputation
575
- Checkpoint[] totalSupplyHistory;
576
-
577
- /// @notice Constructor to create a Reputation
578
- constructor() public {}
579
-
580
- /// @dev This function makes it easy to get the total number of reputation
581
- /// @return The total number of reputation
582
- function totalSupply() public view returns (uint256) {
583
- return totalSupplyAt(block.number);
584
- }
585
-
586
- ////////////////
587
- // Query balance and totalSupply in History
588
- ////////////////
589
- /**
590
- * @dev return the reputation amount of a given owner
591
- * @param _owner an address of the owner which we want to get his reputation
592
- */
593
- function balanceOf(address _owner) public view returns (uint256 balance) {
594
- return balanceOfAt(_owner, block.number);
595
- }
596
-
597
- /// @dev Queries the balance of `_owner` at a specific `_blockNumber`
598
- /// @param _owner The address from which the balance will be retrieved
599
- /// @param _blockNumber The block number when the balance is queried
600
- /// @return The balance at `_blockNumber`
601
- function balanceOfAt(
602
- address _owner,
603
- uint256 _blockNumber
604
- ) public view returns (uint256) {
605
- if (
606
- (balances[_owner].length == 0) ||
607
- (balances[_owner][0].fromBlock > _blockNumber)
608
- ) {
609
- return 0;
610
- // This will return the expected balance during normal situations
611
- } else {
612
- return getValueAt(balances[_owner], _blockNumber);
613
- }
614
- }
615
-
616
- /// @notice Total amount of reputation at a specific `_blockNumber`.
617
- /// @param _blockNumber The block number when the totalSupply is queried
618
- /// @return The total amount of reputation at `_blockNumber`
619
- function totalSupplyAt(uint256 _blockNumber) public view returns (uint256) {
620
- if (
621
- (totalSupplyHistory.length == 0) ||
622
- (totalSupplyHistory[0].fromBlock > _blockNumber)
623
- ) {
624
- return 0;
625
- // This will return the expected totalSupply during normal situations
626
- } else {
627
- return getValueAt(totalSupplyHistory, _blockNumber);
628
- }
629
- }
630
-
631
- /// @notice Generates `_amount` reputation that are assigned to `_owner`
632
- /// @param _user The address that will be assigned the new reputation
633
- /// @param _amount The quantity of reputation generated
634
- /// @return True if the reputation are generated correctly
635
- function mint(
636
- address _user,
637
- uint256 _amount
638
- ) public onlyOwner returns (bool) {
639
- uint256 curTotalSupply = totalSupply();
640
- require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
641
- uint256 previousBalanceTo = balanceOf(_user);
642
- require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
643
- updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount);
644
- updateValueAtNow(balances[_user], previousBalanceTo + _amount);
645
- emit Mint(_user, _amount);
646
- return true;
647
- }
648
-
649
- /// @notice Burns `_amount` reputation from `_owner`
650
- /// @param _user The address that will lose the reputation
651
- /// @param _amount The quantity of reputation to burn
652
- /// @return True if the reputation are burned correctly
653
- function burn(
654
- address _user,
655
- uint256 _amount
656
- ) public onlyOwner returns (bool) {
657
- uint256 curTotalSupply = totalSupply();
658
- uint256 amountBurned = _amount;
659
- uint256 previousBalanceFrom = balanceOf(_user);
660
- if (previousBalanceFrom < amountBurned) {
661
- amountBurned = previousBalanceFrom;
662
- }
663
- updateValueAtNow(totalSupplyHistory, curTotalSupply - amountBurned);
664
- updateValueAtNow(balances[_user], previousBalanceFrom - amountBurned);
665
- emit Burn(_user, amountBurned);
666
- return true;
667
- }
668
-
669
- ////////////////
670
- // Internal helper functions to query and set a value in a snapshot array
671
- ////////////////
672
-
673
- /// @dev `getValueAt` retrieves the number of reputation at a given block number
674
- /// @param checkpoints The history of values being queried
675
- /// @param _block The block number to retrieve the value at
676
- /// @return The number of reputation being queried
677
- function getValueAt(
678
- Checkpoint[] storage checkpoints,
679
- uint256 _block
680
- ) internal view returns (uint256) {
681
- if (checkpoints.length == 0) {
682
- return 0;
683
- }
684
-
685
- // Shortcut for the actual value
686
- if (_block >= checkpoints[checkpoints.length - 1].fromBlock) {
687
- return checkpoints[checkpoints.length - 1].value;
688
- }
689
- if (_block < checkpoints[0].fromBlock) {
690
- return 0;
691
- }
692
-
693
- // Binary search of the value in the array
694
- uint256 min = 0;
695
- uint256 max = checkpoints.length - 1;
696
- while (max > min) {
697
- uint256 mid = (max + min + 1) / 2;
698
- if (checkpoints[mid].fromBlock <= _block) {
699
- min = mid;
700
- } else {
701
- max = mid - 1;
702
- }
703
- }
704
- return checkpoints[min].value;
705
- }
706
-
707
- /// @dev `updateValueAtNow` used to update the `balances` map and the
708
- /// `totalSupplyHistory`
709
- /// @param checkpoints The history of data being updated
710
- /// @param _value The new number of reputation
711
- function updateValueAtNow(
712
- Checkpoint[] storage checkpoints,
713
- uint256 _value
714
- ) internal {
715
- require(uint128(_value) == _value); //check value is in the 128 bits bounderies
716
- if (
717
- (checkpoints.length == 0) ||
718
- (checkpoints[checkpoints.length - 1].fromBlock < block.number)
719
- ) {
720
- Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++];
721
- newCheckPoint.fromBlock = uint128(block.number);
722
- newCheckPoint.value = uint128(_value);
723
- } else {
724
- Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length - 1];
725
- oldCheckPoint.value = uint128(_value);
726
- }
727
- }
728
- }
729
-
730
- /*
731
-
732
- SafeERC20 by daostack.
733
- The code is based on a fix by SECBIT Team.
734
-
735
- USE WITH CAUTION & NO WARRANTY
736
-
737
- REFERENCE & RELATED READING
738
- - https://github.com/ethereum/solidity/issues/4116
739
- - https://medium.com/@chris_77367/explaining-unexpected-reverts-starting-with-solidity-0-4-22-3ada6e82308c
740
- - https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
741
- - https://gist.github.com/BrendanChou/88a2eeb80947ff00bcf58ffdafeaeb61
742
-
743
- */
744
-
745
- library SafeERC20 {
746
- using Address for address;
747
-
748
- bytes4 private constant TRANSFER_SELECTOR =
749
- bytes4(keccak256(bytes("transfer(address,uint256)")));
750
- bytes4 private constant TRANSFERFROM_SELECTOR =
751
- bytes4(keccak256(bytes("transferFrom(address,address,uint256)")));
752
- bytes4 private constant APPROVE_SELECTOR =
753
- bytes4(keccak256(bytes("approve(address,uint256)")));
754
-
755
- function safeTransfer(
756
- address _erc20Addr,
757
- address _to,
758
- uint256 _value
759
- ) internal {
760
- // Must be a contract addr first!
761
- require(_erc20Addr.isContract());
762
-
763
- (
764
- bool success,
765
- bytes memory returnValue // solhint-disable-next-line avoid-low-level-calls
766
- ) = _erc20Addr.call(abi.encodeWithSelector(TRANSFER_SELECTOR, _to, _value));
767
- // call return false when something wrong
768
- require(success);
769
- //check return value
770
- require(
771
- returnValue.length == 0 ||
772
- (returnValue.length == 32 && (returnValue[31] != 0))
773
- );
774
- }
775
-
776
- function safeTransferFrom(
777
- address _erc20Addr,
778
- address _from,
779
- address _to,
780
- uint256 _value
781
- ) internal {
782
- // Must be a contract addr first!
783
- require(_erc20Addr.isContract());
784
-
785
- (
786
- bool success,
787
- bytes memory returnValue // solhint-disable-next-line avoid-low-level-calls
788
- ) = _erc20Addr.call(
789
- abi.encodeWithSelector(TRANSFERFROM_SELECTOR, _from, _to, _value)
790
- );
791
- // call return false when something wrong
792
- require(success);
793
- //check return value
794
- require(
795
- returnValue.length == 0 ||
796
- (returnValue.length == 32 && (returnValue[31] != 0))
797
- );
798
- }
799
-
800
- function safeApprove(
801
- address _erc20Addr,
802
- address _spender,
803
- uint256 _value
804
- ) internal {
805
- // Must be a contract addr first!
806
- require(_erc20Addr.isContract());
807
-
808
- // safeApprove should only be called when setting an initial allowance,
809
- // or when resetting it to zero.
810
- require(
811
- (_value == 0) ||
812
- (IERC20(_erc20Addr).allowance(address(this), _spender) == 0)
813
- );
814
-
815
- (
816
- bool success,
817
- bytes memory returnValue // solhint-disable-next-line avoid-low-level-calls
818
- ) = _erc20Addr.call(
819
- abi.encodeWithSelector(APPROVE_SELECTOR, _spender, _value)
820
- );
821
- // call return false when something wrong
822
- require(success);
823
- //check return value
824
- require(
825
- returnValue.length == 0 ||
826
- (returnValue.length == 32 && (returnValue[31] != 0))
827
- );
828
- }
829
- }
830
-
831
- contract GlobalConstraintInterface {
832
- enum CallPhase {
833
- Pre,
834
- Post,
835
- PreAndPost
836
- }
837
-
838
- function pre(
839
- address _scheme,
840
- bytes32 _params,
841
- bytes32 _method
842
- ) public returns (bool);
843
-
844
- function post(
845
- address _scheme,
846
- bytes32 _params,
847
- bytes32 _method
848
- ) public returns (bool);
849
-
850
- /**
851
- * @dev when return if this globalConstraints is pre, post or both.
852
- * @return CallPhase enum indication Pre, Post or PreAndPost.
853
- */
854
- function when() public returns (CallPhase);
855
- }
856
-
857
- /**
858
- * @title DAOToken, base on zeppelin contract.
859
- * @dev ERC20 compatible token. It is a mintable, burnable token.
860
- */
861
-
862
- contract DAOToken is ERC20, ERC20Burnable, Ownable {
863
- string public name;
864
- string public symbol;
865
- // solhint-disable-next-line const-name-snakecase
866
- uint8 public constant decimals = 18;
867
- uint256 public cap;
868
-
869
- /**
870
- * @dev Constructor
871
- * @param _name - token name
872
- * @param _symbol - token symbol
873
- * @param _cap - token cap - 0 value means no cap
874
- */
875
- constructor(string memory _name, string memory _symbol, uint256 _cap) public {
876
- name = _name;
877
- symbol = _symbol;
878
- cap = _cap;
879
- }
880
-
881
- /**
882
- * @dev Function to mint tokens
883
- * @param _to The address that will receive the minted tokens.
884
- * @param _amount The amount of tokens to mint.
885
- */
886
- function mint(address _to, uint256 _amount) public onlyOwner returns (bool) {
887
- if (cap > 0) require(totalSupply().add(_amount) <= cap);
888
- _mint(_to, _amount);
889
- return true;
890
- }
891
- }
892
-
893
- /**
894
- * @title Controller contract
895
- * @dev A controller controls the organizations tokens ,reputation and avatar.
896
- * It is subject to a set of schemes and constraints that determine its behavior.
897
- * Each scheme has it own parameters and operation permissions.
898
- */
899
- interface ControllerInterface {
900
- /**
901
- * @dev Mint `_amount` of reputation that are assigned to `_to` .
902
- * @param _amount amount of reputation to mint
903
- * @param _to beneficiary address
904
- * @return bool which represents a success
905
- */
906
- function mintReputation(
907
- uint256 _amount,
908
- address _to,
909
- address _avatar
910
- ) external returns (bool);
911
-
912
- /**
913
- * @dev Burns `_amount` of reputation from `_from`
914
- * @param _amount amount of reputation to burn
915
- * @param _from The address that will lose the reputation
916
- * @return bool which represents a success
917
- */
918
- function burnReputation(
919
- uint256 _amount,
920
- address _from,
921
- address _avatar
922
- ) external returns (bool);
923
-
924
- /**
925
- * @dev mint tokens .
926
- * @param _amount amount of token to mint
927
- * @param _beneficiary beneficiary address
928
- * @param _avatar address
929
- * @return bool which represents a success
930
- */
931
- function mintTokens(
932
- uint256 _amount,
933
- address _beneficiary,
934
- address _avatar
935
- ) external returns (bool);
936
-
937
- /**
938
- * @dev register or update a scheme
939
- * @param _scheme the address of the scheme
940
- * @param _paramsHash a hashed configuration of the usage of the scheme
941
- * @param _permissions the permissions the new scheme will have
942
- * @param _avatar address
943
- * @return bool which represents a success
944
- */
945
- function registerScheme(
946
- address _scheme,
947
- bytes32 _paramsHash,
948
- bytes4 _permissions,
949
- address _avatar
950
- ) external returns (bool);
951
-
952
- /**
953
- * @dev unregister a scheme
954
- * @param _avatar address
955
- * @param _scheme the address of the scheme
956
- * @return bool which represents a success
957
- */
958
- function unregisterScheme(
959
- address _scheme,
960
- address _avatar
961
- ) external returns (bool);
962
-
963
- /**
964
- * @dev unregister the caller's scheme
965
- * @param _avatar address
966
- * @return bool which represents a success
967
- */
968
- function unregisterSelf(address _avatar) external returns (bool);
969
-
970
- /**
971
- * @dev add or update Global Constraint
972
- * @param _globalConstraint the address of the global constraint to be added.
973
- * @param _params the constraint parameters hash.
974
- * @param _avatar the avatar of the organization
975
- * @return bool which represents a success
976
- */
977
- function addGlobalConstraint(
978
- address _globalConstraint,
979
- bytes32 _params,
980
- address _avatar
981
- ) external returns (bool);
982
-
983
- /**
984
- * @dev remove Global Constraint
985
- * @param _globalConstraint the address of the global constraint to be remove.
986
- * @param _avatar the organization avatar.
987
- * @return bool which represents a success
988
- */
989
- function removeGlobalConstraint(
990
- address _globalConstraint,
991
- address _avatar
992
- ) external returns (bool);
993
-
994
- /**
995
- * @dev upgrade the Controller
996
- * The function will trigger an event 'UpgradeController'.
997
- * @param _newController the address of the new controller.
998
- * @param _avatar address
999
- * @return bool which represents a success
1000
- */
1001
- function upgradeController(
1002
- address _newController,
1003
- Avatar _avatar
1004
- ) external returns (bool);
1005
-
1006
- /**
1007
- * @dev perform a generic call to an arbitrary contract
1008
- * @param _contract the contract's address to call
1009
- * @param _data ABI-encoded contract call to call `_contract` address.
1010
- * @param _avatar the controller's avatar address
1011
- * @param _value value (ETH) to transfer with the transaction
1012
- * @return bool -success
1013
- * bytes - the return value of the called _contract's function.
1014
- */
1015
- function genericCall(
1016
- address _contract,
1017
- bytes calldata _data,
1018
- Avatar _avatar,
1019
- uint256 _value
1020
- ) external returns (bool, bytes memory);
1021
-
1022
- /**
1023
- * @dev send some ether
1024
- * @param _amountInWei the amount of ether (in Wei) to send
1025
- * @param _to address of the beneficiary
1026
- * @param _avatar address
1027
- * @return bool which represents a success
1028
- */
1029
- function sendEther(
1030
- uint256 _amountInWei,
1031
- address payable _to,
1032
- Avatar _avatar
1033
- ) external returns (bool);
1034
-
1035
- /**
1036
- * @dev send some amount of arbitrary ERC20 Tokens
1037
- * @param _externalToken the address of the Token Contract
1038
- * @param _to address of the beneficiary
1039
- * @param _value the amount of ether (in Wei) to send
1040
- * @param _avatar address
1041
- * @return bool which represents a success
1042
- */
1043
- function externalTokenTransfer(
1044
- IERC20 _externalToken,
1045
- address _to,
1046
- uint256 _value,
1047
- Avatar _avatar
1048
- ) external returns (bool);
1049
-
1050
- /**
1051
- * @dev transfer token "from" address "to" address
1052
- * One must to approve the amount of tokens which can be spend from the
1053
- * "from" account.This can be done using externalTokenApprove.
1054
- * @param _externalToken the address of the Token Contract
1055
- * @param _from address of the account to send from
1056
- * @param _to address of the beneficiary
1057
- * @param _value the amount of ether (in Wei) to send
1058
- * @param _avatar address
1059
- * @return bool which represents a success
1060
- */
1061
- function externalTokenTransferFrom(
1062
- IERC20 _externalToken,
1063
- address _from,
1064
- address _to,
1065
- uint256 _value,
1066
- Avatar _avatar
1067
- ) external returns (bool);
1068
-
1069
- /**
1070
- * @dev externalTokenApproval approve the spender address to spend a specified amount of tokens
1071
- * on behalf of msg.sender.
1072
- * @param _externalToken the address of the Token Contract
1073
- * @param _spender address
1074
- * @param _value the amount of ether (in Wei) which the approval is referring to.
1075
- * @return bool which represents a success
1076
- */
1077
- function externalTokenApproval(
1078
- IERC20 _externalToken,
1079
- address _spender,
1080
- uint256 _value,
1081
- Avatar _avatar
1082
- ) external returns (bool);
1083
-
1084
- /**
1085
- * @dev metaData emits an event with a string, should contain the hash of some meta data.
1086
- * @param _metaData a string representing a hash of the meta data
1087
- * @param _avatar Avatar
1088
- * @return bool which represents a success
1089
- */
1090
- function metaData(
1091
- string calldata _metaData,
1092
- Avatar _avatar
1093
- ) external returns (bool);
1094
-
1095
- /**
1096
- * @dev getNativeReputation
1097
- * @param _avatar the organization avatar.
1098
- * @return organization native reputation
1099
- */
1100
- function getNativeReputation(address _avatar) external view returns (address);
1101
-
1102
- function isSchemeRegistered(
1103
- address _scheme,
1104
- address _avatar
1105
- ) external view returns (bool);
1106
-
1107
- function getSchemeParameters(
1108
- address _scheme,
1109
- address _avatar
1110
- ) external view returns (bytes32);
1111
-
1112
- function getGlobalConstraintParameters(
1113
- address _globalConstraint,
1114
- address _avatar
1115
- ) external view returns (bytes32);
1116
-
1117
- function getSchemePermissions(
1118
- address _scheme,
1119
- address _avatar
1120
- ) external view returns (bytes4);
1121
-
1122
- /**
1123
- * @dev globalConstraintsCount return the global constraint pre and post count
1124
- * @return uint256 globalConstraintsPre count.
1125
- * @return uint256 globalConstraintsPost count.
1126
- */
1127
- function globalConstraintsCount(
1128
- address _avatar
1129
- ) external view returns (uint, uint);
1130
-
1131
- function isGlobalConstraintRegistered(
1132
- address _globalConstraint,
1133
- address _avatar
1134
- ) external view returns (bool);
1135
- }
1136
-
1137
- /**
1138
- * @title An Avatar holds tokens, reputation and ether for a controller
1139
- */
1140
- contract Avatar is Ownable {
1141
- using SafeERC20 for address;
1142
-
1143
- string public orgName;
1144
- DAOToken public nativeToken;
1145
- Reputation public nativeReputation;
1146
-
1147
- event GenericCall(
1148
- address indexed _contract,
1149
- bytes _data,
1150
- uint _value,
1151
- bool _success
1152
- );
1153
- event SendEther(uint256 _amountInWei, address indexed _to);
1154
- event ExternalTokenTransfer(
1155
- address indexed _externalToken,
1156
- address indexed _to,
1157
- uint256 _value
1158
- );
1159
- event ExternalTokenTransferFrom(
1160
- address indexed _externalToken,
1161
- address _from,
1162
- address _to,
1163
- uint256 _value
1164
- );
1165
- event ExternalTokenApproval(
1166
- address indexed _externalToken,
1167
- address _spender,
1168
- uint256 _value
1169
- );
1170
- event ReceiveEther(address indexed _sender, uint256 _value);
1171
- event MetaData(string _metaData);
1172
-
1173
- /**
1174
- * @dev the constructor takes organization name, native token and reputation system
1175
- and creates an avatar for a controller
1176
- */
1177
- constructor(
1178
- string memory _orgName,
1179
- DAOToken _nativeToken,
1180
- Reputation _nativeReputation
1181
- ) public {
1182
- orgName = _orgName;
1183
- nativeToken = _nativeToken;
1184
- nativeReputation = _nativeReputation;
1185
- }
1186
-
1187
- /**
1188
- * @dev enables an avatar to receive ethers
1189
- */
1190
- function() external payable {
1191
- emit ReceiveEther(msg.sender, msg.value);
1192
- }
1193
-
1194
- /**
1195
- * @dev perform a generic call to an arbitrary contract
1196
- * @param _contract the contract's address to call
1197
- * @param _data ABI-encoded contract call to call `_contract` address.
1198
- * @param _value value (ETH) to transfer with the transaction
1199
- * @return bool success or fail
1200
- * bytes - the return bytes of the called contract's function.
1201
- */
1202
- function genericCall(
1203
- address _contract,
1204
- bytes memory _data,
1205
- uint256 _value
1206
- ) public onlyOwner returns (bool success, bytes memory returnValue) {
1207
- // solhint-disable-next-line avoid-call-value
1208
- (success, returnValue) = _contract.call.value(_value)(_data);
1209
- emit GenericCall(_contract, _data, _value, success);
1210
- }
1211
-
1212
- /**
1213
- * @dev send ethers from the avatar's wallet
1214
- * @param _amountInWei amount to send in Wei units
1215
- * @param _to send the ethers to this address
1216
- * @return bool which represents success
1217
- */
1218
- function sendEther(
1219
- uint256 _amountInWei,
1220
- address payable _to
1221
- ) public onlyOwner returns (bool) {
1222
- _to.transfer(_amountInWei);
1223
- emit SendEther(_amountInWei, _to);
1224
- return true;
1225
- }
1226
-
1227
- /**
1228
- * @dev external token transfer
1229
- * @param _externalToken the token contract
1230
- * @param _to the destination address
1231
- * @param _value the amount of tokens to transfer
1232
- * @return bool which represents success
1233
- */
1234
- function externalTokenTransfer(
1235
- IERC20 _externalToken,
1236
- address _to,
1237
- uint256 _value
1238
- ) public onlyOwner returns (bool) {
1239
- address(_externalToken).safeTransfer(_to, _value);
1240
- emit ExternalTokenTransfer(address(_externalToken), _to, _value);
1241
- return true;
1242
- }
1243
-
1244
- /**
1245
- * @dev external token transfer from a specific account
1246
- * @param _externalToken the token contract
1247
- * @param _from the account to spend token from
1248
- * @param _to the destination address
1249
- * @param _value the amount of tokens to transfer
1250
- * @return bool which represents success
1251
- */
1252
- function externalTokenTransferFrom(
1253
- IERC20 _externalToken,
1254
- address _from,
1255
- address _to,
1256
- uint256 _value
1257
- ) public onlyOwner returns (bool) {
1258
- address(_externalToken).safeTransferFrom(_from, _to, _value);
1259
- emit ExternalTokenTransferFrom(address(_externalToken), _from, _to, _value);
1260
- return true;
1261
- }
1262
-
1263
- /**
1264
- * @dev externalTokenApproval approve the spender address to spend a specified amount of tokens
1265
- * on behalf of msg.sender.
1266
- * @param _externalToken the address of the Token Contract
1267
- * @param _spender address
1268
- * @param _value the amount of ether (in Wei) which the approval is referring to.
1269
- * @return bool which represents a success
1270
- */
1271
- function externalTokenApproval(
1272
- IERC20 _externalToken,
1273
- address _spender,
1274
- uint256 _value
1275
- ) public onlyOwner returns (bool) {
1276
- address(_externalToken).safeApprove(_spender, _value);
1277
- emit ExternalTokenApproval(address(_externalToken), _spender, _value);
1278
- return true;
1279
- }
1280
-
1281
- /**
1282
- * @dev metaData emits an event with a string, should contain the hash of some meta data.
1283
- * @param _metaData a string representing a hash of the meta data
1284
- * @return bool which represents a success
1285
- */
1286
- function metaData(string memory _metaData) public onlyOwner returns (bool) {
1287
- emit MetaData(_metaData);
1288
- return true;
1289
- }
1290
- }