Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Jesse-Sawa/58671a69cd31e2c516a449aca7514bf3 to your computer and use it in GitHub Desktop.
Save Jesse-Sawa/58671a69cd31e2c516a449aca7514bf3 to your computer and use it in GitHub Desktop.
/**
* This proposal simulates migrating the owner of the Unsiwap V3 Factory Contract
* on Celo from Optics to Wormhole
*/
import { SimulationConfigNew } from '../types'
import { Interface } from '@ethersproject/abi'
import { ethers } from 'ethers'
/** OPTICS CELO DOMAIN **/
const CELO_DOMAIN = 1667591279
/** RELEVANT ADDRESSES **/
const OPTICS_GOVERNANCE_ADDRESS = '0x47a72910ca53a5087ebcce4282262d4ff4c799c3'
const WORMHOLE_RECEIVER_CONTRACT = '0x0eb863541278308c3a64f8e908bc646e27bfd071'
/** ABIs **/
const OPTICS = [
{
constant: false,
inputs: [
{ name: '_destination', type: 'uint' },
{
name: '_calls',
type: 'tuple[]',
components: [
{ name: 'to', type: 'bytes32' },
{ name: 'data', type: 'bytes' },
],
},
],
name: 'callRemote',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
]
const UniswapV3FactoryABI = ['function setOwner(address _owner)']
const IUniswapV3Factory = new Interface(UniswapV3FactoryABI)
const IOpticsContract = new Interface(OPTICS)
const call = [
CELO_DOMAIN,
[
{
to: ethers.utils.hexZeroPad(ethers.utils.getAddress('0xAfE208a311B21f13EF87E33A90049fC17A7acDEc'), 32),
data: IUniswapV3Factory.encodeFunctionData('setOwner', [WORMHOLE_RECEIVER_CONTRACT]),
},
],
]
const call1 = {
target: OPTICS_GOVERNANCE_ADDRESS,
calldata: IOpticsContract.encodeFunctionData('callRemote', call),
value: 0,
signature: '',
}
export const config: SimulationConfigNew = {
type: 'new',
daoName: 'Uniswap',
governorType: 'bravo',
governorAddress: '0x408ED6354d4973f66138C91495F2f2FCbd8724C3',
targets: [call1.target],
values: [call1.value],
signatures: [call1.signature],
calldatas: [call1.calldata],
description: 'TODO',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment