-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
311 additions
and
7 deletions.
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
2 changes: 1 addition & 1 deletion
2
scripts/prod/ccip/deploy-ccip-dest-tokens.ts → ...d/ccip/stage-1/deploy-ccip-dest-tokens.ts
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
4 changes: 2 additions & 2 deletions
4
scripts/prod/ccip/deploy-ccip-stage-1.ts → .../prod/ccip/stage-1/deploy-ccip-stage-1.ts
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
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,103 @@ | ||
import { toEther } from '../../../utils/helpers' | ||
import { updateDeployments, deploy } from '../../../utils/deployment' | ||
import { RewardsInitiator, SDLPoolCCIPControllerPrimary } from '../../../../typechain-types' | ||
import { ethers, upgrades } from 'hardhat' | ||
import { getContract } from '../../../utils/deployment' | ||
|
||
// Execute on Ethereum Mainnet | ||
|
||
const ccipRouter = '0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D' | ||
const multisigAddress = '0xB351EC0FEaF4B99FdFD36b484d9EC90D0422493D' | ||
|
||
// Linear Boost Controller | ||
const LinearBoostControllerParams = { | ||
minLockingDuration: 86400, // minimum locking duration in seconds | ||
maxLockingDuration: 4 * 365 * 86400, // maximum locking duration in seconds | ||
maxBoost: 8, // maximum boost amount | ||
} | ||
// SDL Pool CCIP Controller Primary | ||
const SDLPoolCCIPControllerParams = { | ||
maxLINKFee: toEther(10), // max LINK fee to paid on outgoing CCIP updates | ||
updateInitiator: '', // address authorized to send CCIP updates | ||
} | ||
// Rewards Initiator | ||
const RewardsInitiatorParams = { | ||
whitelistedCaller: '', // address authorized to initiate rebase and rewards distribution | ||
} | ||
|
||
async function main() { | ||
const sdlPool = await getContract('SDLPool') | ||
const sdlToken = await getContract('SDLToken') | ||
const linkToken = await getContract('LINKToken') | ||
const wstLINKToken = await getContract('LINK_WrappedSDToken') | ||
const stakingPool = await getContract('LINK_StakingPool') | ||
|
||
const boostController = await deploy('LinearBoostController', [ | ||
LinearBoostControllerParams.minLockingDuration, | ||
LinearBoostControllerParams.maxLockingDuration, | ||
LinearBoostControllerParams.maxBoost, | ||
]) | ||
console.log('LinearBoostController deployed: ', boostController.address) | ||
|
||
const sdlPoolPrimaryImp = (await upgrades.prepareUpgrade( | ||
sdlPool.address, | ||
await ethers.getContractFactory('SDLPoolPrimary'), | ||
{ | ||
kind: 'uups', | ||
} | ||
)) as string | ||
console.log('SDLPoolPrimary implementation deployed at: ', sdlPoolPrimaryImp) | ||
|
||
const ccipController = (await deploy('SDLPoolCCIPControllerPrimary', [ | ||
ccipRouter, | ||
linkToken.address, | ||
sdlToken.address, | ||
sdlPool.address, | ||
SDLPoolCCIPControllerParams.maxLINKFee, | ||
SDLPoolCCIPControllerParams.updateInitiator, | ||
])) as SDLPoolCCIPControllerPrimary | ||
console.log('SDLPoolCCIPControllerPrimary deployed: ', ccipController.address) | ||
|
||
const reSDLTokenBridge = await deploy('RESDLTokenBridge', [ | ||
linkToken.address, | ||
sdlToken.address, | ||
sdlPool.address, | ||
ccipController.address, | ||
]) | ||
console.log('RESDLTokenBridge deployed: ', reSDLTokenBridge.address) | ||
|
||
const rewardsInitiator = (await deploy('RewardsInitiator', [ | ||
stakingPool.address, | ||
ccipController.address, | ||
])) as RewardsInitiator | ||
console.log('RewardsInitiator deployed: ', rewardsInitiator.address) | ||
|
||
updateDeployments({ | ||
LinearBoostController: boostController.address, | ||
SDLPoolCCIPControllerPrimary: ccipController.address, | ||
RESDLTokenBridge: reSDLTokenBridge.address, | ||
RewardsInitiator: rewardsInitiator.address, | ||
}) | ||
|
||
await (await boostController.transferOwnership(multisigAddress)).wait() | ||
|
||
await ( | ||
await rewardsInitiator.whitelistCaller(RewardsInitiatorParams.whitelistedCaller, true) | ||
).wait() | ||
await (await rewardsInitiator.transferOwnership(multisigAddress)).wait() | ||
|
||
await ( | ||
await ccipController.setWrappedRewardToken(stakingPool.address, wstLINKToken.address) | ||
).wait() | ||
await (await ccipController.approveRewardTokens([wstLINKToken.address])).wait() | ||
await (await ccipController.setRESDLTokenBridge(reSDLTokenBridge.address)).wait() | ||
await (await ccipController.setRewardsInitiator(rewardsInitiator.address)).wait() | ||
await (await ccipController.transferOwnership(multisigAddress)).wait() | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error) | ||
process.exit(1) | ||
}) |
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,114 @@ | ||
import { toEther } from '../../../utils/helpers' | ||
import { | ||
updateDeployments, | ||
deploy, | ||
deployUpgradeable, | ||
getContract, | ||
} from '../../../utils/deployment' | ||
import { | ||
RESDLTokenBridge, | ||
SDLPoolCCIPControllerSecondary, | ||
SDLPoolSecondary, | ||
} from '../../../../typechain-types' | ||
|
||
// Execute on Arbitrum Mainnet | ||
|
||
const ccipRouter = '0x141fa059441E0ca23ce184B6A78bafD2A517DdE8' | ||
const multisigAddress = '' | ||
|
||
const primaryChainSelector = '5009297550715157269' // ETH Mainnet | ||
const primaryChainSDLPoolCCIPController = '' // ETH Mainnet | ||
|
||
// Linear Boost Controller | ||
const LinearBoostControllerParams = { | ||
minLockingDuration: 86400, // minimum locking duration in seconds | ||
maxLockingDuration: 4 * 365 * 86400, // maximum locking duration | ||
maxBoost: 8, // maximum boost amount | ||
} | ||
// SDL Pool Secondary | ||
const SDLPoolParams = { | ||
derivativeTokenName: 'Reward Escrowed SDL', // SDL staking derivative token name | ||
derivativeTokenSymbol: 'reSDL', // SDL staking derivative token symbol | ||
queuedNewLockLimit: 50, // max number of queued new locks a user can have at once | ||
baseURI: '', // base URI for reSDL NFTs | ||
} | ||
// SDL Pool CCIP Controller Secondary | ||
const SDLPoolCCIPControllerParams = { | ||
maxLINKFee: toEther(10), // max LINK fee to be paid on outgoing CCIP updates | ||
updateInitiator: '', // address authorized to send CCIP updates | ||
minTimeBetweenUpdates: '82800', // min time between updates in seconds | ||
} | ||
|
||
async function main() { | ||
const sdlToken = await getContract('SDLToken') | ||
const linkToken = await getContract('LINKToken') | ||
const wstLINKToken = await getContract('LINK_WrappedSDToken') | ||
|
||
const boostController = await deploy('LinearBoostController', [ | ||
LinearBoostControllerParams.minLockingDuration, | ||
LinearBoostControllerParams.maxLockingDuration, | ||
LinearBoostControllerParams.maxBoost, | ||
]) | ||
console.log('LinearBoostController deployed: ', boostController.address) | ||
|
||
const sdlPool = (await deployUpgradeable('SDLPoolSecondary', [ | ||
SDLPoolParams.derivativeTokenName, | ||
SDLPoolParams.derivativeTokenSymbol, | ||
sdlToken.address, | ||
boostController.address, | ||
SDLPoolParams.queuedNewLockLimit, | ||
])) as SDLPoolSecondary | ||
console.log('SDLPoolSecondary deployed: ', sdlPool.address) | ||
|
||
const rewardsPool = await deploy('RewardsPool', [sdlPool.address, wstLINKToken.address]) | ||
console.log('wstLINK_SDLRewardsPool deployed: ', rewardsPool.address) | ||
|
||
const ccipController = (await deploy('SDLPoolCCIPControllerSecondary', [ | ||
ccipRouter, | ||
linkToken.address, | ||
sdlToken.address, | ||
sdlPool.address, | ||
primaryChainSelector, | ||
primaryChainSDLPoolCCIPController, | ||
SDLPoolCCIPControllerParams.maxLINKFee, | ||
SDLPoolCCIPControllerParams.updateInitiator, | ||
SDLPoolCCIPControllerParams.minTimeBetweenUpdates, | ||
])) as SDLPoolCCIPControllerSecondary | ||
console.log('SDLPoolCCIPControllerSecondary deployed: ', ccipController.address) | ||
|
||
const reSDLTokenBridge = (await deploy('RESDLTokenBridge', [ | ||
linkToken.address, | ||
sdlToken.address, | ||
sdlPool.address, | ||
ccipController.address, | ||
])) as RESDLTokenBridge | ||
console.log('RESDLTokenBridge deployed: ', reSDLTokenBridge.address) | ||
|
||
await (await boostController.transferOwnership(multisigAddress)).wait() | ||
|
||
await (await sdlPool.setCCIPController(ccipController.address)).wait() | ||
await (await sdlPool.addToken(wstLINKToken.address, rewardsPool.address)).wait() | ||
await (await sdlPool.setBaseURI(SDLPoolParams.baseURI)).wait() | ||
await (await sdlPool.transferOwnership(multisigAddress)).wait() | ||
|
||
await (await ccipController.setRESDLTokenBridge(reSDLTokenBridge.address)).wait() | ||
await (await ccipController.transferOwnership(multisigAddress)).wait() | ||
|
||
updateDeployments( | ||
{ | ||
SDLPoolSecondary: sdlPool.address, | ||
LinearBoostController: boostController.address, | ||
wstLINK_SDLRewardsPool: rewardsPool.address, | ||
SDLPoolCCIPControllerSecondary: ccipController.address, | ||
RESDLTokenBridge: reSDLTokenBridge.address, | ||
}, | ||
{ wstLINK_SDLRewardsPool: 'RewardsPool' } | ||
) | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error) | ||
process.exit(1) | ||
}) |
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,86 @@ | ||
import { getContract } from '../../../utils/deployment' | ||
import { SDLPoolCCIPControllerPrimary, SDLPoolPrimary } from '../../../../typechain-types' | ||
import { getAccounts } from '../../../utils/helpers' | ||
import Safe, { EthersAdapter } from '@safe-global/protocol-kit' | ||
import SafeApiKit from '@safe-global/api-kit' | ||
import { ethers } from 'hardhat' | ||
import { MetaTransactionData } from '@safe-global/safe-core-sdk-types' | ||
|
||
// Execute on Ethereum Mainnet | ||
|
||
const multisigAddress = '0xB351EC0FEaF4B99FdFD36b484d9EC90D0422493D' | ||
const secondaryChainSelector = '4949039107694359620' // Arbitrum Mainnet | ||
const secondaryChainSDLPoolCCIPController = '' // Arbitrum Mainnet | ||
const sdlPoolPrimaryImplementation = '' | ||
|
||
async function main() { | ||
const { signers, accounts } = await getAccounts() | ||
const ethAdapter = new EthersAdapter({ | ||
ethers, | ||
signerOrProvider: signers[0], | ||
}) | ||
const safeSdk = await Safe.create({ ethAdapter, safeAddress: multisigAddress }) | ||
const safeService = new SafeApiKit({ | ||
txServiceUrl: 'https://safe-transaction-mainnet.safe.global', | ||
ethAdapter, | ||
}) | ||
|
||
const sdlPool = (await getContract('SDLPool')) as SDLPoolPrimary | ||
const ccipController = (await getContract( | ||
'SDLPoolCCIPControllerPrimary' | ||
)) as SDLPoolCCIPControllerPrimary | ||
|
||
const safeTransactionData: MetaTransactionData[] = [ | ||
{ | ||
to: sdlPool.address, | ||
data: | ||
( | ||
await sdlPool.populateTransaction.upgradeToAndCall( | ||
sdlPoolPrimaryImplementation, | ||
sdlPool.interface.encodeFunctionData('initialize', [ | ||
'', | ||
'', | ||
ethers.constants.AddressZero, | ||
ethers.constants.AddressZero, | ||
]) | ||
) | ||
).data || '', | ||
value: '0', | ||
}, | ||
{ | ||
to: sdlPool.address, | ||
data: | ||
(await sdlPool.populateTransaction.setCCIPController(ccipController.address)).data || '', | ||
value: '0', | ||
}, | ||
{ | ||
to: ccipController.address, | ||
data: | ||
( | ||
await ccipController.populateTransaction.addWhitelistedChain( | ||
secondaryChainSelector, | ||
secondaryChainSDLPoolCCIPController | ||
) | ||
).data || '', | ||
value: '0', | ||
}, | ||
] | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const safeTxHash = await safeSdk.getTransactionHash(safeTransaction) | ||
const senderSignature = await safeSdk.signTransactionHash(safeTxHash) | ||
|
||
await safeService.proposeTransaction({ | ||
safeAddress: multisigAddress, | ||
safeTransactionData: safeTransaction.data, | ||
safeTxHash, | ||
senderAddress: accounts[0], | ||
senderSignature: senderSignature.data, | ||
}) | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error) | ||
process.exit(1) | ||
}) |
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