Change logo and update readme (#87)

This commit is contained in:
Szymon Szlachtowicz 2021-09-22 12:30:03 +02:00 committed by GitHub
parent 4ba460827b
commit 02aa702bca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 83 additions and 27 deletions

View File

@ -131,6 +131,15 @@ For more information about EIP-712 go to [docs](https://eips.ethereum.org/EIPS/e
- `getVotingRooms()` - `getVotingRooms()`
Returns votingRooms Returns votingRooms
- `getVotingRoomLength()`
Returns votingRooms length
- `getLastNVotingRooms(uint256 amount)`
Gets last voting rooms returns amount of voting rooms
- `getVotingRoomsFrom(uint256 id)`
Gets voting rooms from given id
- `getOngoingVotingRooms()` - `getOngoingVotingRooms()`
Returns votingRooms in which `room.endAt > block.timestamp` which means the rooms are still accepting votes. Returns votingRooms in which `room.endAt > block.timestamp` which means the rooms are still accepting votes.
Since `votingLength` is set at contract creation and never changed, `room.endAt` is never decreasing with increasing index of votingRoom. Therefore it is enough to check from votingRooms.length up to first element which `endAt < block.timestamp` Since `votingLength` is set at contract creation and never changed, `room.endAt` is never decreasing with increasing index of votingRoom. Therefore it is enough to check from votingRooms.length up to first element which `endAt < block.timestamp`

View File

@ -1,4 +1,43 @@
# Gassless voting over waku ## Waku Messaging
Is a general class that takes care of keeping waku messages of given topic up to date as well as each address tokens.
This class is meant to be extended by other classes.
When creating a object of this class devs need to provide
```
appName: string // name of a string used for waku topics
tokenAddress: string // address of token contract used to verify messages
provider: Web3Provider
chainId: number,
multicall: string // address of multicall contract in given chainId
wakuMessagesSetup: WakuMessagesSetup<any>[] // objects that define waku messages that are to be updated
waku?: Waku // object of Waku class
```
WakuMessagesSetup is defined as follows
```
WakuMessagesSetup<T> = {
name: string // name of wakuMessages
tokenCheckArray: string[] // array of fields in waku message that are to be checked for token balance
decodeFunction: (wakuMessage: WakuMessage) => T | undefined // function that decodes raw WakuMessage
filterFunction?: (e: T) => boolean // function that filters waku messages
}
```
Waku Messages are stored in `this.wakuMessages[name]` and are of type
```
type WakuMessageStore = {
topic: string
hashMap: { [id: string]: boolean }
tokenCheckArray: string[]
arr: any[] // array holding
updateFunction: (msg: WakuMessage[]) => void
}
```
## Waku Voting ## Waku Voting
@ -6,21 +45,45 @@ Objects of type of WakuVoting, hold their own Waku objects and also store list o
Creating instance of WakuVoting: Creating instance of WakuVoting:
WakuVoting constructor expects name of DApp and address of a token, also as optional parameter can take custom Waku object. WakuVoting constructor expects name of DApp and address of a token, web3provider, also as optional parameter can take custom Waku object.
```ts ```ts
import WakuVoting from 'core' import { WakuVoting } from '@status-waku-voting/core'
const wakuVoting = new WakuVoting('myDapp', '0x00000000000') await WakuVoting.create(appName, contractAddress, provider, multicallAddress)
``` ```
objects of type WakuVoting expose functions: objects of type WakuVoting expose functions:
createTimedPoll(signer: JsonRpcSigner, question:string, answers: string[], pollType: enum, minToken?: BigNumber, endTime?: number) - `getVotingRooms()` which return a list o VotingRoom
getTimedPolls()
sendTimedPollVote(signer: JsonRpcSigner, id: string, selectedAnswer:number, tokenAmount?: number) ```
getTimedPollVotes(id: string) export type VotingRoom = {
startBlock: BigNumber
endAt: BigNumber
question: string
description: string
totalVotesFor: BigNumber // amount of commited votes for
totalVotesAgainst: BigNumber //amount of commited votes against
wakuTotalVotesFor: BigNumber // amount of committed and uncomitted votes for
wakuTotalVotesAgainst: BigNumber // amount of committed and uncomitted votes against
wakuVotes?: {
sum: BigNumber // sum of tokens of uncomitted votes
votes: VoteMsg[] // array of uncomitted votes
}
voters: string[] // array of voters which votes has been commited
id: number
timeLeft: number
voteWinner: number | undefined
transactionHash?: string
}
```
- `sendVote(roomId: number, selectedAnswer: number, tokenAmount: BigNumber)` which sends waku vote
- `commitVotes(votes: VoteMsg[])` commits votes to blockchain
- `getVotingRoom(id: number)` gets VotingRoom with given id
## Polls ## Polls

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -1,16 +0,0 @@
<svg width="32" height="30" viewBox="0 0 32 30" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3.75 1.875C1.68756 1.875 0 3.56244 0 5.625C0 7.68744 1.68756 9.375 3.75 9.375C5.81244 9.375 7.5 7.68744 7.5 5.625C7.5 3.56244 5.81244 1.875 3.75 1.875Z" fill="#FF6C6C"/>
<path d="M0 5.625H7.5C7.5 7.68744 5.81244 9.375 3.75 9.375C1.68756 9.375 0 7.68744 0 5.625Z" fill="#E63950"/>
<path d="M10.3125 1.875H32V9.375H10.3125V1.875Z" fill="#FF6C6C"/>
<path d="M10.3125 5.625H32V9.375H10.3125V5.625Z" fill="#E63950"/>
<path d="M10.3125 11.25H20.75V18.75H10.3125V11.25Z" fill="#97DE3D"/>
<path d="M3.75 11.25C1.68756 11.25 0 12.9374 0 15C0 17.0624 1.68756 18.75 3.75 18.75C5.81244 18.75 7.5 17.0624 7.5 15C7.5 12.9374 5.81244 11.25 3.75 11.25Z" fill="#97DE3D"/>
<path d="M0 15H7.5C7.5 17.0624 5.81244 18.75 3.75 18.75C1.68756 18.75 0 17.0624 0 15Z" fill="#59C36A"/>
<path d="M10.3125 15H20.75V18.75H10.3125V15Z" fill="#59C36A"/>
<path d="M10.3125 20.625H28.25V28.125H10.3125V20.625Z" fill="#FED843"/>
<path d="M3.75 20.625C1.68756 20.625 0 22.3124 0 24.375C0 26.4374 1.68756 28.125 3.75 28.125C5.81244 28.125 7.5 26.4374 7.5 24.375C7.5 22.3124 5.81244 20.625 3.75 20.625Z" fill="#FED843"/>
<path d="M0 24.375H7.5C7.5 26.4374 5.81244 28.125 3.75 28.125C1.68756 28.125 0 26.4374 0 24.375Z" fill="#FABE2C"/>
<path d="M10.3125 24.375H28.25V28.125H10.3125V24.375Z" fill="#FABE2C"/>
<path d="M9.375 0H11.25V30H9.375V0Z" fill="#474F54"/>
<path d="M9.375 15H11.25V30H9.375V15Z" fill="#32393F"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -4,7 +4,7 @@ import { DAppProvider, ChainId, useEthers } from '@usedapp/core'
import { DEFAULT_CONFIG } from '@usedapp/core/dist/cjs/src/model/config/default' import { DEFAULT_CONFIG } from '@usedapp/core/dist/cjs/src/model/config/default'
import { WakuPolling } from './components/WakuPolling' import { WakuPolling } from './components/WakuPolling'
import { TopBar, GlobalStyle } from '@status-waku-voting/react-components' import { TopBar, GlobalStyle } from '@status-waku-voting/react-components'
import pollingIcon from './assets/images/pollingIcon.svg' import pollingIcon from './assets/images/pollingIcon.png'
import { JsonRpcSigner } from '@ethersproject/providers' import { JsonRpcSigner } from '@ethersproject/providers'
import { orangeTheme } from '@status-waku-voting/react-components/dist/esm/src/style/themes' import { orangeTheme } from '@status-waku-voting/react-components/dist/esm/src/style/themes'

View File

@ -22,7 +22,7 @@ export function TopBar({ logo, title, theme, activate, deactivate, account }: To
return ( return (
<Wrapper theme={theme}> <Wrapper theme={theme}>
<ContentWrapper> <ContentWrapper>
<Logo style={{ backgroundImage: `url(${logo})` }} /> <Logo src={logo} />
<TitleWrapper> <TitleWrapper>
{title.split(' ').map((text, idx) => ( {title.split(' ').map((text, idx) => (
<div key={idx}>{text}</div> <div key={idx}>{text}</div>
@ -90,7 +90,7 @@ const TitleWrapper = styled.div`
line-height: 17px; line-height: 17px;
` `
const Logo = styled.div` const Logo = styled.img`
height: 30px; height: 30px;
width: 32px; width: 32px;
` `