Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
188b321c
Unverified
Commit
188b321c
authored
Nov 03, 2021
by
Noah Zinsmeister
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Parse latest proposal description correctly
parent
377331c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
index.ts
src/constants/proposals/index.ts
+1
-0
hooks.ts
src/state/governance/hooks.ts
+8
-6
No files found.
src/constants/proposals/index.ts
View file @
188b321c
export
const
UNISWAP_GRANTS_START_BLOCK
=
11473815
export
const
BRAVO_START_BLOCK
=
13059344
export
const
ONE_BIP_START_BLOCK
=
13551293
src/state/governance/hooks.ts
View file @
188b321c
...
...
@@ -21,7 +21,7 @@ import { useCallback, useMemo } from 'react'
import
{
calculateGasMargin
}
from
'
utils/calculateGasMargin
'
import
{
SupportedChainId
}
from
'
../../constants/chains
'
import
{
BRAVO_START_BLOCK
,
UNISWAP_GRANTS_START_BLOCK
}
from
'
../../constants/proposals
'
import
{
BRAVO_START_BLOCK
,
ONE_BIP_START_BLOCK
,
UNISWAP_GRANTS_START_BLOCK
}
from
'
../../constants/proposals
'
import
{
UNI
}
from
'
../../constants/tokens
'
import
{
useLogs
}
from
'
../logs/hooks
'
import
{
useSingleCallResult
,
useSingleContractMultipleData
}
from
'
../multicall/hooks
'
...
...
@@ -104,6 +104,8 @@ function useFormattedProposalCreatedLogs(
?.
filter
((
parsed
)
=>
indices
.
flat
().
some
((
i
)
=>
i
===
parsed
.
id
.
toNumber
()))
?.
map
((
parsed
)
=>
{
let
description
!
:
string
const
startBlock
=
parseInt
(
parsed
.
startBlock
?.
toString
())
try
{
description
=
parsed
.
description
}
catch
(
error
)
{
...
...
@@ -111,7 +113,6 @@ function useFormattedProposalCreatedLogs(
let
onError
=
Utf8ErrorFuncs
.
replace
// Bravo proposal reverses the codepoints for U+2018 (‘) and U+2026 (…)
const
startBlock
=
parseInt
(
parsed
.
startBlock
?.
toString
())
if
(
startBlock
===
BRAVO_START_BLOCK
)
{
const
U2018
=
[
0xe2
,
0x80
,
0x98
].
toString
()
const
U2026
=
[
0xe2
,
0x80
,
0xa6
].
toString
()
...
...
@@ -131,12 +132,13 @@ function useFormattedProposalCreatedLogs(
}
description
=
JSON
.
parse
(
toUtf8String
(
error
.
error
.
value
,
onError
))
||
''
}
// Bravo proposal omits newlines
if
(
startBlock
===
BRAVO_START_BLOCK
)
{
description
=
description
.
replace
(
/ /g
,
'
\n
'
).
replace
(
/
\d\.
/g
,
'
\n
$&
'
)
}
// Bravo and one bip proposals omit newlines
if
(
startBlock
===
BRAVO_START_BLOCK
||
startBlock
===
ONE_BIP_START_BLOCK
)
{
description
=
description
.
replace
(
/ /g
,
'
\n
'
).
replace
(
/
\d\.
/g
,
'
\n
$&
'
)
}
return
{
description
,
details
:
parsed
.
targets
.
map
((
target
:
string
,
i
:
number
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment