---
# System prepended metadata

title: STEM divergent thoughts on contracts

---

# STEM - Break Down of components

Strategic Tokenized Engagement Model
System for Transparent and Efficient Management
Send Tacos Every Monday
Super Terrible Election Memes

intial imp
https://github.com/dekanbro/stem/tree/main/src

## Contest Contract (main)
 vote struct
- bool released; // has released vote freeing vote points
- address voter; // msg.sender
- uint152 amount; // amount in vote
- uint32 votededAt; // timestamp
- uint48/bytes32 choiceId; // hash/CID/URI
- uint16 voteId; // uid

// use array so we can iterate through results
votes array
// so we can itterate for a specific voter
voterToVoteIds mapping
// keep track of votes spent and current open balance
voterCurrentBalance mapping

// is it worth storing all choice ids in a mapping?
// is it worth storing choice balances in a mapping?
// so we can itterate through votes on a choice
choiceToVoteIds mapping
choiceTotalBalance mapping


// functions
vote
release

// helper functions that interface with modules
// ...

// getters
getVotesForAddress

// sorting and suming could be $$
// maybe external
// ui considerations
getTotalVotesForChoice
getOrderedResults 

### Modules
> a module is used to create flexible conditions around the main events of a contest.  > Template/singletons should have a standard setUp interface. 
    - address template
    - bytes initialConfig
> *Alternatly this could use contract inheritance for one offs instead of a factory pattern

needed interfaces
- points token contract (to get user balance)
- end condition contract (to get if contest is active)
- start condition (to get if contest is active)
- vote condition  (to check if points holder can vote)
- execution condition (this could be an external extention)

**claim conditions: Points contract** return claim balance, isClaimed, claims mapping
- current ERC20 (staking,snapshot,delegation/checkpoint, hodl indurance, conviction?)
    - custom erc20 (airdrop/merkle/offchain)
    - points
    - use token vote/delegation like comp/oz/baal erc20votes

**end condtions** 
- timestamp
- threshold vote participation
- external condition (LP, token price oracle, ...)
- veto/cancel

**start condtions**
- timestamp
- threshold claim participation
- external condition (LP, token price oracle, ...)

**vote conditions**
- threshold
- hodl 

**winner conditions**
// this actually would be handled in the execution module

### Extentions
extentions are external contracts that are dependent on the contest contract
examples:
- reward contract - execution based on winer conditions (end condition / total votes)
- voting yeild based on votedAt
- staking contract
- choice curation registry


## Choice Curation Registry Contract (options / content)

validChoice struct
- bytes32 hash/uri (CID, HASH)
- bytes data

allowlists

...

## Factory / higher order summoner
summons a contest factory with module configurations, module templates. Potential deploy extentions





