July 11, 2026

Building fund pages … – Gorilla Funds

Building fund pages … – Gorilla Funds

This is a part Two in a series of articles. You can read Part One on querying the graph-protocol and making first contact with Gatsby here. Once you’ve read that, you’re ready to read Part Two.

PART TWO

In what follows, I will show you how to build pages for the funds on the Melon Network through a really easy-to-follow example.

Let’s build pages:

Step 1:

Gatsby lets you create pages from Graph-QL Queries in a really easy way. First you have to edit the gatsby-node.js file. You can find it in the root folder of your project. In this file you define what pages are created- when building the static website. For this case we want to have one page per fund. Edit your file so that it looks like this one.

gatsby-node.js https://gist.github.com/gorillafund/8d62260ac9c6188a93032275c599ecd9

The file uses the createPages API from Gatsby. The pages are built using the fundTemplate.js (scroll down), so the source for this file has to be defined as shown in line 5. In line 7 you can see the query for the data from the Melon Network to use in creating pages. In line 21 you can spot the loop in which the pages are built. As the path for the fund pages I have chosen the fund address, the necessary component for the build is the fundTemplate mentioned above and as page context variables to build the page I pass the id/address into the pages. The id is needed for the page query in the file fundTemplate.js. You will probably have noticed that I only query the first 10 funds and just those, that are not shutdown with the condition in the Graph-QL-Query for this example.

Step 2:

O.K — let’s go on: Now, create a folder templates in the src folder. In this folder create a fundTemplate.js file and copy and paste the following code into the file.

fundTemplate.js https://gist.github.com/gorillafund/35cd2d89311eb7efbf56590a3aa43365

In this file the data for every fund is queried (line 30 ff.). For every fund identified with the unique fund-ID (the fund address), the name, the time of creation, the share price, the total supply, the gross asset value (GAV) and the net asset value (NAV) is now available. For an explanation of these values take a look at the monitoring tool built by Avantgarde Finance. The data are then passed into the Site component. As an illustration, I passed one variable from the page context (the id) and the data from the page query into this component. You can pass the id from the page query as well if you change your query so that you have access to the id as well.

Step 3:

Create another folder components in the src-directory, create a Site.jsx file and copy and paste the Site.jsx code into the file.

Site.jsx https://gist.github.com/gorillafund/bef53549c43f4ecc8857178093edf4b0

Step 4: Check the results

Run:

gatsby develop 

in your terminal and visit localhost:8000/x in your browser.

What you should see is a list of links to all available fund pages. Click the links and you can see the rudimentary pages for the queried funds.

If you open the developer tools in your browser and open the console, you can easily spot what props are available at the moment for visualisation on the site.

It should now be easy for you to access the other queried fund values like GAV and NAV for you.

Cool, isn’t it? It’s also the end of PART TWO.

In PART THREE I will show you how to create a list of all funds, how to link the pages, and how to style it a bit.

Happy building.

Thanks to Julie Simon

Published at Wed, 04 Dec 2019 13:35:34 +0000

{flickr|100|campaign}

Previous Article

Crypto Exchange Gemini Burnt One-Fifth of Its GUSD Stablecoin Supply

Next Article

ILCoin Launches 5 Gb Blocks and Gives Blockchain a Push Towards Wide Adoption

You might be interested in …

文組也該知道的區塊鏈技術知識 為何發送 ERC20 Token 需要兩次交易? – Pelith

文組也該知道的區塊鏈技術知識 為何發送 ERC20 Token 需要兩次交易? – Pelith Blockchain Technical Overview <8> Transfer of ERC20 Token 收看本系列文章的讀者,應該都對於區塊鏈的基本原理和架構有些概念,如果沒有,推薦您先去 Google 搜尋 區塊鏈、比特幣、以太坊這些關鍵字了解一下。我們將在這些基礎概念之上,來談區塊鏈的技術知識。本系列文章並不會談到太深的技術鑽研,而是希望以深入淺出的方式讓每一個想要搞懂區塊鏈技術的人都能在讀完後說出:原來如此! 本系列文章由區塊鏈技術解決方案開發公司:Pelith 編撰。內容皆經過諸位區塊鏈資深研究員及開發者校對與驗證,盡可能確保內容正確無誤,讓讀者能安心吸收正確的區塊鏈技術知識。 為什麼發送 ERC20 Token 給別人需要兩次交易? 許多人可能對此感到疑問,透過本篇文章相信能充分為您解惑。上一節 我們帶大家一窺以太坊的架構全貌並為迄今為止七篇文章做了小結。我們將在這基礎之上闡明發送 ERC20 Token 背後的技術解析。 發送以太幣 發送以太幣時其實蠻符合我們的直覺,就是把錢發給別人,別人收到這樣。然而發送 ERC20 代幣卻彷彿不是這麼單純,為什麼呢? EOA […]

BetBeB AIRDROP – Dedi irawan

BetBeB AIRDROP – Dedi irawan BetBeB the biggest ETH Dapp ecological application platform! 8888 BEB airdrop worth 17.7 $ and can be exchanged for ETH within 1 minute! All ETH wallets supported including imToken, metamask, […]