From b2addcd14d52b79a1c082da60930f56547587d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stas=20SU=C8=98COV?= Date: Fri, 20 Dec 2024 22:51:08 +0000 Subject: [PATCH] refactor: lp_shared to use snekmate. --- ape-config.yaml | 7 ++++--- contracts/modules/lp_shared.vy | 17 +++-------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/ape-config.yaml b/ape-config.yaml index 235fdc2..2861bf8 100644 --- a/ape-config.yaml +++ b/ape-config.yaml @@ -4,9 +4,10 @@ vyper: evm_version: cancun dependencies: - - name: snekmate - github: pcaversaccio/snekmate - version: 0.1.0 + - pypi: snekmate + config_override: + base_path: src + contracts_folder: snekmate networks: custom: diff --git a/contracts/modules/lp_shared.vy b/contracts/modules/lp_shared.vy index 8e8a2ae..816286d 100644 --- a/contracts/modules/lp_shared.vy +++ b/contracts/modules/lp_shared.vy @@ -4,6 +4,8 @@ # @title Velodrome Finance LP Module # @author Velodrome Finance +from snekmate.utils import create2_address + MAX_FACTORIES: constant(uint256) = 10 MAX_POOLS: constant(uint256) = 2000 MAX_ITERATIONS: constant(uint256) = 8000 @@ -202,17 +204,4 @@ def _root_lp_address( ) ) - - data: bytes32 = keccak256( - concat( - 0xFF, - convert(_factory, bytes20), - salt, - init_hash - ) - ) - - return convert( - convert(data, uint256) & convert(max_value(uint160), uint256), - address - ) + return create2_address._compute_address(salt, init_hash, _factory)