How to use the @celo/contractkit/lib/governance/proposals.ProposalBuilder function in @celo/contractkit

To help you get started, we’ve selected a few @celo/contractkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github celo-org / celo-monorepo / packages / celotool / src / cmds / deploy / upgrade / hotfix.ts View on Github external
// if (currentNumber !== 727) {
    //   throw new Error(`Expected current number to be 727, but was ${currentNumber}`)
    // }

    // Example B: Repoint a Celo Core Contract proxy
    const validatorsProxyAddress = await kit.registry.addressFor(CeloContract.Validators)
    const currentValidatorsImplementationAddress = await getImplementationOfProxy(
      kit.web3,
      validatorsProxyAddress
    )
    const desiredImplementationAddress = '0xd18620a5eBE0235023602bB4d490E1e96703EddD'
    console.info('Current Implementation Address: ', currentValidatorsImplementationAddress)

    console.info('\nBuild Proposal')

    const proposalBuilder = new ProposalBuilder(kit)

    // Example A
    // proposalBuilder.addJsonTx({
    //   contract: CeloContract.Attestations,
    //   function: 'setAttestationExpiryBlocks',
    //   // @ts-ignore
    //   args: [728],
    //   value: '0',
    // })

    // Example B
    proposalBuilder.addProxyRepointingTx(validatorsProxyAddress, desiredImplementationAddress)

    const proposal = await proposalBuilder.build()
    const proposalHash = proposalToHash(kit, proposal)
github celo-org / celo-monorepo / packages / cli / src / utils / governance.ts View on Github external
export const buildProposalFromJsonFile = async (kit: ContractKit, jsonFile: string) => {
  const builder = new ProposalBuilder(kit)
  const jsonString = readFileSync(jsonFile).toString()
  const jsonTransactions: ProposalTransactionJSON[] = JSON.parse(jsonString)
  jsonTransactions.forEach((tx) => builder.addJsonTx(tx))
  return builder.build()
}