OTOM by Kjetil Golid

Create and experiment with particles called otoms

Website: otom.xyz

Repo: github.com/shape-network/otom-contracts

There are four main actions a chemist can take within the otoms universe.

  1. Mine for Otoms

  1. Annihilate said Otoms and receive Energy (ERC20)

  2. Use Energy along with multiple Otoms to initiate a reaction

  3. Analyze reactions and receive molocules (Chemists can analyze multiple unanalyzed reactions in a single transaction)

Contracts

Link

Description

Otoms

Main NFT contract for minting otoms

OtomsDatabase

DB used for storing information related to things like; tokenURI, Molecules, Who first discovered a Molecule, Universes

OtomsReactionOutputs

Secondary NFT contract of unextracted Molecules

Energy

Fungible token used in reactions

Reactor

Main reactor contract, used to initialize and analyze reactions

Annihilator

Used to convert NFT Otoms into fungible Energy


Functionality

Otoms.sol
/**
 * @dev Mines atoms based on the provided payloads.
 * @param _payloads The payloads to mine atoms from.
 * @return The token IDs of the mined atoms.
 */
function mine(
   MiningPayload[] calldata payloads
) external returns (uint256[] memory);
Reactor.sol
/**
 * @dev Initiates a reaction with the provided atom IDs and energy amount.
 * @param atomIds The token IDs of the atoms to be used in the reaction.
 * @param energyAmount The amount of energy to be used in the reaction.
 * @return The token ID of the output of the reaction.
 */
function initiateReaction(
   uint256[] memory atomIds,
   uint256 energyAmount
) external returns (uint256);

/**
 * @dev Analyses the provided reaction results and returns
 * the output of the reaction.
 * @param reactionResults The results of the reaction.
 * @param expiry The expiry time of the reaction.
 * @param signature The signature of the reaction.
 * @return The output of the reaction.
 */
function analyseReactions(
   ReactionResult[] memory reactionResults,
   uint256 expiry,
   bytes memory signature
) external;
Annihilator.sol
/**
 * @dev Annihilates the provided atom IDs.
 * @param atomIds The token IDs of the atoms to be annihilated.
 * @return The amount of energy produced by the annihilations.
 */
function annihilate(
   uint256[] memory atomIds
) external nonReentrant returns (uint256)

Structs

IOtomsDatabase.sol
struct Molecule {
    string id;
    string name;
    bytes32 universeHash;
    uint256 activationEnergy;
    uint256 radius;
    Bond bond;
    Atom[] givingAtoms;
    Atom[] receivingAtoms;
    uint256 electricalConductivity;
    uint256 thermalConductivity;
    uint256 toughness;
    uint256 hardness;
    uint256 ductility;
}

struct Atom {
    uint256 radius;
    uint256 volume;
    uint256 mass;
    uint256 density;
    uint256 electronegativity;
    bool metallic;
    string name;
    string series;
    uint256 periodicTableX;
    uint256 periodicTableY;
    AtomStructure structure;
    Nucleus nucleus;
}
IOtoms.sol
struct MiningPayload {
    Molecule minedMolecule;
    bytes32 miningHash;
    string tokenUri;
    bytes32 universeHash;
    uint256 expiry;
    bytes signature;
}

We’ve included the three main structs used for mining otoms. Check out IOtoms.sol and IOtomsDatabase.sol for more info.

Data

OtomsDatabase.sol
function getMoleculeByTokenId(
    uint256 tokenId
) external view returns (Molecule memory);

function getUniverseInformation(
    bytes32 universeHash
) external view returns (UniverseInformation memory);

function getMoleculesDiscovered(
    bytes32 universeHash
) external view returns (Molecule[] memory);

function getMoleculesDiscoveredPaginated(
    bytes32 universeHash,
    uint256 offset,
    uint256 limit
) external view returns (Molecule[] memory molecules, uint256 total);

function activeUniverses() external view returns (bytes32[] memory);
Otoms.sol
function moleculeIsAtom(
    Molecule memory _molecule
) external pure returns (bool);
ReactionOutputs.sol
function getReactionOutputData(
    uint256 tokenId
) external view returns (ReactionOutputData memory);

Encoding Utils

IOtomsEncoder.sol
function encodeMolecule(
    Molecule memory _newMolecule
) external pure returns (bytes32);

function encodeAtom(
    Atom memory _newAtom
) external pure returns (bytes32);

function encodeStructure(
    AtomStructure memory _newStructure
) external pure returns (bytes32);

function encodeNucleus(
    Nucleus memory _newNucleus
) external pure returns (bytes32);

function encodeUniverseInformation(
    UniverseInformation memory _universeInformation
) external pure returns (bytes32);

function getSeedUniverseMessageHash(
    UniverseInformation memory _universeInformation,
    uint256 expiry,
    address sender
) external view returns (bytes32);

function getMiningMessageHash(
    Molecule memory _newAtom,
    bytes32 _miningHash,
    string memory _tokenUri,
    bytes32 _universeHash,
    uint256 expiry,
    address sender
) external view returns (bytes32);

function getMiningHash(
    address _chemist,
    bytes32 _universeHash,
    uint256 _nonce
) external pure returns (bytes32);

function getMultipleMiningHashes(
    address _chemist,
    bytes32 _universeHash,
    uint256 _startingNonce,
    uint256 _count
) external pure returns (bytes32[] memory);