New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

artkdev-locking

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

artkdev-locking

[![Build Status](https://app.travis-ci.com/artkdev2020/ArtKDev-Locking.svg?branch=main)](https://app.travis-ci.com/artkdev2020/ArtKDev-Locking) [![codecov](https://codecov.io/gh/artkdev2020/ArtKDev-Locking/branch/main/graph/badge.svg?token=XFXXHIYRJN)](h

latest
Source
npmnpm
Version
3.0.3
Version published
Maintainers
1
Created
Source

ArtKDev-Locking

Build Status codecov CodeFactor

Mainnet contract: link
Testnet contract: link

The main idea of the ArtKDev-Locking contract is to keep ERC-20 tokens foolproofly.

Navigation

Installation

npm install

Testing

truffle run coverage

Deploy

truffle dashboard
truffle migrate --network dashboard

Admin privileges

Setting a whitelist address

ATTENTION!
The default whitelist address is zero

If you want to set a new whitelist address, you should use a SetWhiteListAddress() function.

  function SetWhiteListAddress(address _newAddress) external;

Testnet tx: link

Setting a token fee whitelist id

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

If you want to set a new token fee whitelist id, you should use a SetTokenFeeWhiteListId() function.

    function SetTokenFeeWhiteListId(uint256 _newId) external;

Testnet tx: link

Setting a token filter whitelist id

ATTENTION!
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.

If you want to set a new token filter whitelist id, you should use a SetTokenFilterWhiteListId() function.

  function SetTokenFilterWhiteListId(uint256 _newId) external

Testnet tx: link

Setting a user whitelist id

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

If you want to set a new user whitelist id, you should use a SetUserWhiteListId() function.

    function SetUserWhiteListId(uint256 _newId) external;

Testnet tx: link

Setting a max transaction pools' limit

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

If you want to set a new max transation pools' limit, you should use a SetMaxTransactionPoolsLimit() function.

    function SetMaxTransactionPoolsLimit(uint256 _newLimit) external;

Testnet tx: link

Swapping a token filter

ATTENTION!
The token filter is disabled by default settings.

If you want to swap a token filter condition, you should use a SwapTokenFilter() function.

    function SwapTokenFilter() external

Testnet tx: link

Owner of the tokens

Transferring pool ownership

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

If you want to transfer a pool ownership, you should use a TransferPool() function.

  function TransferPool(address _newOwner, uint256 _poolId) external;

Testnet tx: link

Splitting a pool amount

ATTENTION!
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.

If you want to split a pool, you should use a SplitPoolAmount() function.

  function SplitPoolAmount(
        address _newOwner,
        uint256 _poolId,
        uint256 _newAmount
    ) external returns(uint256);

Testnet tx: link

Approving an allowance

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

If you want to approve an allowance, you should use a ApproveAllowance() function.

  function ApproveAllowance(
        address _user,
        uint256 _poolId,
        uint256 _amount
    ) external;

Testnet tx: link

User privileges

Creating a new pool

ATTENTION!
The number of locked tokens must be approved by the contract of the token before use.

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 _owner,  // owner of tokens
        address _token,  // locking token address
        uint256 _startTime,  // time when pool will be started
        uint256 _finishTime,  // time until pool will have been worked
        uint256 _amount  // amount of tokens to sell in the pool
    ) external payable returns(uint256);

Testnet tx: link

Creating an array of pools

ATTENTION!
The number of locked tokens must be approved by the contract of the token before usage.

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

  function CreatePoolsAmount(
        address _token,
        address[] calldata _owner,
        uint256[] calldata _startTime,
        uint256[] calldata _finishTime,
        uint256[] calldata _amount
    )   external payable;

Testnet tx: link

Creating an array of pools with respect to finish time

ATTENTION!
The number of locked tokens must be approved by the contract of the token before usage.

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

function CreatePoolsAmountTimes(
        address _token,
        address[] calldata _owner,
        uint256[] calldata _startTime,
        uint256[] calldata _finishTime,
        uint256[] calldata _amount
    )   external payable;

Testnet tx: link

Getting my pools' ids by a token

ATTENTION!
You can find the pool IDs by specifying the token addresses.
    function GetMyPoolsIdsByToken(address _owner, address[] memory _tokens)
        external
        view
        returns (uint256[] memory);

Getting a pools' data

ATTENTION!
Each element of the Pool array will return:
uint256 StartTime, uint256 FinishTime, uint256 StartAmount, uint256 DebitedAmount, address Owner, address Token

If you want to get a pool data, you should you a GetPoolsData() function.

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

Check whether is token without fee?

ATTENTION!
If _token returns true, we don't need to pay a fee to create the pool.

If you want to check whether is a token without a fee, you should you a isTokenWithoutFee() function.

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

Check whether is token in a whitelist?

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

If you want to check whether is a token in a whitelist, you should you a IsTokenWhiteListed() function.

   function IsTokenWhiteListed(address _token) public view returns(bool);

Check does whether a user have to pay a commission?

ATTENTION!
Returns true if _user have an allocation in a whitelist.

If you want to check does whether a user have to pay a commission, you should you a IsUserWithoutFee() function.

   function IsUserWithoutFee(address _user) public view returns(bool);

Gettting a pool data

ATTENTION!
There is a way how to get a pool data.
  function PoolsMap(uint256 _id)
        public
        view
        returns (
            address, // owner
            address  // token
            uint256, // startTime
            uint256, // finishTime
            uint256, // amount
            uint256  // debitedAmount
        );

Getting all my pools' ids

ATTENTION!
The function returns an array of all your pools' IDs.
   function GetAllMyPoolsIds(address _owner) external view returns (uint256[] memory);

Getting my pools' ids

ATTENTION!
Returns your pools only with a balance.
  function GetMyPoolsIds(address _owner) external view returns (uint256[] memory);

Withdrawing a tokens

ATTENTION!
The WithdrawTokens() function allows you to withdraw tokens if a pool is over, if there are still in the pool.
  function WithdrawTokens(uint256 _poolId) external returns (bool);

Testnet tx: link

Getting a withdrawable amount

Using this function you can check 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.

ATTENTION!
When splitting a pool, the existing allowance for a user in the pool will be reduced by the specified amount.
  function SplitPoolAmountFrom(
        address _address,
        uint256 _poolId,
        uint256 _amount
    ) external returns(uint256);

Testnet tx: link

Getting an allowance

There is a way how to get a pool allowance.

  function Allowance(uint256 _poolId, address _address) public view returns(uint256);

License

ArtKDev's contracts is released under the MIT License.

FAQs

Package last updated on 26 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts