npm i @email@example.com
The Friktion "volt" program is a solana program written using Anchor. Friktion's primary goal is to provide investment strategies and portfolio legos to prospective users. It accepts user deposits of SPL tokens, invests the tokens in a variety of auto-compounding strategies, and returns yield to the users upon withdrawal. Each volt offers a unique trading product and risk/reward payoff, but they are intended to all be usable within the same base UI. To facilitate this, the program consists of a set of generic "template" instructions that operate over any volt type and strategy. These include deposit/withdraw functionality, administrative controls, alternative strategies any volt can fallback on (such as lending on mango), or swapping assets. Additionally, each distinct "investment strategy" has a unique set of instructions - investment strategies are kept as generic as possible while still retaining a distinct identity in order to preserve variations and usage of the implementation within future volts (e.g. volt 1 & 2, volt 3 & 4 on Entropy)
for instruction sets referred to above, see
program/volt/ixs/* or read the docs.
For more information on how Inertia, Soloptions, and other Supported Protocols factor into Friktion's infrastructure, check out the docs
Volt #1 & #2
Volt #3 & #4
Rebalancing & Cranking
The volts must be cranked through their rebalancing process. Read more about how this is done here
Install Anchor. This should install a compatible rust version as well. It should be >= 1.61.0
Add the ssh key to your local GitHub configuration: instructions here
In order to enable ssh dependencies for cargo (rust) projects, add the following to
[net] git-fetch-with-cli = true
- Now, install typescript dependencies [^1] and build the solana programs in the
npm install -g yarn yarn && cd volt-manager && yarn && cd .. anchor build --skip-lint
Recommended IDE Setup: VSCode, install
Program Deployment Instructions
The most important deliverables of the volt repo are the
*.so binaries generated by
anchor build or
cargo build-bpf. Below is an example of deploying to devnet.
First, check that the binaries exist. If they don't, run
anchor build. The output should look something like this:
~/Friktion/volt ╱ main *1 !1 ?1 ls target/deploy anchor_comp-keypair.json fee_utils-keypair.json oracle_utils-keypair.json soloptions-keypair.json volt-keypair.json anchor_comp.so fee_utils.so oracle_utils.so soloptions.so volt.so daoexamples-keypair.json inertia-keypair.json simple_swap-keypair.json spreads-keypair.json volt_abi-keypair.json daoexamples.so inertia.so simple_swap.so spreads.so volt_abi.so```
Second, confirm your solana config is targeting mainnet. To see the current network, run
solana config get. It should look something like
~/Friktion/volt ╱ main *2 solana config get Config File: /Users/alexwlezien/.config/solana/cli/config.yml RPC URL: https://api.devnet.solana.com WebSocket URL: wss://api.devnet.solana.com/ (computed) Keypair Path: /Users/alexwlezien/.config/solana/id.json Commitment: confirmed
In any case, set your RPC URL to devnet now. To do this, run
solana config set --URL devnet.
solana program deploy target/deploy/volt.so --program-id ~/.secure-directory/volt-program-id.json --keypair ~/.config/solana/id.json
Be patient now. It may take up to 30 minutes or so, but your program is currently deployed! To see more specific CLI docs and read about how the deployment process works under the hood click here.
Now that the program is deployed, you undoubtedly wish to interact with it. We do this via the SDK (
friktion-sdk/) & volt manager (
volt-manager) , which respectively provide a typescript interface to instructions exposed by the program and a CLI tool to specify instruction arguments and handle transaction sending logic. They are closely intertwined.
A simple and commonly desired action is to view the details of the current state. This is possible via the
printVoltDetails command in volt manager, as illustrated below in a (truncated) example.
~/Friktion/volt/volt-manager ╱ main *1 !1 ?1 ts-node volt.ts -i printVoltDetails --volt CMVV4kfSdJRufiTNrrhr6PsvYY8SFhNs3TVjsWS3rJvP ------------------------- ID: CMVV4kfSdJRufiTNrrhr6PsvYY8SFhNs3TVjsWS3rJvP ------------------------- Volt #01: Covered Call Short (Fri, 24 Jun 2022 02:00:00 GMT $133.33333333333333333 PUT) ------------------------- HIGH-LEVEL STATS ------------------------- Total Value (minus pending deposits) (SAMO): 14775278.49369057 , ($): 14775278.49369057 deposit pool: 78.49369057 premium pool: 0.000012 permissioned premium pool: 996.92707 ------------------------- EPOCH INFO ------------------------- Round #: 3 pending deposits SAMO: 224721.50630943 , ($): 224721.50630943 pending withdrawals (SAMO): 5 , ($): 5 ------------------------- POSITION STATS ------------------------- Short ( Fri, 24 Jun 2022 02:00:00 GMT $133.33333333333333333 PUT ): option key: Fpav5Y41VV2rbsugcxtZAyid2BF6gxkFsNFgpbDpZY97 minted options: (#) 147752 (SAMO) 14775200 serum market = CW7CwwgNwcdA5j6cX4XqxRYe9F7GYn2vRbHBjy1NdbHg option market: Fpav5Y41VV2rbsugcxtZAyid2BF6gxkFsNFgpbDpZY97
For detailed usage, see:
There are a few different test suites.
Typescript Integration tests. They are located inside the
tests/integrationdirectory and cover both Solana program functionality (
programs/) and the Friktion SDK (
friktion-sdk/). They are our best attempt at simulating real-world usage of the volts. Configuration is in
or for custom configuration,
anchor test --skip-build ...
Typescript unit tests. They are located inside the
tests/unitdirectory and cover singular points of the functionality provided by the SDK. Typically, the logic being tested here is used by other dapps composing on Friktion (e.g. displaying rewards, getting user balances). Note that at least one of these tests currently depend on a private "volt testing" keypair, thus may not be possible for every developer to run.
or for custom configuration,
ANCHOR_WALLET=~/.config/solana/volt-testing.json yarn run ts-mocha -p ./tests/tsconfig.json -t 100000 tests/unit/**/*test*.ts
Rust integration tests. They are inside the
test/directory of any subdirectory of
programs/. The only current suite of rust integration testing is in
programs/volt/test. While these tests don't capture the real-world use case as fully as the typescript integration tests (since these don't use the SDK), they run much faster and thus speed up the iterative development process. This is because they use a simulated client within rust rather than making inter-process and network calls to a local validator.
or for custom configuration,
cargo test-bpf or
cargo test-bpf --manifest-path programs/volt/Cargo.toml
Rust unit tests. They are located at multiple points in the rust portion of this repository, notably in
These are run using the same commands as the rust integration tests.
However, if you wish to run unit tests in isolation, specify the names in the command. For example,
cargo test-bpf --manifest-path programs/volt/Cargo.toml --test calculates_zero_fees
https://docs.friktion.fi/ - Primary Friktion docs (primarily non-technical)
https://friktion-labs.github.io/mainnet-tvl-snapshots/friktionSnapshot.json - JSON registry up-to-date with the latest information. Useful for on-chain data. Feel accessible to hotlink it. This registry will be maintained through to at least December 2022
https://github.com/Friktion-Labs/mainnet-tvl-snapshots - Historical TVL snapshots per asset, CoinGecko price, and deposit breakdowns. Helpful in creating time-series data without needing to query the chain
https://github.com/Friktion-Labs/sdk - Public Friktion SDK, published to https://www.npmjs.com/package/@friktion-labs/friktion-sdk
SOL Call volt (#1):
SOL Put volt (#2):
For Solana-specific definitions (e.g account, transaction, instruction), click (here)[https://docs.solana.com/terminology]. Anchor-specific terminology (here)[https://book.anchor-lang.com/anchor_references/anchor_references.html]
: A Friktion neologism for "vault" - a single entity that accepts user deposits and invests them in yield-earning products.
: short for "Defi Options Vaults," a common term describing protocols offering automated options selling strategies. Friktion offers these products via Volt #1 & #2.
: Exotic perpetuals exchange operated by the Friktion team to support volt #3
: Spot & perpetuals order book exchange on Solana
: Automated covered call strategy, the first volt Friktion launched. Profits relative to holding underlying during low volatility, moderately bearish scenarios.
: Automated protected put strategy, the second volt Friktion launched. Profits relative to holding underlying during low volatility, moderately bullish scenarios.
: Automated "crab" strategy using power perpetuals on entropy, the third volt Friktion launched. Profits in any relatively low volatility regime. As compared to volt 1 & 2, has the advantage of continuous liquidity and no directional bias.
: Automated basis strategy on Mango Markets. The difference between the funding rate on linear perpetual and the interest rate on borrowing the corresponding spot asset profits.
: Protected moonshot, soon...
: 6th volt in Friktion portfolio. Writes undercollateralized loans to reputable, KYCed parties in return for a risk premium relative to collateralized lending.
: assets an entity controls. For example, the "volt's collateral" refers to all assets the volt controls, typically deposits from users' wallets.
: The process of accepting new deposits, processing further withdrawals and entering/exiting an investment position depending on net inflows/outflows.
: The period between each rebalancing of a volt.
: a single rebalancing period. Single-word synonym for time users must wait for a deposit/withdrawal between each opportunity. Also demarcates when fees are taken by the volt.
: SPL token that represents one share of the volt's total collateral. The $ value of a single share token can be calculated in the following way. `$ = 1 / (share token supply) *
: synonym for Share Token
: A user sends some deposit tokens (e.g., SOL, BTC, USDC) to the volt to receive newly minted share tokens once the current epoch ends.
: A user burns some share tokens to have a claim on their share of the volt's collateral once the current epoch ends.
User Facing Instruction
: a Friktion volt program instruction that can be called permissionlessly from the app.friktion.fi or any other Solana cluster client.
Claim Pending Deposit
: A user-facing instruction to claim share tokens after the epoch attached to a pending deposit ended.
Claim Pending Withdrawal
: A user-facing instruction to claim deposit tokens after the epoch attached to a pending withdrawal ended.
The code in this repository is original. Some parts may have been derived from other codebases, but they have only been derived from permissively open-sourced software:
Code in this repository only contains code derived from permissively licensed open source software (such as those licensed under MIT or Apache-2.0).
Friktion is in active development, so all APIs are subject to change.
Parts of this code may be unaudited, depending on when the last official audit was conducted
If you plan on using common typescript-related CLI tools, you may want to have your global versions match those specified in
package.json(unless you wish to use
yarn run ts-node). Specifically, consider installing matching versions for
cargo build-bpfmay be substituted for
anchor buildin the code block above
Under the hood,
yarn test: voltcalls
anchor test,which spins up a Solana test validator using
Solana-test-validator(packaged with Solana installation). It then deploys the programs included in