@gooddollar/goodprotocol 1.0.27 → 1.0.28
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.
- package/artifacts/abis/AdminWallet.min.json +1 -0
- package/artifacts/abis/FuseFaucet.min.json +1 -1
- package/artifacts/abis/IIdentity.min.json +1 -1
- package/artifacts/abis/ProxyAdmin.min.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentity.json +45 -0
- package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ProxyAdmin.json +23 -0
- package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.json +4 -4
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.json +2 -2
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.json +2 -2
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.json +2 -2
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.json +2 -2
- package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.json +2 -2
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.json +2 -2
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +2 -2
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.json +2 -2
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.json +2 -2
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.json +2 -2
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.json +2 -2
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.json +2 -2
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.json +2 -2
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.json +2 -2
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.json +2 -2
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +2 -2
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.json +2 -2
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.json +2 -2
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.json +2 -2
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.json +2 -2
- package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.json +2 -2
- package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.json +2 -2
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.json +2 -2
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.json +2 -2
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.json +2 -2
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.json +2 -2
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +2 -2
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.json +2 -2
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +2 -2
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +4 -0
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.json +732 -0
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.json +2 -2
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.json +2 -2
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.json +2 -2
- package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
- package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.json +2 -2
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.json +2 -2
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.json +2 -2
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.json +2 -2
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.json +2 -2
- package/contracts/Interfaces.sol +12 -0
- package/contracts/fuseFaucet/FuseFaucet.sol +19 -10
- package/contracts/utils/AdminWallet.sol +242 -0
- package/package.json +1 -1
- package/releases/deployment.json +9 -6
- package/scripts/deployFullDAO.ts +17 -9
- package/scripts/multichain-deploy/basicdao-deploy.ts +0 -10
- package/scripts/test/localOldDaoDeploy.ts +4 -10
- package/test/FuseFaucet.test.ts +8 -12
- package/test/utils/AdminWallet.test.ts +254 -0
- package/types/AdminWallet.ts +1136 -0
- package/types/FuseFaucet.ts +3 -3
- package/types/IIdentity.ts +87 -0
- package/types/ProxyAdmin.ts +44 -0
- package/types/factories/AaveStakingFactory__factory.ts +1 -1
- package/types/factories/AdminWallet__factory.ts +780 -0
- package/types/factories/BaseShareFieldV2__factory.ts +1 -1
- package/types/factories/BaseShareField__factory.ts +1 -1
- package/types/factories/BulkProof__factory.ts +1 -1
- package/types/factories/ClaimersDistribution__factory.ts +1 -1
- package/types/factories/CompoundStakingFactory__factory.ts +1 -1
- package/types/factories/CompoundVotingMachine__factory.ts +1 -1
- package/types/factories/DAOContract__factory.ts +1 -1
- package/types/factories/DAOUpgradeableContract__factory.ts +1 -1
- package/types/factories/DonationsStaking__factory.ts +1 -1
- package/types/factories/ExchangeHelper__factory.ts +1 -1
- package/types/factories/FuseFaucet__factory.ts +3 -3
- package/types/factories/FuseStakingV3__factory.ts +1 -1
- package/types/factories/GReputation__factory.ts +1 -1
- package/types/factories/GoodAaveStakingV2__factory.ts +1 -1
- package/types/factories/GoodAaveStaking__factory.ts +1 -1
- package/types/factories/GoodCompoundStakingTest__factory.ts +1 -1
- package/types/factories/GoodCompoundStakingV2__factory.ts +1 -1
- package/types/factories/GoodCompoundStaking__factory.ts +1 -1
- package/types/factories/GoodFundManagerTest__factory.ts +1 -1
- package/types/factories/GoodFundManager__factory.ts +1 -1
- package/types/factories/GoodMarketMaker__factory.ts +1 -1
- package/types/factories/GoodReserveCDai__factory.ts +1 -1
- package/types/factories/GovernanceStaking__factory.ts +1 -1
- package/types/factories/IIdentity__factory.ts +45 -0
- package/types/factories/InvitesV1__factory.ts +1 -1
- package/types/factories/OverMintTesterRegularStake__factory.ts +1 -1
- package/types/factories/OverMintTester__factory.ts +1 -1
- package/types/factories/ProtocolUpgradeFuseRecover__factory.ts +1 -1
- package/types/factories/ProtocolUpgradeFuse__factory.ts +1 -1
- package/types/factories/ProtocolUpgradeRecover__factory.ts +1 -1
- package/types/factories/ProtocolUpgrade__factory.ts +1 -1
- package/types/factories/ProxyAdmin__factory.ts +23 -0
- package/types/factories/ReputationTestHelper__factory.ts +1 -1
- package/types/factories/Reputation__factory.ts +1 -1
- package/types/factories/StakersDistribution__factory.ts +1 -1
- package/types/factories/SwapHelperTest__factory.ts +1 -1
- package/types/factories/UBIScheme__factory.ts +1 -1
- package/types/factories/UniswapV2SwapHelper__factory.ts +1 -1
- package/types/factories/UpgradableMock2__factory.ts +1 -1
- package/types/factories/UpgradableMock3__factory.ts +1 -1
- package/types/factories/UpgradableMock4__factory.ts +1 -1
- package/types/factories/UpgradableMock__factory.ts +1 -1
- package/types/hardhat.d.ts +9 -0
- package/types/index.ts +2 -0
package/scripts/deployFullDAO.ts
CHANGED
|
@@ -509,19 +509,27 @@ const deployAdminWallet = async identity => {
|
|
|
509
509
|
hdNode.derivePath(`m/44'/60'/0'/0/${i}`)
|
|
510
510
|
);
|
|
511
511
|
|
|
512
|
-
const adminWallet = (await
|
|
513
|
-
|
|
514
|
-
AdminWalletABI.bytecode,
|
|
515
|
-
root
|
|
516
|
-
)
|
|
517
|
-
.deploy(
|
|
512
|
+
const adminWallet = (await upgrades
|
|
513
|
+
.deployProxy(await ethers.getContractFactory("AdminWallet"), [
|
|
518
514
|
admins.slice(0, 20).map(_ => _.address),
|
|
519
|
-
|
|
520
|
-
4,
|
|
515
|
+
root.address,
|
|
521
516
|
identity
|
|
522
|
-
)
|
|
517
|
+
])
|
|
523
518
|
.then(printDeploy)) as Contract;
|
|
524
519
|
|
|
520
|
+
// const adminWallet = (await new ethers.ContractFactory(
|
|
521
|
+
// AdminWalletABI.abi,
|
|
522
|
+
// AdminWalletABI.bytecode,
|
|
523
|
+
// root
|
|
524
|
+
// )
|
|
525
|
+
// .deploy(
|
|
526
|
+
// admins.slice(0, 20).map(_ => _.address),
|
|
527
|
+
// ethers.utils.parseUnits("1000000", "gwei"),
|
|
528
|
+
// 4,
|
|
529
|
+
// identity
|
|
530
|
+
// )
|
|
531
|
+
// .then(printDeploy)) as Contract;
|
|
532
|
+
|
|
525
533
|
const id = await ethers.getContractAt("IIdentity", identity);
|
|
526
534
|
await id.addIdentityAdmin(adminWallet.address).then(printDeploy);
|
|
527
535
|
await root
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { network, ethers, upgrades, run } from "hardhat";
|
|
2
|
-
import { isFunction, get, omitBy } from "lodash";
|
|
3
|
-
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
4
2
|
import pressAnyKey from "press-any-key";
|
|
5
3
|
import { Contract } from "ethers";
|
|
6
|
-
import { range } from "lodash";
|
|
7
4
|
// import DAOCreatorABI from "@gooddollar/goodcontracts/build/contracts/DaoCreatorGoodDollar.json";
|
|
8
5
|
import DAOCreatorABI from "../../../GoodBootstrap/packages/contracts/build/contracts/DaoCreatorGoodDollarWithRep.json";
|
|
9
6
|
// import IdentityABI from "@gooddollar/goodcontracts/build/contracts/Identity.json";
|
|
@@ -11,13 +8,6 @@ import IdentityABI from "../../../GoodBootstrap/packages/contracts/build/contrac
|
|
|
11
8
|
import FeeFormulaABI from "@gooddollar/goodcontracts/build/contracts/FeeFormula.json";
|
|
12
9
|
// import AddFoundersABI from "@gooddollar/goodcontracts/build/contracts/AddFoundersGoodDollar.json";
|
|
13
10
|
import AddFoundersABI from "../../../GoodBootstrap/packages/contracts/build/contracts/AddFoundersGoodDollarWithRep.json";
|
|
14
|
-
import ContributionCalculation from "@gooddollar/goodcontracts/stakingModel/build/contracts/ContributionCalculation.json";
|
|
15
|
-
import FirstClaimPool from "@gooddollar/goodcontracts/stakingModel/build/contracts/FirstClaimPool.json";
|
|
16
|
-
import BridgeMock from "@gooddollar/goodcontracts/stakingModel/build/contracts/BridgeMock.json";
|
|
17
|
-
import AdminWalletABI from "@gooddollar/goodcontracts/build/contracts/AdminWallet.json";
|
|
18
|
-
import OTPABI from "@gooddollar/goodcontracts/build/contracts/OneTimePayments.json";
|
|
19
|
-
import HomeBridgeABI from "@gooddollar/goodcontracts/build/contracts/DeployHomeBridge.json";
|
|
20
|
-
import ForeignBridgeABI from "@gooddollar/goodcontracts/build/contracts/DeployForeignBridge.json";
|
|
21
11
|
|
|
22
12
|
import { deployDeterministic } from "./helpers";
|
|
23
13
|
import releaser from "../../scripts/releaser";
|
|
@@ -23,7 +23,6 @@ import FundManager from "@gooddollar/goodcontracts/stakingModel/build/contracts/
|
|
|
23
23
|
import SimpleDAIStaking from "@gooddollar/goodcontracts/stakingModel/build/contracts/SimpleDAIStaking.json";
|
|
24
24
|
import BridgeMock from "@gooddollar/goodcontracts/stakingModel/build/contracts/BridgeMock.json";
|
|
25
25
|
import DonationsStaking from "@gooddollar/goodcontracts/upgradables/build/contracts/DonationsStaking.json";
|
|
26
|
-
import AdminWalletABI from "@gooddollar/goodcontracts/build/contracts/AdminWallet.json";
|
|
27
26
|
import OTPABI from "@gooddollar/goodcontracts/build/contracts/OneTimePayments.json";
|
|
28
27
|
|
|
29
28
|
import releaser from "../releaser";
|
|
@@ -107,16 +106,11 @@ export const deploy = async (networkName = name, single = false) => {
|
|
|
107
106
|
|
|
108
107
|
const deployAdminWallet = async dao => {
|
|
109
108
|
const signers = await ethers.getSigners();
|
|
110
|
-
const adminWallet = await
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
signers[0]
|
|
114
|
-
).deploy(
|
|
115
|
-
signers.slice(0, 10).map(_ => _.address),
|
|
116
|
-
ethers.utils.parseUnits("1000000", "gwei"),
|
|
117
|
-
4,
|
|
118
|
-
dao.identity
|
|
109
|
+
const adminWallet = await upgrades.deployProxy(
|
|
110
|
+
await ethers.getContractFactory("AdminWallet"),
|
|
111
|
+
[signers.slice(0, 20).map(_ => _.address), signers[0].address, dao.identity]
|
|
119
112
|
);
|
|
113
|
+
|
|
120
114
|
const id = await ethers.getContractAt("IIdentity", dao.identity);
|
|
121
115
|
await id.addIdentityAdmin(adminWallet.address);
|
|
122
116
|
await signers[0].sendTransaction({
|
package/test/FuseFaucet.test.ts
CHANGED
|
@@ -128,30 +128,26 @@ describe("FuseFaucet", () => {
|
|
|
128
128
|
// });
|
|
129
129
|
|
|
130
130
|
it("should not let user top over weekly limit", async () => {
|
|
131
|
-
for (let i = 0; i <
|
|
131
|
+
for (let i = 0; i < 5; i++) {
|
|
132
132
|
await ethers.provider.send("evm_increaseTime", [60 * 60 * 24]);
|
|
133
133
|
await (await faucet.topWallet(user1.address)).wait();
|
|
134
134
|
await user1.sendTransaction({
|
|
135
135
|
to: ethers.constants.AddressZero,
|
|
136
|
-
value: ethers.utils.parseUnits("
|
|
136
|
+
value: ethers.utils.parseUnits("5000000", "gwei")
|
|
137
137
|
});
|
|
138
|
-
// await (await faucet.topWallet(user1.address)).wait();
|
|
139
|
-
// await user1.sendTransaction({
|
|
140
|
-
// to: ethers.constants.AddressZero,
|
|
141
|
-
// value: ethers.utils.parseUnits("500000", "gwei"),
|
|
142
|
-
// });
|
|
143
138
|
}
|
|
144
|
-
// await (await faucet.topWallet(user1.address)).wait();
|
|
145
|
-
// await user1.sendTransaction({
|
|
146
|
-
// to: ethers.constants.AddressZero,
|
|
147
|
-
// value: ethers.utils.parseUnits("500000", "gwei"),
|
|
148
|
-
// });
|
|
149
139
|
await ethers.provider.send("evm_increaseTime", [60 * 60 * 24]);
|
|
150
140
|
|
|
151
141
|
expect(await faucet.canTop(user1.address)).to.false;
|
|
152
142
|
await expect(faucet.topWallet(user1.address)).to.revertedWith(
|
|
153
143
|
"User wallet has been topped too many times this week"
|
|
154
144
|
);
|
|
145
|
+
|
|
146
|
+
//should be able to top again after some days passed
|
|
147
|
+
await ethers.provider.send("evm_increaseTime", [60 * 60 * 24 * 3]);
|
|
148
|
+
await ethers.provider.send("evm_mine", []);
|
|
149
|
+
|
|
150
|
+
expect(await faucet.canTop(user1.address)).to.true;
|
|
155
151
|
});
|
|
156
152
|
|
|
157
153
|
it("should reimburse gas costs", async () => {
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { ethers, upgrades, network } from "hardhat";
|
|
3
|
+
import { createDAO } from "../helpers";
|
|
4
|
+
import { Contract } from "ethers";
|
|
5
|
+
import { AdminWallet } from "../../types";
|
|
6
|
+
|
|
7
|
+
const BN = ethers.BigNumber;
|
|
8
|
+
export const NULL_ADDRESS = ethers.constants.AddressZero;
|
|
9
|
+
export const BLOCK_INTERVAL = 1;
|
|
10
|
+
|
|
11
|
+
describe("AdminWallet", () => {
|
|
12
|
+
let signers,
|
|
13
|
+
adminWallet: AdminWallet,
|
|
14
|
+
newUser,
|
|
15
|
+
newUser2,
|
|
16
|
+
admin,
|
|
17
|
+
admin2,
|
|
18
|
+
toWhitelist,
|
|
19
|
+
toppingTimes,
|
|
20
|
+
toppingAmount,
|
|
21
|
+
founder,
|
|
22
|
+
whitelisted,
|
|
23
|
+
stranger,
|
|
24
|
+
stranger2,
|
|
25
|
+
blacklisted,
|
|
26
|
+
identity;
|
|
27
|
+
|
|
28
|
+
before(async () => {
|
|
29
|
+
signers = await ethers.getSigners();
|
|
30
|
+
[founder, whitelisted, stranger, stranger2, blacklisted] = signers;
|
|
31
|
+
let { identity: id } = await createDAO();
|
|
32
|
+
identity = await ethers.getContractAt("IIdentity", id);
|
|
33
|
+
|
|
34
|
+
adminWallet = (await upgrades.deployProxy(
|
|
35
|
+
await ethers.getContractFactory("AdminWallet"),
|
|
36
|
+
[[], signers[0].address, id],
|
|
37
|
+
{ kind: "uups" }
|
|
38
|
+
)) as AdminWallet;
|
|
39
|
+
|
|
40
|
+
identity.addIdentityAdmin(adminWallet.address);
|
|
41
|
+
|
|
42
|
+
toppingTimes = await adminWallet.toppingTimes();
|
|
43
|
+
toppingAmount = await adminWallet.toppingAmount();
|
|
44
|
+
|
|
45
|
+
newUser = (await ethers.Wallet.createRandom()).connect(ethers.provider);
|
|
46
|
+
newUser2 = (await ethers.Wallet.createRandom()).connect(ethers.provider);
|
|
47
|
+
admin = (await ethers.Wallet.createRandom()).connect(ethers.provider);
|
|
48
|
+
admin2 = (await ethers.Wallet.createRandom()).connect(ethers.provider);
|
|
49
|
+
toWhitelist = (await ethers.Wallet.createRandom()).connect(ethers.provider);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("should transfer to admins", async () => {
|
|
53
|
+
await signers[0].sendTransaction({
|
|
54
|
+
to: admin.address,
|
|
55
|
+
value: toppingAmount / 4
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("should fill wallet", async () => {
|
|
60
|
+
await signers[0].sendTransaction({
|
|
61
|
+
to: adminWallet.address,
|
|
62
|
+
value: ethers.utils.parseUnits("50", "ether")
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("should not top admin list when empty", async () => {
|
|
67
|
+
await expect(adminWallet["topAdmins(uint256)"](0)).revertedWith(
|
|
68
|
+
"Admin list is empty"
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("should add admins", async () => {
|
|
73
|
+
await adminWallet.addAdmins(
|
|
74
|
+
[whitelisted, admin, admin2].map(_ => _.address)
|
|
75
|
+
);
|
|
76
|
+
expect(await adminWallet.isAdmin(whitelisted.address)).true;
|
|
77
|
+
expect(await adminWallet.isAdmin(admin.address)).to.true;
|
|
78
|
+
expect(await adminWallet.isAdmin(admin2.address)).to.true;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("should top admins", async () => {
|
|
82
|
+
const oldBalance = await ethers.provider.getBalance(admin2.address);
|
|
83
|
+
expect(oldBalance).to.be.equal("0");
|
|
84
|
+
|
|
85
|
+
await adminWallet["topAdmins(uint256,uint256)"](0, 1); //test topping with indexes
|
|
86
|
+
await adminWallet["topAdmins(uint256,uint256)"](1, 2);
|
|
87
|
+
expect(await ethers.provider.getBalance(whitelisted.address)).gt(0);
|
|
88
|
+
expect(await ethers.provider.getBalance(admin.address)).gt(0);
|
|
89
|
+
expect(await ethers.provider.getBalance(admin2.address)).eq(0);
|
|
90
|
+
await adminWallet["topAdmins(uint256)"](0);
|
|
91
|
+
const newBalance = await ethers.provider.getBalance(admin2.address);
|
|
92
|
+
const adminTopAmount = await adminWallet
|
|
93
|
+
.adminToppingAmount()
|
|
94
|
+
.then(_ => _.toString());
|
|
95
|
+
expect(newBalance).to.be.equal(adminTopAmount);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("should reimburse gas for admins", async () => {
|
|
99
|
+
const expectedTopping = await adminWallet
|
|
100
|
+
.adminToppingAmount()
|
|
101
|
+
.then(_ => _.toString());
|
|
102
|
+
const adminWalletBalance = await ethers.provider.getBalance(
|
|
103
|
+
adminWallet.address
|
|
104
|
+
);
|
|
105
|
+
expect(expectedTopping).to.be.equal(
|
|
106
|
+
ethers.utils.parseUnits("90000000", "gwei")
|
|
107
|
+
);
|
|
108
|
+
expect(adminWalletBalance).gt(1);
|
|
109
|
+
let oldBalance = await ethers.provider.getBalance(admin2.address);
|
|
110
|
+
let toTransfer = oldBalance.div(2);
|
|
111
|
+
if (toTransfer.gt(0))
|
|
112
|
+
await admin2.sendTransaction({
|
|
113
|
+
to: founder.address,
|
|
114
|
+
value: toTransfer
|
|
115
|
+
});
|
|
116
|
+
oldBalance = await ethers.provider.getBalance(admin2.address);
|
|
117
|
+
expect(oldBalance).to.be.lte(toTransfer);
|
|
118
|
+
|
|
119
|
+
await adminWallet
|
|
120
|
+
.connect(admin2)
|
|
121
|
+
.whitelist(toWhitelist.address, "did:test" + Math.random());
|
|
122
|
+
const newBalance = await ethers.provider.getBalance(admin2.address);
|
|
123
|
+
expect(newBalance).to.be.gte(expectedTopping);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("should remove single admin", async () => {
|
|
127
|
+
await adminWallet.removeAdmins([whitelisted.address]);
|
|
128
|
+
expect(await adminWallet.isAdmin(whitelisted.address)).to.false;
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("should allow admin to whitelist and remove whitelist", async () => {
|
|
132
|
+
expect(await identity.isWhitelisted(whitelisted.address)).to.false;
|
|
133
|
+
await adminWallet.connect(admin).whitelist(whitelisted.address, "did:test");
|
|
134
|
+
|
|
135
|
+
expect(await identity.isWhitelisted(whitelisted.address)).to.true;
|
|
136
|
+
await adminWallet.connect(admin).removeWhitelist(whitelisted.address);
|
|
137
|
+
expect(await identity.isWhitelisted(whitelisted.address)).to.false;
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it("should not allow non-admin to whitelist and remove whitelist", async () => {
|
|
141
|
+
expect(await identity.isWhitelisted(whitelisted.address)).to.false;
|
|
142
|
+
await expect(
|
|
143
|
+
adminWallet.connect(stranger).whitelist(whitelisted.address, "did:test")
|
|
144
|
+
).revertedWith("Caller is not admin");
|
|
145
|
+
expect(await identity.isWhitelisted(whitelisted.address)).to.false;
|
|
146
|
+
await adminWallet.connect(admin).whitelist(whitelisted.address, "did:test");
|
|
147
|
+
expect(await identity.isWhitelisted(whitelisted.address)).to.true;
|
|
148
|
+
await expect(
|
|
149
|
+
adminWallet.connect(stranger).removeWhitelist(whitelisted.address)
|
|
150
|
+
).revertedWith("Caller is not admin");
|
|
151
|
+
expect(await identity.isWhitelisted(whitelisted.address)).to.true;
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("should allow admin to blacklist and remove blacklist", async () => {
|
|
155
|
+
expect(await identity.isBlacklisted(blacklisted.address)).to.false;
|
|
156
|
+
await adminWallet.connect(admin).blacklist(blacklisted.address);
|
|
157
|
+
|
|
158
|
+
expect(await identity.isBlacklisted(blacklisted.address)).to.true;
|
|
159
|
+
await adminWallet.connect(admin).removeBlacklist(blacklisted.address);
|
|
160
|
+
expect(await identity.isBlacklisted(blacklisted.address)).to.false;
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("should not allow non-admin to blacklist and remove blacklist", async () => {
|
|
164
|
+
expect(await identity.isBlacklisted(blacklisted.address)).to.false;
|
|
165
|
+
await expect(
|
|
166
|
+
adminWallet.connect(stranger).blacklist(blacklisted.address)
|
|
167
|
+
).revertedWith("Caller is not admin");
|
|
168
|
+
expect(await identity.isBlacklisted(blacklisted.address)).to.false;
|
|
169
|
+
await adminWallet.connect(admin).blacklist(blacklisted.address);
|
|
170
|
+
expect(await identity.isBlacklisted(blacklisted.address)).to.true;
|
|
171
|
+
await expect(
|
|
172
|
+
adminWallet.connect(stranger).removeBlacklist(blacklisted.address)
|
|
173
|
+
).revertedWith("Caller is not admin");
|
|
174
|
+
expect(await identity.isBlacklisted(blacklisted.address)).to.true;
|
|
175
|
+
await adminWallet.connect(admin).removeBlacklist(blacklisted.address);
|
|
176
|
+
expect(await identity.isBlacklisted(blacklisted.address)).to.false;
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it("should not allow to top wallet if user balance is too high", async () => {
|
|
180
|
+
const walletBalance = await ethers.provider.getBalance(adminWallet.address);
|
|
181
|
+
const tx = await (
|
|
182
|
+
await adminWallet.connect(admin).topWallet(whitelisted.address)
|
|
183
|
+
).wait();
|
|
184
|
+
const walletBalanceAfter = await ethers.provider.getBalance(
|
|
185
|
+
adminWallet.address
|
|
186
|
+
);
|
|
187
|
+
expect(walletBalance).eq(walletBalanceAfter);
|
|
188
|
+
expect(tx.logs.length).eq(0);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it("should allow to top wallet", async () => {
|
|
192
|
+
expect(await ethers.provider.getBalance(newUser.address)).eq(0);
|
|
193
|
+
await adminWallet.connect(admin).topWallet(newUser.address);
|
|
194
|
+
expect(await ethers.provider.getBalance(newUser.address)).gt(0);
|
|
195
|
+
await newUser.sendTransaction({
|
|
196
|
+
to: adminWallet.address,
|
|
197
|
+
value: toppingAmount * 0.9
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it("should not allow to top wallet more than three times", async () => {
|
|
202
|
+
await adminWallet.connect(admin).topWallet(newUser.address);
|
|
203
|
+
await newUser.sendTransaction({
|
|
204
|
+
to: adminWallet.address,
|
|
205
|
+
value: toppingAmount * 0.9
|
|
206
|
+
});
|
|
207
|
+
await founder.sendTransaction({
|
|
208
|
+
to: admin2.address,
|
|
209
|
+
value: toppingAmount / 5
|
|
210
|
+
});
|
|
211
|
+
await adminWallet.connect(admin).topWallet(newUser.address);
|
|
212
|
+
await newUser.sendTransaction({
|
|
213
|
+
to: adminWallet.address,
|
|
214
|
+
value: toppingAmount * 0.9
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
await expect(
|
|
218
|
+
adminWallet.connect(admin).topWallet(newUser.address)
|
|
219
|
+
).revertedWith("User wallet has been topped too many times today");
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it("should whitelist user", async () => {
|
|
223
|
+
expect(await identity.isWhitelisted(stranger2.address)).to.false;
|
|
224
|
+
await adminWallet.connect(admin2).whitelist(stranger2.address, "did:test3");
|
|
225
|
+
expect(await identity.isWhitelisted(stranger2.address)).to.true;
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it("should not allow whitelisting with existing did", async () => {
|
|
229
|
+
await expect(
|
|
230
|
+
adminWallet.connect(admin2).whitelist(stranger.address, "did:test")
|
|
231
|
+
).revertedWith("DID already registered");
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it("should not allow anyone to upgrade", async () => {
|
|
235
|
+
await expect(
|
|
236
|
+
adminWallet.connect(admin2).upgradeTo(adminWallet.address)
|
|
237
|
+
).revertedWith("Ownable: caller is not the owner");
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
it("should allow owner to upgrade", async () => {
|
|
241
|
+
const newver = await (
|
|
242
|
+
await ethers.getContractFactory("AdminWallet")
|
|
243
|
+
).deploy();
|
|
244
|
+
await expect(adminWallet.connect(founder).upgradeTo(newver.address)).not
|
|
245
|
+
.reverted;
|
|
246
|
+
|
|
247
|
+
await expect(
|
|
248
|
+
upgrades.upgradeProxy(
|
|
249
|
+
adminWallet.address,
|
|
250
|
+
await ethers.getContractFactory("AdminWallet")
|
|
251
|
+
)
|
|
252
|
+
).not.throws;
|
|
253
|
+
});
|
|
254
|
+
});
|