8000 support oracle signup by 99Kies · Pull Request #5 · DoraFactory/portable-maci · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

support oracle signup #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! discard

# VOTA_TEST | VOTA
network: VOTA
network: VOTA_TEST

### These parameters will be ignored in the new version of the MACI contract

Expand Down
60 changes: 60 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/components/Main/Maci.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default function Main() {
} = useContext(MainContext)

const [accountStatus, setAccountStatus] = useState<IAccountStatus>(emptyAccountStatus())
const [loading, setLoading] = useState(false)

const usedVc = selectedOptions.reduce((s, o) => s + (isQv ? o.vc * o.vc : o.vc), 0)
const inputError = usedVc > accountStatus.vcbTotal
Expand All @@ -92,7 +93,9 @@ export default function Main() {
setClient(client)

if (client) {
setLoading(true)
const status = await MACI.fetchAccountStatus(client, address, voiceCredit)
setLoading(false)
setAccountStatus(status)
setVoteable(status.stateIdx >= 0)
} else {
Expand Down Expand Up @@ -198,7 +201,7 @@ export default function Main() {
{accountStatus.stateIdx < 0 && !accountStatus.whitelistCommitment ? (
<p
className={[styles.notice, font['regular-note-rg']].join(' ')}
c-error={address ? '' : undefined}
c-error={!loading && address ? '' : undefined}
>
Only addresses on the allowlist can sign up and vote in this round.
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Main/index.module.sass
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
gap: 8px
.notice
color: var(--basic-ink-secondary)
transition: color .1s 1s
// transition: color .1s 1s
&[c-error]
color: var(--error-error-primary)

Expand Down
22 changes: 21 additions & 1 deletion src/lib/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ChainInfo } from '@keplr-wallet/types'

// import config from '@/../config.yaml'

const votaChainInfo = {
chainId: 'vota-ash',
chainName: 'Dora Vota',
Expand Down Expand Up @@ -104,6 +103,7 @@ let configInstance = {
desc: '',
link: '',
status: '',
codeId: '',
},

api: 'https://vota-testnet-api.dorafactory.org/',
Expand All @@ -129,6 +129,13 @@ let configInstance = {
baseGrant: '0',
totalBond: '0',
},
oracleCodeId: ['0'],
oracleApi: '',
oracleCertificate: {
snapshotHeight: '',
signature: '',
amount: '',
},
}

export function getConfig() {
Expand All @@ -142,6 +149,12 @@ export function getConfig() {
? 'https://vota-testnet-api.dorafactory.org/'
: 'https://vota-api.dorafactory.org/',
chainInfo: network === 'VOTA_TEST' ? votaTestChainInfo : votaChainInfo,
oracleCodeId: network === 'VOTA_TEST' ? ['97'] : [''],
oracleApi:
network === 'VOTA_TEST'
? 'https://vota-testnet-certificate-api.dorafactory.org'
: 'https://vota-certificate-api.dorafactory.org',

detailUrl:
network === 'VOTA_TEST'
? 'https://vota-testnet.dorafactory.org/round/'
Expand All @@ -156,3 +169,10 @@ export function updateConfig(config: Partial<typeof configInstance>) {
isQv: /qv/i.test(config.circutType || ''),
}
}

export function updateOracleCertificate(config: Partial<typeof configInstance>) {
configInstance = {
...configInstance,
...config,
}
}
Loading
0