Closed mschneider closed 2 years ago
There's a good reference implementation in mango-client-v3, toPrettyString pretty much implements all that is needed. https://github.com/blockworks-foundation/mango-client-v3/blob/main/src/MangoAccount.ts#L933
It can be invoked for any mainnet account from the cli using ACC=mainnetpk yarn ts-node src/scripts/positions.ts
ACC=mainnetpk yarn ts-node src/scripts/positions.ts
To ensure the math checks out for the different calculations, there's a test-suite with fixtures, which should be ported to solcpp: https://github.com/blockworks-foundation/mango-client-v3/pull/50
There's a good reference implementation in mango-client-v3, toPrettyString pretty much implements all that is needed. https://github.com/blockworks-foundation/mango-client-v3/blob/main/src/MangoAccount.ts#L933
It can be invoked for any mainnet account from the cli using
ACC=mainnetpk yarn ts-node src/scripts/positions.ts
To ensure the math checks out for the different calculations, there's a test-suite with fixtures, which should be ported to solcpp: https://github.com/blockworks-foundation/mango-client-v3/pull/50