-
-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(governance): migrate mainnet DAO's UDT and ETH to Base #15263
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,84 @@ | ||
const { ethers } = require('hardhat') | ||
const { | ||
getNetwork, | ||
getERC20Contract, | ||
getBalance, | ||
} = require('@unlock-protocol/hardhat-helpers') | ||
const l1BridgeAbi = require('../../helpers/abi/l1standardbridge.json') | ||
|
||
// chains | ||
const srcChainId = 1 // mainnet | ||
const destChainId = 8453 // base | ||
const defaultGasAmount = '200000' | ||
|
||
module.exports = async ({ | ||
mainnetTimelockAddress = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B', | ||
baseTimelockAddress = '0xB34567C4cA697b39F72e1a8478f285329A98ed1b', | ||
bridgeAddress = '0x3154Cf16ccdb4C6d922629664174b904d80F2C35', | ||
} = {}) => { | ||
const { | ||
name: srcName, | ||
unlockDaoToken: { address: udtMainnetAddress }, | ||
} = await getNetwork(srcChainId) | ||
const { | ||
name: destName, | ||
unlockDaoToken: { address: udtBaseAddress }, | ||
} = await getNetwork(destChainId) | ||
console.log( | ||
`Submitting proposal to bridge UDT from ${srcName} to ${destName} (${srcChainId} > ${destChainId})` | ||
) | ||
|
||
// get current UDT balance | ||
const udt = await getERC20Contract(udtMainnetAddress) | ||
const mainnetUDTBalance = await udt.balanceOf(mainnetTimelockAddress) | ||
|
||
// get mainnet ETH balance | ||
const mainnetETHBalance = await getBalance(mainnetTimelockAddress) | ||
|
||
// get base bridge contract | ||
const bridgeContract = new ethers.Contract(bridgeAddress, l1BridgeAbi) | ||
|
||
const calls = [ | ||
// set allowance for the bridge to spend udt | ||
{ | ||
contractAddress: udtMainnetAddress, | ||
calldata: udt.interface.encodeFunctionData('approve', [ | ||
bridgeAddress, // dest | ||
mainnetUDTBalance, // amount | ||
]), | ||
}, | ||
// call to bridge ETH | ||
{ | ||
contractAddress: bridgeAddress, | ||
calldata: bridgeContract.interface.encodeFunctionData('bridgeETHTo', [ | ||
baseTimelockAddress, // _to | ||
defaultGasAmount, // _minGasLimit, | ||
'0x', // _extraData | ||
]), | ||
value: mainnetETHBalance, | ||
}, | ||
// call to bridge UDT | ||
{ | ||
contractAddress: bridgeAddress, | ||
calldata: bridgeContract.interface.encodeFunctionData('bridgeERC20To', [ | ||
udtMainnetAddress, // _localToken, | ||
udtBaseAddress, // _remoteToken, | ||
baseTimelockAddress, // _to | ||
mainnetUDTBalance, // amount, | ||
defaultGasAmount, // _minGasLimit, | ||
'0x', // _extraData | ||
]), | ||
}, | ||
] | ||
|
||
// parse calls for Safe | ||
const proposalName = `# Transfer UDT and ETH to Base | ||
|
||
This proposal will bridge the UDT and native ETH owned by the DAO to Base and transfer them to the new UP Governor. | ||
` | ||
|
||
return { | ||
proposalName, | ||
calls, | ||
} | ||
} |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here goes the text of this proposal. Any improvements to make ? Show the balances maybe ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear and concise! that works for me!