contract BbtcPool is IWbtcPoolBase{
  using SafeERC20 for IERC20;

  CurveInterfaceBbtc public pool_deposit;

  constructor() public{
    name = "Bbtc";
    lp_token_addr = address(0x410e3E86ef427e30B9235497143881f717d93c2A);
    //extra_token_addr = address(0x0);
    crv_gauge_addr = CRVGaugeInterfaceWbtc(0xdFc7AdFa664b08767b735dE28f9E84cd30492aeE);
    pool_deposit = CurveInterfaceBbtc(0xC45b2EEe6e09cA176Ca3bB5f7eEe7C47bF93c756);
  }

  //@_amount: wbtc amount
  function deposit_wbtc(uint256 _amount) internal {
    IERC20(wbtc).transferFrom(msg.sender, address(this), _amount);
    IERC20(wbtc).approve(address(pool_deposit), 0);
    IERC20(wbtc).approve(address(pool_deposit), _amount);
    uint256[4] memory uamounts = [uint256(0), 0, _amount, 0];
    pool_deposit.add_liquidity(uamounts, 0);
  }


  function withdraw_from_curve(uint256 _amount) internal{
    require(_amount <= get_lp_token_balance(), "withdraw_from_curve: too large amount");
    IERC20(lp_token_addr).approve(address(pool_deposit), _amount);
    pool_deposit.remove_liquidity_one_coin(_amount, 2, 0);
  }

  function get_virtual_price() public view returns(uint256){
    return PriceInterfaceWbtc(pool_deposit.pool()).get_virtual_price();
  }
}
function deposit_wbtc(uint256 _amount) internal {
  IERC20(wbtc).transferFrom(msg.sender, address(this), _amount);
  IERC20(wbtc).approve(address(pool_deposit), 0);
  IERC20(wbtc).approve(address(pool_deposit), _amount);
  uint256[4] memory uamounts = [uint256(0), 0, _amount, 0];
  pool_deposit.add_liquidity(uamounts, 0);
}

//@_amount: wbtc amount