Request form
Cookbook may introduce a token in the future. Share and contribute to be eligible for future airdrops.
close icon
relevant tag icon
Bancor Network Info
copy icon
Bancor
• version 1.0.0
AMM
Read
Utility
Audited

Bancor Network Info

Audited

Holds all Read functions for the Bancor Network contract, providing an easy process to collect information.

*Visit desktop site to download or deploy

Version

1.0.0

Creator

Bancor

Last Publish

1/13/2023
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
initialize() :
This function initializes the BancorNetworkInfo contract. It calls the __BancorNetworkInfo_init() function which sets up the contract's internal state and sets the owner address. (autogenerated documentation)
__BancorNetworkInfo_init() :
This function is used to initialize the BancorNetworkInfo contract. It calls the __Upgradeable_init() function to initialize the Upgradeable contract, and then calls the __BancorNetworkInfo_init_unchained() function to initialize the BancorNetworkInfo contract. This function is only called when the contract is first deployed. (autogenerated documentation)
__BancorNetworkInfo_init_unchained() :
This function is used to initialize the Bancor Network Info contract. It sets the initial values for the contract's state variables, such as the total supply of BNT tokens, the current exchange rate, and the list of supported tokens. It also sets up the event logging system and the functions for interacting with the contract. (autogenerated documentation)
_validTokensForTrade() :
This function is used to validate two tokens for a trade. It checks that both tokens are valid addresses and that they are not the same token. If either of these conditions are not met, the function will revert with an InvalidToken error. (autogenerated documentation)
version() :
This function is an override of the IVersioned and Upgradeable contracts. It returns a version number (in this case, 2) 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)
network() :
This function returns the IBancorNetwork interface associated with the contract. It works by accessing the _network variable, which is a storage variable that holds the address of the IBancorNetwork interface. (autogenerated documentation)
bnt() :
This function is a getter function that returns the address of the BNT ERC20 token contract. It is an external view function, meaning that it does not modify the state of the contract and does not cost any gas. It simply returns the address of the BNT token contract, allowing other contracts to interact with it. (autogenerated documentation)
bntGovernance() :
This function allows external users to view the ITokenGovernance interface of the Bancor Network Token (BNT). The ITokenGovernance interface provides access to the governance functions of the BNT, such as voting on proposals, setting parameters, and managing the token supply. It also allows users to view the current state of the BNT, including the current supply, total supply, and other relevant information. (autogenerated documentation)
vbnt() :
This function is an external view function that returns the address of the VBNT ERC20 token contract. It works by returning the address of the VBNT token contract stored in the _vbnt variable. (autogenerated documentation)
vbntGovernance() :
This function is used to retrieve the ITokenGovernance interface of the VBNT token contract. It works by returning the address of the VBNT Governance contract, which is stored in the _vbntGovernance variable. This allows users to interact with the governance contract and view information such as the total supply of tokens, the current token holders, and the current voting power of each token holder. (autogenerated documentation)
networkSettings() :
This function is used to retrieve the network settings of a smart contract. It is an external view function, meaning that it does not modify the state of the contract and can be called by anyone. The function returns an INetworkSettings object, which contains information about the network the contract is running on, such as the network ID, the gas price, and the block number. (autogenerated documentation)
masterVault() :
This function is a view function that returns the address of the MasterVault contract. It does not modify any state variables and does not require any input parameters. It simply returns the address of the MasterVault contract stored in the _masterVault state variable. (autogenerated documentation)
externalProtectionVault() :
This function returns an instance of the IExternalProtectionVault interface, which is used to store and manage external protection data. The interface provides methods for securely storing and retrieving data, as well as methods for managing access to the data. The data is stored in a secure vault, which is protected by cryptographic algorithms and other security measures. (autogenerated documentation)
externalRewardsVault() :
This function returns an instance of the IExternalRewardsVault contract, which is used to store and manage rewards for users of a decentralized application. The function works by returning the address of the IExternalRewardsVault contract, which can then be used to interact with the contract and access its functions. (autogenerated documentation)
bntPool() :
This function is a getter function that returns the IBNTPool struct, which contains information about the Bancor Network Token (BNT) pool. This pool is used to facilitate liquidity for the Bancor Network, and contains information such as the total amount of BNT in the pool, the total amount of Ether in the pool, and the current exchange rate between BNT and Ether. (autogenerated documentation)
poolToken() :
This function is used to retrieve the pool token associated with a given token pool. It takes in a Token pool as an argument and returns an IPoolToken. The function checks if the given pool is equal to _bnt, and if so, it returns the _bntPoolToken. Otherwise, it calls the _poolCollection function with the given pool as an argument and returns the poolToken associated with the pool. (autogenerated documentation)
stakedBalance() :
This function returns the staked balance of a given token pool. It works by first checking if the given token pool is equal to BNT, and if so, it returns the staked balance of the BNT pool. Otherwise, it returns the staked balance of the given token pool from the pool collection. (autogenerated documentation)
tradingLiquidity() :
This function is used to retrieve the trading liquidity of a given token pool. It takes in a token pool as a parameter and returns a TradingLiquidity memory object containing the BNT trading liquidity and the base token trading liquidity. The function first checks if the given token pool is equal to BNT, and if so, it reverts with an InvalidParam error. Otherwise, it retrieves the pool liquidity from the pool collection and returns the BNT trading liquidity and the base token trading liquidity in the TradingLiquidity memory object. (autogenerated documentation)
tradingFeePPM() :
This function returns the trading fee in parts-per-million (PPM) for a given token pool. It works by accessing the pool collection and calling the tradingFeePPM() function, which returns the trading fee for the given pool. (autogenerated documentation)
tradingEnabled() :
This function checks if trading is enabled for a given token pool. It does this by first checking if the given pool is equal to the BNT token pool, and if so, it returns true. If not, it calls the _poolCollection function, passing in the given pool, and then calls the tradingEnabled function on the result, passing in the given pool again. This function then returns the result of the tradingEnabled function. (autogenerated documentation)
depositingEnabled() :
This function checks if depositing is enabled for a given token pool. It does this by first checking if the given token pool is equal to the BNT token, and if so, it returns true. If not, it calls the _poolCollection function, passing in the given token pool, and then calls the depositingEnabled function on the result, passing in the token pool again. This function returns a boolean value indicating whether or not depositing is enabled for the given token pool. (autogenerated documentation)
isPoolStable() :
This function checks if a given token pool is stable. It does this by first checking if the pool is equal to the BNT token, and if so, it returns true. If not, it calls the isPoolStable() function from the PoolCollection contract, which checks the pool's liquidity and other metrics to determine if it is stable. (autogenerated documentation)
pendingWithdrawals() :
This function is a view function that returns the IPendingWithdrawals struct, which contains information about pending withdrawals. This function allows users to view the pending withdrawals and check the status of their withdrawal requests. (autogenerated documentation)
poolMigrator() :
This function returns the address of the PoolMigrator contract, which is used to facilitate the migration of funds from one pool to another. The PoolMigrator contract is responsible for managing the migration process, including tracking the amount of funds that have been migrated, and ensuring that the funds are transferred securely and accurately. (autogenerated documentation)
tradeOutputBySourceAmount(uint256) :
This function allows users to trade between two tokens, given a source token and a target token, and a source amount. It returns the amount of the target token that can be obtained from the source amount. It works by using the _tradeOutputAmount function, which calculates the output amount based on the current exchange rate between the two tokens. (autogenerated documentation)
tradeInputByTargetAmount(uint256) :
This function allows users to trade one token for another by specifying the amount of the target token they wish to receive. It works by first validating that both tokens are supported by the exchange and that the target amount is greater than zero. It then calls the _tradeOutputAmount function, passing in the source and target tokens, the target amount, and a boolean value of false. This function calculates the amount of the source token that is required to receive the target amount of the target token, and returns this value. (autogenerated documentation)
isReadyForWithdrawal(uint256) :
This function checks if a withdrawal request with the given ID is ready to be processed. It does this by calling the isReadyForWithdrawal() function from the _pendingWithdrawals mapping, which stores the status of each withdrawal request. If the request is ready, the function returns true, otherwise it returns false. (autogenerated documentation)
poolTokenToUnderlying(uint256) :
This function allows users to convert a given amount of pool tokens into the underlying asset. It works by first checking if the pool token is BNT, and if so, it calls the poolTokenToUnderlying function from the BNT pool contract. If the pool token is not BNT, it calls the poolTokenToUnderlying function from the PoolCollection contract, which is responsible for managing all the other pools. (autogenerated documentation)
underlyingToPoolToken(uint256) :
This function allows users to convert a given amount of an underlying token into the equivalent amount of a pool token. It does this by first checking if the given token is BNT, and if so, it calls the underlyingToPoolToken() function of the BNT pool contract. If the given token is not BNT, it calls the underlyingToPoolToken() function of the PoolCollection contract, which is responsible for managing all of the other pool contracts. (autogenerated documentation)
withdrawalAmounts(uint256) :
This function allows users to withdraw a certain amount of tokens from a pool. It takes in two parameters, the token pool and the amount of tokens to be withdrawn. It then checks if the pool is equal to BNT, and if so, it calculates the withdrawal amount using the _bntPool.withdrawalAmount() function. If the pool is not equal to BNT, it uses the _poolCollection() function to get the pool collection and then calls the withdrawalAmounts() function to calculate the withdrawal amount. The function then returns a WithdrawalAmounts memory object containing the total amount, base token amount, and BNT amount. (autogenerated documentation)
_tradeOutputAmount(uint256,bool) :
This function is used to calculate the output amount of a trade between two tokens. It takes in the source and target tokens, the amount of the trade, and a boolean indicating whether the calculation is based on the source amount or the target amount. It then determines whether either of the tokens is BNT, and if so, it uses the appropriate pool collection to calculate the output amount. If neither token is BNT, it first calculates the target amount using the source token's pool collection, and then uses the target token's pool collection to calculate the output amount. (autogenerated documentation)
_poolCollection() :
This function is used to retrieve the IPoolCollection associated with a given Token. It takes in a Token as an argument and returns an IPoolCollection. It first checks if the address of the IPoolCollection is valid, and if it is, it returns the IPoolCollection. If the address is not valid, it reverts with an InvalidToken error. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i bancor-network-info
copy icon

Last Publish

1/13/2023

Version

1.0.0

Creator

Bancor

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.