Documentation
¶
Index ¶
- Variables
- func ETH2WETH(token common.Address, tokenInfos daemons.TokenInfos) common.Address
- type Balancer
- func (b *Balancer) Estimate(amount *big.Int, token string, pool common.Address) (tokensOut map[string]*big.Int, poolTokenOut *big.Int, err error)
- func (b *Balancer) MultiAssetsInvest(investments []Investment, userAddress common.Address, pool common.Address) (*MultiAssetsInvestResult, error)
- func (b *Balancer) Prepare(amount *big.Int, userAddr common.Address, inToken string, pool common.Address, ...) (*PrepareResult, error)
- func (b *Balancer) RemoveLiquidity(amount *big.Int, account, pool common.Address) (*RemoveLiquidityResult, error)
- type DexPool
- func (dp DexPool) GetPoolBoundTokens(pool common.Address) ([]types.PoolToken, error)
- func (dp DexPool) GetPools() (daemons.PoolInfos, error)
- func (dp DexPool) PackNecessaryAllowances(al *alchemy.Alchemy, user, pool common.Address, investments ...Investment) (map[string]PrependApprove, error)
- func (dp DexPool) RequireTokenBound(token common.Address, pool common.Address) bool
- type EstimateResult
- type HarvestReward
- func (h *HarvestReward) Estimate(amount *big.Int, inToken string, pool common.Address) (tokensOut map[string]*big.Int, poolTokenOut *big.Int, err error)
- func (h *HarvestReward) MultiAssetsInvest(investments []Investment, userAddress common.Address, pool common.Address) (*MultiAssetsInvestResult, error)
- func (h *HarvestReward) Prepare(amount *big.Int, userAddr common.Address, inToken string, pool common.Address, ...) (*PrepareResult, error)
- func (h *HarvestReward) RemoveLiquidity(amount *big.Int, account, pool common.Address) (*RemoveLiquidityResult, error)
- type IPoolInvestAgent
- type Investment
- type MultiAssetsInvestResult
- type PrepareResult
- type PrependApprove
- type RemoveLiquidityResult
- type Sushiswap
- func (s *Sushiswap) Estimate(amount *big.Int, token string, pool common.Address) (tokensOut map[string]*big.Int, lp *big.Int, err error)
- func (s *Sushiswap) MultiAssetsInvest(investments []Investment, userAddress common.Address, pool common.Address) (*MultiAssetsInvestResult, error)
- func (s *Sushiswap) Prepare(amount *big.Int, userAddr common.Address, inToken string, pool common.Address, ...) (*PrepareResult, error)
- func (s *Sushiswap) RemoveLiquidity(amount *big.Int, account, pool common.Address) (*RemoveLiquidityResult, error)
- type UniswapV2
- func (u *UniswapV2) Estimate(amount *big.Int, token string, pool common.Address) (tokensOut map[string]*big.Int, lp *big.Int, err error)
- func (u *UniswapV2) EstimateByTokenSymbols(amount *big.Int, inToken, token0, token1 string) (tokensOut map[string]*big.Int, lp *big.Int, err error)
- func (u *UniswapV2) MultiAssetsInvest(investments []Investment, userAddress common.Address, pool common.Address) (*MultiAssetsInvestResult, error)
- func (u *UniswapV2) Prepare(amount *big.Int, userAddr common.Address, inToken string, pool common.Address, ...) (*PrepareResult, error)
- func (u *UniswapV2) RemoveLiquidity(amount *big.Int, account, pool common.Address) (*RemoveLiquidityResult, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // contract with only the Invest method UniswapInvestAddress = common.HexToAddress("0x73a6DbA24743Ce32f645FeeD8c95F9e0d7494eb9") // contract with only the MultiAssetInvest method UniswapMultiInvestAddress = common.HexToAddress("") BalancerInvestAddress = common.HexToAddress("") BalancerMultiInvestAddress = common.HexToAddress("") SushiswapInvestAddress = common.HexToAddress("0xa43a0d62de25527eb66dd9f00886f2ab9d1bd31e") )
Functions ¶
Types ¶
type Balancer ¶
type Balancer struct {
DexPool
}
func (*Balancer) MultiAssetsInvest ¶
func (b *Balancer) MultiAssetsInvest(investments []Investment, userAddress common.Address, pool common.Address) (*MultiAssetsInvestResult, error)
func (*Balancer) RemoveLiquidity ¶
type DexPool ¶
func (DexPool) GetPoolBoundTokens ¶
func (DexPool) PackNecessaryAllowances ¶
func (dp DexPool) PackNecessaryAllowances(al *alchemy.Alchemy, user, pool common.Address, investments ...Investment) (map[string]PrependApprove, error)
type EstimateResult ¶
type HarvestReward ¶
type HarvestReward struct {
DexPool
}
func (*HarvestReward) MultiAssetsInvest ¶
func (h *HarvestReward) MultiAssetsInvest(investments []Investment, userAddress common.Address, pool common.Address) (*MultiAssetsInvestResult, error)
func (*HarvestReward) RemoveLiquidity ¶
func (h *HarvestReward) RemoveLiquidity(amount *big.Int, account, pool common.Address) (*RemoveLiquidityResult, error)
type IPoolInvestAgent ¶
type IPoolInvestAgent interface { Estimate(amount *big.Int, inToken string, pool common.Address) (tokensOut map[string]*big.Int, poolTokenOut *big.Int, err error) Prepare(amount *big.Int, userAddr common.Address, inToken string, pool common.Address, slippage int64, estimateLP *big.Int) (*PrepareResult, error) GetPools() (daemons.PoolInfos, error) GetPoolBoundTokens(pool common.Address) ([]types.PoolToken, error) RequireTokenBound(token common.Address, pool common.Address) bool MultiAssetsInvest(investments []Investment, userAddress common.Address, pool common.Address) (*MultiAssetsInvestResult, error) RemoveLiquidity(amount *big.Int, account, pool common.Address) (*RemoveLiquidityResult, error) }
func New ¶
func New(dex string) (IPoolInvestAgent, error)
type Investment ¶
type MultiAssetsInvestResult ¶
type MultiAssetsInvestResult struct { NecessaryApproves map[string]PrependApprove Tokens []estimatedToken ContractAddress common.Address CallData []byte }
type PrepareResult ¶
type PrepareResult struct { Data string `json:"data"` TxFee string `json:"tx_fee"` ContractAddr string `json:"contract_addr"` FromTokenAddr string `json:"from_token_addr"` FromTokenAmount string `json:"from_token_amount"` Allowance string `json:"allowance"` AllowanceSatisfied bool `json:"allowance_satisfied"` AllowanceData string `json:"allowance_data"` }
type PrependApprove ¶
type RemoveLiquidityResult ¶
type RemoveLiquidityResult struct { Approve *PrependApprove CallData []byte Contract common.Address }
type Sushiswap ¶
type Sushiswap struct {
DexPool
}
func (*Sushiswap) MultiAssetsInvest ¶
func (s *Sushiswap) MultiAssetsInvest(investments []Investment, userAddress common.Address, pool common.Address) (*MultiAssetsInvestResult, error)
func (*Sushiswap) RemoveLiquidity ¶
type UniswapV2 ¶
type UniswapV2 struct {
DexPool
}
func (*UniswapV2) EstimateByTokenSymbols ¶
func (u *UniswapV2) EstimateByTokenSymbols(amount *big.Int, inToken, token0, token1 string) (tokensOut map[string]*big.Int, lp *big.Int, err error)
TODO: autopilot exchange path because we are doing estimation, so ETH can be seen directly as WETH, although an extra step will indeed take place when doing the real deal
func (*UniswapV2) MultiAssetsInvest ¶
func (u *UniswapV2) MultiAssetsInvest(investments []Investment, userAddress common.Address, pool common.Address) (*MultiAssetsInvestResult, error)
MultiAssetsInvest allows investers using their already owned token pair to add liquidity
func (*UniswapV2) RemoveLiquidity ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.