Skip to content

Commit 72eaec3

Browse files
committed
feat: update BuyGDClone initialization to accept custom Uniswap paths for improved flexibility
1 parent bc538fb commit 72eaec3

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

contracts/utils/BuyGDClone.sol

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,31 +84,14 @@ contract BuyGDCloneV2 is Initializable {
8484
* @notice Initializes the contract with the owner's address.
8585
* @param _owner The address of the owner of the contract.
8686
*/
87-
function initialize(address _owner)
87+
function initialize(address _owner, UniswapPath memory _cusdPath, UniswapPath memory _celoPath)
8888
external
8989
initializer {
9090
owner = _owner;
9191

9292
// Initialize hardcoded default paths
93-
address[] memory cusdTokens = new address[](4);
94-
cusdTokens[0] = CUSD;
95-
cusdTokens[1] = USDC;
96-
cusdTokens[2] = GLOUSD;
97-
cusdTokens[3] = gd;
98-
uint24[] memory cusdFees = new uint24[](3);
99-
cusdFees[0] = 100;
100-
cusdFees[1] = 100;
101-
cusdFees[2] = GD_FEE_TIER;
102-
cusdPath = UniswapPath({tokens: cusdTokens, fees: cusdFees});
103-
104-
address[] memory celoTokens = new address[](3);
105-
celoTokens[0] = celo;
106-
celoTokens[1] = GLOUSD;
107-
celoTokens[2] = gd;
108-
uint24[] memory celoFees = new uint24[](2);
109-
celoFees[0] = 500;
110-
celoFees[1] = GD_FEE_TIER;
111-
celoPath = UniswapPath({tokens: celoTokens, fees: celoFees});
93+
cusdPath = _cusdPath;
94+
celoPath = _celoPath;
11295
}
11396

11497
function getSwapPath(address[] memory tokens, uint24[] memory fees) public pure returns (bytes memory path) {
@@ -629,7 +612,7 @@ contract BuyGDCloneFactory {
629612
function create(address owner) public returns (address) {
630613
bytes32 salt = keccak256(abi.encode(owner));
631614
address clone = ClonesUpgradeable.cloneDeterministic(impl, salt);
632-
BuyGDCloneV2(payable(clone)).initialize(owner);
615+
BuyGDCloneV2(payable(clone)).initialize(owner, cusdPath, celoPath);
633616
return clone;
634617
}
635618

0 commit comments

Comments
 (0)