ae5907ba3a
Previously, we tried to keep track of "other" and "trade" realized pnl. An issue occured when a perp base position went to zero: the way we computed the trade pnl included potential non-trade unsettled pnl. That caused follow-up trouble because the value could change sign and reset the settle limit for trade pnl. This change aims to simplify in some ways: - explicitly talk about oneshot-settleable pnl (fees, funding, liquidation) and recurring-settleable pnl (materialization of settle limit derived from the stable value of the base position when reducing the base position) - instead of directly tracking realized settleable amounts (which doesn't really work), just decrease the recurring settleable amount when it exceeds the remaining unsettled pnl - get rid of the directionality to avoid bugs of that kind - stop tracking unsettled-realized trade pnl (it was wrong before, and no client uses it) - we already track position-lifetime realized trade pnl |
||
---|---|---|
.github | ||
anchor-tests | ||
audits | ||
bin | ||
cd | ||
docs | ||
lib | ||
migrations | ||
programs | ||
py | ||
scripts | ||
ts/client | ||
.dockerignore | ||
.env.sample | ||
.eslintignore | ||
.eslintrc.json | ||
.gitignore | ||
.mocharc.json | ||
.prettierignore | ||
Anchor.toml | ||
CHANGELOG.md | ||
Cargo.lock | ||
Cargo.toml | ||
DEVELOPING.md | ||
Dockerfile | ||
FAQ-DEV.md | ||
HOW-TO-RELEASE.md | ||
LICENSE | ||
Procfile | ||
Program | ||
README.md | ||
RELEASING.md | ||
SECURITY.md | ||
fix-npm-tag.sh | ||
fly.toml | ||
idl-fixup.sh | ||
mango_v4.json | ||
package.json | ||
release-to-devnet.sh | ||
run-anchor-tests.sh | ||
rust-toolchain.toml | ||
tsconfig.cjs.json | ||
tsconfig.esm.json | ||
tsconfig.json | ||
tsconfig.types.json | ||
update-local-idl.sh | ||
yarn.lock |
README.md
work in progress
License
See the LICENSE file.
The majority of this repo is MIT licensed, but some parts needed for compiling the solana program are under GPL.
All GPL code is gated behind the enable-gpl
feature. If you use the mango-v4
crate as a dependency with the client
or cpi
features, you use only MIT
parts of it.
The intention is for you to be able to depend on the mango-v4
crate for
building closed-source tools and integrations, including other solana programs
that call into the mango program.
But deriving a solana program with similar functionality to the mango program from this codebase would require the changes and improvements to stay publicly available under GPL.
Development
See DEVELOPING.md and FAQ-DEV.md
Dependencies
- rust version 1.69.0
- solana-cli 1.16.7
- anchor-cli 0.28.0
- npm 8.1.2
- node v16.13.1
Deployments
- devnet: 4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg
- mainnet-beta: 4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg
- primary mango group on mainnet-beta: 78b8f4cGCwmZ9ysPFMWLaLTkkaYnUjwMJYStWe5RTSSX
Release
For program deployment, see RELEASING.md.
Here are steps followed while performing a npm package release note: the UI currently uses code directly from github, pointing to the ts-client branch
- use
yarn publish
to release a new package, ensure compatibility with program release to mainnet-beta - fix the tag auto added by yarn to match our internal convention, see script
fix-npm-tag.sh
, tags should look like this e.g.npm-v0.0.1
, note: the npm package version/tag should not necessarily match the latest program deployment