Search…
⌃K

SingleTokenPortfolio

Methods

DOMAIN_SEPARATOR

function DOMAIN_SEPARATOR() external view returns (bytes32)

Returns

Name
Type
Description
_0
bytes32
undefined

PERMIT_TYPEHASH

function PERMIT_TYPEHASH() external view returns (bytes32)

Returns

Name
Type
Description
_0
bytes32
undefined

allowance

function allowance(address, address) external view returns (uint256)

Parameters

Name
Type
Description
_0
address
undefined
_1
address
undefined

Returns

Name
Type
Description
_0
uint256
undefined

approve

function approve(address, uint256) external pure returns (bool)
transferFrom disabled on Portfolio tokens.

Parameters

Name
Type
Description
_0
address
undefined
_1
uint256
undefined

Returns

Name
Type
Description
_0
bool
undefined

asset

function asset() external view returns (address)

Returns

Name
Type
Description
_0
address
undefined

authority

function authority() external view returns (contract RolesAuthority)
The contract used to source permissions for accounts targeting this contract.

Returns

Name
Type
Description
_0
contract RolesAuthority
undefined

balanceOf

function balanceOf(address) external view returns (uint256)

Parameters

Name
Type
Description
_0
address
undefined

Returns

Name
Type
Description
_0
uint256
undefined

baseToken

function baseToken() external view returns (contract ERC20)

Returns

Name
Type
Description
_0
contract ERC20
undefined

callAsPortfolio

function callAsPortfolio(address _target, uint256 _value, bytes _data) external payable returns (bytes)
Permissioned method that allows Endaoment admin to make arbitrary calls acting as this Portfolio.

Parameters

Name
Type
Description
_target
address
The address to which the call will be made.
_value
uint256
The ETH value that should be forwarded with the call.
_data
bytes
The calldata that will be sent with the call.

Returns

Name
Type
Description
_0
bytes
_return The data returned by the call.

cap

function cap() external view returns (uint256)

Returns

Name
Type
Description
_0
uint256
undefined

convertToAssets

function convertToAssets(uint256 _amount) external view returns (uint256)
The amount of assets that the Portfolio should exchange for the amount of shares provided.
Rounding down in both of these favors the portfolio, so the user gets slightly less and the portfolio gets slightly more, that way it prevents a situation where the user is owed x but the vault only has x - epsilon, where epsilon is some tiny number due to rounding error.

Parameters

Name
Type
Description
_amount
uint256
undefined

Returns

Name
Type
Description
_0
uint256
undefined

convertToShares

function convertToShares(uint256 _amount) external view returns (uint256)
The amount of shares that the Portfolio should exchange for the amount of assets provided.
Rounding down in both of these favors the portfolio, so the user gets slightly less and the portfolio gets slightly more, that way it prevents a situation where the user is owed x but the vault only has x - epsilon, where epsilon is some tiny number due to rounding error.

Parameters

Name
Type
Description
_amount
uint256
undefined

Returns

Name
Type
Description
_0
uint256
undefined

decimals

function decimals() external view returns (uint8)

Returns

Name
Type
Description
_0
uint8
undefined

deposit

function deposit(uint256 _amountBaseToken, bytes _data) external nonpayable returns (uint256)
Exchange _amountBaseToken for some amount of Portfolio shares.
We convert baseToken to asset via a swap wrapper. _data should be a packed swap wrapper address concatenated with the bytes payload your swap wrapper expects. i.e. bytes.concat(abi.encodePacked(address swapWrapper), SWAP_WRAPPER_BYTES). To determine if this deposit exceeds the cap, we get the asset/baseToken exchange rate and multiply it by totalAssets.

Parameters

Name
Type
Description
_amountBaseToken
uint256
The amount of the Entity's baseToken to deposit.
_data
bytes
Data that the portfolio needs to make the deposit. In some cases, this will be swap parameters.

Returns

Name
Type
Description
_0
uint256
The amount of shares that this deposit yields to the Entity.

depositFee

function depositFee() external view returns (uint256)

Returns

Name
Type
Description
_0
uint256
undefined

exchangeRate

function exchangeRate() external view returns (uint256)

Returns

Name
Type
Description
_0
uint256
undefined

initialize

function initialize(contract RolesAuthority _authority, bytes20 _specialTarget) external nonpayable
One time method to be called at deployment to configure the contract. Required so EndaomentAuth contracts can be deployed as minimal proxies (clones).

Parameters

Name
Type
Description
_authority
contract RolesAuthority
Contract that will be used to source permissions for accounts targeting this contract.
_specialTarget
bytes20
The bytes that this contract will pass as the "target" when looking up permissions from the authority. If set to empty bytes, this contract will pass its own address instead.

name

function name() external view returns (string)

Returns

Name
Type
Description
_0
string
undefined

nonces

function nonces(address) external view returns (uint256)

Parameters

Name
Type
Description
_0
address
undefined

Returns

Name
Type
Description
_0
uint256
undefined

permit

function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external nonpayable

Parameters

Name
Type
Description
owner
address
undefined
spender
address
undefined
value
uint256
undefined
deadline
uint256
undefined
v
uint8
undefined
r
bytes32
undefined
s
bytes32
undefined

redeem

function redeem(uint256 _amountShares, bytes _data) external nonpayable returns (uint256)
Exchange _amountShares for some amount of baseToken.
After converting shares to assets, we convert assets to baseToken via a swap wrapper. _data should be a packed swap wrapper address concatenated with the bytes payload your swap wrapper expects. i.e. bytes.concat(abi.encodePacked(address swapWrapper), SWAP_WRAPPER_BYTES).

Parameters

Name
Type
Description
_amountShares
uint256
The amount of the Entity's portfolio shares to exchange.
_data
bytes
Data that the portfolio needs to make the redemption. In some cases, this will be swap parameters.

Returns

Name
Type
Description
_0
uint256
The amount of baseToken that this redemption yields to the Entity.

redemptionFee

function redemptionFee() external view returns (uint256)

Returns

Name
Type
Description
_0
uint256
undefined

registry

function registry() external view returns (contract Registry)

Returns

Name
Type
Description
_0
contract Registry
undefined

setCap

function setCap(uint256 _amount) external nonpayable
Set the Portfolio cap.

Parameters

Name
Type
Description
_amount
uint256
Amount, denominated in baseToken.

setDepositFee

function setDepositFee(uint256 _pct) external nonpayable
Set deposit fee.

Parameters

Name
Type
Description
_pct
uint256
Percentage as ZOC (e.g. 1000 = 10%).

setRedemptionFee

function setRedemptionFee(uint256 _pct) external nonpayable
Set redemption fee.

Parameters

Name
Type
Description
_pct
uint256
Percentage as ZOC (e.g. 1000 = 10%).

specialTarget

function specialTarget() external view returns (bytes20)
If set to a non-zero value, this contract will pass these byes as the target contract to the RolesAuthority's canCall method, rather than its own contract. This allows a single RolesAuthority permission to manage permissions simultaneously for a group of contracts that identify themselves as a certain type. For example: set a permission for all "entity" contracts.

Returns

Name
Type
Description
_0
bytes20
undefined

symbol

function symbol() external view returns (string)

Returns

Name
Type
Description
_0
string
undefined

takeFees

function takeFees(uint256 _amountAssets) external nonpayable
Takes some amount of assets from this portfolio as assets under management fee.
Importantly, updates exchange rate to change the shares/assets calculations.

Parameters

Name
Type
Description
_amountAssets
uint256
Amount of assets to take.

totalAssets

function totalAssets() external view returns (uint256)
Total amount of the underlying asset that is managed by the Portfolio.

Returns

Name
Type
Description
_0
uint256
undefined

totalSupply

function totalSupply() external view returns (uint256)

Returns

Name
Type
Description
_0
uint256
undefined

transfer

function transfer(address, uint256) external pure returns (bool)
transfer disabled on Portfolio tokens.

Parameters

Name
Type
Description
_0
address
undefined
_1
uint256
undefined

Returns

Name
Type
Description
_0
bool
undefined

transferFrom

function transferFrom(address, address, uint256) external pure returns (bool)
transferFrom disabled on Portfolio tokens.

Parameters

Name
Type
Description
_0
address
undefined
_1
address
undefined
_2
uint256
undefined

Returns

Name
Type
Description
_0
bool
undefined

Events

Approval

event Approval(address indexed owner, address indexed spender, uint256 amount)

Parameters

Name
Type
Description
owner indexed
address
undefined
spender indexed
address
undefined
amount
uint256
undefined

CapSet

event CapSet(uint256 cap)
Event emitted when cap is set.

Parameters

Name
Type
Description
cap
uint256
undefined

Deposit

event Deposit(address indexed sender, address indexed receiver, uint256 assets, uint256 shares)
sender has exchanged assets for shares, and transferred those shares to receiver.

Parameters

Name
Type
Description
sender indexed
address
undefined
receiver indexed
address
undefined
assets
uint256
undefined
shares
uint256
undefined

DepositFeeSet

event DepositFeeSet(uint256 fee)
Event emitted when depositFee is set.

Parameters

Name
Type
Description
fee
uint256
undefined

FeesTaken

event FeesTaken(uint256 amount)

Parameters

Name
Type
Description
amount
uint256
undefined

Redeem

event Redeem(address indexed sender, address indexed receiver, uint256 assets, uint256 shares)
sender has exchanged shares for assets, and transferred those assets to receiver.

Parameters

Name
Type
Description
sender indexed
address
undefined
receiver indexed
address
undefined
assets
uint256
undefined
shares
uint256
undefined

RedemptionFeeSet

event RedemptionFeeSet(uint256 fee)
Event emitted when redemptionFee is set.

Parameters

Name
Type
Description
fee
uint256
undefined

Transfer

event Transfer(address indexed from, address indexed to, uint256 amount)

Parameters

Name
Type
Description
from indexed
address
undefined
to indexed
address
undefined
amount
uint256
undefined

Errors

AlreadyInitialized

error AlreadyInitialized()
Thrown if there is a second call to initialize.

CallFailed

error CallFailed(bytes response)

Parameters

Name
Type
Description
response
bytes
undefined

ExceedsCap

error ExceedsCap()

InvalidAuthority

error InvalidAuthority()
Thrown if there is an attempt to deploy with address 0 as the authority.

InvalidSwapper

error InvalidSwapper()

NotEntity

error NotEntity()

PercentageOver100

error PercentageOver100()

RoundsToZero

error RoundsToZero()

TransferDisallowed

error TransferDisallowed()

Unauthorized

error Unauthorized()
Thrown when an account without proper permissions calls a privileged method.