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
1
Keywords
Readme
Locked Deal V2
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.