Проверенный контрактЧастичноеGPL-2.0-or-later
NpmImplDeployer
Адрес0xdd0f25413473f33c8a62f6b7e2ff6eaf70d0e14b
- Баланс
0 ETH
- Транзакций
1
- Компилятор
solc 0.7.6
- Тот же код
Только этот контракт
Подробности
- Компилятор
- solc 0.7.6+commit.7338295f
- Язык
- solidity
- Оптимизация
- Да, 50 прогонов
- Версия EVM
- istanbul
- Лицензия
- GPL-2.0-or-later
- Совпадение
- Частичноекод создания: да, код в сети: да
- Проверен на Sourcify
- Создан в блоке
- 26 254 058
- Транзакция создания
- 0x7afa0e8e64…a6b47383dc
114 файлов
Исходный код большой: показывается один файл. Выберите файл в списке.
- script/DeployBscMainnet.s.solглавный7,75 КБ
- lib/forge-std/src/Base.sol1,79 КБ
- lib/forge-std/src/Script.sol790 Б
- lib/forge-std/src/StdChains.sol10,58 КБ
- lib/forge-std/src/StdCheats.sol25,51 КБ
- lib/forge-std/src/StdJson.sol6,21 КБ
- lib/forge-std/src/StdMath.sol1,36 КБ
- lib/forge-std/src/StdStorage.sol11,87 КБ
- lib/forge-std/src/StdUtils.sol10,52 КБ
- lib/forge-std/src/Vm.sol32,83 КБ
- lib/forge-std/src/console.sol66,69 КБ
- lib/forge-std/src/console2.sol69,68 КБ
- lib/forge-std/src/interfaces/IMulticall3.sol2,19 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/introspection/ERC165Upgradeable.sol1,94 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/introspection/IERC165Upgradeable.sol797 Б
- lib/openzeppelin-contracts-upgradeable/contracts/math/SafeMathUpgradeable.sol7,23 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/proxy/Initializable.sol2,08 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol17,81 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721EnumerableUpgradeable.sol969 Б
- lib/openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721MetadataUpgradeable.sol715 Б
- lib/openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol869 Б
- lib/openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721Upgradeable.sol4,62 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol6,84 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol1,2 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/utils/EnumerableMapUpgradeable.sol9,74 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/utils/EnumerableSetUpgradeable.sol9,39 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol941 Б
- lib/openzeppelin-contracts/contracts/access/Ownable.sol2,24 КБ
- lib/openzeppelin-contracts/contracts/drafts/IERC20Permit.sol2,12 КБ
- lib/openzeppelin-contracts/contracts/math/SafeMath.sol7,22 КБ
- lib/openzeppelin-contracts/contracts/math/SignedSafeMath.sol2,66 КБ
- lib/openzeppelin-contracts/contracts/proxy/Proxy.sol3,19 КБ
- lib/openzeppelin-contracts/contracts/proxy/ProxyAdmin.sol2,74 КБ
- lib/openzeppelin-contracts/contracts/proxy/TransparentUpgradeableProxy.sol6,12 КБ
- lib/openzeppelin-contracts/contracts/proxy/UpgradeableProxy.sol2,84 КБ
- lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2,7 КБ
- lib/openzeppelin-contracts/contracts/utils/Address.sol7,81 КБ
- lib/openzeppelin-contracts/contracts/utils/Context.sol941 Б
- lib/openzeppelin-contracts/contracts/utils/Strings.sol930 Б
- node_modules/@uniswap/lib/contracts/libraries/AddressStringUtil.sol1,39 КБ
- node_modules/@uniswap/lib/contracts/libraries/SafeERC20Namer.sol3,83 КБ
- node_modules/base64-sol/base64.sol2,28 КБ
- src/core/ListaV3Factory.sol2,83 КБ
- src/core/ListaV3Pool.sol35,44 КБ
- src/core/ListaV3PoolDeployer.sol1,4 КБ
- src/core/NoDelegateCall.sol1,09 КБ
- src/core/interfaces/IERC20Minimal.sol3,07 КБ
- src/core/interfaces/IListaV3Factory.sol4,03 КБ
- src/core/interfaces/IListaV3Pool.sol779 Б
- src/core/interfaces/IListaV3PoolDeployer.sol1,3 КБ
- src/core/interfaces/callback/IUniswapV3FlashCallback.sol970 Б
- src/core/interfaces/callback/IUniswapV3MintCallback.sol968 Б
- src/core/interfaces/callback/IUniswapV3SwapCallback.sol1,28 КБ
- src/core/interfaces/pool/IListaV3PoolActions.sol6,3 КБ
- src/core/interfaces/pool/IListaV3PoolDerivedState.sol2,6 КБ
- src/core/interfaces/pool/IListaV3PoolEvents.sol5,96 КБ
- src/core/interfaces/pool/IListaV3PoolImmutables.sol1,81 КБ
- src/core/interfaces/pool/IListaV3PoolOwnerActions.sol1,19 КБ
- src/core/interfaces/pool/IListaV3PoolState.sol6,51 КБ
- src/core/libraries/BitMath.sol2,79 КБ
- src/core/libraries/FixedPoint128.sol311 Б
- src/core/libraries/FixedPoint96.sol380 Б
- src/core/libraries/FullMath.sol5,13 КБ
- src/core/libraries/LiquidityMath.sol622 Б
- src/core/libraries/LowGasSafeMath.sol1,7 КБ
- src/core/libraries/Oracle.sol16,42 КБ
- src/core/libraries/Position.sol3,59 КБ
- src/core/libraries/SafeCast.sol1,05 КБ
- src/core/libraries/SqrtPriceMath.sol10,78 КБ
- src/core/libraries/SwapMath.sol4,64 КБ
- src/core/libraries/Tick.sol9,72 КБ
- src/core/libraries/TickBitmap.sol4,12 КБ
- src/core/libraries/TickMath.sol8,65 КБ
- src/core/libraries/TransferHelper.sol933 Б
- src/core/libraries/UnsafeMath.sol660 Б
- src/periphery/NonfungiblePositionManager.sol15,7 КБ
- src/periphery/NonfungibleTokenPositionDescriptor.sol4,92 КБ
- src/periphery/SwapRouter.sol9,05 КБ
- src/periphery/base/BlockTimestamp.sol428 Б
- src/periphery/base/ERC721PermitUpgradeable.sol4,13 КБ
- src/periphery/base/LiquidityManagement.sol3,02 КБ
- src/periphery/base/Multicall.sol964 Б
- src/periphery/base/PeripheryImmutableState.sol574 Б
- src/periphery/base/PeripheryPayments.sol2,47 КБ
- src/periphery/base/PeripheryPaymentsWithFee.sol1,98 КБ
- src/periphery/base/PeripheryValidation.sol297 Б
- src/periphery/base/PoolInitializer.sol1,13 КБ
- src/periphery/base/SelfPermit.sol2,03 КБ
- src/periphery/interfaces/IERC20Metadata.sol621 Б
- src/periphery/interfaces/IERC721PermitUpgradeable.sol1,55 КБ
- src/periphery/interfaces/IMulticall.sol705 Б
- src/periphery/interfaces/INonfungiblePositionManager.sol8,68 КБ
- src/periphery/interfaces/INonfungibleTokenPositionDescriptor.sol780 Б
- src/periphery/interfaces/IPeripheryImmutableState.sol417 Б
- src/periphery/interfaces/IPeripheryPayments.sol1,42 КБ
- src/periphery/interfaces/IPeripheryPaymentsWithFee.sol1,18 КБ
- src/periphery/interfaces/IPoolInitializer.sol1,16 КБ
- src/periphery/interfaces/ISelfPermit.sol3,88 КБ
- src/periphery/interfaces/ISwapRouter.sol2,7 КБ
- src/periphery/interfaces/external/IERC1271.sol857 Б
- src/periphery/interfaces/external/IERC20PermitAllowed.sol1,2 КБ
- src/periphery/interfaces/external/IWETH9.sol389 Б
- src/periphery/libraries/BytesLib.sol4,2 КБ
- src/periphery/libraries/CallbackValidation.sol1,44 КБ
- src/periphery/libraries/ChainId.sol357 Б
- src/periphery/libraries/HexStrings.sol1,21 КБ
- src/periphery/libraries/LiquidityAmounts.sol6,78 КБ
- src/periphery/libraries/NFTDescriptor.sol18,31 КБ
- src/periphery/libraries/NFTSVG.sol19,34 КБ
- src/periphery/libraries/Path.sol2,79 КБ
- src/periphery/libraries/PoolAddress.sol1,99 КБ
- src/periphery/libraries/PositionKey.sol373 Б
- src/periphery/libraries/TokenRatioSortOrder.sol341 Б
- src/periphery/libraries/TransferHelper.sol2,55 КБ
script/DeployBscMainnet.s.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
pragma abicoder v2;
import 'forge-std/Script.sol';
import 'forge-std/console.sol';
import {ListaV3Factory} from '../src/core/ListaV3Factory.sol';
import {NonfungiblePositionManager} from '../src/periphery/NonfungiblePositionManager.sol';
import {NonfungibleTokenPositionDescriptor} from '../src/periphery/NonfungibleTokenPositionDescriptor.sol';
import {SwapRouter} from '../src/periphery/SwapRouter.sol';
import {ProxyAdmin} from 'lib/openzeppelin-contracts/contracts/proxy/ProxyAdmin.sol';
import {TransparentUpgradeableProxy} from 'lib/openzeppelin-contracts/contracts/proxy/TransparentUpgradeableProxy.sol';
/// @title Deploy the full Lista V3 stack on BNB Chain mainnet (chainId 56)
/// @notice Self-contained, chain-pinned counterpart to Deploy.s.sol. Everything BSC-mainnet-specific
/// is hardcoded here (WBNB, native-currency label) and the run() hard-requires chainid == 56 so a
/// mis-set RPC can never broadcast mainnet bytecode to the wrong chain. The deploy sequence matches
/// the audited Deploy.s.sol exactly; only the chain config is fixed.
///
/// The NFT collection name/symbol ("Lista V3 Positions NFT" / "LISTA-V3") are baked into the NPM
/// implementation's initialize() — see NonfungiblePositionManager.sol — not set here.
///
/// All privileged roles (factory owner / fee-tier admin, and ProxyAdmin owner) default to the
/// broadcasting deployer EOA. The deployer address is printed before any broadcast so it can be
/// confirmed against the funded signer.
///
/// Optional env (with defaults):
/// OWNER = factory owner / fee-tier admin (defaults to the deployer EOA).
/// PROXY_ADMIN_OWNER = owner of the ProxyAdmin that controls the NPM proxy (defaults to OWNER).
/// TOKEN_DESCRIPTOR = existing NFT position descriptor to reuse. If unset (0x0), a fresh
/// NonfungibleTokenPositionDescriptor is deployed against THIS build's
/// PoolAddress/init-code-hash and wired into the NPM. Only pass an address
/// that was built from THIS repo — never a foreign fork.
///
/// Usage:
/// forge script script/DeployBscMainnet.s.sol:DeployBscMainnet \
/// --rpc-url $BSC_RPC --broadcast --verify --etherscan-api-key $BSCSCAN_API_KEY --slow
contract DeployBscMainnet is Script {
uint256 internal constant BSC_MAINNET_CHAIN_ID = 56;
/// @dev Canonical WBNB on BNB Chain mainnet.
address internal constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;
/// @dev Native-currency label shown for WBNB positions in the freshly-deployed descriptor.
bytes32 internal constant NATIVE_CURRENCY_LABEL = bytes32('BNB');
struct Deployment {
address proxyAdmin;
address factory;
address tokenDescriptor;
address npmImpl;
address npmProxy;
address swapRouter;
}
function run() external returns (Deployment memory out) {
uint256 chainId;
assembly {
chainId := chainid()
}
require(chainId == BSC_MAINNET_CHAIN_ID, 'not BSC mainnet (expected chainid 56)');
// The deployer is the broadcasting signer; all privileged roles default to it.
address deployer = msg.sender;
address owner = vm.envOr('OWNER', deployer);
address proxyAdminOwner = vm.envOr('PROXY_ADMIN_OWNER', owner);
address tokenDescriptor = vm.envOr('TOKEN_DESCRIPTOR', address(0));
require(owner != address(0), 'OWNER=0');
require(proxyAdminOwner != address(0), 'PROXY_ADMIN_OWNER=0');
bool deployDescriptor = tokenDescriptor == address(0);
console.log('--- Lista V3 deploy (BSC mainnet) ---');
console.log('chainId:', chainId);
console.log('deployer:', deployer);
console.log('owner:', owner);
console.log('proxyAdminOwner:', proxyAdminOwner);
console.log('WBNB:', WBNB);
console.log('deploy descriptor?:', deployDescriptor);
if (!deployDescriptor) {
console.log('tokenDescriptor (reused):', tokenDescriptor);
}
vm.startBroadcast();
// ProxyAdmin: owner() is the broadcaster from its constructor; transfer only if a different
// owner was requested.
ProxyAdmin proxyAdmin = new ProxyAdmin();
if (proxyAdminOwner != proxyAdmin.owner()) {
proxyAdmin.transferOwnership(proxyAdminOwner);
}
// Factory: plain deploy. owner = broadcaster; hand off to the requested owner if different.
ListaV3Factory factory = new ListaV3Factory();
if (owner != msg.sender) {
factory.setOwner(owner);
}
// Descriptor: fresh deploy only when TOKEN_DESCRIPTOR was not provided. Built from THIS repo's
// PoolAddress/POOL_INIT_CODE_HASH so it derives pool addresses correctly for this deployment.
// forge auto-deploys and links the NFTDescriptor library it depends on.
if (deployDescriptor) {
NonfungibleTokenPositionDescriptor descriptor =
new NonfungibleTokenPositionDescriptor(WBNB, NATIVE_CURRENCY_LABEL);
tokenDescriptor = address(descriptor);
}
// NPM: impl + proxy. factory/WETH9 are constructor immutables on the impl; every future
// upgrade MUST re-pass the exact same (factory, WBNB) to the new impl.
//
// The impl is created AND its initializer consumed inside NpmImplDeployer's constructor —
// a single CREATE tx — so there is no separate initialize() tx for a bot to front-run
// (an earlier non-atomic `new impl(); impl.initialize(0xdead)` was front-run on mainnet).
address npmImpl = address(new NpmImplDeployer(address(factory), WBNB).impl());
bytes memory npmInit = abi.encodeWithSelector(NonfungiblePositionManager.initialize.selector, tokenDescriptor);
TransparentUpgradeableProxy npmProxy =
new TransparentUpgradeableProxy(npmImpl, address(proxyAdmin), npmInit);
// SwapRouter is not upgradeable; plain deploy against the factory.
SwapRouter swapRouter = new SwapRouter(address(factory), WBNB);
vm.stopBroadcast();
out = Deployment({
proxyAdmin: address(proxyAdmin),
factory: address(factory),
tokenDescriptor: tokenDescriptor,
npmImpl: npmImpl,
npmProxy: address(npmProxy),
swapRouter: address(swapRouter)
});
console.log('--- deployed ---');
console.log('ProxyAdmin:', out.proxyAdmin);
console.log('Factory:', out.factory);
console.log('TokenDescriptor:', out.tokenDescriptor);
console.log('NPM impl:', out.npmImpl);
console.log('NPM proxy:', out.npmProxy);
console.log('SwapRouter:', out.swapRouter);
}
}
/// @title Atomic NPM implementation deployer
/// @notice Deploys a NonfungiblePositionManager implementation and consumes its initializer within
/// this contract's constructor — i.e. inside a single CREATE transaction. Because the deploy and the
/// `initialize(0xdead)` happen in the same tx, there is no intervening block in which a bot can call
/// `initialize()` on the fresh impl. Read `impl()` afterwards for the deployed implementation address.
contract NpmImplDeployer {
NonfungiblePositionManager public immutable impl;
constructor(address factory_, address weth9_) {
NonfungiblePositionManager i = new NonfungiblePositionManager(factory_, weth9_);
// Close the impl-takeover window atomically; harmless even though NPM has no selfdestruct.
i.initialize(address(0xdead));
impl = i;
}
}
Настройки компилятораПоказать
{
"viaIR": false,
"metadata": {
"bytecodeHash": "none",
"useLiteralContent": false
},
"optimizer": {
"runs": 50,
"enabled": true
},
"evmVersion": "istanbul",
"remappings": [
"@openzeppelin/=node_modules/@openzeppelin/",
"@uniswap/=node_modules/@uniswap/",
"base64-sol/=node_modules/base64-sol/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
"solidity-lib/=lib/solidity-lib/contracts/"
]
}Исходный код и метаданные: Sourcify.
Исходный код принадлежит авторам контракта.