Acta Finance
Search…
🌀
Swap
Acta Swap works with an Automatic Market Maker (AMM). An AMM is a smart contract that regulates trading. Since smartcontracts are decentralized, users effectively trade with other users’ provided liquidity. ActaFi Swap users can also trade with a margin provided by funding contracts that are provided with a varied maturity term and funding cost. Margin takers initiate the swap with margin following several steps:
  1. 1.
    Reserving a funding contract from the funding pool covering the required position
  2. 2.
    Providing the required collateral to the settlment pool to cover the interest and immediate changes to the value of the position taken
  3. 3.
    Creating a position by executing the swap in the platform
The lender receives interest from the borrower in exchange for the margin loaned, while borrowers’ crypto assets are counted as collateral to secure investors’ investment. This serves as a guarantee for the lender; if anything goes wrong, the collateral is used as a form of compensation.
Once the position is closed by executing a swap, the lender is returned his funding from the funding pool as well as the interest accrued from the setllement pool while the margin taker gets back his collateral and takes the profit from the position after settling the costs for the funding. ActaFi Oracle closely follows the price feeds from multiple sources and monitors all the active positions. In case the price changes hitting the margin price, it will trigger the margin call. The funding contract will be closed early and after paying the accrued interest the remaining collateral will be paid to the margin taker.
Operations are fully decentralised with the funds and positions held securely in the smart contracts. The funds are backed by the users provided funds via funding pools and liquidity pools giving new opportunities for swap users to earn income with a multiplier.

Factory

The main factory contract takes care of initialising the Pools setting the global settings for the Swap.

createLiquidityPool()

Initiating the liquidity pool allows the possibility to create various pools that operate under different fee settings and token combinations.

createSettlementsPool()

The settlments pool stores the collateral, accrued interest and insurance funds settling the claims after the margin positions are closed.

createFundingPool()

The structure for the funding pools enable the users to create flexible maturity and terms to fund the margin positions for the swap.

setOwner()

Set the owner for the Factory contract, allowing to change the setup of the pools.

enableFeeAmount()

Enable new fee structures for the new initiated pools. enableMarginMultiplier() Enable different multiplers for margin swap.

enableCollateralAmount()

An array of possible collateral selections for the initiated liquidity pools.

enableFudingTerm()

Set the possible funding terms for funding contracts.

Token

The general standard ERC–20 protocol is followed enabling the token trasnfers and balance lookups

totalSupply()

The total supply of the token can be retrieved.

balanceOf()

The balance of the token can be retrieved.

transfer()

Initiates the transfer of the tokens that the user or smart contract holds.

allowance()

The amount allowed to spend by an approved counterparty or smart contract.

approve()

Approve the allowance for a counterparty or smart contract.

mint()

Increase the supply of the tokens.

burn()

Decrease the supply of the token.

LiquidityPool

Initiating the liquidity pool allows the possibility to create various pools that operate under different fee settings and token combinations

initialize()

Initializing the liquidity pool provides the users with an option to provide their assets as liquidity for the swap. collect() Collect the accrued fees for active positions for the swap.
swap()
The swap executes the swap between token0 and token1 either directly or indirectly.

token0()

Get information about the token0 for the pool.

token1()

Get information about the token1 for the pool.

fee()

The total amount of fees gathered

liquidity()

The liquidity positions’ information in the liquidity pool.

tickSpacing()

A parameter that defines the spacing of liquidity according to the price points defined for the pool.

setTickSpacing()

Update the spacing of the liquidity price points.

protocolFees()

Get information about the fee for swaps

setFeeProtocol()

Set the swap fee from availbale options as defined by the swap factory contract

setMarginMultiplier()

Enable margin with possible margin multiplers as defined by the swap factory contract

setCollateralAmount()

Set the percentage of funds that have to be provided to open a margin position

distributeProtocolFees()

Distribute the fees paid by the users, when executing swaps to support the development and other programs.

LiquidityPosition

A liquidity position holds information about the specific liquidity amounts and fees when the user provides it to be used for the protocol users.

create()

Create a position by providing the liquidity for the two token pairs. The liquidity position can be added with upper and lower ticks concentrating the liquidity to a specific price range in the liquidity pool.

positions()

Returns an array of positions that where created for a specific liquidity pool. mint() Mint liquidity provider tokens for liquidity position created. burn() Burn liquidity prodiver tokens when liquidity position is closed.

increase()

Increase the value of an existing position adding the value of the new position.

decrease()

Decrease the value of an existing by removing the value of the new position.

claim()

claim fees accrued for the liquidity position

MarginPosition

A margin pasition holds information about the reserved funding amount, collateral, interest accrued and margin price

create()

A margin position is initiated after the funding amount is reserved in the funding pool, collateral transferred to settlements pools and a swap is executed for the token amount with margin.

positions()

Returns an array of positions that where created for a specific liquidity pool. close() Initiates a reverse transaction on the open token amount with margin, refunds the remaining collateral atfer all interest payments and fees are deducted, releases the locked funding position in the funding pool.

addMargin()

Add additional token amount to the collateral of open position derisking the position.

marginCall()

Execute a forceful close on the margin position by the owner if the margin price is reached.

SwapQuote

Provides an output for estimation and displaying it to the Swap user. The quote can be estimated by providing token0 or token1 as an input also specifying the type if the swap has to executed with a margin. Quote also provides a split output by estimating the partial transactions within internal and extenral pools

quoteExactInput()

Provides an estimation of fees for executing the swap with margin input as token0, receiving token1

quoteExactOutput()

Provides an estimation of fees for executing the swap with margin input as token1, receiving token0

quoteExactMarginInput()

Provides an estimation of fees for funding the margin and executing the swap with margin input as token0, receiving token1.

quoteExactMarginOutput()

Provides an estimation of fees for funding the margin and executing the swap with margin input as token1, receiving token0.

SwapRouter

Execute direct or indirect swap between the two tokens token0 and token1. The swap is routed to the most efficient liquidity pools, provided the cost the change in liquidity and available margin in the funding pool.

exactInput()

Executes the swap with margin input as token0, receiving token1

exactOutput()

Executes the swap with margin input as token1, receiving token0

exactMarginInput()

Executes the swap with margin input as token1, receiving token0

exactMarginOutput()

Executes the swap with margin input as token0, receiving token1

SettlementsPool

The settlements pool acts as an escrow account for open margin positions before they are settled. Each pool holds the amount of tokens as collateral for the open margin position, any unclaimed interest by the funding position provider and an insurance fund that receives a percentage of all the realized lending profits.

initialize()

The settlements pool is initialised when at least one margin multiplier is configured for the liquidity pool.

token()

Get information about the token in the settlements pool.

settle()

Transfer settlement: accrued interest, refund funding position to the owner. claimInterest() Transfer the accrued interest to the owner of the funding position. collaterals() View information about the current collaterals stored in the contract. payCollateral() Transfer the collateral for a margin position. refundCollateral() Invoked by the closed margin position or liquidation event after the settlment to the funding position. liquidate() Liquidate position, invoked only by the Oracle. Invokes the settlement for the funding position. setInsurance() Set the fee percentage that is reserved as insurance for the position when accrued interest is claimed. distributeProtocolFees() Invoked by the owner of the settlements pool distributing the fees from the realised margin swap profits and accrued interest.

FundingPool

A funding pool is initiated for the funding / lending providers with a possibility to provide their liquidity as a source of funds for margin swap. Each position in the funding pool can have a pre-defined maturity term and a user defined interest percentage that is calculated and accrued daily. Funding pools are initiated only for the most actively used swap pairs with the lowest margin multiplier, increasing the possible multiplier corresponding to the total value of positions in the funding pool.

initialize()

Initialised the funding pool for a specific token.

token()

Returns information about the token for the funding pool.

positions()

Returns an information of all currently active / locked funding positions

FundingPosition

A funding position is created after the user transfers his liquidity to the funding position contract indicating the daily interest and maturity term requirement which is started to be estimated only when the position is taken by the margin taker. The position cannot be cancelled if it is taken by the margin taker and can only be closed at the maturity date of the contract, unless the position is closed early with a margin call by the Oracle.

create()

Create the funding position indicating the daily interest and maturity term requirement

lock()

Indicate an open margin position requirement and lock the funding position.

unlock()

Unlock the funding position once the margin position is closed.

close()

Close the funding position removing it from the Funding pool.

enableAutoFund()

User can call the auto fund option for his open position to indicate that it should remain in the funding pool as a new position with the best possible interest rate and lending duration as a new position once the existing position reaches maturity or is closed.

quoteExact()

Provides an estimated returns calculation to the user according to the selected funding amount, interest and maturity term.