diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/FeeCollectorV3PositionTimeLockV1.sol b/FeeCollectorV3PositionTimeLockV1.sol new file mode 100644 index 0000000..86adfb4 --- /dev/null +++ b/FeeCollectorV3PositionTimeLockV1.sol @@ -0,0 +1,192 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.20; +pragma abicoder v2; + + +import "@openzeppelin/contracts/access/Ownable.sol"; +// import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol" as TH; +import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; +// import "@uniswap/v3-periphery/contracts/interfaces/INonfungiblePositionManager.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; +import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; +// import "@openzeppelin/contracts@5.0.2/interfaces/IERC4626.sol"; +// import "@openzeppelin/contracts/utils/math/SafeMath.sol"; + + + +library TransferHelper { + /// @notice Transfers tokens from the targeted address to the given destination + /// @notice Errors with 'STF' if transfer fails + /// @param token The contract address of the token to be transferred + /// @param from The originating address from which the tokens will be transferred + /// @param to The destination address of the transfer + /// @param value The amount to be transferred + function safeTransferFrom( + address token, + address from, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = + token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF'); + } + + /// @notice Transfers tokens from msg.sender to a recipient + /// @dev Errors with ST if transfer fails + /// @param token The contract address of the token which will be transferred + /// @param to The recipient of the transfer + /// @param value The value of the transfer + function safeTransfer( + address token, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST'); + } + + /// @notice Approves the stipulated contract to spend the given allowance in the given token + /// @dev Errors with 'SA' if transfer fails + /// @param token The contract address of the token to be approved + /// @param to The target of the approval + /// @param value The amount of the given token the target will be allowed to spend + function safeApprove( + address token, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA'); + } + + /// @notice Transfers ETH to the recipient address + /// @dev Fails with `STE` + /// @param to The destination of the transfer + /// @param value The value to be transferred + function safeTransferETH(address to, uint256 value) internal { + (bool success, ) = to.call{value: value}(new bytes(0)); + require(success, 'STE'); + } +} + + +interface INonfungiblePositionManager { + + function positions(uint256 tokenId) + external + view + returns ( + uint96 nonce, + address operator, + address token0, + address token1, + uint24 fee, + int24 tickLower, + int24 tickUpper, + uint128 liquidity, + uint256 feeGrowthInside0LastX128, + uint256 feeGrowthInside1LastX128, + uint128 tokensOwed0, + uint128 tokensOwed1 + ); + + struct CollectParams { + uint256 tokenId; + address recipient; + uint128 amount0Max; + uint128 amount1Max; + } + + function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1); + + function transferFrom(address from, address to, uint256 tokenId) external; + function safeTransferFrom(address from, address to, uint256 tokenId) external; +} + +contract FeeCollectorV3PositionTimeLockV1 is IERC721Receiver, Ownable, ReentrancyGuard { + uint256 public defaultLockDuration = 7 days; + + struct LockedPosition { + INonfungiblePositionManager positionManager; + address positionOwner; + uint256 tokenId; + uint256 releaseTime; + } + + // mapping(address => mapping(address => uint256)) public userLockedPositionsTokenId; + mapping(address => mapping(bytes32 => LockedPosition)) public lockedPositions; + + // INonfungiblePositionManager public positionManager; + + constructor(address initialOwner) Ownable(initialOwner) {} + + event FeesCollected(address indexed user, address indexed positionManager, uint256 tokenId, uint256 amount0, uint256 amount1); + event PositionLocked(address indexed user, address indexed positionManager, uint256 tokenId, uint256 releaseTime); + event PositionUnlocked(address indexed user, address indexed positionManager, uint256 tokenId); + + function onERC721Received( + address _operator, + address _from, + uint256 _tokenId, + bytes calldata _data) external pure override returns (bytes4) { + // require(address(whitelistedNftContract) == _msgSender()); + // _stakeNft(tokenId, from); + return IERC721Receiver.onERC721Received.selector; + } + + + function _hashLockedPositionKey(address _positionManager, uint256 tokenId) private view returns(bytes32) { + return keccak256(abi.encodePacked(_msgSender(), _positionManager, tokenId)); + } + + function collectFees(address _positionManager, uint256 tokenId, address recipient) external nonReentrant returns (uint256 amount0Collected, uint256 amount1Collected) { + LockedPosition storage lockedPosition = lockedPositions[_msgSender()][_hashLockedPositionKey(_positionManager, tokenId)]; + require(lockedPosition.positionOwner == _msgSender(), "failed to load position"); + + INonfungiblePositionManager positionManager = lockedPosition.positionManager; + INonfungiblePositionManager.CollectParams memory params = INonfungiblePositionManager.CollectParams({ + tokenId: lockedPosition.tokenId, + recipient: recipient, + amount0Max: type(uint128).max, + amount1Max: type(uint128).max + }); + + (amount0Collected, amount1Collected) = positionManager.collect(params); + emit FeesCollected(_msgSender(), _positionManager, tokenId, amount0Collected, amount1Collected); + + return(amount0Collected, amount1Collected); + } + + function lockPosition(address _positionManager, uint256 tokenId, uint256 lockDurationInSeconds) external { + uint256 _duration = lockDurationInSeconds; + if(lockDurationInSeconds == 0) { + _duration = defaultLockDuration; + } + // LockedPosition storage lockedposition = lockedPositions[_msgSender()][_hashLockedPositionKey(_positionManager, tokenId)]; + // require(lockedposition.tokenId != 0, "failed position already locked"); + uint256 releaseTime = (block.timestamp + (_duration)); + require(releaseTime > block.timestamp, "Release time must be in the future"); + + INonfungiblePositionManager positionManager = INonfungiblePositionManager(_positionManager); + positionManager.safeTransferFrom(_msgSender(), address(this), tokenId); + + lockedPositions[_msgSender()][_hashLockedPositionKey(_positionManager, tokenId)] = LockedPosition(positionManager, _msgSender(), tokenId, releaseTime); + + emit PositionLocked(_msgSender(), _positionManager, tokenId, releaseTime); + } + + function unlockPosition(address _positionManager, uint256 tokenId) external { + LockedPosition storage lockedPosition = lockedPositions[_msgSender()][_hashLockedPositionKey(_positionManager, tokenId)]; + require(lockedPosition.positionOwner == _msgSender(), "failed to load position, not Owner"); + require(block.timestamp >= lockedPosition.releaseTime, "not in time to unlock"); + + INonfungiblePositionManager positionManager = lockedPosition.positionManager; + positionManager.safeTransferFrom(address(this), _msgSender(), tokenId); + + delete lockedPositions[_msgSender()][_hashLockedPositionKey(_positionManager, tokenId)]; + } + + +} \ No newline at end of file diff --git a/MyUSD.sol b/MyUSD.sol new file mode 100644 index 0000000..8621ffd --- /dev/null +++ b/MyUSD.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.20; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract MyUSD is ERC20 { + constructor() ERC20("MyUSD", "MUSD") { + _mint(msg.sender, 1000000 * (10 ** decimals())); + } +} \ No newline at end of file diff --git a/NFTV3FeeCollector.sol b/NFTV3FeeCollector.sol new file mode 100644 index 0000000..ae5a206 --- /dev/null +++ b/NFTV3FeeCollector.sol @@ -0,0 +1,130 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.20; +pragma abicoder v2; + + +import "@openzeppelin/contracts/access/Ownable.sol"; +// import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol" as TH; +import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; +// import "@uniswap/v3-periphery/contracts/interfaces/INonfungiblePositionManager.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +// import "@openzeppelin/contracts@5.0.2/interfaces/IERC4626.sol"; +// import "@openzeppelin/contracts/utils/math/SafeMath.sol"; + + + +library TransferHelper { + /// @notice Transfers tokens from the targeted address to the given destination + /// @notice Errors with 'STF' if transfer fails + /// @param token The contract address of the token to be transferred + /// @param from The originating address from which the tokens will be transferred + /// @param to The destination address of the transfer + /// @param value The amount to be transferred + function safeTransferFrom( + address token, + address from, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = + token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF'); + } + + /// @notice Transfers tokens from msg.sender to a recipient + /// @dev Errors with ST if transfer fails + /// @param token The contract address of the token which will be transferred + /// @param to The recipient of the transfer + /// @param value The value of the transfer + function safeTransfer( + address token, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST'); + } + + /// @notice Approves the stipulated contract to spend the given allowance in the given token + /// @dev Errors with 'SA' if transfer fails + /// @param token The contract address of the token to be approved + /// @param to The target of the approval + /// @param value The amount of the given token the target will be allowed to spend + function safeApprove( + address token, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA'); + } + + /// @notice Transfers ETH to the recipient address + /// @dev Fails with `STE` + /// @param to The destination of the transfer + /// @param value The value to be transferred + function safeTransferETH(address to, uint256 value) internal { + (bool success, ) = to.call{value: value}(new bytes(0)); + require(success, 'STE'); + } +} + + +interface INonfungiblePositionManager { + + function positions(uint256 tokenId) + external + view + returns ( + uint96 nonce, + address operator, + address token0, + address token1, + uint24 fee, + int24 tickLower, + int24 tickUpper, + uint128 liquidity, + uint256 feeGrowthInside0LastX128, + uint256 feeGrowthInside1LastX128, + uint128 tokensOwed0, + uint128 tokensOwed1 + ); + + struct CollectParams { + uint256 tokenId; + address recipient; + uint128 amount0Max; + uint128 amount1Max; + } + + function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1); +} + +contract NFTV3FeeCollector is Ownable { + + // event NewRevenueDistribution(uint256 totalRevenueTokens, uint256 totalAmountOutToken, uint256 totalTokenInVault, uint256 totalTotalSupply, uint256 totalToTreasury, uint256 totalToVault); + + address payable private _treasury; + INonfungiblePositionManager public positionManager; + + constructor(address initialOwner, address _positionManager) + Ownable(initialOwner) + { + positionManager = INonfungiblePositionManager(_positionManager); + } + + function collectFees(uint256 tokenId, address recipient) public onlyOwner returns (uint256 amount0Collected, uint256 amount1Collected) { + // Criando os parâmetros de coleta + INonfungiblePositionManager.CollectParams memory params = INonfungiblePositionManager.CollectParams({ + tokenId: tokenId, + recipient: recipient, + amount0Max: type(uint128).max, // Coletar o máximo possível de token0 + amount1Max: type(uint128).max // Coletar o máximo possível de token1 + }); + + // Chamando a função collect para retirar as taxas + (amount0Collected, amount1Collected) = positionManager.collect(params); + } + + +} \ No newline at end of file diff --git a/RevenueDistributorV1.sol b/RevenueDistributorV1.sol new file mode 100644 index 0000000..217bb90 --- /dev/null +++ b/RevenueDistributorV1.sol @@ -0,0 +1,208 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.20; +pragma abicoder v2; + +import "@openzeppelin/contracts/access/Ownable.sol"; +// import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol" as TH; +import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts/interfaces/IERC4626.sol"; +// import "@openzeppelin/contracts/utils/math/SafeMath.sol"; + + + +library TransferHelper { + /// @notice Transfers tokens from the targeted address to the given destination + /// @notice Errors with 'STF' if transfer fails + /// @param token The contract address of the token to be transferred + /// @param from The originating address from which the tokens will be transferred + /// @param to The destination address of the transfer + /// @param value The amount to be transferred + function safeTransferFrom( + address token, + address from, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = + token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF'); + } + + /// @notice Transfers tokens from msg.sender to a recipient + /// @dev Errors with ST if transfer fails + /// @param token The contract address of the token which will be transferred + /// @param to The recipient of the transfer + /// @param value The value of the transfer + function safeTransfer( + address token, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST'); + } + + /// @notice Approves the stipulated contract to spend the given allowance in the given token + /// @dev Errors with 'SA' if transfer fails + /// @param token The contract address of the token to be approved + /// @param to The target of the approval + /// @param value The amount of the given token the target will be allowed to spend + function safeApprove( + address token, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA'); + } + + /// @notice Transfers ETH to the recipient address + /// @dev Fails with `STE` + /// @param to The destination of the transfer + /// @param value The value to be transferred + function safeTransferETH(address to, uint256 value) internal { + (bool success, ) = to.call{value: value}(new bytes(0)); + require(success, 'STE'); + } +} + + + +// should receive a erc20 token to +// register the revenue distribution share into the correct vault +// and deliver the remaning to the treasure contract +// only accept receive the tokens from a call of distribute func + +contract RevenueDistributorV1 is Ownable { + + event NewRevenueDistribution(uint256 totalRevenueTokens, uint256 totalAmountOutToken, uint256 totalTokenInVault, uint256 totalTotalSupply, uint256 totalToTreasury, uint256 totalToVault); + + address payable private _treasury; + address payable private _oldTreasury; + // address private _token; + IERC20 private _token; + IERC20 private _revenueToken; + IERC4626 private _vault; + ISwapRouter private immutable _swapRouter; + uint24 public constant poolFee = 3000; + uint24 constant BPS = 1E4; + + struct RevenueDistribution { + uint256 timestamp; + uint256 blockNumber; + uint256 totalRevenueTokenAmountIn; + uint256 totalTokenFromRevenueAmount; + uint256 totalTokenToVault; + uint256 totalTokenToTreasury; + uint256 totalStakedVault; + uint256 totalTokenSupply; + } + + RevenueDistribution[] public revenueDistributions; + + + constructor(address initialOwner, ISwapRouter swapRouterAddress, address revenueTokenAddress, address treasuryAddress, address vaultAddress) + Ownable(initialOwner) + { + _treasury = payable(treasuryAddress); + _vault = IERC4626(vaultAddress); + _token = IERC20(_vault.asset()); + _revenueToken = IERC20(revenueTokenAddress); + _swapRouter = swapRouterAddress; + } + + function totalDistributions() public view returns (uint256) { + return revenueDistributions.length; + } + + function swapRouter() external view returns (address swapRouerAddress) { + return address(_swapRouter); + } + + function revenueToken() external view returns (address revenueTokenAddress) { + return address(_revenueToken); + } + + function asset() external view returns (address assetTokenAddress) { + return address(_token); + } + + function vault() external view returns (address vaultAddress) { + return address(_vault); + } + + function treasury() external view returns (address treasuryWallet) { + return address(_treasury); + } + + function changeTreasury(address newTreasury) public virtual onlyOwner { + require(newTreasury != address(0), "invalid treasury wallet"); + require(newTreasury != address(this), "invalid treasury wallet"); + require(newTreasury != owner(), "invalid treasury wallet, cannot be same of owner"); + require(newTreasury != _treasury, "invalid treasury wallet, cannot be same of owner"); + + _oldTreasury = _treasury; + _treasury = payable(newTreasury); + } + + function distributeRewards(uint256 amountIn, uint256 amountOutMin, uint160 _sqrtPriceLimitX96) external onlyOwner returns(RevenueDistribution memory _rd) { + TransferHelper.safeTransferFrom(address(_revenueToken), _msgSender(), address(this), amountIn); + TransferHelper.safeApprove(address(_revenueToken), address(_swapRouter), amountIn); + + ISwapRouter.ExactInputSingleParams memory params = + ISwapRouter.ExactInputSingleParams({ + tokenIn: address(_revenueToken), + tokenOut: address(_token), + fee: poolFee, + recipient: address(this), + deadline: block.timestamp, + amountIn: amountIn, + amountOutMinimum: amountOutMin, + sqrtPriceLimitX96: _sqrtPriceLimitX96 + }); + + uint256 amountOut = _swapRouter.exactInputSingle(params); + uint256 balanceInTokenFromThis = _token.balanceOf(address(this)); + TransferHelper.safeApprove(address(_token), address(this), balanceInTokenFromThis); + + (uint256 totalToTreasoury, uint256 totalToVault) = _ratioDistribution(amountOut); + TransferHelper.safeTransferFrom(address(_token), address(this), address(_vault), totalToVault); + uint256 remainingBalance = _token.balanceOf(address(this)); + TransferHelper.safeTransferFrom(address(_token), address(this), _treasury, remainingBalance); + + RevenueDistribution memory rd = RevenueDistribution({ + timestamp: block.timestamp, + blockNumber: block.number, + totalRevenueTokenAmountIn: amountIn, + totalTokenFromRevenueAmount: amountOut, + totalTokenToVault: totalToVault, + totalTokenToTreasury: totalToTreasoury, + totalStakedVault: _vault.totalAssets(), + totalTokenSupply: _token.totalSupply() + }); + + revenueDistributions.push(rd); + + emit NewRevenueDistribution(amountIn, amountOut, _vault.totalAssets(), _token.totalSupply(), totalToTreasoury, totalToVault); + + return rd; + } + + function _ratioDistribution(uint256 _amount) internal view returns (uint256 totalToTrearusy, uint256 totalToVault) { + uint256 totalRatio = 100*BPS; + uint256 vaultRatio = (_vault.totalAssets() * BPS) / _token.totalSupply(); + // uint256 vaultRatio = vaultTotalAssets.mul(BPS).div(_token.totalSupply()); + + require(vaultRatio <= totalRatio, "vault ratio more that total ratio"); + + totalToVault = (vaultRatio * _amount) / BPS; + totalToTrearusy = _amount - totalToVault; + } + + function ratioDistribution(uint256 _amount) external view returns (uint256 totalToTrearusy, uint256 totalToVault) { + return _ratioDistribution(_amount); + } + +} \ No newline at end of file diff --git a/StakeToken.sol b/StakeToken.sol new file mode 100644 index 0000000..17e381d --- /dev/null +++ b/StakeToken.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.20; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract StakeToken is ERC20 { + constructor() ERC20("StakeToken", "STT") { + _mint(msg.sender, 1000000 * (10 ** decimals())); + } +} \ No newline at end of file diff --git a/TransferHelper.sol b/TransferHelper.sol new file mode 100644 index 0000000..7fc2797 --- /dev/null +++ b/TransferHelper.sol @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity >=0.6.0; + +import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; + +library TransferHelper { + /// @notice Transfers tokens from the targeted address to the given destination + /// @notice Errors with 'STF' if transfer fails + /// @param token The contract address of the token to be transferred + /// @param from The originating address from which the tokens will be transferred + /// @param to The destination address of the transfer + /// @param value The amount to be transferred + function safeTransferFrom( + address token, + address from, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = + token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF'); + } + + /// @notice Transfers tokens from msg.sender to a recipient + /// @dev Errors with ST if transfer fails + /// @param token The contract address of the token which will be transferred + /// @param to The recipient of the transfer + /// @param value The value of the transfer + function safeTransfer( + address token, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST'); + } + + /// @notice Approves the stipulated contract to spend the given allowance in the given token + /// @dev Errors with 'SA' if transfer fails + /// @param token The contract address of the token to be approved + /// @param to The target of the approval + /// @param value The amount of the given token the target will be allowed to spend + function safeApprove( + address token, + address to, + uint256 value + ) internal { + (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value)); + require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA'); + } + + /// @notice Transfers ETH to the recipient address + /// @dev Fails with `STE` + /// @param to The destination of the transfer + /// @param value The value to be transferred + function safeTransferETH(address to, uint256 value) internal { + (bool success, ) = to.call{value: value}(new bytes(0)); + require(success, 'STE'); + } +} diff --git a/Vault.sol b/Vault.sol new file mode 100644 index 0000000..ef4ebee --- /dev/null +++ b/Vault.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.20; + +import "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol"; + +contract Vault is ERC4626 { + constructor(IERC20 _asset) ERC4626(_asset) ERC20("Vault Staked Token", "vSTT") {} +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..fa9bc98 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,71 @@ +{ + "name": "solidity-snippets", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "solidity-snippets", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@openzeppelin/contracts": "^5.0.2", + "@uniswap/v3-periphery": "^1.4.4" + } + }, + "node_modules/@openzeppelin/contracts": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-5.0.2.tgz", + "integrity": "sha512-ytPc6eLGcHHnapAZ9S+5qsdomhjo6QBHTDRRBFfTxXIpsicMhVPouPgmUPebZZZGX7vt9USA+Z+0M0dSVtSUEA==" + }, + "node_modules/@uniswap/lib": { + "version": "4.0.1-alpha", + "resolved": "https://registry.npmjs.org/@uniswap/lib/-/lib-4.0.1-alpha.tgz", + "integrity": "sha512-f6UIliwBbRsgVLxIaBANF6w09tYqc6Y/qXdsrbEmXHyFA7ILiKrIwRFXe1yOg8M3cksgVsO9N7yuL2DdCGQKBA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v2-core": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@uniswap/v2-core/-/v2-core-1.0.1.tgz", + "integrity": "sha512-MtybtkUPSyysqLY2U210NBDeCHX+ltHt3oADGdjqoThZaFRDKwM6k1Nb3F0A3hk5hwuQvytFWhrWHOEq6nVJ8Q==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v3-core": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.1.tgz", + "integrity": "sha512-7pVk4hEm00j9tc71Y9+ssYpO6ytkeI0y7WE9P6UcmNzhxPePwyAxImuhVsTqWK9YFvzgtvzJHi64pBl4jUzKMQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v3-periphery": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.4.4.tgz", + "integrity": "sha512-S4+m+wh8HbWSO3DKk4LwUCPZJTpCugIsHrWR86m/OrUyvSqGDTXKFfc2sMuGXCZrD1ZqO3rhQsKgdWg3Hbb2Kw==", + "dependencies": { + "@openzeppelin/contracts": "3.4.2-solc-0.7", + "@uniswap/lib": "^4.0.1-alpha", + "@uniswap/v2-core": "^1.0.1", + "@uniswap/v3-core": "^1.0.0", + "base64-sol": "1.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v3-periphery/node_modules/@openzeppelin/contracts": { + "version": "3.4.2-solc-0.7", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-3.4.2-solc-0.7.tgz", + "integrity": "sha512-W6QmqgkADuFcTLzHL8vVoNBtkwjvQRpYIAom7KiUNoLKghyx3FgH0GBjt8NRvigV1ZmMOBllvE1By1C+bi8WpA==" + }, + "node_modules/base64-sol": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/base64-sol/-/base64-sol-1.0.1.tgz", + "integrity": "sha512-ld3cCNMeXt4uJXmLZBHFGMvVpK9KsLVEhPpFRXnvSVAqABKbuNZg/+dsq3NuM+wxFLb/UrVkz7m1ciWmkMfTbg==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..c59513b --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "solidity-snippets", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "@openzeppelin/contracts": "^5.0.2", + "@uniswap/v3-periphery": "^1.4.4" + } +}