Factor Docs
  • 🏭Introduction to Factor
  • Getting Started
    • đŸ•šī¸Quickstart
    • 🔗Supported Protocols
    • 🔐Strategy Cheatsheet
      • Swaps Cheatsheet
        • Conditional Market Order
        • Automated Market Order
        • Multi Swap
        • Automated Swap & Earn
        • Automated Scale Order
        • Scale Order Partial Fill Yield
        • Interest On Pending Trades
        • Leverage Trade
        • Leverage DCA
      • Lending Cheatsheet
        • Lending Pool Zap
        • Multi Lend
        • Market Making To Lending Switch
        • Earn Negative Interest
        • Carry Trade
        • Leveraged Staking Yields
        • Leveraged Fixed Yields
      • Borrowing Cheatsheet
        • Collateralized Borrow
        • Collateralized Borrow Zap
        • Multi Borrow
        • Debt Switching
        • Automated Debt Readjustments
        • Debt Refinancing
        • Asset Switching
      • Liquidity Provision Cheatsheet
        • Liquidity Pool Zap
        • Yield Farm Zap
        • Automated LP Adjustments
        • Yield Farm Adjustments
      • Flash Loan Cheatsheet
    • 🧠Strategy Explainers
      • Leverage
        • Leverage Performance Modelling
        • Leverage Long Simulation
        • Leverage Short Simulation
      • Yield
        • Yield Performance Modelling
      • PT Strategies
        • Leverage Long PT Simulation
      • Delta Neutral Yields
        • Levered USD & ETH Carry
    • 📖Glossary
  • Factor Discover
    • 🔍Factor Discover
      • Public Strategies User Guides
        • Deposit Into User Created Strategies
        • Withdraw From User Created Strategies
      • Leverage User Guides
        • Create A Leveraged Position
        • Adjust Position Leverage
        • Add Collateral To Position
        • Withdraw Collateral From Position
        • Repay Position Debt
      • Yield User Guides
        • Auto-compound Your Yields
      • PT User Guides
        • Redeem Your PT
      • APY Calculations
    • âš™ī¸Factor Operated Strategies
      • Yield Type Strategies
        • Additional rETH Yields On USDC Lend
        • Amplified rETH Yields On USDC Lend
        • Additional Liquid Staked ETH Yields On USDC Lend
        • Additional Liquid Restaked ETH Yields On USDC Lend
      • Trading Type Strategies
        • WBTC Base Switch On rETH For ETH & USDC Yields
      • Delta Neutral Type Strategies
        • Delta Neutral ETH With rETH & USDC Yields
  • Factor Studio
    • 🎨Factor Studio
      • Automated Strategies
      • Conditional Strategies
    • 🏠Private Strategies
      • User Guide
        • Private Strategy Creation
    • đŸ‘ĨPublic Strategies
      • User Guide
        • Public Strategy Creation
        • Create An Exit Strategy
        • Making Your Strategy Public
        • Strategy Execution
      • Security
      • Exit Strategy
    • đŸ—ī¸Strategy Builder
      • Building Blocks User Guide
        • Lend
        • Borrow
        • Swap
        • Flash Loan
    • 📜Studio Contracts
      • Leverage
        • FactorLeverageDescriptor.sol
        • FactorLeverageVault.sol
        • WrapperFactorLeverageVault.sol
      • LP Management
        • FactorLPVault.sol
        • FactorLPDescriptor.sol
  • Factor SDK
    • đŸ“ĻFactor SDK
    • â†”ī¸REST APIs
      • Utility APIs
        • Pricing
        • Stats
  • Factor Building Blocks
    • 🧱Factor Building Blocks
    • âžĄī¸Lend
    • âŦ…ī¸Borrow
    • 🔄Leverage
      • Concepts
        • Collateralized Lending & Borrowing
        • Looping
      • Leverage Dev Guides
        • Create Leveraged Position
        • Add Leverage To Position
      • Strategy Contracts
        • AAVEV3LeverageStrategy.sol
        • CompoundLeverageStrategy.sol
        • LodeStarLeverageStrategy.sol
        • RadiantLeverageStrategy.sol
        • SiloLeverageStrategy.sol
        • SiloYieldTokenStrategy.sol
        • TenderLeverageStrategy.sol
      • FAQ - Leverage Building Block
    • 💰Yield
      • Concepts
        • Yield Farming
        • Yield Aggregators
      • ⚡Zap
    • 🌊LP Management
      • Concepts
        • Automated Market Maker
        • Concentrated Liquidity
    • đŸĨŠStake
    • 🔀Swap
      • Concepts
        • Market Orders
        • DEX Aggregators
    • đŸĒ„Flash Loan
      • Concepts
        • Uncollateralized Lending & Borrowing
        • Flash Loan
  • Factor Adapters
    • 🔌Factor Adapters
    • 📜Adapter Contracts
      • Leverage
      • Yield
      • Swap
      • Flash Loan
  • Governance
    • đŸ›ī¸FactorDAO
      • Factor Flywheel
      • Factor Participants
      • Governance Incentive Calculations
        • FactorDAO Incentives Model (LTIPP)
      • User Guides
        • Stake FCTR
        • Governance Migration
      • Contracts
        • FactorDAO Contract Addresses
      • FactorDAO Multisig Addresses
      • Platform Fees
    • đŸĒ™FCTR Token
      • Staking and Governance
      • Tokenomics
      • Contract Addresses
      • FAQ - Tokenomics
    • âš–ī¸Factor Scale
      • Arbitrum Foundation LTIPP
      • Emission Multiplier Calculations
        • Emissions Multiplier Model
      • User Guides
        • Stake FCTR
        • Vote On Emissions Distribution
      • Contracts
        • Factor Scale Contract Addresses
      • ❔FAQ - Factor Scale
    • 🚀Factor Boost
      • Contracts
        • Factor Boost Contract Addresses
    • đŸ’ŧFactor Bribes
      • Contracts
        • Factor Bribes Contracts
  • Security
    • đŸ›Ąī¸Security
    • 📋Audits
      • PeckShield
        • Leverage Vault Wrapper
        • Silo Yield
        • Silo Leverage
        • Penpie
        • Factor Boost
      • SourceHat
        • FactorDAO Vaults
        • FCTR & Voting Escrow
  • Reference
    • Discover Pro dApp
    • Studio dApp
    • Discover dApp
    • Official Website
    • Press Kit
    • Partnership Form
    • Media Kit
    • Geo Restrictions
  • Community
    • Factor Contributors
    • X
    • Discord
    • Telegram
    • Medium
    • Email Enquiries
Powered by GitBook
On this page
  • Properties
  • Events
  • LeverageAdded()
  • LeverageRemoved()
  • LeverageClosed()
  • AssetSwitched()
  • Withdraw()
  • Repay()
  • Supply()
  • Borrow()
  • WithdrawTokenInCaseStuck()
  • RewardClaimed()
  • RewardClaimedSupply()
  • RewardClaimedRepay()
  • LeverageChargeFee()
  • Constructor
  • Modifiers
  • onlyOwner()
  • Methods
  • initialize() - public initializer
  • vaultManager() - public view returns
  • positionId() - public view returns
  • asset() - public view returns
  • debtToken() - public view returns
  • assetPool() - public view returns
  • debtPool() - public view returns
  • assetBalance() - public view returns
  • debtBalance() - public view returns
  • owner() - public view returns
  • addLeverage() - external payable
  • _flAddLeverage() - internal
  • removeLeverage() - external onlyOwner
  • _flRemoveLeverage() - internal
  • swapBySelf() - public returns
  • supply() - external onlyOwner
  • leverageFeeCharge() - internal returns
  • borrow() - external onlyOwner
  • repay() - external onlyOwner
  • withdraw() - external onlyOwner
  • switchAsset() - external onlyOwner
  • _flSwitchAsset() - internal
  • closeLeverage() - external onlyOwner
  • _flCloseLeverage() - internal
  • withdrawTokenInCaseStuck() - external onlyOwner
  • version() - external pure returns
  • _authorizeUpgrade() - internal view override onlyOnwer
  • receiveFlashLoan() - external override nonReentrant
  • claimRewards() - external onlyOwner
  • claimRewardsSupply() - external onlyOwner
  • claimRewardsRepay() - external onlyOwner

Was this helpful?

  1. Factor Building Blocks
  2. Leverage
  3. Strategy Contracts

CompoundLeverageStrategy.sol

PreviousAAVEV3LeverageStrategy.solNextLodeStarLeverageStrategy.sol

Last updated 1 year ago

Was this helpful?

Compound Docs:

Properties

Property
Type
Modifier
Description

balancerVault

address

public; constant

weth

address

public; constant

_positionId

uint256

private

The identifier for the strategy position that is maintained by the Factor Leverage Vault.

_vaultManager

IERC721

private

The address of the Vault Manager contract which facilitates vault admin operations (the underlying Leverage Vault contract in this instance).

_asset

IERC20

private

The address of the asset token (i.e. collateral and token being levered).

_debtToken

IERC20

private

The address of the debt token (i.e. borrow asset for flash loan).

_assetPool

address

public

The address of the asset lending pool.

_debtPool

address

public

The address of the debt lending pool.

flMode

uint8

private

The flash loan mode used to determine the relevant operations to receive the flash loan:

1 = addLeverage 2 = removeLeverage 3 = switchAsset 4 = switchDebt 5 = closeLeverage

Events

LeverageAdded()

Emitted when leverage is added to the position (i.e. this Leverage Strategy contract).

Arguments

Argument
Type
Description

amount

uint256

The amount of asset that was supplied to the lending pool.

debt

uint256

The amount of debt that was taken out as a flash loan denominated in _debtToken.

LeverageRemoved()

Emitted when leverage is removed from the leveraged position (i.e. this Leverage Strategy contract).

Arguments

Argument
Type
Description

debt

uint256

The amount of debt that was repaid.

LeverageClosed()

Emitted when the leveraged position is closed (i.e. fully repaid).

Arguments

Argument
Type
Description

assetBalance

uint256

The amount of asset that was returned after closing the position.

debtBalance

uint256

The amount of debt that was returned after closing the position.

AssetSwitched()

Emitted when the underlying collateral asset for the leveraged position is switched.

Arguments

Argument
Type
Description

newAsset

address

The address of the token used to collateralize the newly switched leverage position.

balance

uint256

The amount of newAsset that was collateralized.

Withdraw()

Emitted when asset is withdrawn from the Compound lending pool.

Arguments

Argument
Type
Description

amount

uint256

The amount of asset withdrawn from the Compound lending pool.

Repay()

Emitted when the Compound lending pool debt is repaid.

Arguments

Argument
Type
Description

amount

uint256

The amount of debt that was repaid.

Supply()

Emitted when asset is supplied to the Compound lending pool.

Arguments

Argument
Type
Description

amount

uint256

The amount of asset supplied to the Compound lending pool.

Borrow()

Emitted when debt is borrowed from the Compound lending pool (which collateralizes the provided asset).

Arguments

Argument
Type
Description

amount

uint256

The amount of debt that was borrowed from the Compound lending pool.

WithdrawTokenInCaseStuck()

Emitted when stuck tokens are withdrawn from the Strategy contract.

Arguments

Argument
Type
Description

tokenAddress

address

The address of the token to be withdrawn.

amount

uint256

The amount of asset withdrawn from the Compound lending pool.

RewardClaimed()

Emitted when Compound rewards are claimed as COMP tokens and transferred to the msg.sender (i.e. user).

Arguments

Argument
Type
Description

amount

uint256

The amount of rewards claimed denominated in COMP tokens.

RewardClaimedSupply()

Emitted when Compound rewards are claimed as asset tokens and transferred to the msg.sender (i.e. user).

Arguments

Argument
Type
Description

amount

uint256

The amount of rewards claimed denominated in COMP tokens.

RewardClaimedRepay()

Emitted when Compound rewards are claimed as debt tokens and transferred to the msg.sender (i.e. user).

Arguments

Argument
Type
Description

amount

uint256

The amount of rewards claimed denominated in COMP tokens.

LeverageChargeFee()

Emitted when a leverage fee is charged.

Arguments

Argument
Type
Description

amount

uint256

Constructor

Modifiers

onlyOwner()

Checks if the msg.sender address is equal to the owner of the position as maintained by the Leverage Vault contract.

Methods

initialize() - public initializer

Initializes the Strategy contract with the __positionId and initial address configurations.

Parameters

Params
Type
Description

__positionId

uint256

The identifier of the leveraged position as maintained by the underlying Leverage Vault contract.

_vaultManagerAddress

address

The address of the Vault Manager contract (the underlying Leverage Vault contract in this instance).

_assetAddress

address

The address of the Strategy's asset token (i.e. collateral and token being levered).

_debtAddress

address

The address of the Strategy's debt token (i.e. borrow asset for flash loan).

_assetPoolAddress

address

The address of the asset lending pool.

_debtPoolAddress

address

The address of the debt lending pool.

vaultManager() - public view returns

Returns the address of the Factor Vault Manager contract which contains vault admin functions (e.g. upgrade strategy, set fees, etc.).

Returns

Type
Description

address

The address of the Factor Vault Manager.

positionId() - public view returns

Returns the position identifier maintained by the underlying Leverage Vault contract. Each strategy implementation (such as this contract) is tied to a positionId.

Returns

Type
Description

uint256

The identifier of the position on the underlying Leverage Vault contract.

asset() - public view returns

Returns the address of the token configured as the main asset for this leverage Strategy contract (i.e. collateralized asset).

Returns

Type
Description

address

The address of the Strategy's _asset.

debtToken() - public view returns

Returns the address of the debt token which is used for taking out a flash loan (i.e. borrow token) for this Strategy contract.

Returns

Type
Description

address

The address of the Strategy's _debtToken .

assetPool() - public view returns

Returns the address of the Compound lending pool where the _asset is being collateralized.

Returns

Type
Description

address

The address of the Strategy's _assetPool.

debtPool() - public view returns

Returns the address of the Compound lending pool where the _debtToken was borrowed from.

Returns

Type
Description

address

The address of the Strategy's _debtPool.

assetBalance() - public view returns

Returns the total collateralized balance (i.e. _asset supplied) of the Strategy contract that is held by the Compound lending pool.

Returns

Type
Description

uint256

The total _asset supplied to the Compound lending pool.

debtBalance() - public view returns

Returns the outstanding debt balance (i.e. _debtToken borrowed) which the Strategy contract owes to the Compound lending contract.

Returns

Type
Description

uint256

The total _debtToken that needs to be repaid to the Compound lending pool.

owner() - public view returns

Returns the address of the owner of the leveraged position.

Returns

Type
Description

address

The address of the owner of the position.

addLeverage() - external payable

Adds leverage to a position by executing the following:

  1. Transfer asset from owner to the Strategy contract

  2. Supply asset to the Compound pool

  3. If debt is specified, executes a flash loan to borrow configured debt amount on Balancer vault

Parameters

Params
Type
Description

amount

uint256

The amount of _asset being supplied.

debt

uint256

The amount of _debtToken to be flash loaned.

data

bytes

The Balancer userData which in this context is used for pool-specific instructions needed to do the calculations.

Events

Events
Description

Emits the results of the leverage addition.

_flAddLeverage() - internal

An internal function which is meant to be called by the Balancer vault contract which repays the flash loan on Balancer by borrowing debt against the new asset collateralized amount on Compound.

  1. Supply newly acquired asset to the Compound pool (i.e. increase total collateral value)

  2. Borrow _debtToken from the Compound pool to repay Balancer flash loan

  3. Repay the Balancer flash loan

Parameters

Params
Type
Description

params

bytes

Encoded bytes data which consists of: amount = The number of _debtToken that was flash loaned. data = The Balancer userData.

feeAmount

uint256

The flash loan fee amount to be repaid denominated in _debtToken.

Removes a specified amount of leverage from the Strategy contract by executing the following:

  1. Query the outstanding debt on the Compound lending pool

  2. Executes a flash loan to borrow debt from the Balancer vault equivalent to the outstanding debt on the Compound pool

  3. Transfer withdrawn asset to the owner

Modifiers

Modifier
Description

onlyOwner

Parameters

Params
Type
Description

amount

uint256

The amount of asset being removed.

data

bytes

The Balancer userData which in this context is used for pool-specific instructions needed to do the calculations.

Events

Events
Description

Emits the results of the leverage removal.

_flRemoveLeverage() - internal

An internal function which is meant to be called by the Balancer vault contract which repays the flash loan on Balancer by withdrawing asset from the Compound lending pool.

  1. Queries the outstanding debt on the Compound lending pool

  2. Repays all of the outstanding debt on Compound

  3. Calculates the remaining Balancer flash loan debt outstanding

  4. Borrow the oustanding flash loan debt amount (including fees) from Compound lending pool

  5. Repay the Balancer flash loan

Parameters

Params
Type
Description

params

bytes

Encoded bytes data which consists of: amount = The number of _asset that is being removed from the Strategy contract. data = The Balancer userData.

feeAmount

uint256

The flash loan fee amount to be repaid denominated in _debtToken.

swapBySelf() - public returns

Allows the msg.sender to conduct a swap via the OpenOcean aggregator.

Parameters

Params
Type
Description

tokenIn

address

The address of the token being swapped from.

tokenOut

address

The address of the token being swapped to.

amount

uint256

The amount of tokenIn being swapped.

data

bytes

The bytes data which consists of the swap method and params.

Returns

Type
Description

uint256

The amount of tokenOut resulting from the swap minus the leverage strategy fees.

Enables the owner to transfer strategy asset from the msg.sender(i.e. depositor) to the Strategy contract which is then supplied to the Compound lending pool. The Strategy contract will hold the balance on behalf of the owner.

Modifiers

Modifier
Description

onlyOwner

Parameters

Params
Type
Description

amount

uint256

The amount of asset that was used for leverage.

Events

Events
Description

Emits the amount of asset that was supplied.

leverageFeeCharge() - internal returns

Charges the fee for the leverage strategy and transfers the fee to the fee recipient. The fee configs are maintained by the Vault Manager contract.

Parameters

Params
Type
Description

amount

uint256

The amount of token that was used for leverage.

token

address

Events

Events
Description

Emits the leverage fee that was charged.

Returns

Type
Description

uint256

The leverage fee charged denominated in token.

Enables the owner to utilize the collateralized asset in the Compound lending pool to borrow the specified amount of debt. The debt is transferred to the msg.owner (i.e. owner) with the Strategy contract holding the debt on behalf of the owner.

Modifiers

Modifier
Description

onlyOwner

Parameters

Params
Type
Description

amount

uint256

The amount of debt to be borrowed.

Events

Events
Description

Emits the amount of debt that was borrowed.

Enables the owner to repay a specified amount of the debt for a borrow position on the Compound lending pool. The debt is repaid on behalf of the Strategy contract which holds the owner's debt obligations.

Modifiers

Modifier
Description

onlyOwner

Parameters

Params
Type
Description

amount

uint256

The amount of debt to be repaid.

Events

Events
Description

Emits the amount of debt that was repaid.

Enables the owner to withdraw a specified amount of asset from the Compound lending pool. The Strategy contract executes the withdrawal as it holds deposit balance on behalf of the owner. The corresponding amount of asset is transferred to the owner address.

Note that due to accrued fees to the iToken, the amount returned by the Compound lending pool might be higher than the given amount. In such cases, the higher of the expected amount or final amount is returned to the owner.

Modifiers

Modifier
Description

onlyOwner

Parameters

Params
Type
Description

amount

uint256

The amount of asset to be withdrawn.

Events

Events
Description

Emits the amount of asset that was withdrawn.

Switches the position's underlying asset to a newly specified newAsset token.

  1. Query the outstanding debt on the Compound lending pool

  2. Executes a flash loan to borrow debt from the Balancer vault equivalent to the outstanding debt on the Compound vault

Allowed New Asset Tokens

The newAsset address must have been registered by the Vault Manager. The list of approved debt tokens is maintained by the Leverage Vault contract.

Amount Validation

The Factor SDK provides convenience functions for the safe handling of the specified amount. By utilizing the Factor SDK, you can avoid spending gas on misconfigured amounts and minimize dust amounts from swaps.

Parameters

Params
Type
Description

newAsset

address

The address of the token which will be switched with the current asset.

amount

uint256

The amount of existing asset that is being switched for the newAsset.

data

bytes

The Balancer userData which in this context is used for pool-specific instructions needed to do the calculations.

_flSwitchAsset() - internal

An internal function which is meant to be called by the Balancer vault contract which switches the asset collateralizing the leveraged position.

  1. Queries the outstanding debt on the Compound lending pool

  2. Repays all of the outstanding debt on Compound

  3. Withdraws all of the asset from the existing position on Compound

  4. Change the Factor Strategy contract properties to align with the newAsset

  5. Supply the swapped newAsset to the newAsset Compound lending pool

  6. Borrow the initial debt balance from Compound using the newAsset as collateral

  7. Repay the Balancer flash loan

Parameters

Params
Type
Description

params

bytes

Encoded bytes data which consists of: newAsset = The address of the token that is being used as the new collateral amount = The number of _asset that is being switched. data = The Balancer userData.

feeAmount

uint256

The flash loan fee amount to be repaid denominated in _debtToken.

Events

Events
Description

Emits the results of the asset switch and new asset balance denominated in newAsset.

Closes the leveraged position and transfers the remaining asset and debt amounts to the owner. If the asset amount specified is greater than the debt value, the position value will be returned in debt tokens.

  1. Executes a flash loan to borrow existing debt from the Balancer vault equivalent to the outstanding debt on the Compound lending pool

  2. Transfers the remaining asset and debt tokens to the owner (i.e. depositor)

Modifiers

Modifier
Description

onlyOwner

Parameters

Params
Type
Description

amount

uint256

The amount of asset that will be swapped for debt.

data

bytes

The Balancer userData which in this context is used for pool-specific instructions needed to do the calculations.

Events

Events
Description

Emits the results of the leverage position closure.

_flCloseLeverage() - internal

An internal function which is meant to be called by the Balancer vault contract which switches the debt of the leveraged position with a provided newDebtToken.

  1. Queries the outstanding debt on the Compound lending pool

  2. Repays all of the outstanding debt on Compound

  3. Withdraws all of the asset from the existing position on Compound

  4. Repay the Balancer flash loan using the acquired debt

Parameters

Params
Type
Description

params

bytes

Encoded bytes data which consists of: amount = The number of asset that is swapped for debt data = The Balancer userData.

feeAmount

uint256

The flash loan fee amount to be repaid denominated in the old debt.

Enables the owner to withdraw any tokenAddress that is stuck in the Strategy contract.

Modifiers

Modifier
Description

onlyOwner

Parameters

Params
Type
Description

tokenAddress

address

The address of the token to withdraw.

amount

uint256

The amount of tokenAddress to be withdrawn.

Events

Events
Description

Emits the amount of tokenAddress that was withdrawn as well as the tokenAddress.

version() - external pure returns

Returns the strategy version which is hardcoded based on contract deployment.

Returns

Type
Description

string

The Strategy contract version.

Modifiers

Modifier
Description

onlyOwner

Parameters

Params
Type
Description

newImplementation

address

The address of the proposed Strategy contract.

receiveFlashLoan() - external override nonReentrant

An external function meant to be called by the Balancer vault contract to check the validity of the vault receiving the flash loan (i.e. can the flash loan be repaid). Reads the configured flMode at the time of execution to determine the correct operation to call.

Modifiers

Modifier
Description

nonReentrant

Parameters

Params
Type
Description

tokens

address[]

The list of token addresses associated with the flash loan operations.

amounts

uint256[]

The amount of each token in tokens to be used for the flash loan operation. The order of each token amount must correspond with the order of the token address in tokens.

feeAmounts

uint256[]

The flash loan fee amount of each token in tokens to be used for the flash loan operation. The order of each token amount must correspond with the order of the token address in tokens.

params

bytes

The Balancer userData passed in as calldata.

Allows the position owner to claim Compound rewards in COMP tokens.

Modifiers

Modifier
Description

onlyOwner

Events

Events
Description

Emits the amount of rewards claimed. Denominated in COMP.

Allows the position owner to claim Compound rewards in asset tokens.

Modifiers

Modifier
Description

onlyOwner

Parameters

Params
Type
Description

amountOutMinimum

uint256

The minimum amount of asset received from the claim else the transaction reverts.

Events

Events
Description

Emits the amount of rewards claimed. Denominated in COMP.

Allows the position owner to claim Compound rewards in debt tokens.

Modifiers

Modifier
Description

onlyOwner

Parameters

Params
Type
Description

amountOutMinimum

uint256

The minimum amount of debt received from the claim else the transaction reverts.

Events

Events
Description

Emits the amount of rewards claimed. Denominated in COMP.

The address of the (to facilitate flash loans).

The address of the .

The leverage fee charged denominated in token passed in .

Factor Strategy contracts implements OpenZeppelin's upgradeable contracts design and locks the strategy contract upon initialization to avoid contract takeover by an attacker. More info can be found on .

Balancer vault calls to trigger flash swap and flash loan debt repayment via

Swap debt for asset (via )

removeLeverage() - external

Balancer vault calls to trigger flash swap and flash loan debt repayment via

Ensures that only the specified owner of the contract is able to execute administrative tasks. More info on .

Withdraws the specified amount of asset (as per )

Swap the withdrawn asset for debt (via )

supply() - external

Ensures that only the specified owner of the contract is able to execute administrative tasks. More info on .

The token which will be collected as fees (i.e. the tokenOut from ).

borrow() - external

Ensures that only the specified owner of the contract is able to execute administrative tasks. More info on .

repay() - external

Ensures that only the specified owner of the contract is able to execute administrative tasks. More info on .

withdraw() - external

Ensures that only the specified owner of the contract is able to execute administrative tasks. More info on .

switchAsset() - external

Balancer vault calls to trigger flash swap and flash loan debt repayment via

Swaps the specified amount (per ) of the withdrawn asset for newAsset (via )

closeLeverage() - external

Balancer vault calls to trigger flash swap and flash loan debt repayment via

Ensures that only the specified owner of the contract is able to execute administrative tasks. More info on .

Swaps the specified amount of asset (per ) for debt (via )

withdrawTokenInCaseStuck() - external

Ensures that only the specified owner of the contract is able to execute administrative tasks. More info on .

_authorizeUpgrade() - internal view override

An internal function that is meant to be called by the that checks if the new implementation is registered by the Factor Vault Manager.

Ensures that only the specified owner of the contract is able to execute administrative tasks. More info on .

Ensures that there are no nested (reentrant calls). More info on .

claimRewards() - external

Ensures that only the specified owner of the contract is able to execute administrative tasks. More info on .

claimRewardsSupply() - external

Ensures that only the specified owner of the contract is able to execute administrative tasks. More info on .

claimRewardsRepay() - external

Ensures that only the specified owner of the contract is able to execute administrative tasks. More info on .

🔄
https://docs.compound.finance/
OpenZeppelin Docs
UUPSUpgradeable contract
receiveFlashLoan()
_flAddLeverage()
swapBySelf()
onlyOwner
receiveFlashLoan()
_flRemoveLeverage()
removeLeverage()
swapBySelf()
onlyOwner
onlyOwner
onlyOwner
onlyOwner
onlyOwner
receiveFlashLoan()
_flSwitchAsset()
switchAsset()
swapBySelf()
onlyOwner
receiveFlashLoan()
_flCloseLeverage()
closeLeverage()
swapBySelf()
onlyOwner
onlyOnwer
onlyOwner
onlyOwner
onlyOwner
Balancer Vault contract
WETH token
OpenZeppelin Docs
OpenZeppelin Docs
OpenZeppelin Docs
OpenZeppelin Docs
OpenZeppelin Docs
OpenZeppelin Docs
OpenZeppelin Docs
OpenZeppelin Docs
OpenZeppelin Docs
OpenZeppelin Docs
OpenZeppelin Docs
OpenZeppelin Docs
leverageFeeCharge()
LeverageAdded()
LeverageRemoved()
Supply()
swapBySelf()
LeverageChargeFee()
Borrow()
Repay()
Withdraw()
AssetSwitched()
LeverageClosed()
WithdrawTokenInCaseStuck()
RewardClaimed()
RewardClaimedSupply()
RewardClaimedRepay()