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)
initialize() :
This function is an external initializer for the BancorPortal contract. It is used to set up the contract and initialize its state. It calls the __BancorPortal_init() function, which is responsible for setting up the contract's variables and functions. (autogenerated documentation)
__BancorPortal_init() :
This function is used to initialize the BancorPortal contract. It calls the __ReentrancyGuard_init() and __Upgradeable_init() functions to set up the reentrancy guard and upgradeable features, and then calls the __BancorPortal_init_unchained() function to complete the initialization process. (autogenerated documentation)
__BancorPortal_init_unchained() :
This function is used to initialize the Bancor Portal contract. It sets the initial values for the contract's state variables and sets up the necessary logic for the contract to function properly. It also sets up the logic for the contract to interact with other contracts, such as the Bancor Network and the Bancor Protocol. This function is only called once during the contract's deployment. (autogenerated documentation)
migrateUniswapV2Position(uint256) :
This function allows users to migrate their Uniswap V2 positions to a new pool. It takes in two tokens and a pool token amount as parameters, and returns a PositionMigration object containing the amounts of each token in the new pool. The function first calls the _migrateUniswapV2Position function, which uses the UniswapV2Router and UniswapV2Factory contracts to migrate the position. It then emits an UniswapV2PositionMigrated event, which contains information about the migrated position. Finally, it returns the PositionMigration object containing the amounts of each token in the new pool. (autogenerated documentation)
migrateSushiSwapPosition(uint256) :
This function migrates a position from SushiSwap to UniswapV2. It takes in three parameters: the two tokens involved in the position, and the amount of the pool token. It then calls the _migrateUniswapV2Position function, which performs the actual migration. The function then emits an event to notify the caller of the migration result. Finally, it returns a PositionMigration struct containing the amounts of tokens A and B in the new position. (autogenerated documentation)
_migrateUniswapV2Position(uint256,address) :
This function is used to migrate a Uniswap V2 position from one provider to another. It first checks if the tokens provided are supported by the network, then it transfers the pool token amount from the provider to the contract. It then removes the liquidity from the Uniswap V2 pair and deposits the tokens into the new provider's account. Finally, it returns a MigrationResult object containing the details of the migration. (autogenerated documentation)
_deposit(uint256,address) :
This function is used to deposit a given amount of a given token into the network. It first checks if the token is native or not, and if it is native, it calls the depositFor() function of the network contract with the given amount and token address. If the token is not native, it calls the safeApprove() function of the token contract to approve the network contract to transfer the given amount of tokens, and then calls the depositFor() function of the network contract with the given amount and token address. (autogenerated documentation)
_transferToProvider(uint256,address) :
This function is used to transfer a specified amount of a given token to a specified provider. If the token is a native token, the function sends the amount as a payable transaction to the provider. If the token is an ERC20 token, the function uses the token's safeTransfer function to transfer the amount to the provider. (autogenerated documentation)
_uniV2RemoveLiquidity(uint256) :
This function is used to remove liquidity from a Uniswap V2 pool. It takes in two tokens, a Uniswap V2 pair, a Uniswap V2 router, and a pool token amount as parameters. It then calls the appropriate removeLiquidity function on the router, depending on whether the tokens are native or not. The function also sets a deadline for the transaction to be completed. (autogenerated documentation)
_getUniswapV2Pair() :
This function is used to get the UniswapV2Pair from the UniswapV2Factory. It takes two tokens as parameters and checks if they are native tokens or not. If they are native tokens, it sets the address to the address of the WETH token. It then calls the getPair function of the UniswapV2Factory with the two token addresses and returns the IUniswapV2Pair associated with the two tokens. (autogenerated documentation)
_isWETH() :
This function checks if a given token is the WETH token. It does this by comparing the address of the given token to the address of the WETH token stored in the _weth variable. If the two addresses match, the function returns true, otherwise it returns false. (autogenerated documentation)