@gooddollar/goodprotocol 1.0.3-beta.2 → 1.0.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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/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/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.json +14 -2
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GovarnanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- 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/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- 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/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- 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/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- 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/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- 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/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- 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/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/unaudited-foundation/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
- package/artifacts/contracts/unaudited-foundation/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/unaudited-foundation/InvitesV1.sol/InvitesV1.json +2 -2
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- 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/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/contracts/governance/CompoundVotingMachine.sol +8 -2
- package/contracts/unaudited-foundation/InvitesV1.sol +29 -24
- package/hardhat.config.ts +6 -3
- package/package.json +2 -1
- package/releases/deployment.json +24 -24
- package/scripts/deployFullDAO.ts +239 -162
- package/scripts/keeper/fishInactive.ts +57 -0
- package/scripts/upgradeToV2/upgradeToV2.ts +58 -36
- package/test/governance/CompoundVotingMachine.delegate.test.ts +0 -4
- package/test/governance/CompoundVotingMachine.guardian.test.ts +2 -2
- package/test/helpers.ts +3 -10
- package/test/reserve/GoodReserveCDai.cap.test.ts +1 -1
- package/test/reserve/GoodReserveCDai.test.ts +11 -109
- package/test/utils/ProtocolUpgrade.test.ts +8 -0
- package/yarn.lock +14 -0
package/scripts/deployFullDAO.ts
CHANGED
|
@@ -21,15 +21,28 @@ import releaser from "../scripts/releaser";
|
|
|
21
21
|
import ProtocolSettings from "../releases/deploy-settings.json";
|
|
22
22
|
import dao from "../releases/deployment.json";
|
|
23
23
|
import { main as deployV2 } from "./upgradeToV2/upgradeToV2";
|
|
24
|
+
import { TransactionResponse } from "@ethersproject/providers";
|
|
25
|
+
import pressAnyKey from "press-any-key";
|
|
26
|
+
|
|
24
27
|
const { name } = network;
|
|
25
28
|
|
|
26
|
-
const printDeploy = (
|
|
27
|
-
|
|
29
|
+
const printDeploy = async (
|
|
30
|
+
c: Contract | TransactionResponse
|
|
31
|
+
): Promise<Contract | TransactionResponse> => {
|
|
32
|
+
if (c instanceof Contract) {
|
|
33
|
+
await c.deployed();
|
|
34
|
+
console.log("deployed to: ", c.address);
|
|
35
|
+
}
|
|
36
|
+
if (c.wait) {
|
|
37
|
+
await c.wait();
|
|
38
|
+
console.log("tx done:", c.hash);
|
|
39
|
+
}
|
|
28
40
|
return c;
|
|
29
41
|
};
|
|
30
42
|
|
|
31
43
|
export const createDAO = async () => {
|
|
32
44
|
const fusedao = dao[network.name.split("-")[0]];
|
|
45
|
+
let release: { [key: string]: any } = {}; //dao[network.name];
|
|
33
46
|
let [root, ...signers] = await ethers.getSigners();
|
|
34
47
|
//generic call permissions
|
|
35
48
|
let schemeMock = root;
|
|
@@ -44,7 +57,6 @@ export const createDAO = async () => {
|
|
|
44
57
|
.then(_ => _.toString())
|
|
45
58
|
});
|
|
46
59
|
|
|
47
|
-
console.log("deployed erc20 tokens");
|
|
48
60
|
const DAOCreatorFactory = new ethers.ContractFactory(
|
|
49
61
|
DAOCreatorABI.abi,
|
|
50
62
|
DAOCreatorABI.bytecode,
|
|
@@ -67,48 +79,51 @@ export const createDAO = async () => {
|
|
|
67
79
|
root
|
|
68
80
|
);
|
|
69
81
|
|
|
70
|
-
const BancorFormula = await (
|
|
82
|
+
const BancorFormula = (await (
|
|
71
83
|
await ethers.getContractFactory("BancorFormula")
|
|
72
|
-
)
|
|
84
|
+
)
|
|
85
|
+
.deploy()
|
|
86
|
+
.then(printDeploy)) as Contract;
|
|
73
87
|
|
|
74
|
-
const AddFounders = await AddFoundersFactory.deploy().then(
|
|
88
|
+
const AddFounders = (await AddFoundersFactory.deploy().then(
|
|
89
|
+
printDeploy
|
|
90
|
+
)) as Contract;
|
|
75
91
|
// const AddFounders = await ethers.getContractAt(
|
|
76
92
|
// AddFoundersABI.abi,
|
|
77
93
|
// "0x6F1BAbfF5E119d61F0c6d8653d84E8B284B87091"
|
|
78
94
|
// );
|
|
79
95
|
|
|
80
|
-
const Identity = await IdentityFactory.deploy().then(
|
|
96
|
+
const Identity = (await IdentityFactory.deploy().then(
|
|
97
|
+
printDeploy
|
|
98
|
+
)) as Contract;
|
|
81
99
|
// const Identity = await ethers.getContractAt(
|
|
82
100
|
// IdentityABI.abi,
|
|
83
|
-
//
|
|
101
|
+
// release.Identity
|
|
84
102
|
// );
|
|
85
103
|
|
|
86
|
-
const daoCreator = await DAOCreatorFactory.deploy(AddFounders.address).then(
|
|
104
|
+
const daoCreator = (await DAOCreatorFactory.deploy(AddFounders.address).then(
|
|
87
105
|
printDeploy
|
|
88
|
-
);
|
|
89
|
-
// const daoCreator = await ethers.getContractAt(
|
|
90
|
-
// DAOCreatorABI.abi,
|
|
91
|
-
// "0xfD1eFFDed0EE8739dF61B580F24bCd6585d0c6B4"
|
|
92
|
-
// );
|
|
93
|
-
|
|
94
|
-
const FeeFormula = await FeeFormulaFactory.deploy(0).then(printDeploy);
|
|
95
|
-
// const FeeFormula = await ethers.getContractAt(
|
|
96
|
-
// FeeFormulaABI.abi,
|
|
97
|
-
// "0x85b146AAa910aF4ab1D64cD81ab6f804aDf3053c"
|
|
98
|
-
// );
|
|
99
|
-
|
|
100
|
-
await Identity.setAuthenticationPeriod(365);
|
|
101
|
-
await daoCreator.forgeOrg(
|
|
102
|
-
"GoodDollar",
|
|
103
|
-
"G$",
|
|
104
|
-
0,
|
|
105
|
-
FeeFormula.address,
|
|
106
|
-
Identity.address,
|
|
107
|
-
[root.address, signers[0].address, signers[1].address],
|
|
108
|
-
1000,
|
|
109
|
-
[100000, 100000, 100000]
|
|
110
|
-
);
|
|
106
|
+
)) as Contract;
|
|
111
107
|
|
|
108
|
+
const FeeFormula = (await FeeFormulaFactory.deploy(0).then(
|
|
109
|
+
printDeploy
|
|
110
|
+
)) as Contract;
|
|
111
|
+
|
|
112
|
+
await Identity.setAuthenticationPeriod(365).then(printDeploy);
|
|
113
|
+
console.log("setAuthPeriod");
|
|
114
|
+
await daoCreator
|
|
115
|
+
.forgeOrg(
|
|
116
|
+
"GoodDollar",
|
|
117
|
+
"G$",
|
|
118
|
+
0,
|
|
119
|
+
FeeFormula.address,
|
|
120
|
+
Identity.address,
|
|
121
|
+
[root.address, signers[0].address, signers[1].address],
|
|
122
|
+
1000,
|
|
123
|
+
[100000, 100000, 100000]
|
|
124
|
+
)
|
|
125
|
+
.then(printDeploy);
|
|
126
|
+
console.log("forgeOrg done ");
|
|
112
127
|
const Avatar = new ethers.Contract(
|
|
113
128
|
await daoCreator.avatar(),
|
|
114
129
|
[
|
|
@@ -118,7 +133,16 @@ export const createDAO = async () => {
|
|
|
118
133
|
root
|
|
119
134
|
);
|
|
120
135
|
|
|
121
|
-
|
|
136
|
+
// const Avatar = new ethers.Contract(
|
|
137
|
+
// release.Avatar,
|
|
138
|
+
// [
|
|
139
|
+
// "function owner() view returns (address)",
|
|
140
|
+
// "function nativeToken() view returns (address)"
|
|
141
|
+
// ],
|
|
142
|
+
// root
|
|
143
|
+
// );
|
|
144
|
+
|
|
145
|
+
await Identity.setAvatar(Avatar.address).then(printDeploy);
|
|
122
146
|
|
|
123
147
|
console.log("Done deploying DAO, setting schemes permissions");
|
|
124
148
|
|
|
@@ -130,13 +154,15 @@ export const createDAO = async () => {
|
|
|
130
154
|
|
|
131
155
|
console.log("setting schemes", schemes);
|
|
132
156
|
|
|
133
|
-
await daoCreator
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
157
|
+
await daoCreator
|
|
158
|
+
.setSchemes(
|
|
159
|
+
Avatar.address,
|
|
160
|
+
schemes,
|
|
161
|
+
schemes.map(_ => ethers.constants.HashZero),
|
|
162
|
+
["0x0000001F", "0x00000001"],
|
|
163
|
+
""
|
|
164
|
+
)
|
|
165
|
+
.then(printDeploy);
|
|
140
166
|
|
|
141
167
|
let { setSchemes, genericCall, addWhitelisted } = await getHelperFunctions(
|
|
142
168
|
Identity,
|
|
@@ -145,13 +171,22 @@ export const createDAO = async () => {
|
|
|
145
171
|
);
|
|
146
172
|
|
|
147
173
|
let mainnet: { [key: string]: Contract } = {};
|
|
174
|
+
release = {
|
|
175
|
+
...release,
|
|
176
|
+
Avatar: Avatar.address,
|
|
177
|
+
Controller: controller,
|
|
178
|
+
GoodDollar: gd,
|
|
179
|
+
Identity: Identity.address,
|
|
180
|
+
FeeFormula: FeeFormula.address
|
|
181
|
+
};
|
|
148
182
|
|
|
149
183
|
if (isMainnet) {
|
|
150
184
|
mainnet = await deployMainnet(Avatar, Identity);
|
|
185
|
+
Object.entries(mainnet).forEach(([k, v]) => (release[k] = v.address));
|
|
151
186
|
}
|
|
152
187
|
|
|
153
188
|
let sidechain: { [key: string]: any } = {};
|
|
154
|
-
|
|
189
|
+
|
|
155
190
|
if (false === isMainnet) {
|
|
156
191
|
sidechain = await deploySidechain(
|
|
157
192
|
setSchemes,
|
|
@@ -162,23 +197,24 @@ export const createDAO = async () => {
|
|
|
162
197
|
);
|
|
163
198
|
schemes.push(sidechain.OneTimePayments.address);
|
|
164
199
|
const adminWallet = await deployAdminWallet(Identity.address);
|
|
165
|
-
await root.sendTransaction({
|
|
166
|
-
to: adminWallet.address,
|
|
167
|
-
value: ethers.utils.parseUnits("0.1", "ether")
|
|
168
|
-
});
|
|
169
200
|
Object.entries(sidechain).forEach(([k, v]) => (release[k] = v.address));
|
|
170
201
|
release["AdminWallet"] = adminWallet.address;
|
|
171
202
|
}
|
|
172
203
|
|
|
204
|
+
await releaser(release, network.name);
|
|
205
|
+
|
|
206
|
+
await pressAnyKey();
|
|
173
207
|
const bridgeRelease = await deployBridge(Avatar, gd, setSchemes, isMainnet);
|
|
174
208
|
release = { ...release, ...bridgeRelease };
|
|
209
|
+
await releaser(release, network.name);
|
|
175
210
|
|
|
176
|
-
|
|
211
|
+
await pressAnyKey();
|
|
212
|
+
// deploy v2 mainnet/sidechain contracts, returns their addresses
|
|
177
213
|
const v2 = await deployV2(network.name, false, {
|
|
178
|
-
FirstClaimPool:
|
|
179
|
-
BancorFormula: BancorFormula
|
|
180
|
-
Avatar: Avatar
|
|
181
|
-
Controller:
|
|
214
|
+
FirstClaimPool: release.FirstClaimPool,
|
|
215
|
+
BancorFormula: release.BancorFormula,
|
|
216
|
+
Avatar: release.Avatar,
|
|
217
|
+
Controller: release.Controller,
|
|
182
218
|
DAIUsdOracle: ethers.constants.AddressZero,
|
|
183
219
|
COMPUsdOracle: ethers.constants.AddressZero,
|
|
184
220
|
USDCUsdOracle: ethers.constants.AddressZero,
|
|
@@ -186,20 +222,22 @@ export const createDAO = async () => {
|
|
|
186
222
|
AaveLendingPool: ethers.constants.AddressZero,
|
|
187
223
|
AaveIncentiveController: ethers.constants.AddressZero,
|
|
188
224
|
GasPriceOracle: ethers.constants.AddressZero,
|
|
189
|
-
cDAI:
|
|
190
|
-
DAI:
|
|
191
|
-
COMP:
|
|
225
|
+
cDAI: release.cDAI || ethers.constants.AddressZero,
|
|
226
|
+
DAI: release.DAI || ethers.constants.AddressZero,
|
|
227
|
+
COMP: release.COMP || ethers.constants.AddressZero,
|
|
192
228
|
USDC: ethers.constants.AddressZero,
|
|
193
|
-
Identity: Identity
|
|
194
|
-
GoodDollar:
|
|
195
|
-
Contribution:
|
|
229
|
+
Identity: release.Identity,
|
|
230
|
+
GoodDollar: release.GoodDollar,
|
|
231
|
+
Contribution: release.Contribution,
|
|
196
232
|
UniswapRouter: "0x0000000000000000000000000000000000000001",
|
|
197
|
-
|
|
233
|
+
HomeBridge: release.HomeBridge,
|
|
234
|
+
ForeignBridge: release.ForeignBridge,
|
|
198
235
|
SchemeRegistrar: ethers.constants.AddressZero,
|
|
199
236
|
UpgradeScheme: ethers.constants.AddressZero
|
|
200
237
|
});
|
|
201
|
-
release = { ...
|
|
202
|
-
|
|
238
|
+
release = { ...v2, ...release };
|
|
239
|
+
await releaser(release, network.name);
|
|
240
|
+
await pressAnyKey();
|
|
203
241
|
if (isMainnet) {
|
|
204
242
|
await setSchemes([release.ProtocolUpgrade]);
|
|
205
243
|
await performUpgrade(release, fusedao.UBIScheme);
|
|
@@ -218,28 +256,16 @@ export const createDAO = async () => {
|
|
|
218
256
|
|
|
219
257
|
if (false === isMainnet) {
|
|
220
258
|
let encoded = (
|
|
221
|
-
await ethers.getContractAt("IGoodDollar",
|
|
259
|
+
await ethers.getContractAt("IGoodDollar", release.GoodDollar)
|
|
222
260
|
).interface.encodeFunctionData("mint", [release.UBIScheme, 1000000]);
|
|
223
261
|
|
|
224
|
-
await genericCall(
|
|
262
|
+
await genericCall(release.GoodDollar, encoded);
|
|
225
263
|
|
|
226
264
|
await setSchemes([release.ProtocolUpgradeFuse]);
|
|
227
265
|
await performUpgradeFuse(release);
|
|
228
266
|
}
|
|
229
267
|
|
|
230
268
|
await releaser(release, network.name);
|
|
231
|
-
|
|
232
|
-
return {
|
|
233
|
-
...mainnet,
|
|
234
|
-
...sidechain,
|
|
235
|
-
daoCreator,
|
|
236
|
-
controller,
|
|
237
|
-
avatar: await daoCreator.avatar(),
|
|
238
|
-
gd: await Avatar.nativeToken(),
|
|
239
|
-
identity: Identity.address,
|
|
240
|
-
bancorFormula: BancorFormula.address
|
|
241
|
-
// bridge: Bridge.address,
|
|
242
|
-
};
|
|
243
269
|
};
|
|
244
270
|
|
|
245
271
|
const deployBridge = async (Avatar, gd, setSchemes, isMainnet) => {
|
|
@@ -261,18 +287,19 @@ const deployBridge = async (Avatar, gd, setSchemes, isMainnet) => {
|
|
|
261
287
|
isMainnet,
|
|
262
288
|
isAlreadyMinter
|
|
263
289
|
});
|
|
264
|
-
const scheme = await bridgeFactory
|
|
265
|
-
Avatar.address,
|
|
266
|
-
|
|
267
|
-
);
|
|
290
|
+
const scheme = (await bridgeFactory
|
|
291
|
+
.deploy(Avatar.address, BridgeFactoryContract)
|
|
292
|
+
.then(printDeploy)) as Contract;
|
|
268
293
|
await setSchemes([scheme.address]);
|
|
269
294
|
|
|
270
295
|
if (network.name.includes("develop")) {
|
|
271
|
-
const mockBridge = await new ethers.ContractFactory(
|
|
296
|
+
const mockBridge = (await new ethers.ContractFactory(
|
|
272
297
|
BridgeMock.abi,
|
|
273
298
|
BridgeMock.bytecode,
|
|
274
299
|
root
|
|
275
|
-
)
|
|
300
|
+
)
|
|
301
|
+
.deploy()
|
|
302
|
+
.then(printDeploy)) as Contract;
|
|
276
303
|
console.log("deployed mock bridge for develop mode:", mockBridge.address);
|
|
277
304
|
return isMainnet
|
|
278
305
|
? { ForeignBridge: mockBridge.address }
|
|
@@ -284,11 +311,12 @@ const deployBridge = async (Avatar, gd, setSchemes, isMainnet) => {
|
|
|
284
311
|
? scheme.setBridge()
|
|
285
312
|
: scheme.setBridge(isAlreadyMinter === false))
|
|
286
313
|
).wait();
|
|
287
|
-
|
|
314
|
+
const bridgeEvent = tx.events.find(_ => _.event?.includes("Bridge"));
|
|
315
|
+
console.log("deployed bridge:", bridgeEvent);
|
|
288
316
|
console.log(tx.events, tx);
|
|
289
317
|
return isMainnet
|
|
290
|
-
? { ForeignBridge:
|
|
291
|
-
: { HomeBridge:
|
|
318
|
+
? { ForeignBridge: bridgeEvent.args._foreignBridge }
|
|
319
|
+
: { HomeBridge: bridgeEvent.args._homeBridge };
|
|
292
320
|
};
|
|
293
321
|
|
|
294
322
|
const deployMainnet = async (Avatar, Identity) => {
|
|
@@ -301,17 +329,17 @@ const deployMainnet = async (Avatar, Identity) => {
|
|
|
301
329
|
const cdaiAddr = ProtocolSettings[network.name]?.compound?.cdai;
|
|
302
330
|
const COMPAddr = ProtocolSettings[network.name]?.compound?.comp;
|
|
303
331
|
|
|
304
|
-
let
|
|
332
|
+
let DAI = daiAddr
|
|
305
333
|
? await ethers.getContractAt("DAIMock", daiAddr)
|
|
306
|
-
: await daiFactory.deploy();
|
|
334
|
+
: ((await daiFactory.deploy().then(printDeploy)) as Contract);
|
|
307
335
|
|
|
308
336
|
let COMP = COMPAddr
|
|
309
337
|
? await ethers.getContractAt("DAIMock", COMPAddr)
|
|
310
|
-
: await daiFactory.deploy();
|
|
338
|
+
: ((await daiFactory.deploy().then(printDeploy)) as Contract);
|
|
311
339
|
|
|
312
340
|
let cDAI = cdaiAddr
|
|
313
341
|
? await ethers.getContractAt("DAIMock", cdaiAddr)
|
|
314
|
-
: await cdaiFactory.deploy(
|
|
342
|
+
: ((await cdaiFactory.deploy(DAI.address).then(printDeploy)) as Contract);
|
|
315
343
|
|
|
316
344
|
const ccFactory = new ethers.ContractFactory(
|
|
317
345
|
ContributionCalculation.abi,
|
|
@@ -319,17 +347,17 @@ const deployMainnet = async (Avatar, Identity) => {
|
|
|
319
347
|
root
|
|
320
348
|
);
|
|
321
349
|
|
|
322
|
-
const
|
|
350
|
+
const Contribution = (await ccFactory
|
|
323
351
|
.deploy(Avatar.address, 0, 1e15)
|
|
324
|
-
.then(printDeploy);
|
|
352
|
+
.then(printDeploy)) as Contract;
|
|
325
353
|
// const contribution = await ethers.getContractAt(
|
|
326
354
|
// ContributionCalculation.abi,
|
|
327
355
|
// "0xc3171409dB6827A68294B3A0D40a31310E83eD6B"
|
|
328
356
|
// );
|
|
329
357
|
|
|
330
358
|
return {
|
|
331
|
-
|
|
332
|
-
|
|
359
|
+
Contribution,
|
|
360
|
+
DAI,
|
|
333
361
|
COMP,
|
|
334
362
|
cDAI
|
|
335
363
|
};
|
|
@@ -374,7 +402,9 @@ export const deploySidechain = async (
|
|
|
374
402
|
identity
|
|
375
403
|
});
|
|
376
404
|
|
|
377
|
-
const firstClaim = await fcFactory
|
|
405
|
+
const firstClaim = (await fcFactory
|
|
406
|
+
.deploy(avatar, identity, 1000)
|
|
407
|
+
.then(printDeploy)) as Contract;
|
|
378
408
|
|
|
379
409
|
let encoded = (
|
|
380
410
|
await ethers.getContractAt("IGoodDollar", gd)
|
|
@@ -384,21 +414,29 @@ export const deploySidechain = async (
|
|
|
384
414
|
|
|
385
415
|
console.log("deploying OneTimePayments");
|
|
386
416
|
|
|
387
|
-
const otp = await otpf
|
|
417
|
+
const otp = (await otpf
|
|
418
|
+
.deploy(avatar, identity)
|
|
419
|
+
.then(printDeploy)) as Contract;
|
|
388
420
|
|
|
389
421
|
console.log("deploying OneTimePayments invites");
|
|
390
|
-
const invites = await upgrades
|
|
391
|
-
avatar,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
422
|
+
const invites = (await upgrades
|
|
423
|
+
.deployProxy(invitesf, [avatar, identity, gd, 10000])
|
|
424
|
+
.then(printDeploy)) as Contract;
|
|
425
|
+
|
|
426
|
+
const faucet = (await upgrades
|
|
427
|
+
.deployProxy(faucetf, [identity])
|
|
428
|
+
.then(printDeploy)) as Contract;
|
|
429
|
+
|
|
430
|
+
await root
|
|
431
|
+
.sendTransaction({
|
|
432
|
+
to: faucet.address,
|
|
433
|
+
value: ethers.utils.parseEther("5")
|
|
434
|
+
})
|
|
435
|
+
.then(printDeploy);
|
|
398
436
|
|
|
399
437
|
console.log("setting firstclaim and otp schemes...");
|
|
400
438
|
await setSchemes([firstClaim.address, otp.address]);
|
|
401
|
-
|
|
439
|
+
await firstClaim.start().then(printDeploy);
|
|
402
440
|
|
|
403
441
|
return {
|
|
404
442
|
FirstClaimPool: firstClaim,
|
|
@@ -415,24 +453,28 @@ const deployAdminWallet = async identity => {
|
|
|
415
453
|
hdNode.derivePath(`m/44'/60'/0'/0/${i + 1}`)
|
|
416
454
|
);
|
|
417
455
|
|
|
418
|
-
const adminWallet = await new ethers.ContractFactory(
|
|
456
|
+
const adminWallet = (await new ethers.ContractFactory(
|
|
419
457
|
AdminWalletABI.abi,
|
|
420
458
|
AdminWalletABI.bytecode,
|
|
421
459
|
root
|
|
422
|
-
)
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
460
|
+
)
|
|
461
|
+
.deploy(
|
|
462
|
+
admins.slice(0, 20).map(_ => _.address),
|
|
463
|
+
ethers.utils.parseUnits("1000000", "gwei"),
|
|
464
|
+
4,
|
|
465
|
+
identity
|
|
466
|
+
)
|
|
467
|
+
.then(printDeploy)) as Contract;
|
|
428
468
|
|
|
429
469
|
const id = await ethers.getContractAt("IIdentity", identity);
|
|
430
|
-
await id.addIdentityAdmin(adminWallet.address);
|
|
431
|
-
await root
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
470
|
+
await id.addIdentityAdmin(adminWallet.address).then(printDeploy);
|
|
471
|
+
await root
|
|
472
|
+
.sendTransaction({
|
|
473
|
+
to: adminWallet.address,
|
|
474
|
+
value: ethers.utils.parseEther("1")
|
|
475
|
+
})
|
|
476
|
+
.then(printDeploy);
|
|
477
|
+
await adminWallet["topAdmins(uint256)"](0).then(printDeploy);
|
|
436
478
|
console.log(
|
|
437
479
|
"deployAdminWallet admins:",
|
|
438
480
|
admins.map(_ => _.address),
|
|
@@ -457,17 +499,19 @@ const getHelperFunctions = async (Identity, Avatar, schemeMock) => {
|
|
|
457
499
|
params[i] || ethers.constants.HashZero,
|
|
458
500
|
"0x0000001F",
|
|
459
501
|
Avatar.address
|
|
460
|
-
);
|
|
502
|
+
).then(printDeploy);
|
|
461
503
|
}
|
|
462
504
|
};
|
|
463
505
|
|
|
464
506
|
const genericCall = (target, encodedFunc) => {
|
|
465
|
-
return Controller.genericCall(target, encodedFunc, Avatar.address, 0)
|
|
507
|
+
return Controller.genericCall(target, encodedFunc, Avatar.address, 0).then(
|
|
508
|
+
printDeploy
|
|
509
|
+
);
|
|
466
510
|
};
|
|
467
511
|
|
|
468
512
|
const addWhitelisted = (addr, did, isContract = false) => {
|
|
469
513
|
if (isContract) return Identity.addContract(addr);
|
|
470
|
-
return Identity.addWhitelistedWithDID(addr, did);
|
|
514
|
+
return Identity.addWhitelistedWithDID(addr, did).then(printDeploy);
|
|
471
515
|
};
|
|
472
516
|
|
|
473
517
|
return { setSchemes, addWhitelisted, genericCall };
|
|
@@ -480,39 +524,43 @@ const performUpgradeFuse = async release => {
|
|
|
480
524
|
);
|
|
481
525
|
|
|
482
526
|
console.log("performing protocol v2 upgrade on Fuse...", { release });
|
|
483
|
-
await upgrade
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
[
|
|
494
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("REPUTATION")),
|
|
495
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("BRIDGE_CONTRACT")),
|
|
496
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("UBISCHEME")),
|
|
497
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_STAKING")),
|
|
498
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_CLAIMERS"))
|
|
499
|
-
],
|
|
500
|
-
[
|
|
501
|
-
release.GReputation,
|
|
502
|
-
release.HomeBridge || ethers.constants.AddressZero,
|
|
527
|
+
await upgrade
|
|
528
|
+
.upgrade(
|
|
529
|
+
release.NameService,
|
|
530
|
+
//old contracts
|
|
531
|
+
[
|
|
532
|
+
ethers.constants.AddressZero,
|
|
533
|
+
ethers.constants.AddressZero,
|
|
534
|
+
ethers.constants.AddressZero,
|
|
535
|
+
release.FirstClaimPool
|
|
536
|
+
],
|
|
503
537
|
release.UBIScheme,
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
538
|
+
[
|
|
539
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("REPUTATION")),
|
|
540
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("BRIDGE_CONTRACT")),
|
|
541
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("UBISCHEME")),
|
|
542
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_STAKING")),
|
|
543
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_CLAIMERS"))
|
|
544
|
+
],
|
|
545
|
+
[
|
|
546
|
+
release.GReputation,
|
|
547
|
+
release.HomeBridge || ethers.constants.AddressZero,
|
|
548
|
+
release.UBIScheme,
|
|
549
|
+
release.GovernanceStaking,
|
|
550
|
+
release.ClaimersDistribution
|
|
551
|
+
]
|
|
552
|
+
)
|
|
553
|
+
.then(printDeploy);
|
|
508
554
|
|
|
509
555
|
console.log("upgrading governance...");
|
|
510
556
|
|
|
511
|
-
await upgrade
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
557
|
+
await upgrade
|
|
558
|
+
.upgradeGovernance(
|
|
559
|
+
ethers.constants.AddressZero,
|
|
560
|
+
ethers.constants.AddressZero,
|
|
561
|
+
release.CompoundVotingMachine
|
|
562
|
+
)
|
|
563
|
+
.then(printDeploy);
|
|
516
564
|
};
|
|
517
565
|
|
|
518
566
|
const performUpgrade = async (release, ubiScheme) => {
|
|
@@ -524,10 +572,35 @@ const performUpgrade = async (release, ubiScheme) => {
|
|
|
524
572
|
console.log("performing protocol v2 upgrade on Mainnet...", {
|
|
525
573
|
release
|
|
526
574
|
});
|
|
527
|
-
console.log(
|
|
575
|
+
console.log(
|
|
576
|
+
"upgrading nameservice + staking rewards...",
|
|
577
|
+
release.NameService,
|
|
578
|
+
[
|
|
579
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("RESERVE")),
|
|
580
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("MARKET_MAKER")),
|
|
581
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("FUND_MANAGER")),
|
|
582
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("REPUTATION")),
|
|
583
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_STAKERS")),
|
|
584
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("BRIDGE_CONTRACT")),
|
|
585
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("UBI_RECIPIENT")),
|
|
586
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("EXCHANGE_HELPER"))
|
|
587
|
+
],
|
|
588
|
+
[
|
|
589
|
+
release.GoodReserveCDai,
|
|
590
|
+
release.GoodMarketMaker,
|
|
591
|
+
release.GoodFundManager,
|
|
592
|
+
release.GReputation,
|
|
593
|
+
release.StakersDistribution,
|
|
594
|
+
release.ForeignBridge || ethers.constants.AddressZero,
|
|
595
|
+
ubiScheme,
|
|
596
|
+
release.ExchangeHelper
|
|
597
|
+
],
|
|
598
|
+
release.StakingContracts.map((_: any) => _[0]),
|
|
599
|
+
release.StakingContracts.map((_: any) => _[1])
|
|
600
|
+
);
|
|
528
601
|
let tx;
|
|
529
|
-
tx = await
|
|
530
|
-
|
|
602
|
+
tx = await upgrade
|
|
603
|
+
.upgradeBasic(
|
|
531
604
|
release.NameService,
|
|
532
605
|
[
|
|
533
606
|
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("RESERVE")),
|
|
@@ -552,7 +625,7 @@ const performUpgrade = async (release, ubiScheme) => {
|
|
|
552
625
|
release.StakingContracts.map((_: any) => _[0]),
|
|
553
626
|
release.StakingContracts.map((_: any) => _[1])
|
|
554
627
|
)
|
|
555
|
-
|
|
628
|
+
.then(printDeploy);
|
|
556
629
|
|
|
557
630
|
console.log("upgrading reserve...", {
|
|
558
631
|
params: [
|
|
@@ -563,21 +636,25 @@ const performUpgrade = async (release, ubiScheme) => {
|
|
|
563
636
|
release.COMP
|
|
564
637
|
]
|
|
565
638
|
});
|
|
566
|
-
tx = await upgrade
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
639
|
+
tx = await upgrade
|
|
640
|
+
.upgradeReserve(
|
|
641
|
+
release.NameService,
|
|
642
|
+
ethers.constants.AddressZero,
|
|
643
|
+
ethers.constants.AddressZero,
|
|
644
|
+
ethers.constants.AddressZero,
|
|
645
|
+
release.COMP
|
|
646
|
+
)
|
|
647
|
+
.then(printDeploy);
|
|
573
648
|
|
|
574
649
|
console.log("upgrading governance...");
|
|
575
650
|
|
|
576
|
-
tx = await upgrade
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
651
|
+
tx = await upgrade
|
|
652
|
+
.upgradeGovernance(
|
|
653
|
+
ethers.constants.AddressZero,
|
|
654
|
+
ethers.constants.AddressZero,
|
|
655
|
+
release.CompoundVotingMachine
|
|
656
|
+
)
|
|
657
|
+
.then(printDeploy);
|
|
581
658
|
};
|
|
582
659
|
|
|
583
660
|
const main = async () => {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { range, chunk } from "lodash";
|
|
2
|
+
import { ethers as Ethers } from "hardhat";
|
|
3
|
+
import fetch from "node-fetch";
|
|
4
|
+
|
|
5
|
+
const ONE_DAY = 24 * 60 * 60;
|
|
6
|
+
|
|
7
|
+
const main = async () => {
|
|
8
|
+
const signer = (await Ethers.getSigners())[0];
|
|
9
|
+
console.log("signer:", signer.address);
|
|
10
|
+
const ubiScheme = new Ethers.Contract(
|
|
11
|
+
"0xD7aC544F8A570C4d8764c3AAbCF6870CBD960D0D",
|
|
12
|
+
["function fishMulti(address[] tofish)"]
|
|
13
|
+
).connect(signer);
|
|
14
|
+
const twoWeeksAgo =
|
|
15
|
+
parseInt((Date.now() / 1000).toFixed(0)) - 24 * 60 * 60 * 14;
|
|
16
|
+
|
|
17
|
+
const daysAgo: number[] = range(0, 180, 1);
|
|
18
|
+
let curDay = twoWeeksAgo;
|
|
19
|
+
for (let day of daysAgo) {
|
|
20
|
+
const query = `
|
|
21
|
+
{
|
|
22
|
+
walletStats(first:1000, where: { lastClaimed_lt: ${curDay},lastClaimed_gt: ${
|
|
23
|
+
curDay - 24 * 60 * 60
|
|
24
|
+
} isActiveUser: true }) {
|
|
25
|
+
id
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
console.log(
|
|
31
|
+
"fetching inactive users since:",
|
|
32
|
+
{ curDay, day },
|
|
33
|
+
JSON.stringify({ query })
|
|
34
|
+
);
|
|
35
|
+
const { walletStats } = await fetch(
|
|
36
|
+
"https://api.thegraph.com/subgraphs/name/gooddollar/gooddollarfuse",
|
|
37
|
+
{
|
|
38
|
+
method: "post",
|
|
39
|
+
body: JSON.stringify({ query }),
|
|
40
|
+
headers: { "Content-Type": "application/json" }
|
|
41
|
+
}
|
|
42
|
+
).then(_ => _.json());
|
|
43
|
+
|
|
44
|
+
console.log("got inactive wallets:", walletStats.length);
|
|
45
|
+
const accounts = walletStats.map(_ => _.id);
|
|
46
|
+
for (let tofish of chunk(accounts, 50)) {
|
|
47
|
+
const tx = await ubiScheme.fishMulti(tofish, { gasLimit: 2000000 });
|
|
48
|
+
console.log("fishing tx:", tx, tofish);
|
|
49
|
+
const res = await tx.wait();
|
|
50
|
+
console.log("fishing tx result:", res);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
curDay = curDay - ONE_DAY;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
main();
|