---
# System prepended metadata

title: Commission workings for MOCDA

---

# Commission workings for MOCDA

### Useful links

* KODA V2 contract
    * https://etherscan.io/address/0xfbeef911dc5821886e1dda71586d90ed28174b7d
* SubGraph 
    * https://thegraph.com/explorer/subgraph/knownorigin/known-origin
* Spreadsheet
    * https://docs.google.com/spreadsheets/d/1Qd5km_6hcoEMzq-hynWn5cdh6jgXNM5rnrRKd0vrJss/edit#gid=0

### HOW TO

```
SEE API - /scripts/mocda/extract-sales.js to script this process
```

1) get address address e.g. 
    - sparrow = 0xdc546f477f273bcf327297bf4adcb671b5f20be1
    - stina = 0x92baffdd6cfb11a4e57a58ffec4833b4d1abd25d
    - UrBen = 0xa1acaddd259649d470b42c95738e5e89c8d8a233
    - unrealcity = 0x3311d6d155a6d30e01a628d4cd64f3212e87e12a
    - ocramnartlof = 0xaffa62575ff764a32ca0bd36292b10cdc3de92ed

2) Get UNIX timestamp for dates e.g.
    - https://www.unixtimestamp.com/
    - start = 07/15/2020 @ 12:00am (UTC) = 1594771200
    - end   = 08/15/2020 @ 12:00am (UTC) = 1597449600

3) Get editions created by artist 
    - Call method `artistsEditions(<address>)` on etherscan/subgraph
```
{
  editions(where:{artistAccount_in:["0xdc546f477f273bcf327297bf4adcb671b5f20be1"]}) {
    id
  }
}
```

3) Get all (Primary) purchases from accounts, between timeframes above
    - Primary = `type: "EDITION"``
    - date range = `timestamp_gte:1594771200 timestamp_lt:1597449600`
    - Only purchases = `eventType_in: ["Purchase", "BidAccepted"]`
    - creator = artist accounts

```
{
  activityEvents(
    where:{
      type: "EDITION"
      timestamp_gte:1594771200 
      timestamp_lt:1597449600 
      eventType_in: ["Purchase", "BidAccepted"]
      creator_in: ["0xdc546f477f273bcf327297bf4adcb671b5f20be1", "0x92baffdd6cfb11a4e57a58ffec4833b4d1abd25d","0xa1acaddd259649d470b42c95738e5e89c8d8a233","0x3311d6d155a6d30e01a628d4cd64f3212e87e12a","0xaffa62575ff764a32ca0bd36292b10cdc3de92ed"]
    } first: 1000) {
    id
    edition {
      id
    }
    type
    eventType
    buyer
    seller
    creator
    eventValueInWei
    triggeredBy
  }
}
```

4) Convert and map results - tally up "eventValueInWei" = total sales

5) 5% of total sales = commission
