Skip to content

Commit 1a49a68

Browse files
committed
feat(contracts): return clone addresses from factories on deploy
1 parent 61608da commit 1a49a68

23 files changed

+92
-44
lines changed

packages/contracts/contracts/extensions/anonAadhaar/AnonAadhaarCheckerFactory.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ contract AnonAadhaarCheckerFactory is Factory {
1414
/// @notice Deploys a new AnonAadhaarChecker clone.
1515
/// @param anonAadhaarVerifier The address of the anonAadhaar contract
1616
/// @param nullifierSeed The nullifier seed specific to the app
17-
function deploy(address anonAadhaarVerifier, uint256 nullifierSeed) public {
17+
/// @return clone The address of the newly deployed AnonAadhaarChecker clone.
18+
function deploy(address anonAadhaarVerifier, uint256 nullifierSeed) public returns (address clone) {
1819
bytes memory data = abi.encode(anonAadhaarVerifier, nullifierSeed);
19-
address clone = super._deploy(data);
20+
21+
clone = super._deploy(data);
2022

2123
AnonAadhaarChecker(clone).initialize();
2224
}

packages/contracts/contracts/extensions/anonAadhaar/AnonAadhaarPolicyFactory.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ contract AnonAadhaarPolicyFactory is Factory {
1414
/// @notice Deploys a new AnonAadhaarPolicy clone with the specified checker address.
1515
/// @dev Encodes the checker address and caller as configuration data for the clone.
1616
/// @param checkerAddress Address of the checker to use for validation.
17-
function deploy(address checkerAddress) public {
17+
/// @return clone The address of the newly deployed AnonAadhaarPolicy clone.
18+
function deploy(address checkerAddress) public returns (address clone) {
1819
bytes memory data = abi.encode(msg.sender, checkerAddress);
1920

20-
address clone = super._deploy(data);
21+
clone = super._deploy(data);
2122

2223
AnonAadhaarPolicy(clone).initialize();
2324
}

packages/contracts/contracts/extensions/eas/EASCheckerFactory.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ contract EASCheckerFactory is Factory {
1515
/// @param eas The EAS contract
1616
/// @param attester The trusted attester
1717
/// @param schema The schema UID
18-
function deploy(address eas, address attester, bytes32 schema) public {
18+
/// @return clone The address of the newly deployed EASChecker clone.
19+
function deploy(address eas, address attester, bytes32 schema) public returns (address clone) {
1920
bytes memory data = abi.encode(eas, attester, schema);
20-
address clone = super._deploy(data);
21+
22+
clone = super._deploy(data);
2123

2224
EASChecker(clone).initialize();
2325
}

packages/contracts/contracts/extensions/eas/EASPolicyFactory.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ contract EASPolicyFactory is Factory {
1414
/// @notice Deploys a new EASPolicy clone with the specified checker address.
1515
/// @dev Encodes the checker address and caller as configuration data for the clone.
1616
/// @param checkerAddress Address of the checker to use for validation.
17-
function deploy(address checkerAddress) public {
17+
/// @return clone The address of the newly deployed EASPolicy clone.
18+
function deploy(address checkerAddress) public returns (address clone) {
1819
bytes memory data = abi.encode(msg.sender, checkerAddress);
1920

20-
address clone = super._deploy(data);
21+
clone = super._deploy(data);
2122

2223
EASPolicy(clone).initialize();
2324
}

packages/contracts/contracts/extensions/erc20/ERC20CheckerFactory.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ contract ERC20CheckerFactory is Factory {
1212
constructor() Factory(address(new ERC20Checker())) {}
1313

1414
/// @notice Deploys a new ERC20VotesChecker clone.
15-
function deploy(address _token, uint256 _threshold) public {
15+
/// @return clone The address of the newly deployed ERC20VotesChecker clone.
16+
function deploy(address _token, uint256 _threshold) public returns (address clone) {
1617
bytes memory data = abi.encode(_token, _threshold);
17-
address clone = super._deploy(data);
18+
19+
clone = super._deploy(data);
1820

1921
ERC20Checker(clone).initialize();
2022
}

packages/contracts/contracts/extensions/erc20/ERC20PolicyFactory.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ contract ERC20PolicyFactory is Factory {
1414
/// @notice Deploys a new ERC20Policy clone with the specified checker address.
1515
/// @dev Encodes the checker address and caller as configuration data for the clone.
1616
/// @param _checkerAddress Address of the checker to use for validation.
17-
function deploy(address _checkerAddress) public {
17+
/// @return clone The address of the newly deployed ERC20Policy clone.
18+
function deploy(address _checkerAddress) public returns (address clone) {
1819
bytes memory data = abi.encode(msg.sender, _checkerAddress);
1920

20-
address clone = super._deploy(data);
21+
clone = super._deploy(data);
2122

2223
ERC20Policy(clone).initialize();
2324
}

packages/contracts/contracts/extensions/erc20votes/ERC20VotesCheckerFactory.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ contract ERC20VotesCheckerFactory is Factory {
1212
constructor() Factory(address(new ERC20VotesChecker())) {}
1313

1414
/// @notice Deploys a new ERC20VotesChecker clone.
15-
function deploy(address _token, uint256 _snapshotBlock, uint256 _threshold) public {
15+
/// @return clone The address of the newly deployed ERC20VotesChecker clone.
16+
function deploy(address _token, uint256 _snapshotBlock, uint256 _threshold) public returns (address clone) {
1617
bytes memory data = abi.encode(_token, _snapshotBlock, _threshold);
17-
address clone = super._deploy(data);
18+
19+
clone = super._deploy(data);
1820

1921
ERC20VotesChecker(clone).initialize();
2022
}

packages/contracts/contracts/extensions/erc20votes/ERC20VotesPolicyFactory.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ contract ERC20VotesPolicyFactory is Factory {
1414
/// @notice Deploys a new ERC20VotesPolicy clone with the specified checker address.
1515
/// @dev Encodes the checker address and caller as configuration data for the clone.
1616
/// @param _checkerAddress Address of the checker to use for validation.
17-
function deploy(address _checkerAddress) public {
17+
/// @return clone The address of the newly deployed ERC20VotesPolicy clone.
18+
function deploy(address _checkerAddress) public returns (address clone) {
1819
bytes memory data = abi.encode(msg.sender, _checkerAddress);
1920

20-
address clone = super._deploy(data);
21+
clone = super._deploy(data);
2122

2223
ERC20VotesPolicy(clone).initialize();
2324
}

packages/contracts/contracts/extensions/freeForAll/FreeForAllCheckerFactory.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ contract FreeForAllCheckerFactory is Factory {
1212
constructor() Factory(address(new FreeForAllChecker())) {}
1313

1414
/// @notice Deploys a new FreeForAllChecker clone.
15-
function deploy() public {
15+
/// @return clone The address of the newly deployed FreeForAllChecker clone.
16+
function deploy() public returns (address clone) {
1617
bytes memory data = abi.encode();
17-
address clone = super._deploy(data);
18+
19+
clone = super._deploy(data);
1820

1921
FreeForAllChecker(clone).initialize();
2022
}

packages/contracts/contracts/extensions/freeForAll/FreeForAllPolicyFactory.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ contract FreeForAllPolicyFactory is Factory {
1414
/// @notice Deploys a new FreeForAllPolicy clone with the specified checker address.
1515
/// @dev Encodes the checker address and caller as configuration data for the clone.
1616
/// @param _checkerAddress Address of the checker to use for validation.
17-
function deploy(address _checkerAddress) public {
17+
/// @return clone The address of the newly deployed FreeForAllPolicy clone.
18+
function deploy(address _checkerAddress) public returns (address clone) {
1819
bytes memory data = abi.encode(msg.sender, _checkerAddress);
1920

20-
address clone = super._deploy(data);
21+
clone = super._deploy(data);
2122

2223
FreeForAllPolicy(clone).initialize();
2324
}

0 commit comments

Comments
 (0)