@poolzfinance/collateral-provider
v1.0.3
Published
[](https://github.com/The-Poolz/LockDealNFT.CollateralProvider/actions/workflows/node.js.yml) [ and the corresponding tokens within each pool.
mapping(uint256 => uint256) public poolIdToRateToWei;- Key (uint256): Represents the unique identifier of a collateral pool (poolId).
- Value (uint256): Represents the rate conversion factor from main coins to tokens associated with the specified pool.
Example Usage
// Example values
// Updated example values in Wei
uint256 mainCoinAmount = 300 * 10**18; // Main coin amount, e.g., USDT in Wei
uint256 tokenAmount = 150 * 10**18; // Token amount in Wei
// Calculate exchange rate
uint256 rate = (mainCoinAmount * 1e21) / tokenAmount;
// Output the result
// rate = (300 * 1e21) / 150 = 2e18In this case, the values for mainCoinAmount and tokenAmount are represented in Wei (the smallest unit of ether). The resulting rate is 2*10**18 or 2e18. The resulting rate indicates that for every 1 Wei of the tokens, a user would receive 2e18 Wei worth of main coins based on this exchange rate.
Conclusion
The CollateralProvider contract provides a comprehensive solution for managing tokens and main coins for the Project Owner. With its time-limited collateral pools, it ensures that funds are securely held until a specific time limit is reached. Once the time limit expires, the Project Owner gains full control over the Collector pools, enabling efficient fund withdrawal.
Contract creates three types of pools: the Main Coin Pool, Token Pool, and Refund Main Coin Pool. These pools facilitate the exchange and withdrawal of tokens and main coins based on user actions and the defined time limit. Users withdrawing tokens increase the Main Coin pool and decrease the Refund Main coin pool, while those who initiate a refund exchange tokens for main coins, which affects the Token pool and the Refund Main coin pool.
The CollateralProvider contract collaborates with other providers to accurately calculate the required accrual amounts for the Collector pools, ensuring transparency and reliability in fund management.
License
The CollateralProvider contract is released under the MIT License.
