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