blog

Mogul Development AMA Recap

Jul 1, 2021
Mogul Development AMA Recap

This post will recap the development team AMA that took place on the Mogul Telegram channel on Wednesday 30th June. This was hosted by David Liu (Lead Blockchain Developer). Tune in next week for an AMA with the Mogul Film team!

Question 1, asked by @MarkFacebook.

What will the team be working on for the rest of 2021?

Answer 1

The main products that we’re working on are the quadratic voting and movie NFT module, NFT marketplace, and smart wallet. We work in an agile process, so we break down these tasks to smaller components as well, and within these, we’re building different bridges, polygon infrastructure, smart contracts, fiat onramps, etc. This allows us to have consistent product releases and launch different features over time. 


There’s also a lot being worked on that help support and back-end perspective that a lot of you can’t see when we’re launching products. For example, a back-end system for our support team to help monitor user accounts and give direct support. A lot of this ground work we’ve been working on will start to make a big impact when we launch new features. 

Question 2, asked by @PugMagician.

What Mogul technical development do you think will be the industry leading tech? What will other projects point to Mogul to say " This is something new!"?

Answer 2
Mogul is the first platform to bring together a proper ecosystem for movie funding. We bring together easy onboarding, Hollywood movie makers, a non-custodial smart wallet and an NFT marketplace for the sale of movie props/rewards/merch.


I think our staking and voting system will be highly regarded among the technical community. Especially because it’s never really been done before where blockchain voting is used to decide an off-chain event as big as making a movie. Plus, every movie is represented as an NFT so there’s another layer of authenticity and auditability that people can track through the blockchain to make sure that the votes are authentic and going to the movies that actually end up winning. 


Question 3, asked by @defiapez.

Vitalik has been talking about quadratic voting since 2017. What was the process like in building these voting smart contracts? Was the audit process extensive? To my knowledge, I don't think quadratic voting has actually been done yet on a large scale.

Answer 3

Quadratic voting in itself is not complex to implement but adding staking rewards for voters increased the amount of time necessary for design and testing. This is something we added to encourage people to vote and gamify the process

The audit process was quite smooth, auditors reviewed our code and noted some minor vulnerabilities, which were promptly fixed and approved by the auditors.

We work with 2 auditors, Zokyo and Hacken, and our code has passed with flying colours each time it’s gone to audit :)

Every contract we put out goes through our own internal testing process where we write test cases for the contract to cover the vast majority of potential vulnerabilities. Then we send it to the auditor and they do manual and automated testing and we work with them to improve the code if necessary. 

The most important thing, as our team discusses daily, is making sure that our products and UI look friendly to people from the film industry. Our business team has a lot of calls educating Hollywood people on Mogul every day so it’s important when walking them through our product that it’s easy to use and understand.

Question 4, asked by @prakashrj.

Can you share your technology stack, including tools used for development, testing and deployment? What is your test coverage and how often do you build and deploy internally?

Answer 4

For the blockchain side: 


Blockchain (Smart Contract integration)

  • Hardhat
  • EthersJS
  • WaffleJS
  • TypeChain


We are using Hardhat because it offers the most customization to build smart contracts. It is very easy to integrate other Solidity and testing libraries, along with built in usage with EthersJS.


EthersJS was chosen for its readability. It tends to keep functionality in one liners instead of doing several lower level tasks to achieve the same goal. This makes our code less bug prone and easy to communicate functionality with our blockchain devs.

WaffleJS works perfectly with Hardhat for testing smart contracts.


For the platform side, our platform tech stack is centered on Typescript for both the frontend and backend. We are running a custom NodeJS application that serves our REST API backed by a Postgres Database. All of our frontend and backend code lives in a single monorepo using Yarn 2 workspaces. We are making heavy use of codegen steps in our build process to reduce repetitive tasks and to establish strict static typing between the database and the React UI layer. A change to any of our database models is immediately reflected in the generated react-query hooks we are using to load data in our components.


The frontend portion of our stack is kept really lean using a (non-ejected) Create React App build. We aren’t using a component library or UI framework - the UI is a mix of fully hand-coded (new and “legacy”) React components with custom CSS module styles.

We also have an internal admin app built using Create React App and Material UI. We have re-skinned Material UI with a custom theme, but all of our style customizations are in a central location which helps keep our various component definitions free of any css or visual concerns. This helps us be very fast and responsive to any requests our business team has for internal features.


We test our backend with a local integration test suite using ephemeral database instances. We follow a “testing pyramid” pattern and invest more heavily in fast isolated tests and checks - we use strict TypeScript everywhere and have a very strict eslint config. This really helps diminish the need for more comprehensive testing further down the line and empowers us to be more agile.


We build, test, and deploy continuously with every commit pushed to our monorepo. Each PR spawns a temporary staging instance of the application that we use to review and test changes immediately. We release to production at least once a week with little fanfare with the batch of incremental changes that we have ready. New features are added in disabled state and “released” to production before the moment we formally launch them. This gives us early feedback on any new issues when the stakes are lower and really cuts down on the pressure of launching new features to the entire user base.

Frontend

  • React, using Create React App
  • Strict Typescript usage
  • Strict static code analysis + automatic formatting (using ESLint + prettier)
  • Storybook
  • TailwindCSS (replacing “CSS Modules”)


Backend

  • Strict Typescript usage
  • Fully containerized using Docker
  • Strict static code analysis + automatic formatting (using ESLint + prettier)
  • TSOA for API layer documentation + request validation + API client generation
  • Custom (domain/module based) service layer
  • MikroORM as a db abstraction layer
  • TSyringe for dependency injection
  • Postgresql for the database
  • Github Actions for continuous integration & deployment
  • AWS Beanstalk for horizontal scaling (new from our previous issues)
  • AWS S3 for file storage
  • Terraform for infrastructure management
  • Jest for unit + integration testing (using supertest)
  • Sentry in the backend & frontend for error reporting
  • Netlify for frontend dev + production deployments


Using Docker we’re able to give developers the experience of a one step dev build which means they can spend more time working on features. This is the first step towards velocity during development.


During the development of a feature we employ strict rules around code review to ensure the whole team is abreast of changes to the codebase & product. We pair programs heavily to increase team awareness of incoming changes, and to generally raise the quality of our changes.


Following basic CI/CD (continuous integration and continuous delivery) principles we are building every commit pushed to Github as well as running a plethora of automated checks & tests using Github Actions against it.


Every frontend commit is deployed automatically thanks to Netlify deploy previews, whereas for the backend it’s up to us to choose when we deploy. All changes are deployed and tested first in a dev environment before we pull the trigger to go to production.


With the automated integration pipeline and one-step production deployments it’s no challenge to do several full production deployments a day.


After each production deployment we use Sentry to monitor error rates in real time, and in the case of any issue we’re able to issue a hotfix within minutes or simply roll back to a known good state.


Question 5, asked by @gbrown135.

My question is regarding the BSC, ETH and Polygon network integration. We know these 3 networks are going to be used together. How will this look when they are all released? Will we have a pool of STARS with a certain amount of STARS on each network? If this is the case how will fees differ between the networks? And is there a seamless mechanism to transfer between them?


Answer 5

A certain amount of the STARS total supply will be deposited on Mainnet and minted on BSC and Polygon, and added on Pancakeswap and Quickswap. Using the Anyswap bridge, users will be able to transfer the STARS between BSC and Mainnet, and Polygon bridge to transfer between Polygon and Mainnet. Gas fees will be close to very low as BSC and Polygon are Layer 2 networks.

In the future, when there is sufficient demand to make it easy for our users, we’ve talked about building a BSC <---> Matic bridge and have done research into this already so that we know the proper way to do it. In addition, Gas will be free when transactions are done on the Mogul Platform on the Polygon network due to our partnership with Biconomy and building relayer technology to allow users to sign transactions and execute them securely and trustlessly still. 


Question 6, asked by @RonnieDacey.

I think the fiat on-ramp and smart wallet will be really beneficial features of the Mogul platform, how is the process going? Any hurdles?

Answer 6

Smart Wallet smart contracts are finished, audited and in progress with platform front end and robust back-end integration.

Fiat on-ramp is going to be added shortly in the future. In the meantime, users can connect with Metamask and buy ETH with their credit cards via Wyre or MoonPay.

One problem with Wyre that our business team is working on is that they only have about a 50% ‘approval’ rate for users using their checkout product in making a transaction. That’s because of the amount of fraud prevention they have in place. So our team has been in touch with other payment providers, even Layer 2 fiat onramps, such as Transak and Moonpay to make sure that when we launch a product we have sufficient geographic and technical coverage for verified users (from the film space) trying to onboard to Mogul and STARS. 


Our development team is experienced with payment rails so there are no hurdles in adding features like these from a technical perspective.

Question 7, asked by prakashrj. What goals were considered when the platform was designed and architected?

Answer 7

To lead the DeFiFi industry, by bringing Movie Productions into the hands of the fans, with the power of blockchain technology. We are highly focused on user friendliness, especially for those new to blockchain and DeFi.


On the architecture side we prioritized stability, robustness and testability with the goal of being able to develop at speed while still retaining confidence in the system. That means almost zero tolerance for technical debt, which in turn means proper architecture and design of features before development.


The result is that we can release features which are more stable, at a faster pace, and still with a high degree of confidence that we’ve not introduced annoying or potentially risky bugs to the system.


Question 8, asked by @jbarcel

Are NFTs a market that mogul would be aiming to get a good market share?

Answer 8

Yes we are aiming to be the top marketplace for movie props, rewards and virtual NFTs related to movies. We’ve built / are building the front end of the technology to support this so we can work with many more artists and film industry professionals to launch really cool NFT drops more efficiently through auctions and direct listings. 


Super excited. Our business team has a lot in the pipeline when it comes to NFT opportunities!

Question 9, asked by @defiapez.

When writing smart contracts, how often are you looking at competitors or blue chip projects in the space? Which projects does Mogul take inspiration from when making smart contracts?

Answer 9

Mogul, and our development team, are hyper aware of the crypto space and look towards successful projects depending on the feature. The majority of our development team has been participating in DeFi for the last few years. The space moves so fast that you need to be studying the trends to develop quicker and cleaner. There aren’t many “standards” in smart contracts, so you need to pave your own path and find the standards that the best are using and add your own knowledge. 


For voting, we study Compound, for Staking we study Sushiswap and for NFT marketplace, we study Opensea. All 3 of these systems are considered to be leaders in their respective areas (governance, farming and NFTs), so we want to be following best in class standards and make sure that we’re seen as innovators in the space.


In terms of the UI for the NFT marketplace, we really liked the simplicity of the new FTX Exchange NFT marketplace and took inspiration from there as well. They offer rewards as NFTs too. Things like a FTX hat or pair of socks and they’re all limited issue. So when having product discussions with the team, that’s the direction we wanted to take, and then as a user, if you buy the NFT you can choose to give it to Mogul or burn it to redeem the reward. Recently we also added the ability in our NFT contracts for the holder to burn their own NFT too to give more flexibility. 


Question 10, asked by @defiapez.

Blockchain (and all) developers are in high demand. As a developer on the project, what drew you to working on Mogul?

Answer 10

Sir, I like the coin lol.
With high funding, connections, skills and team dynamics, Mogul will inevitably dominate the DeFiFi space. No way I’m going to pass on such an opportunity to join in!

There aren’t many projects out there, where as a developer, you are working on cool smart contracts in governance, NFTs, staking, and wallets at the same time. It’s a really talented team and we get to work on things that are going to be used in the real world.


I’ve been approached to work with a lot of projects, but most of them lack either funding, business connections to bring the project to the next level, or marketing expertise. Mogul has all of that and as developers there are a lot of “sh!t coins” that try to hire you but the good projects stand out easily.