Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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)
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()
}