@gooddollar/goodprotocol 1.0.0 → 1.0.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/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/ubi/UBIScheme.sol/UBIScheme.json +2 -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/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/contracts/.DS_Store +0 -0
- package/contracts/ubi/UBIScheme.sol +4 -6
- package/hardhat.config.ts +7 -0
- package/package.json +2 -2
- package/releases/olddao.json +411 -1
- package/scripts/proofs/testStorageProof.ts +33 -0
- package/scripts/ubi/fish.ts +109 -0
- package/test/.DS_Store +0 -0
- package/test/ubi/UBISchemeCycle.test.ts +20 -59
- package/truffle-config.js +21 -3
|
@@ -23,14 +23,8 @@ describe("UBIScheme cycle", () => {
|
|
|
23
23
|
ubiScheme: UBIScheme;
|
|
24
24
|
|
|
25
25
|
before(async () => {
|
|
26
|
-
[
|
|
27
|
-
|
|
28
|
-
acct,
|
|
29
|
-
claimer1,
|
|
30
|
-
claimer2,
|
|
31
|
-
claimer3,
|
|
32
|
-
...signers
|
|
33
|
-
] = await ethers.getSigners();
|
|
26
|
+
[root, acct, claimer1, claimer2, claimer3, ...signers] =
|
|
27
|
+
await ethers.getSigners();
|
|
34
28
|
|
|
35
29
|
const deployedDAO = await createDAO();
|
|
36
30
|
let {
|
|
@@ -149,7 +143,7 @@ describe("UBIScheme cycle", () => {
|
|
|
149
143
|
expect(cycleEvent.args.dailyUBIPool).to.be.equal(117187); //pool balance: (1000000 - 62500 given to first claimer) divided by 8 days - only first claimer got 62500 in first cycle
|
|
150
144
|
});
|
|
151
145
|
|
|
152
|
-
it("should calculate cycle early if
|
|
146
|
+
it("should calculate cycle early if we can increase current daily pool", async () => {
|
|
153
147
|
//increase ubi pool balance
|
|
154
148
|
let encoded = goodDollar.interface.encodeFunctionData("mint", [
|
|
155
149
|
ubiScheme.address,
|
|
@@ -158,73 +152,40 @@ describe("UBIScheme cycle", () => {
|
|
|
158
152
|
await genericCall(goodDollar.address, encoded);
|
|
159
153
|
let balance = await goodDollar.balanceOf(ubiScheme.address);
|
|
160
154
|
|
|
155
|
+
const cycleLength = await ubiScheme.cycleLength();
|
|
156
|
+
const curDailyPool = await ubiScheme.dailyCyclePool();
|
|
157
|
+
console.log({ balance, cycleLength, curDailyPool });
|
|
158
|
+
|
|
159
|
+
//verify new daily pool IS gonna be larger than current
|
|
160
|
+
expect(balance.div(cycleLength)).to.be.gt(curDailyPool);
|
|
161
|
+
|
|
161
162
|
await increaseTime(ONE_DAY); //make sure
|
|
162
163
|
let transaction = await (await ubiScheme.connect(claimer1).claim()).wait();
|
|
163
|
-
|
|
164
|
-
let currentCycle = await ubiScheme.currentCycleLength();
|
|
164
|
+
|
|
165
165
|
const cycleEvent = transaction.events.find(
|
|
166
166
|
e => e.event === "UBICycleCalculated"
|
|
167
167
|
);
|
|
168
|
+
|
|
169
|
+
expect(cycleEvent).to.be.not.empty;
|
|
168
170
|
expect(cycleEvent.args.day.toNumber()).to.be.a("number");
|
|
169
171
|
expect(cycleEvent.args.pool).to.be.equal(balance);
|
|
170
172
|
expect(cycleEvent.args.cycleLength).to.be.equal(cycleLength);
|
|
171
173
|
expect(cycleEvent.args.dailyUBIPool).to.be.equal(balance.div(cycleLength));
|
|
172
174
|
});
|
|
173
175
|
|
|
174
|
-
it("should not calculate cycle early if
|
|
175
|
-
//increase ubi pool balance
|
|
176
|
-
let encoded = goodDollar.interface.encodeFunctionData("mint", [
|
|
177
|
-
ubiScheme.address,
|
|
178
|
-
100000
|
|
179
|
-
]);
|
|
180
|
-
await genericCall(goodDollar.address, encoded);
|
|
181
|
-
let balance = await goodDollar.balanceOf(ubiScheme.address);
|
|
182
|
-
const curCycleLen = await ubiScheme.currentCycleLength();
|
|
183
|
-
const curDailyUbi = await ubiScheme.dailyUbi();
|
|
184
|
-
const cycleStartingBalance = curCycleLen.mul(curDailyUbi);
|
|
185
|
-
|
|
186
|
-
//pass one condition
|
|
187
|
-
expect(balance).to.be.gt(cycleStartingBalance.mul(80).div(100));
|
|
188
|
-
|
|
189
|
-
//dont pass other condition
|
|
190
|
-
const curCycle = await ubiScheme.dailyUBIHistory(
|
|
191
|
-
await ubiScheme.currentDay()
|
|
192
|
-
);
|
|
193
|
-
expect(balance).to.be.lt(curCycle.openAmount.mul(130).div(100));
|
|
194
|
-
|
|
195
|
-
await increaseTime(ONE_DAY); //make sure
|
|
196
|
-
let transaction = await (await ubiScheme.connect(claimer1).claim()).wait();
|
|
197
|
-
const cycleEvent = transaction.events.find(
|
|
198
|
-
e => e.event === "UBICycleCalculated"
|
|
199
|
-
);
|
|
200
|
-
expect(cycleEvent).to.be.undefined;
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
it("should not calculate cycle early if only currentBalance > 1.3 * openBalance[prevDay])", async () => {
|
|
204
|
-
for (let i = 0; i < 13; i++) {
|
|
205
|
-
await increaseTime(ONE_DAY); //make sure
|
|
206
|
-
await ubiScheme.connect(claimer1).claim();
|
|
207
|
-
await ubiScheme.connect(claimer2).claim();
|
|
208
|
-
}
|
|
176
|
+
it("should not calculate cycle early if not possible to increase daily ubi pool", async () => {
|
|
209
177
|
//increase ubi pool balance
|
|
210
178
|
let encoded = goodDollar.interface.encodeFunctionData("mint", [
|
|
211
179
|
ubiScheme.address,
|
|
212
|
-
|
|
180
|
+
1000
|
|
213
181
|
]);
|
|
214
182
|
await genericCall(goodDollar.address, encoded);
|
|
215
183
|
let balance = await goodDollar.balanceOf(ubiScheme.address);
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
);
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
expect(balance).to.be.gt(curCycle.openAmount.mul(130).div(100));
|
|
222
|
-
|
|
223
|
-
//dont pass second condition
|
|
224
|
-
const curCycleLen = await ubiScheme.currentCycleLength();
|
|
225
|
-
const curDailyUbi = await ubiScheme.dailyUbi();
|
|
226
|
-
const cycleStartingBalance = curCycleLen.mul(curDailyUbi);
|
|
227
|
-
expect(balance).to.be.lt(cycleStartingBalance.mul(80).div(100));
|
|
184
|
+
const curCycleLen = await ubiScheme.cycleLength();
|
|
185
|
+
const curDailyPool = await ubiScheme.dailyCyclePool();
|
|
186
|
+
console.log({ balance, curCycleLen, curDailyPool });
|
|
187
|
+
//verify new daily pool is not gonna be larger than current
|
|
188
|
+
expect(balance.div(curCycleLen)).to.be.lt(curDailyPool);
|
|
228
189
|
|
|
229
190
|
await increaseTime(ONE_DAY); //make sure
|
|
230
191
|
let transaction = await (await ubiScheme.connect(claimer1).claim()).wait();
|
package/truffle-config.js
CHANGED
|
@@ -69,7 +69,25 @@ module.exports = {
|
|
|
69
69
|
confirmations: 2, // # of confs to wait between deployments. (default: 0)
|
|
70
70
|
timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
|
|
71
71
|
skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
|
|
72
|
+
},
|
|
73
|
+
fuse: {
|
|
74
|
+
provider: () => new HDWalletProvider(mnemonic, `https://rpc.fuse.io`),
|
|
75
|
+
network_id: 122, // Ropsten's id
|
|
76
|
+
gas: 8000000, // Ropsten has a lower block limit than mainnet
|
|
77
|
+
confirmations: 1, // # of confs to wait between deployments. (default: 0)
|
|
78
|
+
timeoutBlocks: 20, // # of blocks before a deployment times out (minimum/default: 50)
|
|
79
|
+
skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
|
|
80
|
+
},
|
|
81
|
+
fusespark: {
|
|
82
|
+
provider: () =>
|
|
83
|
+
new HDWalletProvider(mnemonic, `https://rpc.fusespark.io`),
|
|
84
|
+
network_id: 123, // Ropsten's id
|
|
85
|
+
gas: 8000000, // Ropsten has a lower block limit than mainnet
|
|
86
|
+
confirmations: 1, // # of confs to wait between deployments. (default: 0)
|
|
87
|
+
timeoutBlocks: 20, // # of blocks before a deployment times out (minimum/default: 50)
|
|
88
|
+
skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
|
|
72
89
|
}
|
|
90
|
+
|
|
73
91
|
// Useful for private networks
|
|
74
92
|
// private: {
|
|
75
93
|
// provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
|
|
@@ -86,12 +104,12 @@ module.exports = {
|
|
|
86
104
|
// Configure your compilers
|
|
87
105
|
compilers: {
|
|
88
106
|
solc: {
|
|
89
|
-
version: "0.8.
|
|
107
|
+
version: "0.8.8", // Fetch exact version from solc-bin (default: truffle's version)
|
|
90
108
|
settings: {
|
|
91
109
|
// See the solidity docs for advice about optimization and evmVersion
|
|
92
110
|
optimizer: {
|
|
93
111
|
enabled: true,
|
|
94
|
-
runs:
|
|
112
|
+
runs: 0
|
|
95
113
|
}
|
|
96
114
|
}
|
|
97
115
|
}
|
|
@@ -109,5 +127,5 @@ module.exports = {
|
|
|
109
127
|
api_keys: {
|
|
110
128
|
etherscan: process.env.ETHERSCAN_KEY
|
|
111
129
|
},
|
|
112
|
-
plugins: ["truffle-
|
|
130
|
+
plugins: ["truffle-source-verify"]
|
|
113
131
|
};
|