🍺PINT Community Update #2

🍺PINT Community Update #2

Authored by Timothy Hao Chi Ho

PINT is an index token representing a diversified basket of Polkadot ecosystem projects.

PINT is an index token representing a diversified basket of Polkadot ecosystem projects. It is a StakerDAO community initiative being built by ChainSafe and Stateless Money. You can read more about PINT in the announcement[ here](https://medium.com/chainsafe-systems/announcing-the-polkadot-index-network-token-pint-to-be-developed-by-chainsafe-36127e7fb197), and learn more from our first community update here. PINT is funded by the StakerDAO Community Treasury, and is an initiative intended to benefit the entire Polkadot ecosystem. We'll be releasing periodic project updates to keep the community informed in a transparent, open manner. As always, you can follow our open-source work by taking a look at our PINT Github repo, or by reading our Gitbook docs. Contributions are always welcome!

PINT and the Polkadot ecosystem

In the time since our last project update, the Polkadot ecosystem has gone through two major events. The first one was the annual Polkadot Decoded community conference, which was held on May 19th to 20th, and featured tons of amazing projects, including talks from PINT's council members and Constituent Committee. Although those of us directly involved with building PINT were not able to participate this time, a lot of lessons were still learned and provided ample opportunities to reflect on the state of the ecosystem and witness first-hand the budding DOT community.

The other major event was the beginning of Kusama's parachain auctions. Naturally, since PINT is intimately related to the parachain process by allowing participating parachains to access PINT's treasury funds for Parachain Lease Offerings (PLO), the team was extra attentive. Understanding what the parachain process would look like would yield lessons in how the PINT team could best design the governance of the treasury.

All custom pallets for PINT have been completed

🎉 Since our last update, both the AssetIndex and RemoteAssetManager pallets have been completed 🎉 .

The AssetIndex is the fundamental custom pallet that tracks a set of assets and represents them in the form of an index. The RemoteAssetManager custom pallet provides capabilities to bond/unbond, stake and transfer assets on behalf of other chains. The RemoteAssetManager custom pallet is utilized by the AssetIndex to interact with assets on other parachains via cross-chain message passing (XCMP).

With the completion of these pallets, much of the PINT architecture that requires custom-built solutions, including the LocalTreasury, Committee, and SAFTRegistry, are now considered feature complete.

Cross-chain functionality enabled

A big theme for our work in our most recent iteration is cross-chain functionality. In the Polkadot vernacular, they are known as cross-chain messages (XCM). It means that a user can execute a transfer of an asset (the native token of a chain, like DOT) to another parachain. Each parachain has its own account, derived from their unique parachain ID. An XCM transfer of an asset from chain A to chain B works in roughly 4 steps:

  1. User executes XCM transfer on chain A to send X amount of an asset to chain B

  2. Assets are withdrawn from user account and deposited into account of parachain B, still on chain A

  3. XCM is sent from A to B to deposit X amount of the asset into the user's account on chain B

  4. On chain B, user account gets credited with the amount

In terms of XCM work on our RemoteAssetManager pallet, we have added support for transacting cross-chain message (XCM) calls, and depositing or teleporting assets to PINT. Specifically, implemented XCM features now allow the PINT parachain itself to manage staking on the Relay Chain. The implemented functionalities include:

  • The ability for the PINT council to register their staking proxy on chains that support staking

  • The initial implementation of staking-related cross chain messages to transact the bonding and unbonding calls

Since cross-chain functionality was such a big focus for our last sprint, it is no surprise that we have added several XCM features:

  • XCM asset handlers to be used within the RemoteAssetManager. We already talked in the previous section about how the RemoteAssetManager is used in the PINT protocol. In addition to that it has the ability to control assets on other chains via XCMP and will be used to provide loans of DOT for Parachain Slot Auctions 6–12 months after the launch of PINT.

  • Support for dynamic dispatching encoded transaction calls for the FRAME proxy and staking pallets on different chains via XCM [PR: #97]

  • XCM bindings for dispatching the FRAME assets pallet calls [PR: #100]

For context, PRs 97 and 100 allow the PINT protocol to interact with Substrate FRAME pallets from other parachains, and most importantly, the Relay Chain. These bindings are tailored to the expected call encoding of the target chain. With that, PINT can interact with other chains using Polkadot's XCMP format, and this allows PINT to stake DOTs that users send to PINT.

The process works as follows:

  1. User wants to invest some DOTs (stored in their account on Polkadot) into the index in exchange for PINT tokens.

  2. User sends DOTs via XCMP to the PINT parachain.

  3. The DOTs are transferred from their account into a special PINT parachain account (still on Polkadot) that the PINT parachain has access to.

  4. An XCM is sent to PINT, confirming that the transfer took place on the Polkadot chain.

  5. User receives credit for that on PINT and can now invest their locked DOT into PINT on the PINT parachain.

Calculating PINT price and Net Asset Value (NAV)

Finally, we have implemented the math behind the index's price and net asset value (NAV) calculations. Since PINT is minted or redeemed at the NAV on a dynamic, ongoing basis, this calculation is critical to the functioning of the protocol.

In essence, the NAV calculations will determine:

  • How many PINT tokens will be exchanged when a certain amount of an asset is contributed

Or

  • How much a liquidity provider will receive in distribution of assets (what rights they hold over the liquid assets in the basket) when redeeming PINT tokens

Since the NAV is dynamically calculated, the PINT protocol needs to constantly query an accurate PINT/Asset price feed for whenever funds are deposited. The same holds true for redemptions, except the process is slightly more complicated, since the protocol needs to determine the distribution of the assets the user should receive for their PINT tokens. This is always proportional to the NAV of each asset. The NAV of the Index Token can be calculated by taking the value of each of the underlying tokens over the total supply of PINT:

The total NAV is:

The portion of a specific asset is therefore:

This is the ratio that determines the amount of asset the user will receive for their redeemed PINT token, which is:

You can read more about the minting and withdrawal process here.

Other achievements

In other news, here are some of the achievements we have managed to unlock over the past run.

We have fully integrated the Chainlink Oracle pallet, a price oracle/feed used to accurately report on the prices of assets that get exchanged for PINT, and for determining PINT's dynamically calculated NAV, as discussed above.

In our last update, we mentioned adding functionality for a "Constituent Committee" to exist. In this iteration, we have finished developing the council selection feature, which will allow for representatives from each asset on the index to be selected as well as have voting powers against the decisions of the PINT council.

Finally, we have determined an initial approach to end-to-end (E2E) testing for PINT, and have begun development for it, referencing Acala Network's approach here.

What's next

For the next few sprints, we will turn our attention towards completing the remaining API calls, specifically adding support for general purpose asset transfers and supporting multi-currencies.

Optimizing the RemoteAssetManager is also currently an open issue we are looking to address, as it is quite inefficient. As it is currently set up, each withdrawal/deposit event into PINT would trigger an XCM call.

We will also continue developing the E2E testing, with a particular focus on XCM testing, since cross-chain functionality touches the most moving parts. We have a couple of open issues we will look to address:

Amongst other things, we are also looking to improve the PINT documentation, extending the polkadot.js bindings, before finally working towards joining a testnet.

Get Involved

We are eager to evolve PINT into an inclusive community project. If you believe you can help in any way, please join us on the PINT channel within the StakerDAO discord and introduce yourself. Once the index is live, we intend to utilize the PINT treasury to compensate those who add value to the project.

Want to work with ChainSafe? COME JOIN US! Check out the new Careers section of our website and our open positions, and get in touch with us at careers@chainsafe.io if you are interested!

If you want to get involved with the project, check out our Github. If you would like to get in contact with one of the PINT team members, feel free to drop by on ChainSafe's Discord, or email info@chainsafe.io. We would love to know more about you, your team and your project!

For more details on PINT, please head to our documentation site.

Learn more about ChainSafe by visiting their website, through Medium, via Twitter, or by visiting the ChainSafe GitHub.

Learn more about StakerDAO by visiting their website, via Twitter, or on their Discord.

Learn more about Stateless Money on their website, or support us by nominating our validators on Polkadot and Kusama.

Please be wary of scams

There will never be a PINT "Pre-Sale" or a way to "invest in PINT" pre-launch. Anyone claiming otherwise is trying to steal your hard earned DOTs.

Acknowledgements

Thank you to Dustin Brickwood, Matthias Seitz, Graham Tonkin, and Tim Ho. Your contributions were invaluable in the making of this article.