5. Building Block View

5.1. Battle Cron and API

While originally built for only chimp battle simulation and generation, the battle repository over time has grown in to a multi-purpose cron job and API powering adventures, metadata, bandanas, as well as battles. It has become the workhorse of the ecosystem and everything else we built depends upon it. Despite growing in to something that does so much more, we still affectionately call it the battle system.

5.1.1. Blackbox

Diagram
Table 5.1 - Interfaces

Dojo

The dojo uses the battle API for all internal data including battles, adventures, bandanas, chimpvolutions, snapshots, etc.

Genesis Metadata API

Retrieves image IPFS location.

Chimpers Website

Retrieves check-a-chimp details.

Manifold

Exposes details about staked chimps.

Hal

Delivers chimpvolution details to be written to the database.

5.1.2. Whitebox

Diagram
Table 5.2 - Building Blocks

Cron

A daily job that runs between 00:00 and 01:00 UTC. It is responsible for taking a snapshot of all current holders, updating XP, running battle or adventure simulations, updating chimpvolved chimps and similar tasks.

Battle Generator

Monitors a queue for battle requests, generates the battle using ffmpeg, and upload the video to blob storage.

Battle API

A REST API that exposes data about battles, adventures, chimps, holders, and more.

Battle Storage

Queue storage for battle requests and chimpvolution updates, and blob storage for battle videos.

Database

A Mongo database that stores snapshots, battles, adventures, chimpvolutions, and more off-chain data.

Battle API

A REST API that exposes data about battles, adventures, chimps, holders, and more.

Diagram
Battle Storage

Queue storage for battle requests and chimpvolution updates, and blob storage for battle videos.

Diagram

5.2. Dojo

The dojo is the main application that holders interact with. It is written in Vue.js and is a SPA (Single Page Application).

5.2.1. Blackbox

Diagram

5.2.2. Whitebox

Diagram

5.3. Manifold

Manifold wrote all the Solidity smart contracts that power the system. While normally an external system is not dived in to in detail, the Manifold contracts are the core of the ecosystem and are worth understanding the relationships between the contracts and their neighbors.

5.3.1. Blackbox

Diagram

5.3.2. Whitebox

Diagram

5.4. Chimpers Website

The Chimpers website is mostly a static brochure website, but a couple of pieces of functionality are dynamic and require a backend.

5.4.1. Blackbox

Diagram

5.4.2. Whitebox

Diagram

5.5. Genesis Metadata API