@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
|
@@ -11,7 +11,7 @@ import { network, ethers, upgrades, run } from "hardhat";
|
|
|
11
11
|
import { networkNames } from "@openzeppelin/upgrades-core";
|
|
12
12
|
import { isFunction, get, omitBy } from "lodash";
|
|
13
13
|
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
14
|
-
|
|
14
|
+
import pressAnyKey from "press-any-key";
|
|
15
15
|
import {
|
|
16
16
|
AaveStakingFactory,
|
|
17
17
|
CompoundStakingFactory,
|
|
@@ -74,12 +74,18 @@ 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,
|
|
81
81
|
gasPrice: ethers.utils.parseUnits("1", "gwei")
|
|
82
82
|
};
|
|
83
|
+
} else if (network.config.chainId === 3 || network.config.chainId === 42) {
|
|
84
|
+
GAS_SETTINGS = {
|
|
85
|
+
maxPriorityFeePerGas: ethers.utils.parseUnits("1", "gwei"),
|
|
86
|
+
maxFeePerGas: ethers.utils.parseUnits("10", "gwei"),
|
|
87
|
+
gasLimit: 6000000
|
|
88
|
+
};
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
const isBackendTest = networkName.startsWith("dapptest");
|
|
@@ -108,6 +114,10 @@ export const main = async (
|
|
|
108
114
|
|
|
109
115
|
const founders = await getFounders(networkName);
|
|
110
116
|
|
|
117
|
+
console.log(
|
|
118
|
+
`root: ${root.address} founders: ${founders.map(_ => _.address)}`
|
|
119
|
+
);
|
|
120
|
+
|
|
111
121
|
const compoundTokens = [
|
|
112
122
|
{
|
|
113
123
|
name: "cdai",
|
|
@@ -216,7 +226,8 @@ export const main = async (
|
|
|
216
226
|
args: [
|
|
217
227
|
() => get(release, "NameService", newdao.NameService),
|
|
218
228
|
protocolSettings.governance.proposalVotingPeriod,
|
|
219
|
-
protocolSettings.governance.guardian || root.address
|
|
229
|
+
protocolSettings.governance.guardian || root.address,
|
|
230
|
+
() => get(release, "GReputation", newdao.GReputation)
|
|
220
231
|
]
|
|
221
232
|
},
|
|
222
233
|
{
|
|
@@ -614,7 +625,7 @@ export const main = async (
|
|
|
614
625
|
dao.Reserve,
|
|
615
626
|
dao.MarketMaker,
|
|
616
627
|
dao.FundManager,
|
|
617
|
-
|
|
628
|
+
release.COMP
|
|
618
629
|
]
|
|
619
630
|
});
|
|
620
631
|
tx = await upgrade.upgradeReserve(
|
|
@@ -622,7 +633,8 @@ export const main = async (
|
|
|
622
633
|
dao.Reserve,
|
|
623
634
|
dao.MarketMaker,
|
|
624
635
|
dao.FundManager,
|
|
625
|
-
|
|
636
|
+
release.COMP,
|
|
637
|
+
GAS_SETTINGS
|
|
626
638
|
);
|
|
627
639
|
await countTotalGas(tx, "call upgrade reserve");
|
|
628
640
|
console.log("upgrading donationstaking...", {
|
|
@@ -636,7 +648,8 @@ export const main = async (
|
|
|
636
648
|
release.NameService,
|
|
637
649
|
dao.DonationsStaking, //old
|
|
638
650
|
release.DonationsStaking, //new
|
|
639
|
-
dao.DAIStaking
|
|
651
|
+
dao.DAIStaking,
|
|
652
|
+
GAS_SETTINGS
|
|
640
653
|
);
|
|
641
654
|
await countTotalGas(tx, "call upgrade donations");
|
|
642
655
|
console.log("Donation staking upgraded");
|
|
@@ -666,31 +679,34 @@ export const main = async (
|
|
|
666
679
|
)) as unknown as ProtocolUpgradeFuse;
|
|
667
680
|
|
|
668
681
|
console.log("performing protocol v2 upgrade on Fuse...", { release, dao });
|
|
669
|
-
await upgrade
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
[
|
|
680
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("REPUTATION")),
|
|
681
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("BRIDGE_CONTRACT")),
|
|
682
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("UBISCHEME")),
|
|
683
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_STAKING")),
|
|
684
|
-
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_CLAIMERS"))
|
|
685
|
-
],
|
|
686
|
-
[
|
|
687
|
-
release.GReputation,
|
|
688
|
-
dao.HomeBridge,
|
|
682
|
+
await upgrade
|
|
683
|
+
.upgrade(
|
|
684
|
+
release.NameService,
|
|
685
|
+
//old contracts
|
|
686
|
+
[
|
|
687
|
+
dao.SchemeRegistrar || ethers.constants.AddressZero,
|
|
688
|
+
dao.UpgradeScheme,
|
|
689
|
+
dao.UBIScheme,
|
|
690
|
+
dao.FirstClaimPool
|
|
691
|
+
],
|
|
689
692
|
release.UBIScheme,
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
693
|
+
[
|
|
694
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("REPUTATION")),
|
|
695
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("BRIDGE_CONTRACT")),
|
|
696
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("UBISCHEME")),
|
|
697
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_STAKING")),
|
|
698
|
+
ethers.utils.keccak256(ethers.utils.toUtf8Bytes("GDAO_CLAIMERS"))
|
|
699
|
+
],
|
|
700
|
+
[
|
|
701
|
+
release.GReputation,
|
|
702
|
+
dao.HomeBridge,
|
|
703
|
+
release.UBIScheme,
|
|
704
|
+
release.GovernanceStaking,
|
|
705
|
+
release.ClaimersDistribution
|
|
706
|
+
],
|
|
707
|
+
GAS_SETTINGS
|
|
708
|
+
)
|
|
709
|
+
.then(_ => countTotalGas(_, "fuse basic upgrade"));
|
|
694
710
|
|
|
695
711
|
if (isProduction || isBackendTest) {
|
|
696
712
|
console.log(
|
|
@@ -702,7 +718,8 @@ export const main = async (
|
|
|
702
718
|
await upgrade.upgradeGovernance(
|
|
703
719
|
dao.SchemeRegistrar,
|
|
704
720
|
dao.UpgradeScheme,
|
|
705
|
-
release.CompoundVotingMachine
|
|
721
|
+
release.CompoundVotingMachine,
|
|
722
|
+
GAS_SETTINGS
|
|
706
723
|
);
|
|
707
724
|
}
|
|
708
725
|
};
|
|
@@ -752,10 +769,13 @@ export const main = async (
|
|
|
752
769
|
founders
|
|
753
770
|
});
|
|
754
771
|
await Promise.all(
|
|
755
|
-
founders.slice(
|
|
772
|
+
founders.slice(1).map(f =>
|
|
756
773
|
absoluteVote
|
|
757
774
|
.connect(f)
|
|
758
|
-
.vote(proposalId, 1, 0, f.address, {
|
|
775
|
+
.vote(proposalId, 1, 0, f.address, {
|
|
776
|
+
...GAS_SETTINGS,
|
|
777
|
+
gasLimit: 300000
|
|
778
|
+
})
|
|
759
779
|
.then(_ => countTotalGas(_.wait(), "vote"))
|
|
760
780
|
.catch(e => console.log("founder vote failed:", f.address, e.message))
|
|
761
781
|
)
|
|
@@ -941,8 +961,10 @@ export const main = async (
|
|
|
941
961
|
await deployContracts();
|
|
942
962
|
|
|
943
963
|
if (isPerformUpgrade) {
|
|
944
|
-
console.log("deployed contracts", { totalGas });
|
|
964
|
+
console.log("deployed contracts", { totalGas, dao, release });
|
|
965
|
+
if (isTest === false) await pressAnyKey();
|
|
945
966
|
await voteProtocolUpgrade(release);
|
|
967
|
+
if (isTest === false) await pressAnyKey();
|
|
946
968
|
console.log("voted contracts", { totalGas });
|
|
947
969
|
isMainnet && (await performUpgrade(release));
|
|
948
970
|
!isMainnet && (await performUpgradeFuse(release));
|
|
@@ -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");
|
package/yarn.lock
CHANGED
|
@@ -13647,6 +13647,13 @@ preserve@^0.2.0:
|
|
|
13647
13647
|
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
|
|
13648
13648
|
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
|
|
13649
13649
|
|
|
13650
|
+
press-any-key@^0.1.1:
|
|
13651
|
+
version "0.1.1"
|
|
13652
|
+
resolved "https://registry.yarnpkg.com/press-any-key/-/press-any-key-0.1.1.tgz#97cf184ae84f25858fe3d83ab824e9d1dce2cde8"
|
|
13653
|
+
integrity sha512-TR722R9UpZjvOtyVcmS7hx2/1KzKIyeizIqHJ7sRcfXvCDzeSknS3UNLhmQMN7075Jd9gGUBdq98sHw2eqb86Q==
|
|
13654
|
+
dependencies:
|
|
13655
|
+
single-line-log "^1.1.2"
|
|
13656
|
+
|
|
13650
13657
|
prettier@^1.14.3:
|
|
13651
13658
|
version "1.19.1"
|
|
13652
13659
|
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
|
|
@@ -15022,6 +15029,13 @@ simple-get@^2.7.0:
|
|
|
15022
15029
|
once "^1.3.1"
|
|
15023
15030
|
simple-concat "^1.0.0"
|
|
15024
15031
|
|
|
15032
|
+
single-line-log@^1.1.2:
|
|
15033
|
+
version "1.1.2"
|
|
15034
|
+
resolved "https://registry.yarnpkg.com/single-line-log/-/single-line-log-1.1.2.tgz#c2f83f273a3e1a16edb0995661da0ed5ef033364"
|
|
15035
|
+
integrity sha1-wvg/Jzo+GhbtsJlWYdoO1e8DM2Q=
|
|
15036
|
+
dependencies:
|
|
15037
|
+
string-width "^1.0.1"
|
|
15038
|
+
|
|
15025
15039
|
slash@^1.0.0:
|
|
15026
15040
|
version "1.0.0"
|
|
15027
15041
|
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
|