initialize() :
This function is an external initializer for the BNTPool contract. It calls the __BNTPool_init() function, which is responsible for setting up the contract's initial state. This includes setting up the pool's parameters, such as the minimum and maximum deposit amounts, as well as the pool's reward structure. It also sets up the contract's internal data structures, such as the mapping of user addresses to their balances and the mapping of user addresses to their rewards. Finally, it sets up the contract's event logging system. (autogenerated documentation)
__BNTPool_init() :
This function is used to initialize the BNTPool contract. It calls the __Vault_init() function to initialize the Vault contract, and then calls the __BNTPool_init_unchained() function to initialize the BNTPool contract. This function is marked as internal and onlyInitializing, meaning that it can only be called from within the contract and only during the initial setup. (autogenerated documentation)
__BNTPool_init_unchained() :
This function is used to initialize the BNT Pool contract. It sets the ownership of the pool token to the BNT Pool contract, and sets the admin roles for the BNT Pool Token Manager, BNT Manager, Vault Manager, and Funding Manager. This allows the contract to be managed by the appropriate roles. (autogenerated documentation)
_poolWhitelisted() :
This function is used to check if a given token is whitelisted in the network settings. It takes a token as an argument and checks if it is present in the whitelisted tokens list. If the token is not present in the list, the function will revert with an error. (autogenerated documentation)
version() :
This function is an override of the IVersioned and Upgradeable contracts. It returns a version number (in this case, 3) which is used to track the version of the contract. This allows for the contract to be upgraded and for users to know which version of the contract they are interacting with. (autogenerated documentation)
isPayable() :
This function is an override of the isPayable() function from the IVault and Vault contracts. It returns a boolean value of false, indicating that the Vault contract is not payable. This means that it cannot receive Ether or other tokens as payment. (autogenerated documentation)
roleBNTPoolTokenManager() :
This function returns the bytes32 value of the role BNT Pool Token Manager. This role is used to manage the BNT Pool Token, which is a token that is used to represent the ownership of a pool of Bancor Network Tokens (BNT). The function works by simply returning the bytes32 value of the role, which can then be used to check if a user has the necessary permissions to manage the BNT Pool Token. (autogenerated documentation)
roleBNTManager() :
This function returns the bytes32 value of the ROLE_BNT_MANAGER constant. This constant is used to identify the role of a BNT Manager, which is a user with the ability to manage the BNT token. The function is declared as external and pure, meaning that it does not modify the state of the contract and does not interact with any external contracts. (autogenerated documentation)
roleVaultManager() :
This function is a getter function that returns the bytes32 value of the ROLE_VAULT_MANAGER constant. This constant is used to identify the role of a Vault Manager, which is a user with the ability to manage the funds stored in a smart contract. The function simply returns the value of the constant, allowing other functions to access it. (autogenerated documentation)
roleFundingManager() :
This function is a getter function that returns the bytes32 value of the constant ROLE_FUNDING_MANAGER. This constant is used to identify the role of a Funding Manager in the smart contract. The function is declared as external and pure, meaning that it does not modify the state of the contract and does not interact with the blockchain. (autogenerated documentation)
isAuthorizedWithdrawal(address,uint256) :
This function checks if a given address has the permission to withdraw a given token from a pool. It does this by first checking if the token is the same as the pool token, and then checking if the caller has the role of BNT Pool Token Manager. If both of these conditions are met, the function returns true, indicating that the caller is authorized to withdraw the token from the pool. (autogenerated documentation)
poolToken() :
This function is a view function that returns the IPoolToken interface. This interface is used to interact with the PoolToken contract, which is a token contract that allows users to pool their tokens together and receive rewards. The function allows users to access the PoolToken contract and interact with it. (autogenerated documentation)
stakedBalance() :
This function returns the total amount of tokens that have been staked in the contract. It works by accessing the _stakedBalance variable, which stores the total amount of tokens that have been staked. (autogenerated documentation)
currentPoolFunding() :
This function returns the current amount of funds in a given token pool. It works by accessing the _currentPoolFunding mapping, which stores the current amount of funds in each token pool. The function takes in a Token pool as an argument and returns the corresponding amount of funds stored in the mapping. (autogenerated documentation)
availableFunding() :
This function returns the amount of available funding for a given token pool. It does this by subtracting the current pool funding from the pool funding limit set in the network settings. The result is then passed through the MathEx.subMax0() function to ensure that the result is never negative. (autogenerated documentation)
poolTokenToUnderlying(uint256) :
This function allows users to convert a given amount of pool tokens into the underlying asset. It works by calculating the current exchange rate between the pool token and the underlying asset, and then multiplying the given amount of pool tokens by the exchange rate to determine the amount of underlying asset that can be obtained. (autogenerated documentation)
underlyingToPoolToken(uint256) :
This function converts a given amount of BNT (Bancor Network Token) into the equivalent amount of tokens from the pool. It does this by using a conversion rate that is determined by the current supply and demand of the pool tokens. The conversion rate is calculated by dividing the total supply of pool tokens by the total supply of BNT. (autogenerated documentation)
poolTokenAmountToBurn(uint256) :
This function calculates the amount of pool tokens that should be burned in order to distribute a given amount of BNT tokens. It does this by taking the given BNT amount and multiplying it by the total supply of pool tokens. This result is then divided by the sum of the given BNT amount and the staked balance multiplied by the difference between the total supply of pool tokens and the balance of the contract address. This calculation is done using the MathEx.mulDivF function which is a safe math function that prevents overflows. (autogenerated documentation)
mint(address,uint256) :
This function allows a user with the role of BNT Manager to mint a specified amount of BNT tokens to a given address. The function first checks that the recipient address is valid, and that the amount of BNT to be minted is greater than zero. If these conditions are met, the function calls the mint() function of the BNT Governance contract, which will create the specified amount of BNT tokens and transfer them to the recipient address. (autogenerated documentation)
burnFromVault(uint256) :
This function allows a user with the role of Vault Manager to burn a specified amount of BNT tokens from the Master Vault. It works by calling the burn() function from the Master Vault contract, passing in the address of the BNT token contract and the amount of BNT tokens to be burned. (autogenerated documentation)
depositFor(bytes32,address,uint256,bool,uint256) :
This function allows a user to deposit BNT tokens into the Bancor Network in exchange for VBNT tokens. The function first checks that the address of the provider is valid and that the amount of BNT being deposited is greater than zero. It then calculates the amount of Pool Tokens that will be minted in exchange for the BNT, and checks that the amount of Pool Tokens is available. If not, it increases the staked balance and mints the additional Pool Tokens. The BNT tokens are then burned, and the VBNT tokens are minted and sent to the provider. Finally, an event is emitted to log the transaction. (autogenerated documentation)
withdraw(bytes32,address,uint256,uint256) :
This function allows a user to withdraw a specified amount of pool tokens and receive a corresponding amount of BNT tokens in return. The function first calculates the underlying amount of BNT tokens that corresponds to the amount of pool tokens specified. If the amount of BNT tokens specified is greater than the underlying amount, the function will revert. The function then burns the specified amount of pool tokens and mints the corresponding amount of BNT tokens to the specified provider address. Finally, the function emits an event to log the withdrawal and returns the amount of BNT tokens minted. (autogenerated documentation)
withdrawalAmount(uint256) :
This function allows users to withdraw a certain amount of BNT tokens from the pool in exchange for a certain amount of pool tokens. It takes in a uint256 poolTokenAmount as an argument and returns a uint256 bntAmount. The function first checks that the poolTokenAmount is greater than zero, and then uses the _poolTokenToUnderlying() function to convert the poolTokenAmount to an underlying amount. Finally, it returns the bntAmount associated with the underlying amount from the _withdrawalAmounts mapping. (autogenerated documentation)
requestFunding(bytes32,uint256) :
This function is used to request funding for a given pool. It takes in three parameters: a bytes32 contextId, a Token pool, and a uint256 bntAmount. It first checks if the new funding amount exceeds the funding limit for the given pool. If it does, the transaction is reverted. It then calculates the amount of pool tokens to be minted based on the given bntAmount and the current staked balance. It then updates the current pool funding and the staked balance, and mints the calculated amount of pool tokens. Finally, it emits two events: FundingRequested and TotalLiquidityUpdated. (autogenerated documentation)
renounceFunding(bytes32,uint256) :
This function allows a Funding Manager to renounce a portion of the funding for a given pool. It takes in a context ID, a pool token, and an amount of BNT as parameters. It then calculates the amount of pool tokens that correspond to the amount of BNT being renounced, and burns the corresponding amount of pool tokens and BNT from the Master Vault. Finally, it emits two events, FundingRenounced and TotalLiquidityUpdated, to notify other contracts of the changes. (autogenerated documentation)
onFeesCollected(uint256,bool) :
This function is triggered when fees are collected from a token pool. It adds the fee amount to the total staked balance and, if the fee is a trade fee, adds it to the current pool funding for the pool from which the fee was collected. The function is triggered externally by the network, and only if the address of the pool is valid. (autogenerated documentation)
_poolTokenToUnderlying(uint256) :
This function is used to convert a given amount of pool tokens into the underlying asset. It works by calculating the ratio of the staked balance to the total supply of pool tokens, and then multiplying the given pool token amount by this ratio. The result is the amount of the underlying asset that is equivalent to the given pool token amount. (autogenerated documentation)
_poolTokenToUnderlying(uint256,uint256,uint256) :
This function converts a given amount of pool tokens into the equivalent amount of underlying tokens. It does this by calculating the ratio of the current staked balance to the total supply of pool tokens, and then multiplying the given amount of pool tokens by this ratio. (autogenerated documentation)
_underlyingToPoolToken(uint256) :
This function is used to calculate the amount of pool tokens that can be minted from a given amount of underlying tokens. It works by taking the given amount of underlying tokens (bntAmount) and calculating the ratio of the total supply of pool tokens to the total staked balance of underlying tokens. This ratio is then used to calculate the amount of pool tokens that can be minted from the given amount of underlying tokens. (autogenerated documentation)
_underlyingToPoolToken(uint256,uint256,uint256) :
This function converts an amount of BNT (bntAmount) into an equivalent amount of Pool Tokens (the token associated with the pool). It does this by calculating the ratio between the total supply of Pool Tokens and the current staked balance of BNT, and then multiplying the bntAmount by this ratio. The result is the amount of Pool Tokens that is equivalent to the bntAmount. (autogenerated documentation)
_withdrawalAmounts(uint256) :
This function calculates the amount of BNT to be withdrawn from a given amount, taking into account the withdrawal fee. It does this by first calculating the withdrawal fee amount by multiplying the given BNT amount by the withdrawal fee (in parts per million) and dividing it by the PPM resolution. The BNT amount is then reduced by the withdrawal fee amount, and the resulting amounts are returned in an InternalWithdrawalAmounts memory object. (autogenerated documentation)