@gooddollar/goodprotocol 1.0.13-beta.1 → 1.0.14
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/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/governance/StakersDistribution.sol/StakersDistribution.json +2 -2
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.json +2 -2
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.json +2 -2
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.json +2 -2
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/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/ExchangeHelper.sol/ExchangeHelper.json +2 -2
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.json +7 -2
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.json +15 -2
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.json +6 -6
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.json +2 -2
- package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.json +2 -2
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.json +2 -2
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.json +2 -2
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.json +2 -2
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.json +2 -2
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.json +2 -2
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.json +60 -2
- 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/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/ProtocolUpgrade.sol/ProtocolUpgrade.json +2 -2
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +4 -0
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.json +83 -0
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +4 -0
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.json +121 -0
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.json +2 -2
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.json +2 -2
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/contracts/reserve/GoodMarketMaker.sol +3 -2
- package/contracts/reserve/GoodReserveCDai.sol +25 -21
- package/contracts/staking/DonationsStaking.sol +1 -0
- package/contracts/ubi/UBIScheme.sol +32 -4
- package/contracts/utils/ProtocolUpgrade.sol +3 -2
- package/contracts/utils/ProtocolUpgradeFuseRecover.sol +116 -0
- package/contracts/utils/ProtocolUpgradeRecover.sol +198 -0
- package/contracts/utils/ProxyFactory1967.sol +1 -0
- package/package.json +1 -1
- package/releases/deployment.json +67 -2
- package/scripts/deployFullDAO.ts +2 -1
- package/scripts/upgradeToV2/upgradeToV2Recover.ts +947 -0
- package/test/helpers.ts +1 -1
- package/test/reserve/GoodMarketMaker.test.ts +6 -5
- package/test/staking/DonationsStaking.test.ts +14 -4
- package/test/ubi/UBIScheme.e2e.test.ts +1 -1
- package/test/ubi/UBIScheme.test.ts +4 -4
- package/test/utils/ProxyFactory.test.ts +31 -0
package/test/helpers.ts
CHANGED
|
@@ -225,7 +225,7 @@ export const createDAO = async () => {
|
|
|
225
225
|
const setReserveToken = async (token, gdReserve, tokenReserve, RR) => {
|
|
226
226
|
const encoded = marketMaker.interface.encodeFunctionData(
|
|
227
227
|
"initializeToken",
|
|
228
|
-
[token, gdReserve, tokenReserve, RR]
|
|
228
|
+
[token, gdReserve, tokenReserve, RR, 0]
|
|
229
229
|
);
|
|
230
230
|
|
|
231
231
|
await ictrl.genericCall(marketMaker.address, encoded, Avatar.address, 0);
|
|
@@ -55,7 +55,7 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
55
55
|
marketMaker: mm,
|
|
56
56
|
setSchemes,
|
|
57
57
|
setReserveToken,
|
|
58
|
-
setDAOAddress
|
|
58
|
+
setDAOAddress
|
|
59
59
|
} = await createDAO();
|
|
60
60
|
avatar = av;
|
|
61
61
|
marketMaker = mm.connect(fakeReserve);
|
|
@@ -144,7 +144,7 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
144
144
|
expect(
|
|
145
145
|
await marketMaker
|
|
146
146
|
.reserveTokens(cdai)
|
|
147
|
-
.then(
|
|
147
|
+
.then(_ => _["reserveRatio"].toString())
|
|
148
148
|
).to.be.equal("994511"); // 998777 * 0.999388834642296000000000000^7
|
|
149
149
|
});
|
|
150
150
|
|
|
@@ -165,13 +165,14 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
165
165
|
const marketMaker1 = await upgrades.deployProxy(MM, [
|
|
166
166
|
await marketMaker.nameService(),
|
|
167
167
|
999388834642296,
|
|
168
|
-
1e15
|
|
168
|
+
1e15
|
|
169
169
|
]);
|
|
170
170
|
await marketMaker1.initializeToken(
|
|
171
171
|
dai,
|
|
172
172
|
"100", //1gd
|
|
173
173
|
ethers.utils.parseEther("0.0001"),
|
|
174
|
-
"800000" //80% rr
|
|
174
|
+
"800000", //80% rr,
|
|
175
|
+
0
|
|
175
176
|
);
|
|
176
177
|
const res = marketMaker1.sellWithContribution(
|
|
177
178
|
dai,
|
|
@@ -188,7 +189,7 @@ describe("GoodMarketMaker - calculate gd value at reserve", () => {
|
|
|
188
189
|
await marketMaker.mintInterest(cdai, BN.from(1e8));
|
|
189
190
|
expect(
|
|
190
191
|
Math.floor(
|
|
191
|
-
(await marketMaker.currentPrice(cdai).then(
|
|
192
|
+
(await marketMaker.currentPrice(cdai).then(_ => _.toNumber())) / 100
|
|
192
193
|
).toString()
|
|
193
194
|
).to.be.equal(Math.floor(priceBefore.toNumber() / 100).toString());
|
|
194
195
|
});
|
|
@@ -357,10 +357,20 @@ describe("DonationsStaking - DonationStaking contract that receives funds in ETH
|
|
|
357
357
|
return contract;
|
|
358
358
|
});
|
|
359
359
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
360
|
+
//not avatar
|
|
361
|
+
await expect(
|
|
362
|
+
donationsStaking.setStakingContract(simpleStaking.address, [
|
|
363
|
+
NULL_ADDRESS,
|
|
364
|
+
bat.address
|
|
365
|
+
])
|
|
366
|
+
).to.be.reverted;
|
|
367
|
+
|
|
368
|
+
let encodedData = donationsStaking.interface.encodeFunctionData(
|
|
369
|
+
"setStakingContract",
|
|
370
|
+
[simpleStaking.address, [NULL_ADDRESS, bat.address]]
|
|
371
|
+
);
|
|
372
|
+
await genericCall(donationsStaking.address, encodedData);
|
|
373
|
+
|
|
364
374
|
const avatarDaiBalanceAfterSet = await dai.balanceOf(avatar);
|
|
365
375
|
const stakingAmountAfterSet = await goodCompoundStaking.balanceOf(
|
|
366
376
|
donationsStaking.address
|
|
@@ -226,7 +226,7 @@ describe("UBIScheme - network e2e tests", () => {
|
|
|
226
226
|
it("should award a new user with the award amount on first time execute claim", async () => {
|
|
227
227
|
await increaseTime(86400);
|
|
228
228
|
let claimerBalance1 = await goodDollar.balanceOf(claimer.address);
|
|
229
|
-
let ce = await ubi.connect(claimer)
|
|
229
|
+
let ce = await ubi.connect(claimer)["checkEntitlement()"]();
|
|
230
230
|
await ubi.connect(claimer).claim();
|
|
231
231
|
let claimerBalance2 = await goodDollar.balanceOf(claimer.address);
|
|
232
232
|
expect(claimerBalance2.sub(claimerBalance1).toNumber()).to.be.equal(
|
|
@@ -281,7 +281,7 @@ describe("UBIScheme", () => {
|
|
|
281
281
|
});
|
|
282
282
|
|
|
283
283
|
it("should return the reward value for entitlement user", async () => {
|
|
284
|
-
let amount = await ubi.connect(claimer4)
|
|
284
|
+
let amount = await ubi.connect(claimer4)["checkEntitlement()"]();
|
|
285
285
|
let claimAmount = await firstClaimPool.claimAmount();
|
|
286
286
|
expect(amount.toString()).to.be.equal(claimAmount.toString());
|
|
287
287
|
});
|
|
@@ -324,13 +324,13 @@ describe("UBIScheme", () => {
|
|
|
324
324
|
it("should return the daily ubi for entitlement user", async () => {
|
|
325
325
|
// claimer3 hasn't claimed during that interval so that user
|
|
326
326
|
// may have the dailyUbi
|
|
327
|
-
let amount = await ubi.connect(claimer3)
|
|
327
|
+
let amount = await ubi.connect(claimer3)["checkEntitlement()"]();
|
|
328
328
|
let dailyUbi = await ubi.dailyUbi();
|
|
329
329
|
expect(amount.toString()).to.be.equal(dailyUbi.toString());
|
|
330
330
|
});
|
|
331
331
|
it("should return 0 for entitlement if the user has already claimed for today", async () => {
|
|
332
332
|
await ubi.connect(claimer4).claim();
|
|
333
|
-
let amount = await ubi.connect(claimer4)
|
|
333
|
+
let amount = await ubi.connect(claimer4)["checkEntitlement()"]();
|
|
334
334
|
expect(amount.toString()).to.be.equal("0");
|
|
335
335
|
});
|
|
336
336
|
|
|
@@ -548,7 +548,7 @@ describe("UBIScheme", () => {
|
|
|
548
548
|
await increaseTime(ONE_DAY);
|
|
549
549
|
await ubi.connect(claimer1).claim();
|
|
550
550
|
await increaseTime(ONE_DAY);
|
|
551
|
-
let amount = await ubi.connect(claimer1)
|
|
551
|
+
let amount = await ubi.connect(claimer1)["checkEntitlement()"]();
|
|
552
552
|
let balance2 = await goodDollar.balanceOf(ubi.address);
|
|
553
553
|
let estimated = await ubi.estimateNextDailyUBI();
|
|
554
554
|
expect(amount).to.be.equal(estimated);
|
|
@@ -99,4 +99,35 @@ describe("proxyfactory", () => {
|
|
|
99
99
|
proxy = await ethers.getContractAt("UpgradableMock", proxyAddr);
|
|
100
100
|
expect(await proxy.owner()).to.eq(signers[2].address);
|
|
101
101
|
});
|
|
102
|
+
|
|
103
|
+
it("should not be able to re-initialize proxy", async () => {
|
|
104
|
+
const c1 = await (
|
|
105
|
+
await ethers.getContractFactory("UpgradableMock")
|
|
106
|
+
).deploy();
|
|
107
|
+
const encoded = c1.interface.encodeFunctionData("initialize", [
|
|
108
|
+
signers[2].address
|
|
109
|
+
]);
|
|
110
|
+
|
|
111
|
+
const deployTX = await (
|
|
112
|
+
await factory.deployProxy(4, c1.address, encoded)
|
|
113
|
+
).wait();
|
|
114
|
+
const proxyAddr = deployTX.events.find(_ => _.event === "ProxyCreated").args
|
|
115
|
+
.proxy;
|
|
116
|
+
let proxy = await ethers.getContractAt("ERC1967Proxy", proxyAddr);
|
|
117
|
+
|
|
118
|
+
const c2 = await (
|
|
119
|
+
await ethers.getContractFactory("UpgradableMock")
|
|
120
|
+
).deploy();
|
|
121
|
+
|
|
122
|
+
const encoded2 = c1.interface.encodeFunctionData("initialize", [
|
|
123
|
+
signers[3].address
|
|
124
|
+
]);
|
|
125
|
+
|
|
126
|
+
await expect(
|
|
127
|
+
proxy["initialize(address,bytes)"](c2.address, encoded)
|
|
128
|
+
).revertedWith("initialized");
|
|
129
|
+
|
|
130
|
+
let orgproxy = await ethers.getContractAt("UpgradableMock", proxyAddr);
|
|
131
|
+
expect(await orgproxy.owner()).to.eq(signers[2].address);
|
|
132
|
+
});
|
|
102
133
|
});
|