---
# System prepended metadata

title: contractmanagermodule
tags: [strunfun]

---

###### tags: `strunfun`

# contractmanagermodule

## Description
The contractmanagermodule is the module which should have all relevant `data°` for relevant smart contracts available in such a way it could be simply retrieved by a key `name"` and easily be used by other components.

## Expectations to the Environment
- `allModules.abicachemodule` - dependency [abicachemodule](https://hackmd.io/3rTPT3XCSkSvUyAC2mMaHQ?view)
- `genericABIs = require("./genericABIs")` 

## Structure
- `abiCache°`
- `genericABIs°`
- `contractLibrary°`
- `.initialize§`
- `.addContract§` `name"`, `data°`
- `.getContract§` `name"`

## Specification
- `abiCache°` = the reference the the external [abicachemodule](https://hackmd.io/3rTPT3XCSkSvUyAC2mMaHQ?view)
- `genericABIs°` = a collection more general ABIs
- `contractLibrary°` = a store object where all the contract data are accessible by their key `name"`
- `.initialize§` = wire up the `abiCache` reference
- `.addContract§` `name"`, `data°` = add the `data` of a contract to the `contractLibrary`
    if we have `data.abi"` then take `data.abi° = genericABIs[data.abi"]`
    otherwise if we donot have  any `abi` in the `data` then get it from `abiCache`
    `contractLibrary[name] = data`
    return nothing
- `.getContract§` `name"` = return `contractLibrary[name"]`

