-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update Axiom integration Co-authored-by: Wiktor Tkaczyński <wiktor.tkaczynski@gmail.com> * feat: add Isokratia execution strategy * feat: support cast Highlight vote * fix: pass axiom and isokratia as execution strategies to config * feat: finalize Axiom proposals via Mana * feat: handle execution_ready for Axiom strategies * fix: only show actions for Axiom proposals after max_end --------- Co-authored-by: less <fabien@bonustrack.co>
- Loading branch information
1 parent
5591831
commit f49adac
Showing
29 changed files
with
340 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@snapshot-labs/sx": patch | ||
--- | ||
|
||
add Axiom and Isokratia strategies to execution strategies instead of voting strategies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { Client } from '@snapshot-labs/highlight'; | ||
import { Wallet } from '@ethersproject/wallet'; | ||
|
||
const WALLET_PRIVATE_KEY = Wallet.createRandom().privateKey; | ||
|
||
const HIGHLIGHT_URL = import.meta.env.VITE_HIGHLIGHT_URL || 'http://localhost:3000'; | ||
|
||
const signer = new Wallet(WALLET_PRIVATE_KEY); | ||
|
||
export const client = new Client({ | ||
url: `${HIGHLIGHT_URL}/highlight`, | ||
signer | ||
}); | ||
|
||
export const baseDomain = { | ||
name: 'snapshot-x', | ||
version: '1.0.0' | ||
}; | ||
|
||
type EIP712VoteMessage = { | ||
space: string; | ||
voter: string; | ||
proposalId: number; | ||
choice: number; | ||
}; | ||
|
||
export const voteTypes = { | ||
Vote: [ | ||
{ name: 'space', type: 'address' }, | ||
{ name: 'voter', type: 'address' }, | ||
{ name: 'proposalId', type: 'uint256' }, | ||
{ name: 'choice', type: 'uint8' } | ||
] | ||
}; | ||
|
||
export async function vote({ signer, data }): Promise<any> { | ||
const voter = await signer.getAddress(); | ||
|
||
const domain = { | ||
...baseDomain, | ||
chainId: data.chainId, | ||
verifyingContract: data.space | ||
}; | ||
|
||
const message: EIP712VoteMessage = { | ||
space: data.space, | ||
voter, | ||
proposalId: data.proposal, | ||
choice: data.choice | ||
}; | ||
|
||
const signature = await signer._signTypedData(domain, voteTypes, message); | ||
|
||
const signatureData = { | ||
address: voter, | ||
signature, | ||
domain, | ||
types: voteTypes, | ||
message | ||
}; | ||
|
||
const receipt = await client.votes.vote({ | ||
space: data.space, | ||
voter, | ||
proposalId: data.proposal, | ||
choice: data.choice, | ||
chainId: data.chainId, | ||
sig: signature | ||
}); | ||
console.log('Receipt', receipt); | ||
|
||
return { payloadType: 'HIGHLIGHT_VOTE', signatureData, data }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.