xWin Fund

FundV2

userAvgPrice

struct userAvgPrice {
  uint256 shares;
  uint256 avgPrice;
}

validInvestors

mapping(address => bool) validInvestors

Whitelisted addresses that can use the fund if openForPublic=false

performanceMap

mapping(address => struct FundV2.userAvgPrice) performanceMap

User average price, and share amount for performace fee calculations

waivedPerformanceFees

mapping(address => bool) waivedPerformanceFees

Priviliged addresses with fees waived for this fund (e.g. manager/platform)

TargetWeight

Stores the weight of the target asset

targetAddr

Array containing target asset addresses

priceMaster

Address of price master

xWinSwap

Address of swap engine

lockingAddress

Address of locked staking contract, for performance fee discounts

managerAddr

Address of manager wallet to receive management fees

managerRebAddr

Address of manager account, which can execute manager only functions

platformWallet

Address of platform wallet to receive platform fees

lastFeeCollection

Last block where fees were collected

nextRebalance

Next available block

pendingMFee

Pending shares to award to manager

pendingPFee

Pending shares to award to platform

managerFee

manager fee in 4 decimals, e.g 100% = 10000

platformFee

platform fee in 4 decimals, e.g 100% = 10000

smallRatio

performFee

platform fee in 4 decimals, e.g 100% = 10000

UPMultiplier

Unit price multiplier

openForPublic

Received

ManagerFeeUpdate

ManagerOwnerUpdate

initialize

init

collectFundFee

Mints management fee to manager wallet, sets pendingMFee to 0

collectPlatformFee

Mints platform fee to platform wallet, sets pendingPFee to 0

_calcFundFee

Updates pending management/platform fee

createTargetNames

Sets target token addresses and weights for the fund

Rebalance

Performs rebalance with new weight and reset next rebalance period

Rebalance

deposit

deposit

Deposits baseToken into the fund, and receives shares based on the fund's unitPrice

Parameters

Name
Type
Description

amount

uint256

Amount of baseToken to deposit

Return Values

Name
Type
Description

[0]

uint256

shares Amount of shares minted to depositor

_deposit

withdraw

withdraw

Withdraws from the fund by burning shares, liquidating assets into baseToken and transfering to user

Parameters

Name
Type
Description

amount

uint256

Amount of shares to withdraw

Return Values

Name
Type
Description

[0]

uint256

amount Amount of baseTokens transferred to depositor

_withdraw

MoveNonIndexNameToBase

fund owner move any name back to baseToken

emergencyRedeem

get the proportional token without swapping it in emergency case

_getTransferAmt

Calc return balance during redemption

_getMintQty

Calc qty to issue during subscription

_getActiveOverWeight

Calculates the weight difference between the current fund and target

Parameters

Name
Type
Description

destAddr

address

token address

totalvalue

uint256

fund vault value

Return Values

Name
Type
Description

destRebQty

uint256

Amount of tokens to sell if overweight

destActiveWeight

uint256

amount of weight the token is off from target

overweight

bool

bool to indicate if token is overweight

_rebalance

_sellOverWeightNames

Sells overweight tokens

Parameters

Name
Type
Description

_slippage

uint32

Slippage used for the swaps

Return Values

Name
Type
Description

underwgts

struct xWinLib.UnderWeightData[]

Returns remaining underweighted tokens, and amount

totalunderwgt

uint256

Total underweighted sum

_buyUnderWeightNames

Buys Underweighted tokens

_moveNonIndex

_getDeleteNames

_convertTo18

getEstimateShares

Display estimate shares if deposit

getUnitPrice

The unitprice of a share of this fund in baseToken

_getUnitPrice

getUnitPriceInUSD

The unitprice of a share of this fund, in stablecoinUSDAddr

getLatestPrice

getVaultValues

Gets the total value of the tokens within the fund, value shown in baseToken

getVaultValuesInUSD

Gets the total value of the tokens within the fund, value shown in stablecoinUSDAddr

getTokenValues

return token value in the vault in base currency

getFundTotalSupply

Actual total supply, taking into account for fees

_getLatestPrice

_getLatestPriceInUSD

_getVaultValues

_getVaultValuesInUSD

_getUP

_getUnitPrice

_getUPInUSD

_getTokenValues

_getTokenValuesInUSD

getBalance

getTargetNamesAddress

getTargetWeightQty

return target amount based on weight of each token in the fund

GetFundExtra

Get All Extra the fund data needed for client

GetFundDataAll

Get All the fund data needed for client

setValidInvestor

setOpenForPublic

updateOtherProperties

updateBlockPerday

update average blocks per day value

updatePlatformProperty

update platform fee and wallet

setPerformanceFee

updateManagerProperty

update manager fee and wallet

updatexWinEngines

update xwin master contract

updateLockedStakingAddress

setPerformDeposit

Handles performance fee logic, keeping record of deposits

Parameters

Name
Type
Description

mintShares

uint256

Shares minted

latestUP

uint256

Unit price of fund

setPerformWithdraw

Handles performance fee logic, calculating profit after swap

Parameters

Name
Type
Description

swapOutput

uint256

Amount of tokens received

_shares

uint256

Amount of shares burned

_investorAddress

address

User address that is withdrawing

_managerAddress

address

Address to receive performance fee

getUserAveragePrice

Returns Users average price and shares

Parameters

Name
Type
Description

_user

address

Address of the user

Return Values

Name
Type
Description

shares

uint256

Total shares minted by the user

avgPrice

uint256

Average mint price

getDiscountedPerformFee

Returns performance fee for user after applying discount

Parameters

Name
Type
Description

_user

address

Address of the user

addContractWaiveFee

removeContractWaiveFee

receive

onlyRebManager

Last updated