# Subsquare, dotreasury and statescan maintenance proposal for 2022 Q4 and 2023 Q1
Proponent: OpenSquare(ESgz7GLVW7BL5DhRgpVnxSXVwaKt4ytWcrf52TY1GQD1cEb)
Date: 03/22/2023
Requested Allocation: $71718.37(1987.8KSM with EMA7 price in 04.18.2023)
----
[Opensquare team](https://www.opensquare.network/team/) has been dedicated in dotsama ecosystem developing governance tools, explorers, dashboards, dapps. We are proposing a treasury proposal to cover our cost for the maintenance of [dotreasury](https://www.dotreasury.com/ksm/child-bounties), [statescan](https://statemine.statescan.io/), and [subsquare](https://www.subsquare.io/).
Time scope: 2022 Q4 and 2023 Q1.
## Infrastructure
### Servers
- Legacy hetzner servers for statescan v1 about 5 monthes: 4 Hetzner vps + a 800G volume, and the vps are 1 * CPX31 + 2 * CPX41 + 1 * CX41.
- New hetzner servers for statescan v2 about 3 monthes: 3 * CX41 + 1200GB volume.
- Blockmeta server which stores dotsama and several common good chain block metadata: 1 * CX41 + 1500GB volume, 6 monthes.
- Dotreasury kusama and polkadot: 2 * CX41, 6 monthes.
- Subsquare kusama, polkadot, rococo, collectives: 2 * CX41 * 6 monthes + 1 * CX41 * 4 monthes + 1 * CX41 * 2 monthes.
- Development/test servers: 3 contabo servers * 6 monthes + 1 hetzner server CX41 * 4 monthes.
| Product | Details | per month | Months | Total |
|--------------|-------------------------------|-----------|--------|--------|
| Statescan V1 | 4 Hetzenr vps + 800GB volume | €105 | 6 | €630 |
| Statescan V2 | 3 Hetzner vps + 1200 volume | €105 | 3 | €315 |
| Blockmeta | 1 Hetzner vps + 1500 volume | €83.4 | 6 | €500.4 |
| Dotreasury | 2 Hetzner vps | €34.8 | 6 | €208.8 |
| Subsquare kusama and polkadot | 2 Hetzner vps | €34.8 | 6 | €208.8 |
| Subsquare rococo | 1 Hetzner vps | €17.4 | 4 | €69.6 |
| Subsquare collectives | 1 Hetzner vps | €17.4 | 2 | €34.8 |
| Development/test contabo servers | 3 vps | $25.47 | 6 | $152.82 |
| Development/test hetzner servers | 1 vps | $17.4 | 4 | €69.6 |
| Total | | | | $2332.2 |
## Ali email service
| Service | one cost | Number | Cost |
| ------- | -------- | ------ | ---- |
| email resource package | ¥81 | 3 | ¥243 |
| In dollar | | | $35.32 |
## Domains
| Domain | scope | Cost |
|--------------|-------------------------------|-----------|
| dotreasury.com | 2022 | $10.95 |
| statescan.io | 2022 | $47.99 |
| subsquare.io | 2022 | $47.99 |
| Total | | $106.93 |
## Infrastructure summary
| Item | Cost |
| ------- | ---- |
| Servers | $2332.2 |
| Ali email service | $35.32 |
| Domains | $106.93 |
| volatility and currency translation for servers and domains | $243.92 |
| Total | $2718.37 |
Note: we paid server and domain bills with Chinese CNY, and it costed us additional fees because of currency translation and token price volatility. This is only requsted for server/domain bills, no developers payment.
## Maintenance
The maintenance work includes:
- Server deployment maintenance: daily server monitor, upgrading products versions, emergency handling, etc.
- Necessary context information collection, like dotreasury proposal/projects context collection and updation, statescan asset information.
- Collaboration with other teams to provide api support and some governance explanation.
- Codebase maintenance: code refactor, bug fixes, UI tweaks, dependency upgrading, etc.
We will list the main work for codebase maintenance by products.
### Subsquare
- Polkassembly changed its backend apis, and we'd have to change most of context syncing and comments query code.
- Support split votes for democracy referendum.
- Support OpenGov inline proposal.
- Common post detail page refactor, and common business are extracted as components.
- Remember the choice even when user don't agree with the cookie policy.
- Config eslint for next/backend/scan packages to check potential bugs with github CI.
- Fix popup and delegation items responsive scroll style.
- Add warning bar for scam proposals.
- Improve word break style for post content and remark call argument.
- Fix estimated democracy referendum executed time.
- Fix babel build configuration.
- CSS common code extraction.
- Add more react components mounted check to prevent memory leak on fronted pages.
- Fix external urls for subscan/statescan.
- Remove useless user profile query in Auth component.
- Fix toast item style.
- Fix identity icon for addresses with sub identity.
- Fix page width for some pages including empty overview page, settings page, etc.
- Disable background page scrolling when popup is shown.
- Fix theme toggle with react context, while previously we use redux.
- More than 10 times hotfixes after new version released.
Please check the [changelog](https://github.com/opensquare-network/subsquare/blob/main/CHANGELOG.md) (release 2.3.1 to 2.9.8) and [commits](https://github.com/opensquare-network/subsquare/commits/main) for more details. We will request 10 FTE equivalent work per month for subsquare, totally 60 FTE.
### Dotreasury
- Fix tip slashed business handling. There are 2 slashed ones on kusama.
- Refactor proposals/applications tab summary layout, better for responsive view.
- Add overview api for statescan.
- Fix the business in council motion rejected hook to solve the proposal invalid state bug.
- Add `isFinal` field to proposals in case of council motions handle finished proposals.
- Query and show proposal titles from subsquare if no set manually by admin.
- Update funded projects information.
- Remove semantic ui css patch because of dependency upgrading.
- Improve codebase configuration to ignore annoyning and unnecessary sourcemap warnings.
- Several times hotfix after release. Many times we found bugs, and sometimes user reported them.
Please check [commits](https://github.com/opensquare-network/dotreasury/commits/main) for more details. We will request 6 FTE equivalent work per month for dotreasury, totally 36 FTE.
### Statescan
We deprecated [statescan v1](https://github.com/opensquare-network/statescan) and developed [statescan v2](https://github.com/opensquare-network/statescan-v2). There are several reasons:
1. We want a better codebase for [visualizing polkadot bounty program](https://kusama.subsquare.io/treasury/bounty/11). The code should be more modularized and clean.
2. SSR is abandoned, because:
- We want the page first be loaded without the affection of backend apis.
- Fronted code can be deployed to IPFS.
- Better collaboration for future bounties.
The work includes:
- We migrate the statemine/statemint/westmint v1 deployments to v2 and add new deployments for kusama, collectives and westend collectives.
- We refactored the scripts to parse, fetch and sync NFT metadata. The code is splited into different modules including IPFS related utilities, parse task population, parse result syncing, etc.
- Add asset height for predefined asset information, so destroyed assets' context won't be used for existed ones.
- Fix NFT image layout and background color for better image view.
- Remove all count for extrinsics/events list api for performance. The all documents count require a full DB table scan, so it's extremely slow.
- Test and add more database indexes for better performance.
- Blockmeta scan for collectives para-chain.
- A [monitor api](https://status.statescan.io/) is created to fast track all chains scan status.
- A [lark](https://www.larksuite.com/) bot is created to report the scan failure. OpenSquare team use lark for daily collaboration work and this bot can reach us well.
- Support video NFTs, including metadata parse and fronted site rendering.
- Remove scemantic UI from dependency.
- Add lint and github CI configuration for backend packages.
Please check [commits](https://github.com/opensquare-network/statescan-v2/commits/main) for more details. We will request 7 FTE equivalent work per month for statescan, totally 42 FTE. Note our request is higher than previous request because the statescan v2 really cost more devops, design and hotfix work.
## Metrics

## Total cost
| Item | Detail | Cost |
|------------|--------|-----------|
| Servers | see servers section | $2718.37 |
| Subsquare | see subsquare section | $30,000 |
| Dotreasury | see dotreasury section | $18,000 |
| Statescan | see statescan section | $21,000 |
| Total | | $71,718.37 |
Payment conditions:
- We use $500($62.5/hour) for each FTE(8 hours) maintenance cost, total 138 FTE, $69,000.
- We will use the latest or EMA7 price to calculate the KSM amount, 2042.5KSM with price in 03.22.2023.