Inspiration
Finterra launched a Cash Waqf Charity Crowdfunding platform (WaqfChain) in Feb 2019, built on the Gallactic network, using EVM based cross-chain Smart Contracts. In the continues evolution of WaqfChain, Finterra is crafting more innovative Waqf inked instruments to not only cater for charities, but also private equity based liquidity opportunities. This has pushed the boundaries of WaqfChain to a DeFi platform.
Distributed Finance (DeFi) creates a new paradigm for Waqf, that was unthinkable before in asset management and private equity markets. Liquidity – meaning that liquidity providers (private investors) should have the option to withdraw at any time. Provided liquidity in a General Waqf Fund (GWF) pool is being lent out for waqf development projects for a period of time. Liquidity providers get “waqf participation” tokens” (WP tokens) which represent their stake in the protocol. If all underlying capital is allocated, the WP token holders cannot redeem their WP tokens for the underlying asset.
At Finterra, we came up with a liquidity system that allows us to:
- keep yields high by not working with a buffer
- allow liquidity providers to get in / out at anytime
- prevent KYC’d liquidity providers to transfer WP tokens to non-KYC’d entities
Our solution is based upon the following principles:
- Permissioned order book per General Waqf Fund pool
- Burning WP tokens
- Buy-in moments
- Deploy WP tokens in a portfolio of waqf linked investments (private-equity)
What it does
Although Point 2 (burning WP tokens) and Point 3 (buy-in moments) above are interesting mechanism that we’ll further explore in another more detailed article. For this article, we focus on “1. Permissioned order book per GWF pool”
A permissioned order book is set up for each GWF pool. Where each GWF pool is considered as a single waqf portfolio (single waqf linked investment instrument). It is similar to most order books in that it allows participants to place buy and sell orders, yet different in that:
- it only allows entities that have passed the KYC, and thus have a valid access pass to participate;
- cash waqf collecting entity (Nazir) should have a valid access pass (= pool or portfolio-specific whitelisting);
- WP token accounts are always frozen; only the WaqfChain program can thaw them upon posting a sell order and freeze them again upon execution of a buy/sell order
How we built it
We’ve built 2 programs: the (1) WaqfChain Liquidity program and the (2) WaqfChain-permissioned-market program:
– WaqfChain Liquidity program
This is a dummy program featuring limited functionality of the WaqfChain smart contract protocol, it contains instructions to: initialize a market, deposit funds and get WP tokens, to create a WaqfChain pass, and to update a WaqfChain pass. Anyone can initiate these instructions (for the ease of demonstration). It also contains an instruction to freeze WP Tokens and thaw WP tokens. Only the signing-authority PDA of WaqfChain-permissioned-market program can invoke this freeze/thaw instruction. This way we make sure that no-one can thaw their WP tokens and transfer them to a public key that doesn’t have a valid WaqfChain pass.
– WaqfChain-permissioned-market program
The WaqfChain permissioned market is a “permissioned market” on Serum via a proxy program. It is a regular serum market with the additional checks for a valid WaqfChain pass. Along with these checks it also sends an instruction to the waqfchain program
to thaw WP tokens before calling the dex instruction and freeze them again right after that.
We created this proxy program with the permissioned package. Along with the proxy instructions to the dex program it contains an instruction to create the signing-authority PDA.
[NOTE: See also the Introduction to WaqfChain, and the WaqfChain Smart Contract Architecture tutorial].
Challenges we ran into
- The WaqfChain permissioned market is a “permissioned market” on Serum via a proxy program. It is a regular serum market with the additional checks for a valid WaqfChain pass. Along with these checks it also sends an instruction to the
waqfchain program
to thaw WP tokens before calling the dex instruction and freeze them again right after that. - limited documentation on how to work with permissioned markets
Accomplishments that we’re proud of
- coming up with a novel way to provide liquidity in private (credit) waqf-linked markets
- be the first protocol ever to complete a fully permissioned transfer of assets (= waqfchain pass check + FREEZING/THAWING of WP token accounts to prevent transfers to non-qualified participants)
- deployed on devnet
What we learned
- how Serum Core works; very interesting to see how data structures from the old-coding-world are implemented in the Solana programming model
- how we can work with Serum’s permissioned markets and proxy programs
What’s next for WaqfChain | hyper-permissioned market
- clean up the waqfchain-permissioned-market code and tests
- expand the test cases
- write a more detailed article on how to get started with permissioned markets + open source the dummy version to complement this article
- integrate this solution in the WaqfChain protocol as part of our novel liquidity provisioning system
- Integrate a user-friendly UI into the WaqfChain web app. The submitted web app as featured in the demo video was hacked together in a very short amount of time and is only used for this pilot only.
Built With
- anchor
- nextjs
- serum
- solana
- typescript
Try it out

https://www.linkedin.com/in/hamid-rashid-64576aaa/