Skip to main content

Solidity API

OrionEncryptedVault

A privacy-preserving implementation of OrionVault where curator intents are submitted in encrypted form

_portfolio

mapping(address => euint128) _portfolio

Current portfolio shares per asset (w_0) - mapping of token address to live allocation

_portfolioKeys

address[] _portfolioKeys

_intent

mapping(address => euint128) _intent

Curator intent (w_1) - mapping of token address to target allocation

_intentKeys

address[] _intentKeys

_seenTokens

mapping(address => bool) _seenTokens

Temporary mapping to track seen tokens during submitIntent to check for duplicates

_ezero

euint128 _ezero

_eTrue

ebool _eTrue

_encryptedTotalWeight

euint128 _encryptedTotalWeight

isIntentValid

bool isIntentValid

Whether the intent is valid

constructor

constructor(address vaultOwner, address curator, contract IOrionConfig configAddress, string name, string symbol, uint8 feeType, uint16 performanceFee, uint16 managementFee) public

Constructor

Parameters

NameTypeDescription
vaultOwneraddressThe address of the vault owner
curatoraddressThe address of the vault curator
configAddresscontract IOrionConfigThe address of the OrionConfig contract
namestringThe name of the vault
symbolstringThe symbol of the vault
feeTypeuint8The fee type
performanceFeeuint16The performance fee
managementFeeuint16The management fee

submitIntent

function submitIntent(struct IOrionEncryptedVault.EncryptedIntent[] intent, bytes inputProof) external

Submit an encrypted portfolio intent.

The weights are interpreted as percentage of total supply.

Parameters

NameTypeDescription
intentstruct IOrionEncryptedVault.EncryptedIntent[]EncryptedIntent struct containing the tokens and encrypted weights.
inputProofbytescontains the ZKPoK to validate the authenticity of the encrypted inputs. https://docs.zama.ai/protocol/solidity-guides/smart-contract/inputs#validating-encrypted-inputs

_validateIntent

function _validateIntent(address[] assets, euint128 totalWeight) internal

Validates the intent

Parameters

NameTypeDescription
assetsaddress[]The assets in the intent
totalWeighteuint128The total weight of the intent

getPortfolio

function getPortfolio() external view returns (address[] tokens, euint128[] sharesPerAsset)

Returns the current encrypted portfolio (w_0)

Return Values

NameTypeDescription
tokensaddress[]The tokens in the portfolio.
sharesPerAsseteuint128[]The shares per asset in the portfolio.

getIntent

function getIntent() external view returns (address[] tokens, euint128[] weights)

Get the encrypted intent.

Return Values

NameTypeDescription
tokensaddress[]The tokens in the intent.
weightseuint128[]The weights in the intent.

updateVaultState

function updateVaultState(struct IOrionEncryptedVault.EncryptedPortfolio[] portfolio, uint256 newTotalAssets) external

Updates the vault's portfolio state and total assets

Can only be called by the liquidity orchestrator. Clears the previous portfolio and replaces it with the new one.

Parameters

NameTypeDescription
portfoliostruct IOrionEncryptedVault.EncryptedPortfolio[]Array of EncryptedPortfolio structs It contains the new portfolio token addresses and encrypted number of shares per asset.
newTotalAssetsuint256The new total assets value for the vault

callbackDecryptSingleEbool

function callbackDecryptSingleEbool(uint256 requestID, bytes cleartexts, bytes decryptionProof) external

Callback function to decrypt a single ebool

Parameters

NameTypeDescription
requestIDuint256The request ID
cleartextsbytesThe cleartexts
decryptionProofbytesThe decryption proof