Skip to content

Commit 23e3e13

Browse files
authored
Merge pull request #62 from pooltogether/pool-2501-remove-manager-role-from
fix(PrizeDistributionFactoryV2): remove manager role
2 parents 1b6ed15 + 647f66e commit 23e3e13

4 files changed

+50
-40
lines changed

contracts/PrizeDistributionFactoryV2.sol

+7-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "@pooltogether/v4-core/contracts/interfaces/ITicket.sol";
55
import "@pooltogether/v4-core/contracts/interfaces/IPrizeDistributionBuffer.sol";
66
import "@pooltogether/v4-core/contracts/interfaces/IPrizeDistributionSource.sol";
77
import "@pooltogether/v4-core/contracts/libraries/ExtendedSafeCastLib.sol";
8-
import "@pooltogether/owner-manager-contracts/contracts/Manageable.sol";
8+
import "@pooltogether/owner-manager-contracts/contracts/Ownable.sol";
99

1010
import "./interfaces/IPrizeTierHistoryV2.sol";
1111

@@ -16,7 +16,7 @@ import "./interfaces/IPrizeTierHistoryV2.sol";
1616
* to compute the correct prize distribution. It automatically sets the cardinality based on
1717
* the DPR (Draw Percentage Rate), prize, minPickCost and the total ticket supply.
1818
*/
19-
contract PrizeDistributionFactoryV2 is Manageable {
19+
contract PrizeDistributionFactoryV2 is Ownable {
2020
using ExtendedSafeCastLib for uint256;
2121

2222
/* ============ Events ============ */
@@ -96,14 +96,13 @@ contract PrizeDistributionFactoryV2 is Manageable {
9696
/* ============ External Functions ============ */
9797

9898
/**
99-
* @notice Allows the owner or manager to push a new prize distribution onto the buffer.
100-
* The PrizeTier and Draw for the given draw id will be pulled in, and the prize distribution will be computed.
99+
* @notice Push a new prize distribution onto the PrizeDistributionBuffer.
100+
* PrizeTier and Draw for the given draw id will be pulled in and the prize distribution will be computed.
101101
* @param _drawId The draw id to compute for
102102
* @return The resulting Prize Distribution
103103
*/
104104
function pushPrizeDistribution(uint32 _drawId)
105105
external
106-
onlyManagerOrOwner
107106
returns (IPrizeDistributionBuffer.PrizeDistribution memory)
108107
{
109108
IPrizeDistributionBuffer.PrizeDistribution
@@ -117,8 +116,8 @@ contract PrizeDistributionFactoryV2 is Manageable {
117116
}
118117

119118
/**
120-
* @notice Allows the owner or manager to override an existing prize distribution in the buffer.
121-
* The PrizeTier and Draw for the given draw id will be pulled in, and the prize distribution will be computed.
119+
* @notice Allows the owner to override an existing prize distribution in the buffer.
120+
* PrizeTier and Draw for the given draw id will be pulled in and the prize distribution will be computed.
122121
* @param _drawId The draw id to compute for
123122
* @return The resulting Prize Distribution
124123
*/
@@ -229,7 +228,7 @@ contract PrizeDistributionFactoryV2 is Manageable {
229228
* maxPicks = totalSupply / minPickCost
230229
* targetPicks = maxPicks / odds = (totalSupply / minPickCost) / ((dpr * totalSupply) / prize)
231230
* targetPicks = (1 / minPickCost) / ((dpr * 1) / prize) = prize / (dpr * minPickCost)
232-
*/
231+
*/
233232
uint256 _targetPicks = (_prize * RATE_NORMALIZATION) / (_dpr * _minPickCost);
234233

235234
do {

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pooltogether/v4-periphery",
3-
"version": "1.3.0-beta.1",
3+
"version": "1.3.0",
44
"description": "PoolTogether V4 Periphery",
55
"main": "index.js",
66
"license": "GPL-3.0",
@@ -28,15 +28,15 @@
2828
},
2929
"peerDependencies": {
3030
"@openzeppelin/contracts": "4.7.3",
31-
"@pooltogether/v4-core": "1.3.0-beta.1"
31+
"@pooltogether/v4-core": "1.3.0"
3232
},
3333
"devDependencies": {
3434
"@nomiclabs/hardhat-ethers": "2.2.0",
3535
"@nomiclabs/hardhat-etherscan": "3.1.1",
3636
"@nomiclabs/hardhat-waffle": "2.0.3",
3737
"@openzeppelin/contracts": "4.7.3",
3838
"@pooltogether/aave-yield-source": "1.2.1",
39-
"@pooltogether/v4-core": "1.3.0-beta.1",
39+
"@pooltogether/v4-core": "1.3.0",
4040
"@studydefi/money-legos": "2.4.2",
4141
"@typechain/ethers-v5": "10.1.0",
4242
"@typechain/hardhat": "6.1.3",

test/PrizeDistributionFactoryV2.test.ts

-18
Original file line numberDiff line numberDiff line change
@@ -447,24 +447,6 @@ describe('PrizeDistributionFactoryV2', () => {
447447
.to.emit(prizeDistributionFactory, 'PrizeDistributionPushed')
448448
.withArgs(1);
449449
});
450-
451-
it('should push the prize distribution if manager', async () => {
452-
await prizeDistributionFactory.transferOwnership(wallet2.address);
453-
await prizeDistributionFactory.connect(wallet2).claimOwnership();
454-
455-
await setupMocks();
456-
await prizeDistributionBuffer.mock.pushPrizeDistribution.returns(true);
457-
458-
await expect(prizeDistributionFactory.connect(wallet2).pushPrizeDistribution(1))
459-
.to.emit(prizeDistributionFactory, 'PrizeDistributionPushed')
460-
.withArgs(1);
461-
});
462-
463-
it('should fail to push if not manager or owner', async () => {
464-
await expect(
465-
prizeDistributionFactory.connect(wallet2).pushPrizeDistribution(1),
466-
).to.be.revertedWith('Manageable/caller-not-manager-or-owner');
467-
});
468450
});
469451

470452
describe('setPrizeDistribution()', () => {

yarn.lock

+40-11
Original file line numberDiff line numberDiff line change
@@ -1251,28 +1251,38 @@
12511251
resolved "https://registry.yarnpkg.com/@pooltogether/owner-manager-contracts/-/owner-manager-contracts-1.1.0.tgz#776f1b96a81cec05bfe6575583b4b239a4038fa9"
12521252
integrity sha512-1PqkzSE/AJ4luGhpEfaN9YnHI7mbe63zy92iXgNwHJ4XDqerm+hfJsggrXK7BUyUkAIFLFf8+Ol0TntZAUTedw==
12531253

1254-
"@pooltogether/[email protected]":
1255-
version "1.4.0"
1256-
resolved "https://registry.yarnpkg.com/@pooltogether/pooltogether-rng-contracts/-/pooltogether-rng-contracts-1.4.0.tgz#310b9667a1123cfcce718aa6d8eba7c434a53c75"
1257-
integrity sha512-dNgDpDsCMxUxaz8u6OfpjSBtMOdcp8QkLC3cwJ6E++4ux0qY2ON+ZqJEHIC3q4ZVJ4Xf6FikMJF0a8SVNtl8Zw==
1254+
"@pooltogether/[email protected]":
1255+
version "1.5.1"
1256+
resolved "https://registry.yarnpkg.com/@pooltogether/pooltogether-rng-contracts/-/pooltogether-rng-contracts-1.5.1.tgz#cc2fd10d1b7a61be00d5b7136f94ff3c74cc6d33"
1257+
integrity sha512-GEfsPcdKD8Hpa5F4Z16rgkKIWP93cQYEwN5aoYCOpNUaiHB5kdI1s+tNECGD6ILDWfNpQq0MP6gfYoRV9DV0Ng==
1258+
dependencies:
1259+
"@pooltogether/owner-manager-contracts" "1.1.0"
12581260

1259-
"@pooltogether/[email protected]-beta.1":
1260-
version "1.3.0-beta.1"
1261-
resolved "https://registry.yarnpkg.com/@pooltogether/v4-core/-/v4-core-1.3.0-beta.1.tgz#5fbb6123753b006b255f56c5a54174963c4d4146"
1262-
integrity sha512-w4jqm5Oq9Pj3hOuiXexTvI5Et04O4CJuSRXNBXz+YJ1oSylSbOzoVU1DuU0DNaHtMINFjTsyZ8AOh1+NAiTURg==
1261+
"@pooltogether/[email protected]":
1262+
version "1.3.0"
1263+
resolved "https://registry.yarnpkg.com/@pooltogether/v4-core/-/v4-core-1.3.0.tgz#6d74a610a2ee0c59e7138ec66d97beade684d700"
1264+
integrity sha512-fjtu411I+YHEfF1XfUb7Zo2XSUCzkBbrtsS/HZsX8fKYVGpO3n10QE7YN9oA+2sg5dPK19XpSuYfole97ChW9w==
12631265
dependencies:
12641266
"@openzeppelin/contracts" "4.3.1"
12651267
"@pooltogether/fixed-point" "1.0.0"
12661268
"@pooltogether/owner-manager-contracts" "1.1.0"
1267-
"@pooltogether/pooltogether-rng-contracts" "1.4.0"
1268-
"@pooltogether/yield-source-interface" "1.3.0"
1269+
"@pooltogether/pooltogether-rng-contracts" "1.5.1"
1270+
"@pooltogether/yield-source-interface" "1.4.0"
12691271
deploy-eip-1820 "1.0.0"
12701272

12711273
"@pooltogether/[email protected]":
12721274
version "1.3.0"
12731275
resolved "https://registry.yarnpkg.com/@pooltogether/yield-source-interface/-/yield-source-interface-1.3.0.tgz#93e9c12bb2d62e2215bb2f9c9d391a092e6eb6d5"
12741276
integrity sha512-HEo4iB/emXz/QZ0J1ilWVtBk0NFAmIQe80xG3hbSfLI/SnAMIHixGq/TSw3IWu4RGEf2ttoMc44Bxd+IdbZisA==
12751277

1278+
"@pooltogether/[email protected]":
1279+
version "1.4.0"
1280+
resolved "https://registry.yarnpkg.com/@pooltogether/yield-source-interface/-/yield-source-interface-1.4.0.tgz#50cddcc7bb4609e673329b826d5c47a6a774f766"
1281+
integrity sha512-Xy7LeS3Bk5/fx0HxH6YgTveo3YZGN7wBo2OkMG2MV0HtaC8l7aXMEyw6PGXFjERvqtYsyaTa6nQczzNRUt0PfQ==
1282+
dependencies:
1283+
hardhat-deploy "^0.11.4"
1284+
hardhat-deploy-ethers "^0.3.0-beta.13"
1285+
12761286
"@resolver-engine/core@^0.3.3":
12771287
version "0.3.3"
12781288
resolved "https://registry.yarnpkg.com/@resolver-engine/core/-/core-0.3.3.tgz#590f77d85d45bc7ecc4e06c654f41345db6ca967"
@@ -5605,7 +5615,7 @@ [email protected]:
56055615
resolved "https://registry.yarnpkg.com/hardhat-dependency-compiler/-/hardhat-dependency-compiler-1.1.3.tgz#1e49e23f68878bd713f860c66648a711bc4a4a79"
56065616
integrity sha512-bCDqsOxGST6WkbMvj4lPchYWidNSSBm5CFnkyAex1T11cGmr9otZTGl81W6f9pmrtBXbKCvr3OSuNJ6Q394sAw==
56075617

5608-
5618+
[email protected], hardhat-deploy-ethers@^0.3.0-beta.13:
56095619
version "0.3.0-beta.13"
56105620
resolved "https://registry.yarnpkg.com/hardhat-deploy-ethers/-/hardhat-deploy-ethers-0.3.0-beta.13.tgz#b96086ff768ddf69928984d5eb0a8d78cfca9366"
56115621
integrity sha512-PdWVcKB9coqWV1L7JTpfXRCI91Cgwsm7KLmBcwZ8f0COSm1xtABHZTyz3fvF6p42cTnz1VM0QnfDvMFlIRkSNw==
@@ -5629,6 +5639,25 @@ [email protected]:
56295639
qs "^6.9.4"
56305640
zksync-web3 "^0.8.1"
56315641

5642+
hardhat-deploy@^0.11.4:
5643+
version "0.11.22"
5644+
resolved "https://registry.yarnpkg.com/hardhat-deploy/-/hardhat-deploy-0.11.22.tgz#9799c0266a0fc40c84690de54760f1b4dae5e487"
5645+
integrity sha512-ZhHVNB7Jo2l8Is+KIAk9F8Q3d7pptyiX+nsNbIFXztCz81kaP+6kxNODRBqRCy7SOD3It4+iKCL6tWsPAA/jVQ==
5646+
dependencies:
5647+
"@types/qs" "^6.9.7"
5648+
axios "^0.21.1"
5649+
chalk "^4.1.2"
5650+
chokidar "^3.5.2"
5651+
debug "^4.3.2"
5652+
enquirer "^2.3.6"
5653+
ethers "^5.5.3"
5654+
form-data "^4.0.0"
5655+
fs-extra "^10.0.0"
5656+
match-all "^1.2.6"
5657+
murmur-128 "^0.2.1"
5658+
qs "^6.9.4"
5659+
zksync-web3 "^0.8.1"
5660+
56325661
56335662
version "1.0.9"
56345663
resolved "https://registry.yarnpkg.com/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.9.tgz#9a2afb354bc3b6346aab55b1c02ca556d0e16450"

0 commit comments

Comments
 (0)