@gooddollar/goodprotocol 1.0.3-beta.4 → 1.0.3
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 +3 -1
- package/package.json +1 -1
- package/releases/deployment.json +24 -24
- package/scripts/deployFullDAO.ts +159 -125
- package/scripts/keeper/fishInactive.ts +17 -12
- package/scripts/upgradeToV2/upgradeToV2.ts +7 -2
- 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
|
@@ -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)) {
|
|
@@ -74,7 +74,7 @@ export const main = async (
|
|
|
74
74
|
if (isProduction && networkName.includes("mainnet")) {
|
|
75
75
|
GAS_SETTINGS.gasLimit = 6000000;
|
|
76
76
|
GAS_SETTINGS.maxFeePerGas = ethers.utils.parseUnits("80", "gwei");
|
|
77
|
-
} else if (
|
|
77
|
+
} else if (network.config.chainId === 122) {
|
|
78
78
|
//case we are on fusefuse
|
|
79
79
|
GAS_SETTINGS = {
|
|
80
80
|
gasLimit: 6000000,
|
|
@@ -108,6 +108,10 @@ export const main = async (
|
|
|
108
108
|
|
|
109
109
|
const founders = await getFounders(networkName);
|
|
110
110
|
|
|
111
|
+
console.log(
|
|
112
|
+
`root: ${root.address} founders: ${founders.map(_ => _.address)}`
|
|
113
|
+
);
|
|
114
|
+
|
|
111
115
|
const compoundTokens = [
|
|
112
116
|
{
|
|
113
117
|
name: "cdai",
|
|
@@ -216,7 +220,8 @@ export const main = async (
|
|
|
216
220
|
args: [
|
|
217
221
|
() => get(release, "NameService", newdao.NameService),
|
|
218
222
|
protocolSettings.governance.proposalVotingPeriod,
|
|
219
|
-
protocolSettings.governance.guardian || root.address
|
|
223
|
+
protocolSettings.governance.guardian || root.address,
|
|
224
|
+
() => get(release, "GReputation", newdao.GReputation)
|
|
220
225
|
]
|
|
221
226
|
},
|
|
222
227
|
{
|
|
@@ -62,10 +62,6 @@ describe("CompoundVotingMachine#Delegation", () => {
|
|
|
62
62
|
before(async () => {
|
|
63
63
|
[root, acct, ...signers] = await ethers.getSigners();
|
|
64
64
|
|
|
65
|
-
const CompoundVotingMachine = await ethers.getContractFactory(
|
|
66
|
-
"CompoundVotingMachine"
|
|
67
|
-
);
|
|
68
|
-
|
|
69
65
|
let {
|
|
70
66
|
daoCreator,
|
|
71
67
|
reputation,
|
|
@@ -93,7 +93,7 @@ describe("CompoundVotingMachine#Guardian", () => {
|
|
|
93
93
|
it("should set guardian from initializer", async () => {
|
|
94
94
|
const votingMachine = (await upgrades.deployProxy(
|
|
95
95
|
await ethers.getContractFactory("CompoundVotingMachine"),
|
|
96
|
-
[nameService.address, 5760, signers[2].address],
|
|
96
|
+
[nameService.address, 5760, signers[2].address, NULL_ADDRESS],
|
|
97
97
|
{ kind: "uups" }
|
|
98
98
|
)) as unknown as CompoundVotingMachine;
|
|
99
99
|
expect(await votingMachine.guardian()).to.equal(signers[2].address);
|
|
@@ -151,7 +151,7 @@ describe("CompoundVotingMachine#Guardian", () => {
|
|
|
151
151
|
|
|
152
152
|
const gov2 = (await upgrades.deployProxy(
|
|
153
153
|
CompoundVotingMachine,
|
|
154
|
-
[nameService.address, 5760, root.address],
|
|
154
|
+
[nameService.address, 5760, root.address, NULL_ADDRESS],
|
|
155
155
|
{ kind: "uups" }
|
|
156
156
|
)) as CompoundVotingMachine;
|
|
157
157
|
|
package/test/helpers.ts
CHANGED
|
@@ -14,15 +14,8 @@ import IUniswapV2Pair from "@uniswap/v2-core/build/IUniswapV2Pair.json";
|
|
|
14
14
|
import UniswapV2Factory from "@uniswap/v2-core/build/UniswapV2Factory.json";
|
|
15
15
|
import WETH9 from "@uniswap/v2-periphery/build/WETH9.json";
|
|
16
16
|
import UniswapV2Router02 from "@uniswap/v2-periphery/build/UniswapV2Router02.json";
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
GoodMarketMaker,
|
|
20
|
-
CompoundVotingMachine,
|
|
21
|
-
GoodCompoundStaking,
|
|
22
|
-
GoodAaveStaking
|
|
23
|
-
} from "../types";
|
|
24
|
-
import { Contract } from "@ethersproject/contracts";
|
|
25
|
-
import { BigNumber } from "@ethersproject/bignumber";
|
|
17
|
+
import { GoodMarketMaker, CompoundVotingMachine } from "../types";
|
|
18
|
+
import { Contract } from "ethers";
|
|
26
19
|
|
|
27
20
|
export const getStakingFactory = async (
|
|
28
21
|
factory: "GoodCompoundStaking" | "GoodAaveStaking" | "GoodCompoundStakingTest"
|
|
@@ -285,7 +278,7 @@ export const createDAO = async () => {
|
|
|
285
278
|
);
|
|
286
279
|
const votingMachine = (await upgrades.deployProxy(
|
|
287
280
|
await ethers.getContractFactory("CompoundVotingMachine"),
|
|
288
|
-
[nameService.address, 5760, root.address],
|
|
281
|
+
[nameService.address, 5760, root.address, reputation.address],
|
|
289
282
|
{ kind: "uups" }
|
|
290
283
|
)) as unknown as CompoundVotingMachine;
|
|
291
284
|
return {
|
|
@@ -2,7 +2,7 @@ import { default as hre, ethers, upgrades } from "hardhat";
|
|
|
2
2
|
import { expect } from "chai";
|
|
3
3
|
import { GoodMarketMaker, CERC20, GoodReserveCDai } from "../../types";
|
|
4
4
|
import { createDAO, increaseTime, advanceBlocks } from "../helpers";
|
|
5
|
-
import { Contract } from "
|
|
5
|
+
import { Contract } from "ethers";
|
|
6
6
|
|
|
7
7
|
const BN = ethers.BigNumber;
|
|
8
8
|
export const NULL_ADDRESS = ethers.constants.AddressZero;
|
|
@@ -175,7 +175,7 @@ describe("GoodReserve - staking with cDAI mocks", () => {
|
|
|
175
175
|
// // await goodDollar.addMinter(goodReserve.address);
|
|
176
176
|
// });
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
it("should mint UBI correctly for 18 decimals precision and no interest", async () => {
|
|
179
179
|
let reserveToken = await marketMaker.reserveTokens(cDAI.address);
|
|
180
180
|
let reserveBalanceBefore = reserveToken.reserveSupply;
|
|
181
181
|
let supplyBefore = reserveToken.gdSupply;
|
|
@@ -191,7 +191,7 @@ describe("GoodReserve - staking with cDAI mocks", () => {
|
|
|
191
191
|
|
|
192
192
|
await dai["mint(address,uint256)"](goodReserve.address, daiAmount);
|
|
193
193
|
const tx = await (
|
|
194
|
-
await goodReserve.mintUBI(
|
|
194
|
+
await goodReserve.mintUBI(daiAmount, 0, cDAI.address)
|
|
195
195
|
).wait();
|
|
196
196
|
const gdBalanceFund = await goodDollar.balanceOf(founder.address);
|
|
197
197
|
const gdPriceAfter = await goodReserve["currentPrice()"]();
|
|
@@ -214,7 +214,7 @@ describe("GoodReserve - staking with cDAI mocks", () => {
|
|
|
214
214
|
// expected that the new reserve balance will include
|
|
215
215
|
// the new 1e18 cdai which transferred
|
|
216
216
|
expect(reserveBalanceAfter).to.be.equal(
|
|
217
|
-
reserveBalanceBefore.add(BN.from("10").pow(17))
|
|
217
|
+
reserveBalanceBefore.add(BN.from("10").pow(17))
|
|
218
218
|
);
|
|
219
219
|
// the new reserve ratio should be effected from the mintExpansion by:
|
|
220
220
|
// the daily change that was set up in the constructor (999388834642296)
|
|
@@ -228,115 +228,17 @@ describe("GoodReserve - staking with cDAI mocks", () => {
|
|
|
228
228
|
.toString()
|
|
229
229
|
);
|
|
230
230
|
});
|
|
231
|
-
|
|
232
|
-
it("should mint UBI
|
|
233
|
-
let
|
|
234
|
-
|
|
235
|
-
let supplyBefore = reserveToken.gdSupply;
|
|
236
|
-
const gdBalanceFundBefore = await goodDollar.balanceOf(founder.address);
|
|
237
|
-
const gdBalanceAvatarBefore = await goodDollar.balanceOf(avatar);
|
|
238
|
-
const gdPriceBefore = await goodReserve["currentPrice()"]();
|
|
239
|
-
const tx = await (
|
|
240
|
-
await goodReserve.mintInterestAndUBI(
|
|
241
|
-
cDAI.address,
|
|
242
|
-
ethers.utils.parseUnits("10000", "gwei"),
|
|
243
|
-
"10000"
|
|
244
|
-
)
|
|
245
|
-
).wait(); // interest is 0.0001 cDai which equal to 1 gd
|
|
246
|
-
const gdBalanceFundAfter = await goodDollar.balanceOf(founder.address);
|
|
247
|
-
const gdBalanceAvatarAfter = await goodDollar.balanceOf(avatar);
|
|
248
|
-
const gdPriceAfter = await goodReserve["currentPrice()"]();
|
|
249
|
-
reserveToken = await marketMaker.reserveTokens(cDAI.address);
|
|
250
|
-
let reserveBalanceAfter = reserveToken.reserveSupply;
|
|
251
|
-
let supplyAfter = reserveToken.gdSupply;
|
|
252
|
-
let rrAfter = reserveToken.reserveRatio;
|
|
253
|
-
let et = BN.from(ethers.utils.parseUnits("10000", "gwei"));
|
|
254
|
-
console.log(
|
|
255
|
-
gdPriceBefore.toNumber(),
|
|
256
|
-
supplyAfter.toNumber(),
|
|
257
|
-
supplyBefore.toNumber()
|
|
258
|
-
);
|
|
259
|
-
const mintEvent = tx.events.find(_ => _.event === "UBIMinted");
|
|
260
|
-
const toMint = mintEvent.args.gdInterestMinted.add(
|
|
261
|
-
mintEvent.args.gdExpansionMinted
|
|
262
|
-
);
|
|
263
|
-
expect(reserveBalanceAfter.toString()).to.be.equal(
|
|
264
|
-
et.add(reserveBalanceBefore).toString(),
|
|
265
|
-
"reserve balance has changed"
|
|
266
|
-
);
|
|
267
|
-
expect(supplyAfter.toString()).to.be.equal(
|
|
268
|
-
toMint.add(supplyBefore).toString(),
|
|
269
|
-
"supply has changed"
|
|
270
|
-
);
|
|
271
|
-
expect(gdPriceAfter.toString()).to.be.equal(
|
|
272
|
-
gdPriceBefore.toString(),
|
|
273
|
-
"price has changed"
|
|
274
|
-
);
|
|
275
|
-
expect(
|
|
276
|
-
(gdBalanceAvatarAfter - gdBalanceAvatarBefore).toString()
|
|
277
|
-
).to.be.equal("0"); // 1 gd
|
|
278
|
-
expect(gdBalanceFundAfter.sub(gdBalanceFundBefore)).to.be.equal(
|
|
279
|
-
toMint,
|
|
280
|
-
"ubi minted mismatch"
|
|
281
|
-
);
|
|
282
|
-
expect(rrAfter.toString()).to.be.equal("999388");
|
|
231
|
+
|
|
232
|
+
it("should not mint UBI if the reserve is not cDAI", async () => {
|
|
233
|
+
let error = await goodReserve.mintUBI(1, 0, dai.address).catch(e => e);
|
|
234
|
+
expect(error.message).not.to.be.empty;
|
|
283
235
|
});
|
|
284
|
-
*/
|
|
285
|
-
// it("should not mint UBI if the reserve is not cDAI", async () => {
|
|
286
|
-
// let error = await goodReserve
|
|
287
|
-
// .mintInterestAndUBI(dai.address, ethers.utils.parseEther("1"), "0")
|
|
288
|
-
// .catch(e => e);
|
|
289
|
-
// expect(error.message).not.to.be.empty;
|
|
290
|
-
// });
|
|
291
236
|
|
|
292
|
-
|
|
293
|
-
let tx = goodReserve
|
|
294
|
-
.connect(staker)
|
|
295
|
-
.mintUBI(1, ethers.utils.parseEther("1"), cDAI.address);
|
|
237
|
+
it("should not mint UBI if the caller is not the fund manager", async () => {
|
|
238
|
+
let tx = goodReserve.connect(staker).mintUBI(0, 0, cDAI.address);
|
|
296
239
|
await expect(tx).to.be.revertedWith("GoodReserve: not a minter");
|
|
297
240
|
});
|
|
298
241
|
|
|
299
|
-
// it("should set block interval by avatar", async () => {
|
|
300
|
-
// let encodedCall = web3.eth.abi.encodeFunctionCall(
|
|
301
|
-
// {
|
|
302
|
-
// name: "setBlockInterval",
|
|
303
|
-
// type: "function",
|
|
304
|
-
// inputs: [
|
|
305
|
-
// {
|
|
306
|
-
// type: "uint256",
|
|
307
|
-
// name: "_blockInterval"
|
|
308
|
-
// }
|
|
309
|
-
// ]
|
|
310
|
-
// },
|
|
311
|
-
// [100]
|
|
312
|
-
// );
|
|
313
|
-
// await controller.genericCall(
|
|
314
|
-
// goodReserve.address,
|
|
315
|
-
// encodedCall,
|
|
316
|
-
// avatar,
|
|
317
|
-
// 0
|
|
318
|
-
// );
|
|
319
|
-
// const newBI = await goodReserve.blockInterval();
|
|
320
|
-
// expect(newBI.toString()).to.be.equal("100");
|
|
321
|
-
// });
|
|
322
|
-
|
|
323
|
-
// it("should not mint UBI if not in the interval", async () => {
|
|
324
|
-
// const gdBalanceFundBefore = await goodDollar.balanceOf(founder.address);
|
|
325
|
-
// const gdBalanceAvatarBefore = await goodDollar.balanceOf(avatar);
|
|
326
|
-
// const error = await goodReserve
|
|
327
|
-
// .mintInterestAndUBI(
|
|
328
|
-
// cDAI.address,
|
|
329
|
-
// ethers.utils.parseUnits("10000", "gwei"),
|
|
330
|
-
// "10000"
|
|
331
|
-
// )
|
|
332
|
-
// .catch(e => e);
|
|
333
|
-
// const gdBalanceFundAfter = await goodDollar.balanceOf(founder.address);
|
|
334
|
-
// const gdBalanceAvatarAfter = await goodDollar.balanceOf(avatar);
|
|
335
|
-
// expect(error.message).to.have.string("wait for the next interval");
|
|
336
|
-
// expect(gdBalanceFundAfter).to.be.equal(gdBalanceFundBefore);
|
|
337
|
-
// expect(gdBalanceAvatarAfter).to.be.equal(gdBalanceAvatarBefore);
|
|
338
|
-
// });
|
|
339
|
-
|
|
340
242
|
it("should be able to buy gd with DAI", async () => {
|
|
341
243
|
let daiAmount = ethers.utils.parseEther("100");
|
|
342
244
|
const cdaiRateStored = await cDAI.exchangeRateStored();
|
|
@@ -1086,8 +988,8 @@ describe("GoodReserve - staking with cDAI mocks", () => {
|
|
|
1086
988
|
(1 - amount.toNumber() / parseInt(supply.toString())) **
|
|
1087
989
|
(1000000 / reserveToken.reserveRatio));
|
|
1088
990
|
|
|
1089
|
-
|
|
1090
|
-
expected = Math.floor(0.8 * expected);
|
|
991
|
+
expected = Math.ceil((0.8 * expected) / 100) * 100; //deduct 20% contribution, allow 5 points precission mismatch (due to bancor pow estimation?), match solidity no floating point
|
|
992
|
+
//expected = Math.floor(0.8 * expected);
|
|
1091
993
|
expect(cDAIBalanceAfter.sub(cDAIBalanceBefore)).to.be.equal(expected);
|
|
1092
994
|
expect(cDAIBalanceReserveBefore.sub(cDAIBalanceReserveAfter)).to.be.equal(
|
|
1093
995
|
expected
|
|
@@ -417,6 +417,14 @@ describe("ProtocolUpgrade - Upgrade old protocol contracts to new ones", () => {
|
|
|
417
417
|
);
|
|
418
418
|
});
|
|
419
419
|
|
|
420
|
+
it("should initialize reputation address", async () => {
|
|
421
|
+
const cvm = await ethers.getContractAt(
|
|
422
|
+
"CompoundVotingMachine",
|
|
423
|
+
deployment["test-mainnet"].CompoundVotingMachine
|
|
424
|
+
);
|
|
425
|
+
expect(await cvm.rep()).to.equal(deployment["test-mainnet"].GReputation);
|
|
426
|
+
});
|
|
427
|
+
|
|
420
428
|
it("it should set fuse nameservice variables properly", async () => {
|
|
421
429
|
const fse = require("fs-extra");
|
|
422
430
|
const deployment = await fse.readJson("releases/deployment.json");
|