Skip to content

Commit

Permalink
Merge pull request #171 from gammaswap/fix/address-calculator-salt
Browse files Browse the repository at this point in the history
publish package
  • Loading branch information
0xDanr committed Dec 24, 2023
2 parents df642aa + 4c5e4d5 commit 4400b7d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contracts/base/AbstractGammaPoolFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ abstract contract AbstractGammaPoolFactory is IGammaPoolFactory, TwoStepOwnable
}

function cloneDeterministic(uint16 protocolId, bytes32 salt) internal virtual returns (address instance) {
bytes memory bytecode = AddressCalculator.calcMinimalBeaconProxyBytecode(protocolId, salt, address(this));
bytes memory bytecode = AddressCalculator.calcMinimalBeaconProxyBytecode(protocolId, address(this));

assembly {
instance := create2(0, add(bytecode, 32), mload(bytecode), salt)
Expand Down
4 changes: 1 addition & 3 deletions contracts/libraries/AddressCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ library AddressCalculator {

/// @dev Compute bytecode of a minimal beacon proxy contract, excluding bytecode metadata hash
/// @param protocolId - id of protocol
/// @param salt - salt used in address generation to assure its uniqueness
/// @param factory - address of factory that instantiated or will instantiate this contract
/// @return bytecode - the calculated bytecode for minimal beacon proxy contract
function calcMinimalBeaconProxyBytecode(
uint16 protocolId,
bytes32 salt,
address factory
) internal pure returns(bytes memory) {
return abi.encodePacked(
Expand Down Expand Up @@ -74,7 +72,7 @@ library AddressCalculator {
bytes32 salt,
address factory
) internal pure returns (address) {
bytes memory bytecode = calcMinimalBeaconProxyBytecode(protocolId, salt, factory);
bytes memory bytecode = calcMinimalBeaconProxyBytecode(protocolId, factory);

// Compute the hash of the initialization code.
bytes32 bytecodeHash = keccak256(bytecode);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gammaswap/v1-core",
"version": "1.1.15",
"version": "1.1.16",
"description": "Core smart contracts for the GammaSwap V1 protocol",
"homepage": "https://gammaswap.com",
"scripts": {
Expand Down

0 comments on commit 4400b7d

Please sign in to comment.