@gooddollar/goodprotocol 2.1.4 → 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 (292) hide show
  1. package/artifacts/abis/IdentityV4.min.json +1 -0
  2. package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
  3. package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
  4. package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
  5. package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
  6. package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
  7. package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
  8. package/artifacts/contracts/IUniswapV3.sol/INonfungiblePositionManager.dbg.json +1 -1
  9. package/artifacts/contracts/IUniswapV3.sol/IUniswapV3Pool.dbg.json +1 -1
  10. package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
  11. package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
  12. package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
  13. package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
  14. package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
  15. package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
  16. package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
  17. package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
  18. package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
  19. package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
  20. package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
  21. package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
  22. package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
  23. package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
  24. package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
  25. package/artifacts/contracts/Interfaces.sol/IQuoterV2.dbg.json +1 -1
  26. package/artifacts/contracts/Interfaces.sol/ISwapRouter.dbg.json +1 -1
  27. package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
  28. package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
  29. package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
  30. package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
  31. package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
  32. package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
  33. package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
  34. package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
  35. package/artifacts/contracts/MentoInterfaces.sol/IBancorExchangeProvider.dbg.json +1 -1
  36. package/artifacts/contracts/MentoInterfaces.sol/IBroker.dbg.json +1 -1
  37. package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.dbg.json +1 -1
  38. package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.dbg.json +1 -1
  39. package/artifacts/contracts/MentoInterfaces.sol/IMentoReserve.dbg.json +1 -1
  40. package/artifacts/contracts/MentoInterfaces.sol/ITradingLimits.dbg.json +1 -1
  41. package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
  42. package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
  43. package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
  44. package/artifacts/contracts/fuseFaucet/SuperfluidFacuet.sol/SuperfluidFaucet.dbg.json +1 -1
  45. package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
  46. package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
  47. package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
  48. package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
  49. package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
  50. package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
  51. package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
  52. package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
  53. package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.dbg.json +1 -1
  54. package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.json +2 -2
  55. package/artifacts/contracts/identity/IdentityV4.sol/IdentityV4.dbg.json +4 -0
  56. package/artifacts/contracts/identity/IdentityV4.sol/IdentityV4.json +1162 -0
  57. package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
  58. package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
  59. package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
  60. package/artifacts/contracts/invite/OneTimeReward.sol/OneTimeReward.dbg.json +1 -1
  61. package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
  62. package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
  63. package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
  64. package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTest.dbg.json +1 -1
  65. package/artifacts/contracts/mocks/CeloDistributionHelperTest.sol/CeloDistributionHelperTestHelper.dbg.json +1 -1
  66. package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
  67. package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
  68. package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
  69. package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
  70. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
  71. package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
  72. package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
  73. package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
  74. package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
  75. package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest.dbg.json +1 -1
  76. package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper.dbg.json +1 -1
  77. package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
  78. package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
  79. package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
  80. package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
  81. package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
  82. package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
  83. package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
  84. package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
  85. package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
  86. package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
  87. package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
  88. package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
  89. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
  90. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
  91. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
  92. package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
  93. package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
  94. package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
  95. package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
  96. package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
  97. package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
  98. package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
  99. package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
  100. package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
  101. package/artifacts/contracts/reserve/CeloDistributionHelper.sol/CeloDistributionHelper.dbg.json +1 -1
  102. package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
  103. package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
  104. package/artifacts/contracts/reserve/GenericDistributionHelper.sol/GenericDistributionHelper.dbg.json +1 -1
  105. package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
  106. package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
  107. package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
  108. package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
  109. package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
  110. package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
  111. package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
  112. package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
  113. package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
  114. package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
  115. package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
  116. package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
  117. package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
  118. package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
  119. package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
  120. package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
  121. package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
  122. package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
  123. package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
  124. package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
  125. package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
  126. package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
  127. package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
  128. package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
  129. package/artifacts/contracts/token/GoodDollar2.sol/GoodDollar2.dbg.json +1 -1
  130. package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
  131. package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
  132. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
  133. package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
  134. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
  135. package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
  136. package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
  137. package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
  138. package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
  139. package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
  140. package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
  141. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
  142. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
  143. package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
  144. package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
  145. package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
  146. package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
  147. package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
  148. package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
  149. package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
  150. package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.dbg.json +1 -1
  151. package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
  152. package/artifacts/contracts/utils/BuyFromReserveHelper.sol/BuyFromReserveHelper.dbg.json +1 -1
  153. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
  154. package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
  155. package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
  156. package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
  157. package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
  158. package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
  159. package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
  160. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/EternalStorage.dbg.json +1 -1
  161. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/FuseOldBridgeKill.dbg.json +1 -1
  162. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/IUpgradeabilityOwnerStorage.dbg.json +1 -1
  163. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Initializable.dbg.json +1 -1
  164. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Ownable.dbg.json +1 -1
  165. package/artifacts/contracts/utils/FuseOldBridgeKill.sol/Upgradeable.dbg.json +1 -1
  166. package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
  167. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
  168. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
  169. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
  170. package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
  171. package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
  172. package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
  173. package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
  174. package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
  175. package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
  176. package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
  177. package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/MentoExchange.dbg.json +1 -1
  178. package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.dbg.json +1 -1
  179. package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
  180. package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
  181. package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
  182. package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
  183. package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
  184. package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
  185. package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
  186. package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
  187. package/contracts/identity/IdentityV3.sol +0 -3
  188. package/contracts/identity/IdentityV4.sol +578 -0
  189. package/hardhat.config.ts +3 -4
  190. package/package.json +8 -4
  191. package/releases/deployment.json +691 -1
  192. package/test/governance/ClaimersDistribution.test.ts +1 -1
  193. package/test/governance/CompoundVotingMachine.castvote.test.ts +30 -30
  194. package/test/helpers.ts +76 -195
  195. package/test/identity/IdentityV3.test.ts +53 -129
  196. package/test/identity/IdentityV4.test.ts +454 -0
  197. package/test/reserve/GenericDistributionHelper.e2e.test.ts +445 -0
  198. package/test/utils/AdminWallet.test.ts +14 -15
  199. package/types/contracts/identity/IdentityV4.ts +2001 -0
  200. package/types/contracts/identity/index.ts +1 -0
  201. package/types/contracts/utils/UpdateReserveRatio.sol/MentoExchange.ts +81 -0
  202. package/types/contracts/utils/UpdateReserveRatio.sol/UpdateReserveRatio.ts +134 -0
  203. package/types/contracts/utils/UpdateReserveRatio.sol/index.ts +5 -0
  204. package/types/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.ts +7 -2
  205. package/types/contracts/utils/index.ts +2 -0
  206. package/types/factories/contracts/identity/IdentityV3__factory.ts +1 -1
  207. package/types/factories/contracts/identity/IdentityV4__factory.ts +1213 -0
  208. package/types/factories/contracts/identity/index.ts +1 -0
  209. package/types/factories/contracts/utils/UpdateReserveRatio.sol/MentoExchange__factory.ts +39 -0
  210. package/types/factories/contracts/utils/UpdateReserveRatio.sol/UpdateReserveRatio__factory.ts +113 -0
  211. package/types/factories/contracts/utils/UpdateReserveRatio.sol/index.ts +5 -0
  212. package/types/factories/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC__factory.ts +9 -15
  213. package/types/factories/contracts/utils/index.ts +1 -0
  214. package/types/hardhat.d.ts +27 -0
  215. package/types/index.ts +4 -0
  216. package/scripts/ProxyFactory.json +0 -4425
  217. package/scripts/analytics/activeGDStakers.ts +0 -188
  218. package/scripts/analytics/activeStakers.ts +0 -25
  219. package/scripts/analytics/activeUsersCount.ts +0 -156
  220. package/scripts/analytics/activeWalletsStats.ts +0 -301
  221. package/scripts/analytics/checkActiveWallets.ts +0 -60
  222. package/scripts/analytics/checkBridgeBalances.ts +0 -442
  223. package/scripts/analytics/claimIncidentStats.ts +0 -98
  224. package/scripts/analytics/faucetStats.ts +0 -130
  225. package/scripts/analytics/gdinflow.ts +0 -57
  226. package/scripts/analytics/goodHolders.ts +0 -46
  227. package/scripts/analytics/goodgiveback.ts +0 -64
  228. package/scripts/analytics/p2pTxs.ts +0 -564
  229. package/scripts/analytics/stuckgd.ts +0 -70
  230. package/scripts/analytics/tokenInOutStats.ts +0 -48
  231. package/scripts/analytics/whitelistsyncIssue.ts +0 -87
  232. package/scripts/bulkProof.ts +0 -202
  233. package/scripts/bulkWhitelist.ts +0 -31
  234. package/scripts/deployGnosisSafe.ts +0 -111
  235. package/scripts/fetchOrDeployProxyFactory.ts +0 -46
  236. package/scripts/fv.ts +0 -263
  237. package/scripts/gdx/gdxAirdropCalculation.ts +0 -479
  238. package/scripts/getFounders.ts +0 -32
  239. package/scripts/governance/README.md +0 -70
  240. package/scripts/governance/airdropCalculation.ts +0 -1119
  241. package/scripts/governance/airdropCalculationRecover.ts +0 -416
  242. package/scripts/governance/airdropCalculationSorted.ts +0 -438
  243. package/scripts/governance/goodCheckpointSorted.ts +0 -300
  244. package/scripts/keeper/fishInactive.ts +0 -47
  245. package/scripts/minimize.sh +0 -17
  246. package/scripts/multichain-deploy/0_proxyFactory-deploy.ts +0 -131
  247. package/scripts/multichain-deploy/1_basicdao-deploy.ts +0 -294
  248. package/scripts/multichain-deploy/2_helpers-deploy.ts +0 -152
  249. package/scripts/multichain-deploy/2b_otp-deploy.ts +0 -73
  250. package/scripts/multichain-deploy/3_gdSavings-deploy.ts +0 -190
  251. package/scripts/multichain-deploy/4_ubi-deploy.ts +0 -129
  252. package/scripts/multichain-deploy/5_gov-deploy.ts +0 -179
  253. package/scripts/multichain-deploy/6_testnetFaucet.ts +0 -85
  254. package/scripts/multichain-deploy/7_superfluidfaucet-deploy.ts +0 -123
  255. package/scripts/multichain-deploy/8_disthelper-deploy.ts +0 -152
  256. package/scripts/multichain-deploy/createUniswapTestPools.ts +0 -163
  257. package/scripts/multichain-deploy/flattened/Avatar.sol +0 -913
  258. package/scripts/multichain-deploy/flattened/Controller.sol +0 -1891
  259. package/scripts/multichain-deploy/flattened/FeeFormula.sol +0 -1290
  260. package/scripts/multichain-deploy/fulldeploy.sh +0 -26
  261. package/scripts/multichain-deploy/helpers.ts +0 -647
  262. package/scripts/multichain-deploy/multichainWrapper-deploy.ts +0 -59
  263. package/scripts/multichain-deploy/verifyEtherscan.ts +0 -177
  264. package/scripts/proposals/gip-14_1.ts +0 -251
  265. package/scripts/proposals/gip-15.ts +0 -427
  266. package/scripts/proposals/gip-25-xdc-upgrade-ubi.ts +0 -746
  267. package/scripts/proposals/gips-14_1.md +0 -29
  268. package/scripts/proposals/hack-ubi-recovery.ts +0 -414
  269. package/scripts/proposals/identityAuthPeriod.ts +0 -229
  270. package/scripts/proposals/reserveRestore.ts +0 -474
  271. package/scripts/proposals/updateDistHelper.ts +0 -180
  272. package/scripts/proposals/v4Upgrade.ts +0 -845
  273. package/scripts/releaser.js +0 -24
  274. package/scripts/staking/stakersGdRewardsCalculation.ts +0 -64
  275. package/scripts/upgradeScheme.ts +0 -97
  276. package/scripts/upgradeToV2/upgradeToV2.ts +0 -853
  277. package/scripts/upgradeToV2/upgradeToV2Recover.ts +0 -939
  278. package/scripts/upgradeToV3/v3-fix.ts +0 -120
  279. package/scripts/upgradeToV3/v3-fuse-multichain.ts +0 -117
  280. package/scripts/upgradeToV3/v3-upgrade.ts +0 -219
  281. package/scripts/upgrades/celo-defi-ubi-deploy.ts +0 -184
  282. package/scripts/upgrades/identity-upgrade.ts +0 -126
  283. package/scripts/upgrades/multichain-formula-upgrade.ts +0 -143
  284. package/scripts/upgrades/multichain-temp-fix.ts +0 -129
  285. package/scripts/upgrades/restoreFunds.ts +0 -91
  286. package/scripts/upgrades/superfluid-nft-celo-gas-token.ts +0 -159
  287. package/scripts/upgrades/transferDaoToGuardians.ts +0 -80
  288. package/scripts/upgrades/upgradeAdminWallet.ts +0 -29
  289. package/scripts/upgrades/upgradeFaucet.ts +0 -46
  290. package/scripts/utils.ts +0 -50
  291. package/scripts/verify.ts +0 -67
  292. package/scripts/voltageswaps.ts +0 -46
@@ -1,913 +0,0 @@
1
- /**
2
- *Submitted for verification at celoscan.io on 2022-09-18
3
- */
4
-
5
- // File: openzeppelin-solidity/contracts/ownership/Ownable.sol
6
-
7
- /**
8
- * @title Ownable
9
- * @dev The Ownable contract has an owner address, and provides basic authorization control
10
- * functions, this simplifies the implementation of "user permissions".
11
- */
12
- contract Ownable {
13
- address private _owner;
14
-
15
- event OwnershipTransferred(
16
- address indexed previousOwner,
17
- address indexed newOwner
18
- );
19
-
20
- /**
21
- * @dev The Ownable constructor sets the original `owner` of the contract to the sender
22
- * account.
23
- */
24
- constructor() internal {
25
- _owner = msg.sender;
26
- emit OwnershipTransferred(address(0), _owner);
27
- }
28
-
29
- /**
30
- * @return the address of the owner.
31
- */
32
- function owner() public view returns (address) {
33
- return _owner;
34
- }
35
-
36
- /**
37
- * @dev Throws if called by any account other than the owner.
38
- */
39
- modifier onlyOwner() {
40
- require(isOwner());
41
- _;
42
- }
43
-
44
- /**
45
- * @return true if `msg.sender` is the owner of the contract.
46
- */
47
- function isOwner() public view returns (bool) {
48
- return msg.sender == _owner;
49
- }
50
-
51
- /**
52
- * @dev Allows the current owner to relinquish control of the contract.
53
- * @notice Renouncing to ownership will leave the contract without an owner.
54
- * It will not be possible to call the functions with the `onlyOwner`
55
- * modifier anymore.
56
- */
57
- function renounceOwnership() public onlyOwner {
58
- emit OwnershipTransferred(_owner, address(0));
59
- _owner = address(0);
60
- }
61
-
62
- /**
63
- * @dev Allows the current owner to transfer control of the contract to a newOwner.
64
- * @param newOwner The address to transfer ownership to.
65
- */
66
- function transferOwnership(address newOwner) public onlyOwner {
67
- _transferOwnership(newOwner);
68
- }
69
-
70
- /**
71
- * @dev Transfers control of the contract to a newOwner.
72
- * @param newOwner The address to transfer ownership to.
73
- */
74
- function _transferOwnership(address newOwner) internal {
75
- require(newOwner != address(0));
76
- emit OwnershipTransferred(_owner, newOwner);
77
- _owner = newOwner;
78
- }
79
- }
80
-
81
- // File: @daostack/infra/contracts/Reputation.sol
82
-
83
- pragma solidity ^0.5.4;
84
-
85
- /**
86
- * @title Reputation system
87
- * @dev A DAO has Reputation System which allows peers to rate other peers in order to build trust .
88
- * A reputation is use to assign influence measure to a DAO'S peers.
89
- * Reputation is similar to regular tokens but with one crucial difference: It is non-transferable.
90
- * The Reputation contract maintain a map of address to reputation value.
91
- * It provides an onlyOwner functions to mint and burn reputation _to (or _from) a specific address.
92
- */
93
-
94
- contract Reputation is Ownable {
95
- uint8 public decimals = 18; //Number of decimals of the smallest unit
96
- // Event indicating minting of reputation to an address.
97
- event Mint(address indexed _to, uint256 _amount);
98
- // Event indicating burning of reputation for an address.
99
- event Burn(address indexed _from, uint256 _amount);
100
-
101
- /// @dev `Checkpoint` is the structure that attaches a block number to a
102
- /// given value, the block number attached is the one that last changed the
103
- /// value
104
- struct Checkpoint {
105
- // `fromBlock` is the block number that the value was generated from
106
- uint128 fromBlock;
107
- // `value` is the amount of reputation at a specific block number
108
- uint128 value;
109
- }
110
-
111
- // `balances` is the map that tracks the balance of each address, in this
112
- // contract when the balance changes the block number that the change
113
- // occurred is also included in the map
114
- mapping(address => Checkpoint[]) balances;
115
-
116
- // Tracks the history of the `totalSupply` of the reputation
117
- Checkpoint[] totalSupplyHistory;
118
-
119
- /// @notice Constructor to create a Reputation
120
- constructor() public {}
121
-
122
- /// @dev This function makes it easy to get the total number of reputation
123
- /// @return The total number of reputation
124
- function totalSupply() public view returns (uint256) {
125
- return totalSupplyAt(block.number);
126
- }
127
-
128
- ////////////////
129
- // Query balance and totalSupply in History
130
- ////////////////
131
- /**
132
- * @dev return the reputation amount of a given owner
133
- * @param _owner an address of the owner which we want to get his reputation
134
- */
135
- function balanceOf(address _owner) public view returns (uint256 balance) {
136
- return balanceOfAt(_owner, block.number);
137
- }
138
-
139
- /// @dev Queries the balance of `_owner` at a specific `_blockNumber`
140
- /// @param _owner The address from which the balance will be retrieved
141
- /// @param _blockNumber The block number when the balance is queried
142
- /// @return The balance at `_blockNumber`
143
- function balanceOfAt(
144
- address _owner,
145
- uint256 _blockNumber
146
- ) public view returns (uint256) {
147
- if (
148
- (balances[_owner].length == 0) ||
149
- (balances[_owner][0].fromBlock > _blockNumber)
150
- ) {
151
- return 0;
152
- // This will return the expected balance during normal situations
153
- } else {
154
- return getValueAt(balances[_owner], _blockNumber);
155
- }
156
- }
157
-
158
- /// @notice Total amount of reputation at a specific `_blockNumber`.
159
- /// @param _blockNumber The block number when the totalSupply is queried
160
- /// @return The total amount of reputation at `_blockNumber`
161
- function totalSupplyAt(uint256 _blockNumber) public view returns (uint256) {
162
- if (
163
- (totalSupplyHistory.length == 0) ||
164
- (totalSupplyHistory[0].fromBlock > _blockNumber)
165
- ) {
166
- return 0;
167
- // This will return the expected totalSupply during normal situations
168
- } else {
169
- return getValueAt(totalSupplyHistory, _blockNumber);
170
- }
171
- }
172
-
173
- /// @notice Generates `_amount` reputation that are assigned to `_owner`
174
- /// @param _user The address that will be assigned the new reputation
175
- /// @param _amount The quantity of reputation generated
176
- /// @return True if the reputation are generated correctly
177
- function mint(
178
- address _user,
179
- uint256 _amount
180
- ) public onlyOwner returns (bool) {
181
- uint256 curTotalSupply = totalSupply();
182
- require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
183
- uint256 previousBalanceTo = balanceOf(_user);
184
- require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
185
- updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount);
186
- updateValueAtNow(balances[_user], previousBalanceTo + _amount);
187
- emit Mint(_user, _amount);
188
- return true;
189
- }
190
-
191
- /// @notice Burns `_amount` reputation from `_owner`
192
- /// @param _user The address that will lose the reputation
193
- /// @param _amount The quantity of reputation to burn
194
- /// @return True if the reputation are burned correctly
195
- function burn(
196
- address _user,
197
- uint256 _amount
198
- ) public onlyOwner returns (bool) {
199
- uint256 curTotalSupply = totalSupply();
200
- uint256 amountBurned = _amount;
201
- uint256 previousBalanceFrom = balanceOf(_user);
202
- if (previousBalanceFrom < amountBurned) {
203
- amountBurned = previousBalanceFrom;
204
- }
205
- updateValueAtNow(totalSupplyHistory, curTotalSupply - amountBurned);
206
- updateValueAtNow(balances[_user], previousBalanceFrom - amountBurned);
207
- emit Burn(_user, amountBurned);
208
- return true;
209
- }
210
-
211
- ////////////////
212
- // Internal helper functions to query and set a value in a snapshot array
213
- ////////////////
214
-
215
- /// @dev `getValueAt` retrieves the number of reputation at a given block number
216
- /// @param checkpoints The history of values being queried
217
- /// @param _block The block number to retrieve the value at
218
- /// @return The number of reputation being queried
219
- function getValueAt(
220
- Checkpoint[] storage checkpoints,
221
- uint256 _block
222
- ) internal view returns (uint256) {
223
- if (checkpoints.length == 0) {
224
- return 0;
225
- }
226
-
227
- // Shortcut for the actual value
228
- if (_block >= checkpoints[checkpoints.length - 1].fromBlock) {
229
- return checkpoints[checkpoints.length - 1].value;
230
- }
231
- if (_block < checkpoints[0].fromBlock) {
232
- return 0;
233
- }
234
-
235
- // Binary search of the value in the array
236
- uint256 min = 0;
237
- uint256 max = checkpoints.length - 1;
238
- while (max > min) {
239
- uint256 mid = (max + min + 1) / 2;
240
- if (checkpoints[mid].fromBlock <= _block) {
241
- min = mid;
242
- } else {
243
- max = mid - 1;
244
- }
245
- }
246
- return checkpoints[min].value;
247
- }
248
-
249
- /// @dev `updateValueAtNow` used to update the `balances` map and the
250
- /// `totalSupplyHistory`
251
- /// @param checkpoints The history of data being updated
252
- /// @param _value The new number of reputation
253
- function updateValueAtNow(
254
- Checkpoint[] storage checkpoints,
255
- uint256 _value
256
- ) internal {
257
- require(uint128(_value) == _value); //check value is in the 128 bits bounderies
258
- if (
259
- (checkpoints.length == 0) ||
260
- (checkpoints[checkpoints.length - 1].fromBlock < block.number)
261
- ) {
262
- Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++];
263
- newCheckPoint.fromBlock = uint128(block.number);
264
- newCheckPoint.value = uint128(_value);
265
- } else {
266
- Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length - 1];
267
- oldCheckPoint.value = uint128(_value);
268
- }
269
- }
270
- }
271
-
272
- // File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
273
-
274
- /**
275
- * @title ERC20 interface
276
- * @dev see https://github.com/ethereum/EIPs/issues/20
277
- */
278
- interface IERC20 {
279
- function transfer(address to, uint256 value) external returns (bool);
280
-
281
- function approve(address spender, uint256 value) external returns (bool);
282
-
283
- function transferFrom(
284
- address from,
285
- address to,
286
- uint256 value
287
- ) external returns (bool);
288
-
289
- function totalSupply() external view returns (uint256);
290
-
291
- function balanceOf(address who) external view returns (uint256);
292
-
293
- function allowance(
294
- address owner,
295
- address spender
296
- ) external view returns (uint256);
297
-
298
- event Transfer(address indexed from, address indexed to, uint256 value);
299
-
300
- event Approval(address indexed owner, address indexed spender, uint256 value);
301
- }
302
-
303
- // File: openzeppelin-solidity/contracts/math/SafeMath.sol
304
-
305
- /**
306
- * @title SafeMath
307
- * @dev Unsigned math operations with safety checks that revert on error
308
- */
309
- library SafeMath {
310
- /**
311
- * @dev Multiplies two unsigned integers, reverts on overflow.
312
- */
313
- function mul(uint256 a, uint256 b) internal pure returns (uint256) {
314
- // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
315
- // benefit is lost if 'b' is also tested.
316
- // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
317
- if (a == 0) {
318
- return 0;
319
- }
320
-
321
- uint256 c = a * b;
322
- require(c / a == b);
323
-
324
- return c;
325
- }
326
-
327
- /**
328
- * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
329
- */
330
- function div(uint256 a, uint256 b) internal pure returns (uint256) {
331
- // Solidity only automatically asserts when dividing by 0
332
- require(b > 0);
333
- uint256 c = a / b;
334
- // assert(a == b * c + a % b); // There is no case in which this doesn't hold
335
-
336
- return c;
337
- }
338
-
339
- /**
340
- * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
341
- */
342
- function sub(uint256 a, uint256 b) internal pure returns (uint256) {
343
- require(b <= a);
344
- uint256 c = a - b;
345
-
346
- return c;
347
- }
348
-
349
- /**
350
- * @dev Adds two unsigned integers, reverts on overflow.
351
- */
352
- function add(uint256 a, uint256 b) internal pure returns (uint256) {
353
- uint256 c = a + b;
354
- require(c >= a);
355
-
356
- return c;
357
- }
358
-
359
- /**
360
- * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
361
- * reverts when dividing by zero.
362
- */
363
- function mod(uint256 a, uint256 b) internal pure returns (uint256) {
364
- require(b != 0);
365
- return a % b;
366
- }
367
- }
368
-
369
- // File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
370
-
371
- /**
372
- * @title Standard ERC20 token
373
- *
374
- * @dev Implementation of the basic standard token.
375
- * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
376
- * Originally based on code by FirstBlood:
377
- * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
378
- *
379
- * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
380
- * all accounts just by listening to said events. Note that this isn't required by the specification, and other
381
- * compliant implementations may not do it.
382
- */
383
- contract ERC20 is IERC20 {
384
- using SafeMath for uint256;
385
-
386
- mapping(address => uint256) private _balances;
387
-
388
- mapping(address => mapping(address => uint256)) private _allowed;
389
-
390
- uint256 private _totalSupply;
391
-
392
- /**
393
- * @dev Total number of tokens in existence
394
- */
395
- function totalSupply() public view returns (uint256) {
396
- return _totalSupply;
397
- }
398
-
399
- /**
400
- * @dev Gets the balance of the specified address.
401
- * @param owner The address to query the balance of.
402
- * @return An uint256 representing the amount owned by the passed address.
403
- */
404
- function balanceOf(address owner) public view returns (uint256) {
405
- return _balances[owner];
406
- }
407
-
408
- /**
409
- * @dev Function to check the amount of tokens that an owner allowed to a spender.
410
- * @param owner address The address which owns the funds.
411
- * @param spender address The address which will spend the funds.
412
- * @return A uint256 specifying the amount of tokens still available for the spender.
413
- */
414
- function allowance(
415
- address owner,
416
- address spender
417
- ) public view returns (uint256) {
418
- return _allowed[owner][spender];
419
- }
420
-
421
- /**
422
- * @dev Transfer token for a specified address
423
- * @param to The address to transfer to.
424
- * @param value The amount to be transferred.
425
- */
426
- function transfer(address to, uint256 value) public returns (bool) {
427
- _transfer(msg.sender, to, value);
428
- return true;
429
- }
430
-
431
- /**
432
- * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
433
- * Beware that changing an allowance with this method brings the risk that someone may use both the old
434
- * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
435
- * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
436
- * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
437
- * @param spender The address which will spend the funds.
438
- * @param value The amount of tokens to be spent.
439
- */
440
- function approve(address spender, uint256 value) public returns (bool) {
441
- require(spender != address(0));
442
-
443
- _allowed[msg.sender][spender] = value;
444
- emit Approval(msg.sender, spender, value);
445
- return true;
446
- }
447
-
448
- /**
449
- * @dev Transfer tokens from one address to another.
450
- * Note that while this function emits an Approval event, this is not required as per the specification,
451
- * and other compliant implementations may not emit the event.
452
- * @param from address The address which you want to send tokens from
453
- * @param to address The address which you want to transfer to
454
- * @param value uint256 the amount of tokens to be transferred
455
- */
456
- function transferFrom(
457
- address from,
458
- address to,
459
- uint256 value
460
- ) public returns (bool) {
461
- _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
462
- _transfer(from, to, value);
463
- emit Approval(from, msg.sender, _allowed[from][msg.sender]);
464
- return true;
465
- }
466
-
467
- /**
468
- * @dev Increase the amount of tokens that an owner allowed to a spender.
469
- * approve should be called when allowed_[_spender] == 0. To increment
470
- * allowed value is better to use this function to avoid 2 calls (and wait until
471
- * the first transaction is mined)
472
- * From MonolithDAO Token.sol
473
- * Emits an Approval event.
474
- * @param spender The address which will spend the funds.
475
- * @param addedValue The amount of tokens to increase the allowance by.
476
- */
477
- function increaseAllowance(
478
- address spender,
479
- uint256 addedValue
480
- ) public returns (bool) {
481
- require(spender != address(0));
482
-
483
- _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(
484
- addedValue
485
- );
486
- emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
487
- return true;
488
- }
489
-
490
- /**
491
- * @dev Decrease the amount of tokens that an owner allowed to a spender.
492
- * approve should be called when allowed_[_spender] == 0. To decrement
493
- * allowed value is better to use this function to avoid 2 calls (and wait until
494
- * the first transaction is mined)
495
- * From MonolithDAO Token.sol
496
- * Emits an Approval event.
497
- * @param spender The address which will spend the funds.
498
- * @param subtractedValue The amount of tokens to decrease the allowance by.
499
- */
500
- function decreaseAllowance(
501
- address spender,
502
- uint256 subtractedValue
503
- ) public returns (bool) {
504
- require(spender != address(0));
505
-
506
- _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(
507
- subtractedValue
508
- );
509
- emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
510
- return true;
511
- }
512
-
513
- /**
514
- * @dev Transfer token for a specified addresses
515
- * @param from The address to transfer from.
516
- * @param to The address to transfer to.
517
- * @param value The amount to be transferred.
518
- */
519
- function _transfer(address from, address to, uint256 value) internal {
520
- require(to != address(0));
521
-
522
- _balances[from] = _balances[from].sub(value);
523
- _balances[to] = _balances[to].add(value);
524
- emit Transfer(from, to, value);
525
- }
526
-
527
- /**
528
- * @dev Internal function that mints an amount of the token and assigns it to
529
- * an account. This encapsulates the modification of balances such that the
530
- * proper events are emitted.
531
- * @param account The account that will receive the created tokens.
532
- * @param value The amount that will be created.
533
- */
534
- function _mint(address account, uint256 value) internal {
535
- require(account != address(0));
536
-
537
- _totalSupply = _totalSupply.add(value);
538
- _balances[account] = _balances[account].add(value);
539
- emit Transfer(address(0), account, value);
540
- }
541
-
542
- /**
543
- * @dev Internal function that burns an amount of the token of a given
544
- * account.
545
- * @param account The account whose tokens will be burnt.
546
- * @param value The amount that will be burnt.
547
- */
548
- function _burn(address account, uint256 value) internal {
549
- require(account != address(0));
550
-
551
- _totalSupply = _totalSupply.sub(value);
552
- _balances[account] = _balances[account].sub(value);
553
- emit Transfer(account, address(0), value);
554
- }
555
-
556
- /**
557
- * @dev Internal function that burns an amount of the token of a given
558
- * account, deducting from the sender's allowance for said account. Uses the
559
- * internal burn function.
560
- * Emits an Approval event (reflecting the reduced allowance).
561
- * @param account The account whose tokens will be burnt.
562
- * @param value The amount that will be burnt.
563
- */
564
- function _burnFrom(address account, uint256 value) internal {
565
- _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
566
- _burn(account, value);
567
- emit Approval(account, msg.sender, _allowed[account][msg.sender]);
568
- }
569
- }
570
-
571
- // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol
572
-
573
- /**
574
- * @title Burnable Token
575
- * @dev Token that can be irreversibly burned (destroyed).
576
- */
577
- contract ERC20Burnable is ERC20 {
578
- /**
579
- * @dev Burns a specific amount of tokens.
580
- * @param value The amount of token to be burned.
581
- */
582
- function burn(uint256 value) public {
583
- _burn(msg.sender, value);
584
- }
585
-
586
- /**
587
- * @dev Burns a specific amount of tokens from the target address and decrements allowance
588
- * @param from address The address which you want to send tokens from
589
- * @param value uint256 The amount of token to be burned
590
- */
591
- function burnFrom(address from, uint256 value) public {
592
- _burnFrom(from, value);
593
- }
594
- }
595
-
596
- // File: @daostack/arc/contracts/controller/DAOToken.sol
597
-
598
- /**
599
- * @title DAOToken, base on zeppelin contract.
600
- * @dev ERC20 compatible token. It is a mintable, burnable token.
601
- */
602
-
603
- contract DAOToken is ERC20, ERC20Burnable, Ownable {
604
- string public name;
605
- string public symbol;
606
- // solhint-disable-next-line const-name-snakecase
607
- uint8 public constant decimals = 18;
608
- uint256 public cap;
609
-
610
- /**
611
- * @dev Constructor
612
- * @param _name - token name
613
- * @param _symbol - token symbol
614
- * @param _cap - token cap - 0 value means no cap
615
- */
616
- constructor(string memory _name, string memory _symbol, uint256 _cap) public {
617
- name = _name;
618
- symbol = _symbol;
619
- cap = _cap;
620
- }
621
-
622
- /**
623
- * @dev Function to mint tokens
624
- * @param _to The address that will receive the minted tokens.
625
- * @param _amount The amount of tokens to mint.
626
- */
627
- function mint(address _to, uint256 _amount) public onlyOwner returns (bool) {
628
- if (cap > 0) require(totalSupply().add(_amount) <= cap);
629
- _mint(_to, _amount);
630
- return true;
631
- }
632
- }
633
-
634
- // File: openzeppelin-solidity/contracts/utils/Address.sol
635
-
636
- /**
637
- * Utility library of inline functions on addresses
638
- */
639
- library Address {
640
- /**
641
- * Returns whether the target address is a contract
642
- * @dev This function will return false if invoked during the constructor of a contract,
643
- * as the code is not actually created until after the constructor finishes.
644
- * @param account address of the account to check
645
- * @return whether the target address is a contract
646
- */
647
- function isContract(address account) internal view returns (bool) {
648
- uint256 size;
649
- // XXX Currently there is no better way to check if there is a contract in an address
650
- // than to check the size of the code at that address.
651
- // See https://ethereum.stackexchange.com/a/14016/36603
652
- // for more details about how this works.
653
- // TODO Check this again before the Serenity release, because all addresses will be
654
- // contracts then.
655
- // solhint-disable-next-line no-inline-assembly
656
- assembly {
657
- size := extcodesize(account)
658
- }
659
- return size > 0;
660
- }
661
- }
662
-
663
- // File: @daostack/arc/contracts/libs/SafeERC20.sol
664
-
665
- /*
666
-
667
- SafeERC20 by daostack.
668
- The code is based on a fix by SECBIT Team.
669
-
670
- USE WITH CAUTION & NO WARRANTY
671
-
672
- REFERENCE & RELATED READING
673
- - https://github.com/ethereum/solidity/issues/4116
674
- - https://medium.com/@chris_77367/explaining-unexpected-reverts-starting-with-solidity-0-4-22-3ada6e82308c
675
- - https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
676
- - https://gist.github.com/BrendanChou/88a2eeb80947ff00bcf58ffdafeaeb61
677
-
678
- */
679
-
680
- library SafeERC20 {
681
- using Address for address;
682
-
683
- bytes4 private constant TRANSFER_SELECTOR =
684
- bytes4(keccak256(bytes("transfer(address,uint256)")));
685
- bytes4 private constant TRANSFERFROM_SELECTOR =
686
- bytes4(keccak256(bytes("transferFrom(address,address,uint256)")));
687
- bytes4 private constant APPROVE_SELECTOR =
688
- bytes4(keccak256(bytes("approve(address,uint256)")));
689
-
690
- function safeTransfer(
691
- address _erc20Addr,
692
- address _to,
693
- uint256 _value
694
- ) internal {
695
- // Must be a contract addr first!
696
- require(_erc20Addr.isContract());
697
-
698
- (bool success, bytes memory returnValue) = // solhint-disable-next-line avoid-low-level-calls
699
- _erc20Addr.call(abi.encodeWithSelector(TRANSFER_SELECTOR, _to, _value));
700
- // call return false when something wrong
701
- require(success);
702
- //check return value
703
- require(
704
- returnValue.length == 0 ||
705
- (returnValue.length == 32 && (returnValue[31] != 0))
706
- );
707
- }
708
-
709
- function safeTransferFrom(
710
- address _erc20Addr,
711
- address _from,
712
- address _to,
713
- uint256 _value
714
- ) internal {
715
- // Must be a contract addr first!
716
- require(_erc20Addr.isContract());
717
-
718
- (bool success, bytes memory returnValue) = // solhint-disable-next-line avoid-low-level-calls
719
- _erc20Addr.call(
720
- abi.encodeWithSelector(TRANSFERFROM_SELECTOR, _from, _to, _value)
721
- );
722
- // call return false when something wrong
723
- require(success);
724
- //check return value
725
- require(
726
- returnValue.length == 0 ||
727
- (returnValue.length == 32 && (returnValue[31] != 0))
728
- );
729
- }
730
-
731
- function safeApprove(
732
- address _erc20Addr,
733
- address _spender,
734
- uint256 _value
735
- ) internal {
736
- // Must be a contract addr first!
737
- require(_erc20Addr.isContract());
738
-
739
- // safeApprove should only be called when setting an initial allowance,
740
- // or when resetting it to zero.
741
- require(
742
- (_value == 0) ||
743
- (IERC20(_erc20Addr).allowance(address(this), _spender) == 0)
744
- );
745
-
746
- (bool success, bytes memory returnValue) = // solhint-disable-next-line avoid-low-level-calls
747
- _erc20Addr.call(abi.encodeWithSelector(APPROVE_SELECTOR, _spender, _value));
748
- // call return false when something wrong
749
- require(success);
750
- //check return value
751
- require(
752
- returnValue.length == 0 ||
753
- (returnValue.length == 32 && (returnValue[31] != 0))
754
- );
755
- }
756
- }
757
-
758
- // File: @daostack/arc/contracts/controller/Avatar.sol
759
-
760
- /**
761
- * @title An Avatar holds tokens, reputation and ether for a controller
762
- */
763
- contract Avatar is Ownable {
764
- using SafeERC20 for address;
765
-
766
- string public orgName;
767
- DAOToken public nativeToken;
768
- Reputation public nativeReputation;
769
-
770
- event GenericCall(
771
- address indexed _contract,
772
- bytes _data,
773
- uint _value,
774
- bool _success
775
- );
776
- event SendEther(uint256 _amountInWei, address indexed _to);
777
- event ExternalTokenTransfer(
778
- address indexed _externalToken,
779
- address indexed _to,
780
- uint256 _value
781
- );
782
- event ExternalTokenTransferFrom(
783
- address indexed _externalToken,
784
- address _from,
785
- address _to,
786
- uint256 _value
787
- );
788
- event ExternalTokenApproval(
789
- address indexed _externalToken,
790
- address _spender,
791
- uint256 _value
792
- );
793
- event ReceiveEther(address indexed _sender, uint256 _value);
794
- event MetaData(string _metaData);
795
-
796
- /**
797
- * @dev the constructor takes organization name, native token and reputation system
798
- and creates an avatar for a controller
799
- */
800
- constructor(
801
- string memory _orgName,
802
- DAOToken _nativeToken,
803
- Reputation _nativeReputation
804
- ) public {
805
- orgName = _orgName;
806
- nativeToken = _nativeToken;
807
- nativeReputation = _nativeReputation;
808
- }
809
-
810
- /**
811
- * @dev enables an avatar to receive ethers
812
- */
813
- function() external payable {
814
- emit ReceiveEther(msg.sender, msg.value);
815
- }
816
-
817
- /**
818
- * @dev perform a generic call to an arbitrary contract
819
- * @param _contract the contract's address to call
820
- * @param _data ABI-encoded contract call to call `_contract` address.
821
- * @param _value value (ETH) to transfer with the transaction
822
- * @return bool success or fail
823
- * bytes - the return bytes of the called contract's function.
824
- */
825
- function genericCall(
826
- address _contract,
827
- bytes memory _data,
828
- uint256 _value
829
- ) public onlyOwner returns (bool success, bytes memory returnValue) {
830
- // solhint-disable-next-line avoid-call-value
831
- (success, returnValue) = _contract.call.value(_value)(_data);
832
- emit GenericCall(_contract, _data, _value, success);
833
- }
834
-
835
- /**
836
- * @dev send ethers from the avatar's wallet
837
- * @param _amountInWei amount to send in Wei units
838
- * @param _to send the ethers to this address
839
- * @return bool which represents success
840
- */
841
- function sendEther(
842
- uint256 _amountInWei,
843
- address payable _to
844
- ) public onlyOwner returns (bool) {
845
- _to.transfer(_amountInWei);
846
- emit SendEther(_amountInWei, _to);
847
- return true;
848
- }
849
-
850
- /**
851
- * @dev external token transfer
852
- * @param _externalToken the token contract
853
- * @param _to the destination address
854
- * @param _value the amount of tokens to transfer
855
- * @return bool which represents success
856
- */
857
- function externalTokenTransfer(
858
- IERC20 _externalToken,
859
- address _to,
860
- uint256 _value
861
- ) public onlyOwner returns (bool) {
862
- address(_externalToken).safeTransfer(_to, _value);
863
- emit ExternalTokenTransfer(address(_externalToken), _to, _value);
864
- return true;
865
- }
866
-
867
- /**
868
- * @dev external token transfer from a specific account
869
- * @param _externalToken the token contract
870
- * @param _from the account to spend token from
871
- * @param _to the destination address
872
- * @param _value the amount of tokens to transfer
873
- * @return bool which represents success
874
- */
875
- function externalTokenTransferFrom(
876
- IERC20 _externalToken,
877
- address _from,
878
- address _to,
879
- uint256 _value
880
- ) public onlyOwner returns (bool) {
881
- address(_externalToken).safeTransferFrom(_from, _to, _value);
882
- emit ExternalTokenTransferFrom(address(_externalToken), _from, _to, _value);
883
- return true;
884
- }
885
-
886
- /**
887
- * @dev externalTokenApproval approve the spender address to spend a specified amount of tokens
888
- * on behalf of msg.sender.
889
- * @param _externalToken the address of the Token Contract
890
- * @param _spender address
891
- * @param _value the amount of ether (in Wei) which the approval is referring to.
892
- * @return bool which represents a success
893
- */
894
- function externalTokenApproval(
895
- IERC20 _externalToken,
896
- address _spender,
897
- uint256 _value
898
- ) public onlyOwner returns (bool) {
899
- address(_externalToken).safeApprove(_spender, _value);
900
- emit ExternalTokenApproval(address(_externalToken), _spender, _value);
901
- return true;
902
- }
903
-
904
- /**
905
- * @dev metaData emits an event with a string, should contain the hash of some meta data.
906
- * @param _metaData a string representing a hash of the meta data
907
- * @return bool which represents a success
908
- */
909
- function metaData(string memory _metaData) public onlyOwner returns (bool) {
910
- emit MetaData(_metaData);
911
- return true;
912
- }
913
- }