0

I'm wondering how the code might look/if it's possible to use the Safe Core SDK to deploy a safe, then vote on a Snapshot proposal? Suppose I have a safe, successfully created with:

const safe = await safeFactory.deploySafe({
  { owners, threshold },
  saltNonce,
  callback: (hash) =>
    console.log(`Tx hash: ${hash}`),
});

And I can create the snapshot client:

const client = new snapshot.Client712('https://testnet.hub.snapshot.org');

How might I modify this example (from the snapshot docs), to vote with the safe I've created?

const web3 = new Web3Provider(window.ethereum);
const [account] = await web3.listAccounts();

const receipt = await client.vote(web3, account, {
  space: 'yam.eth',
  proposal: '0x21ea31e896ec5b5a49a3653e51e787ee834aaf953263144ab936ed756f36609f',
  type: 'single-choice',
  choice: 1,
  reason: 'Choice 1 make lot of sense',
  app: 'my-app'
});

I assume the account would be the address of the deployed safe, and in my case I am not creating a provider from window.ethereum, rather new ethers.providers.JsonRpcProvider using an Alchemy RPC endpoint.

1 Answer 1

0

Yes you are absolutely right, account would be in this case the address of your newly deployed safe.

If you have access to the window object with an web3 provider like MetaMask, you might use new Web3Provider(window.ethereum). If not, you should be able to use ethers with an RPC endpoint as you suggested.

Hope it helps, Louis

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.