npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

poolz-locked-deal-v2

v1.1.1

Published

[![Build Status](https://travis-ci.com/The-Poolz/Locked-pools.svg?branch=master)](https://travis-ci.com/The-Poolz/Locked-pools) [![codecov](https://codecov.io/gh/The-Poolz/Locked-pools/branch/master/graph/badge.svg?token=szMZsBIF3L)](https://codecov.io/g

Downloads

14

Readme

Locked Deal V2

Build Status codecov CodeFactor

Smart contract for secure storage of ERC20 tokens.

Navigation

Installation

npm install

Testing

truffle run coverage

Deploy

truffle dashboard
truffle migrate --f 1 --to 1 --network dashboard

Admin settings

Whitelist address

Problem: Admin has set the payment price for creating a pool, but it is necessary that certain addresses don't pay.

Solution: Create a whitelist of addresses that don't pay and integrate it with Locked-pools.

  • The default whitelist address is zero
  • We can set only contract that implements IWhiteList interface.
    function setWhiteListAddress(address _address) external;

Testnet tx: link

Non-paid token

Locked-pools can uses three manual whitelists. One of them is a whitelist for tokens that are exempt from paying fees.

    function setTokenFeeWhiteListId(uint256 _id) external;

Testnet tx: link

Security token filter

If someone is trying to lock tokens that damage the contract, we can create a whitelist of tokens that can only be used to create a locked pool.

    function setTokenFilterWhiteListId(uint256 _id) external;

Testnet tx: link

User without fee

Setting a whitelist ID for users who are exempt from paying fees.

    function setUserWhiteListId(uint256 _id) external;

Testnet tx: link

Max transaction limit

There is a restriction on the implementation of mass locked pools.

    // by default, the maximum transaction limit is 400
    function setMaxTransactionLimit(uint256 _newLimit) external;

Testnet tx: link

Enable/Disable token filter

    // by default the token filter is disabled
    function swapTokenFilter() external;

Testnet tx: link

Pool owner settings

Transfer of ownership of locked tokens

After using PoolTransfer, a new locked-pool of tokens is created based on the previous one, but with a new owner.

    function PoolTransfer(uint256 _PoolId, address _NewOwner)
        external;

Testnet tx: link

Splitting a pool amount

When you splitting a pool, it creates a new pool with splitted amount, in the original pool, the amount is reduced by the amount of the new pool.

    function SplitPoolAmount(
        uint256 _PoolId,
        uint256 _NewAmount,
        address _NewOwner
    ) external returns(uint256)

Testnet tx: link

Approving an allowance

Using the ApproveAllowance function, we can allocate an amount for non-owner addresses to split the pool.

    function ApproveAllowance(
        uint256 _PoolId,
        uint256 _Amount,
        address _Spender
    ) external;

Testnet tx: link

User settings

Creating a new pool

CreateNewPool() function allows us to create a new pool for locking tokens. If it is needed you have to pay some fee for creation.

    function CreateNewPool(
        address _Token, // Token address to lock
        uint256 _StartTime, // Until what time a pool will start
        uint256 _FinishTime, // Until what time a pool will end
        uint256 _StartAmount, // Total amount of the tokens to sell in a pool
        address _Owner // Token owner
    ) external payable;

Testnet tx: link

Creating an array of pools

CreateMassPool() function allows us to create an array of pools for locking tokens.

    function CreateMassPools(
        address _Token,
        uint256[] calldata _StartTime,
        uint256[] calldata _FinishTime,
        uint256[] calldata _StartAmount,
        address[] calldata _Owner
    )   external payable;

Testnet tx: link

Creating an array of pools with respect to finish time

    function CreatePoolsWrtTime(
        address _Token,
        uint256[] calldata _StartTime,
        uint256[] calldata _FinishTime,
        uint256[] calldata _StartAmount,
        address[] calldata _Owner
    )   external payable

Testnet tx: link

Getting my pools' ids by a token

Find pool IDs by specifying token addresses.

    function GetMyPoolsIdByToken(address[] memory _tokens)
        public
        view
        returns (uint256[] memory);

Getting a pools' data

Each element of the Pool array will return:

    function GetPoolsData(uint256[] memory _ids)
        public
        view
        returns (Pool[] memory)

Is Token without fee

If _tokenAddress returns true, we don't need to pay to create the pool.

    function isTokenWithoutFee(address _tokenAddress) public view returns(bool);

Check token validation

If false is returned, the token cannot be used in a locked pool.

    function isTokenWhiteListed(address _tokenAddress) public view returns(bool);

Does the user have to pay a commission?

Returns true if _UserAddress have allocation in WhiteList.

    function isUserWithoutFee(address _UserAddress) public view returns(bool);

Gettting a pool data

There is a way how to get a pool data.

        function AllPoolz(uint256 _id)
        public
        view
        returns (
            uint256, // StartTime
            uint256, // FinishTime
            uint256, // StartAmount
            uint256, // DebitedAmount
            address, // Owner
            address  // Token
        );

Getting all my pools' ids

The function returns an array of all your pools IDs.

    function GetAllMyPoolsId() public view returns (uint256[] memory);

Getting my pools ids

Returns only your pools with a balance.

    function GetMyPoolsId() public view returns (uint256[] memory);

Withdrawing a token

The WithdrawToken() function allows you to withdraw tokens if the pool is over, provided they are still in the pool.

    function WithdrawToken(uint256 _PoolId) external returns (bool);

Testnet tx: link

Getting a withdrawable amount

See how many tokens can be unlocked in a pool.

    function getWithdrawableAmount(uint256 _PoolId) public view returns(uint256)

Splitting a pool amount from already an existing pool's allowance for a user.

When splitting a pool, the existing allowance for a user in the pool will be reduced by the specified amount.

        function SplitPoolAmountFrom(
        uint256 _PoolId,
        uint256 _Amount,
        address _Address
    ) external returns(uint256);

Testnet tx: link

Getting allowance

There is a way how to get a pool allowance.

    function Allowance(uint256 _PoolId, address _Address) public view returns(uint256);

License

The-Poolz Contracts is released under the MIT License.