3.0.3 • Published 2 years ago

artkdev-locking v3.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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

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

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

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

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

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

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

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

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

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

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

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

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

    function GetMyPoolsIdsByToken(address _owner, address[] memory _tokens)
        external
        view
        returns (uint256[] memory);

Getting a pools' data

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?

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?

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?

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

  function PoolsMap(uint256 _id)
        public
        view
        returns (
            address, // owner
            address  // token
            uint256, // startTime
            uint256, // finishTime
            uint256, // amount
            uint256  // debitedAmount
        );

Getting all my pools' ids

   function GetAllMyPoolsIds(address _owner) external view returns (uint256[] memory);

Getting my pools' ids

  function GetMyPoolsIds(address _owner) external view returns (uint256[] memory);

Withdrawing a tokens

  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.

  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.