Skip to content

Commit 64a7d96

Browse files
committed
RescueAirdropFactory: add loop
1 parent 932c535 commit 64a7d96

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/RescueAirdropFactory.sol

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import {BeaconProxy} from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"
88
// interfaces
99
import {IRescueAirdrop} from "@src/interfaces/IRescueAirdrop.sol";
1010

11+
/**
12+
* @title Rescue Airdrop Factory
13+
* @author @apoorvlathey
14+
*
15+
* @notice Factory that deploys RescueAirdrop beacon proxies, by iterating the nonces.
16+
*/
1117
contract RescueAirdropFactory is UpgradeableBeacon {
1218
uint256 public proxyCount;
1319

@@ -17,7 +23,13 @@ contract RescueAirdropFactory is UpgradeableBeacon {
1723
address beaconImplementation
1824
) UpgradeableBeacon(beaconImplementation) {}
1925

20-
function deployNewProxy() external onlyOwner {
26+
function deployNewProxies(uint256 count) external {
27+
for (uint256 i; i < count; i++) {
28+
_deployNewProxy();
29+
}
30+
}
31+
32+
function _deployNewProxy() internal {
2133
address proxy = address(new BeaconProxy(address(this), ""));
2234
IRescueAirdrop(proxy).__RescueAirdrop_init();
2335

test/RescueAirdrop.t.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ contract RescueAirdropTests is Test {
5757
}
5858
assertEq(address(rescueAidropFactory), NFTX_FACTORY);
5959

60-
for (uint256 i; i <= factoryNonce; ++i) {
61-
rescueAidropFactory.deployNewProxy();
62-
}
60+
rescueAidropFactory.deployNewProxies(factoryNonce + 1);
6361

6462
uint256 preMFERBalance = IERC20(MFER_AIRDROP_TOKEN).balanceOf(
6563
FACTORY_DEPLOYER

0 commit comments

Comments
 (0)