-
Notifications
You must be signed in to change notification settings - Fork 87
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
Contract Pipeline Scripts #561
Merged
Merged
Changes from 3 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
3939e92
feat: MovementDeployer
Primata b44012a
add the actual movementdeployer script
Primata c33d0d5
feat: break down scripts
Primata e185384
add missing loadConfig
Primata b0be4a5
feat: call upgrade and propose safe transaction from cli
Primata 7710b45
improve code
Primata 8f52a3d
README
Primata 986f528
temp
Primata e839ab6
merge main
Primata d959f05
merge main
Primata d95014c
feat: pre-foundry-std upgrade
Primata dbcb26b
weird issue with parseRaw
Primata e601e3c
fix: config loading in abc order
Primata 9cdb5e9
fix: start repurposing Multisig
Primata 6c2b688
multisig move token deployer finalized
Primata 877239b
add writability to all deployers
Primata 4a5e8cc
add sepolia deployment
Primata 6d26e31
feat: propose transactions
Primata 2da6d99
feat: simplify
Primata 686a921
conditional operation
Primata 95c1d26
rewording token notices
Primata 44275d7
add tx acceptance
Primata 3d28bf5
cleanup
Primata 1f7d2c4
fix: only write to upgrade file if broadcasting
Primata cca0eef
fix deployer
Primata 26da9df
modify multisig deployment
Primata e2d1909
feat: multisig deployment
Primata 2a4d64f
feat: multisig deployment
Primata dfe0ab5
pre addition of custody param
Primata f1d51e0
add some keys
Primata a5b4845
add token fixes
Primata 209a2b7
feat: mainnet deployment
Primata d4c324a
feat: accept kms signature
Primata bbe8cf5
rename logo file
Primata 4c27a3c
fix: tests
Primata 35ee46f
merge conflicts
Primata f1180b3
feat: diff storage before upgrade
Primata 633e830
feat: kms and registry update
Primata 2a79014
fix: review
Primata 02aeb82
fix: CoreDeployer fixes
Primata 78a1d31
feat:artifact versioning
Primata f4dab18
adjust workflow to contain environment
Primata 2c192f9
feat: include mainnet token release artifacts
Primata 79d9a2b
move artifacts
Primata 6d56eb4
dev deployment
Primata 86adea1
deploy to holesky
Primata ded7606
move faucet
Primata ff1989b
faucet
Primata dca5b1a
fix: faucet
Primata f5b3ec6
fix tests
Primata 7eb8e40
fix conflict options
Primata 8d532f0
test withdraw
Primata b39861f
maxBalance config
Primata 370f9c2
Merge branch 'main' into primata/contract-pipeline
Primata 4cfa884
move faucet to holesky
Primata 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
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
Submodule safe-smart-account
added at
bf943f
1 change: 1 addition & 0 deletions
1
...s/settlement/mcr/contracts/protocol-units/settlement/mcr/contracts/lib/safe-smart-account
Submodule safe-smart-account
added at
786dad
90 changes: 90 additions & 0 deletions
90
protocol-units/settlement/mcr/contracts/script/CoreDeployer.s.sol
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,90 @@ | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
import {MOVEToken} from "../src/token/MOVEToken.sol"; | ||
import { Helper } from "./helpers/Helper.sol"; | ||
import { MCRDeployer } from "./MCRDeployer.s.sol"; | ||
import { StakingDeployer } from "./StakingDeployer.s.sol"; | ||
import { StlMoveDeployer } from "./StlMoveDeployer.s.sol"; | ||
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol"; | ||
|
||
contract CoreDeployer is MCRDeployer, StakingDeployer, StlMoveDeployer { | ||
|
||
function run() external override(MCRDeployer, StakingDeployer, StlMoveDeployer) { | ||
|
||
// load config data | ||
_loadConfig(); | ||
|
||
// Load deployment data | ||
_loadDeployments(); | ||
|
||
uint256 signer = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(signer); | ||
|
||
// timelock is required for all deployments | ||
if (deployment.timelock == ZERO) { | ||
timelock = new TimelockController(config.minDelay, config.proposers, config.executors, config.admin); | ||
deployment.timelock = address(timelock); | ||
} | ||
|
||
// Deploy or upgrade contracts conditionally | ||
deployment.moveAdmin == ZERO && deployment.move == ZERO ? | ||
_deployMove() : deployment.moveAdmin != ZERO && deployment.move != ZERO ? | ||
_upgradeMove() : revert("MOVE: both admin and proxy should be registered"); | ||
|
||
deployment.stakingAdmin == ZERO && deployment.staking == ZERO && deployment.move != ZERO ? | ||
_deployStaking() : deployment.stakingAdmin != ZERO && deployment.staking != ZERO ? | ||
_upgradeStaking() : revert("STAKING: both admin and proxy should be registered"); | ||
|
||
deployment.stlMoveAdmin == ZERO && deployment.stlMove == ZERO && deployment.move != ZERO ? | ||
_deployStlMove() : deployment.stlMoveAdmin != ZERO && deployment.stlMove != ZERO ? | ||
_upgradeStlMove() : revert("STL: both admin and proxy should be registered"); | ||
|
||
deployment.mcrAdmin == ZERO && deployment.mcr == ZERO && deployment.move != ZERO && deployment.staking != ZERO ? | ||
_deployMCR() : deployment.mcrAdmin != ZERO && deployment.mcr != ZERO ? | ||
_upgradeMCR() : revert("MCR: both admin and proxy should be registered"); | ||
|
||
vm.stopBroadcast(); | ||
|
||
// Only write to file if chainid is not running a foundry local chain | ||
if (block.chainid != foundryChainId) { | ||
_writeDeployments(); | ||
} | ||
} | ||
|
||
function _deployMove() internal { | ||
console.log("MOVE: deploying"); | ||
MOVEToken moveImplementation = new MOVEToken(); | ||
vm.recordLogs(); | ||
moveProxy = new TransparentUpgradeableProxy( | ||
address(moveImplementation), | ||
address(timelock), | ||
abi.encodeWithSignature(moveSignature) | ||
); | ||
console.log("MOVE deployment records:"); | ||
console.log("proxy", address(moveProxy)); | ||
deployment.move = address(moveProxy); | ||
deployment.moveAdmin = _storeAdminDeployment(); | ||
} | ||
|
||
function _upgradeMove() internal { | ||
console.log("MOVE: upgrading"); | ||
MOVEToken newMoveImplementation = new MOVEToken(); | ||
timelock.schedule( | ||
address(deployment.moveAdmin), | ||
0, | ||
abi.encodeWithSignature( | ||
"upgradeAndCall(address,address,bytes)", | ||
address(moveProxy), | ||
address(newMoveImplementation), | ||
"" | ||
), | ||
bytes32(0), | ||
bytes32(0), | ||
block.timestamp + 1 days | ||
); | ||
console.log("MOVE: upgrade scheduled"); | ||
} | ||
|
||
} |
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
79 changes: 79 additions & 0 deletions
79
protocol-units/settlement/mcr/contracts/script/MCRDeployer.s.sol
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,79 @@ | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
import {MCR} from "../src/settlement/MCR.sol"; | ||
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol"; | ||
import { Helper } from "./helpers/Helper.sol"; | ||
import { Vm } from "forge-std/Vm.sol"; | ||
|
||
contract MCRDeployer is Helper { | ||
|
||
function run() external virtual { | ||
|
||
// Load deployment data | ||
_loadDeployments(); | ||
|
||
uint256 signer = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(signer); | ||
|
||
// timelock is required for all deployments | ||
if (deployment.timelock == ZERO) { | ||
timelock = new TimelockController(config.minDelay, config.proposers, config.executors, config.admin); | ||
deployment.timelock = address(timelock); | ||
} | ||
|
||
deployment.mcrAdmin == ZERO && deployment.mcr == ZERO && deployment.move != ZERO && deployment.staking != ZERO ? | ||
_deployMCR() : deployment.mcrAdmin != ZERO && deployment.mcr != ZERO ? | ||
_upgradeMCR() : revert("MCR: both admin and proxy should be registered"); | ||
|
||
vm.stopBroadcast(); | ||
|
||
// Only write to file if chainid is not running a foundry local chain | ||
if (block.chainid != foundryChainId) { | ||
_writeDeployments(); | ||
} | ||
} | ||
|
||
function _deployMCR() internal { | ||
console.log("MCR: deploying"); | ||
MCR mcrImplementation = new MCR(); | ||
vm.recordLogs(); | ||
mcrProxy = new TransparentUpgradeableProxy( | ||
address(mcrImplementation), | ||
address(timelock), | ||
abi.encodeWithSignature( | ||
mcrSignature, | ||
address(stakingProxy), | ||
128, | ||
100 ether, | ||
100 ether, | ||
config.proposers | ||
) | ||
); | ||
console.log("MCR deployment records:"); | ||
console.log("proxy", address(mcrProxy)); | ||
deployment.mcr = address(mcrProxy); | ||
deployment.mcrAdmin = _storeAdminDeployment(); | ||
} | ||
|
||
function _upgradeMCR() internal { | ||
console.log("MCR: upgrading"); | ||
MCR newMCRImplementation = new MCR(); | ||
timelock.schedule( | ||
address(deployment.mcrAdmin), | ||
0, | ||
abi.encodeWithSignature( | ||
"upgradeAndCall(address,address,bytes)", | ||
address(mcrProxy), | ||
address(newMCRImplementation), | ||
"" | ||
), | ||
bytes32(0), | ||
bytes32(0), | ||
block.timestamp + 1 days | ||
); | ||
console.log("MCR: upgrade scheduled"); | ||
} | ||
|
||
} |
75 changes: 75 additions & 0 deletions
75
protocol-units/settlement/mcr/contracts/script/StakingDeployer.s.sol
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,75 @@ | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
import {MovementStaking} from "../src/staking/MovementStaking.sol"; | ||
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol"; | ||
import { Helper } from "./helpers/Helper.sol"; | ||
import { Vm } from "forge-std/Vm.sol"; | ||
|
||
contract StakingDeployer is Helper { | ||
|
||
function run() external virtual { | ||
|
||
// load config data | ||
_loadConfig(); | ||
|
||
// Load deployment data | ||
_loadDeployments(); | ||
|
||
uint256 signer = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(signer); | ||
|
||
// timelock is required for all deployments | ||
if (deployment.timelock == ZERO) { | ||
timelock = new TimelockController(config.minDelay, config.proposers, config.executors, config.admin); | ||
deployment.timelock = address(timelock); | ||
} | ||
|
||
deployment.stakingAdmin == ZERO && deployment.staking == ZERO && deployment.move != ZERO ? | ||
_deployStaking() : deployment.stakingAdmin != ZERO && deployment.staking != ZERO ? | ||
_upgradeStaking() : revert("STAKING: both admin and proxy should be registered"); | ||
|
||
vm.stopBroadcast(); | ||
|
||
// Only write to file if chainid is not running a foundry local chain | ||
if (block.chainid != foundryChainId) { | ||
_writeDeployments(); | ||
} | ||
} | ||
|
||
function _deployStaking() internal { | ||
console.log("STAKING: deploying"); | ||
MovementStaking stakingImplementation = new MovementStaking(); | ||
vm.recordLogs(); | ||
stakingProxy = new TransparentUpgradeableProxy( | ||
address(stakingImplementation), | ||
address(timelock), | ||
abi.encodeWithSignature(stakingSignature, address(moveProxy)) | ||
); | ||
console.log("STAKING deployment records:"); | ||
console.log("proxy", address(stakingProxy)); | ||
deployment.staking = address(stakingProxy); | ||
deployment.stakingAdmin = _storeAdminDeployment(); | ||
} | ||
|
||
function _upgradeStaking() internal { | ||
console.log("STAKING: upgrading"); | ||
MovementStaking newStakingImplementation = new MovementStaking(); | ||
timelock.schedule( | ||
address(deployment.stakingAdmin), | ||
0, | ||
abi.encodeWithSignature( | ||
"upgradeAndCall(address,address,bytes)", | ||
address(stakingProxy), | ||
address(newStakingImplementation), | ||
"" | ||
), | ||
bytes32(0), | ||
bytes32(0), | ||
block.timestamp + 1 days | ||
); | ||
console.log("STAKING: upgrade scheduled"); | ||
} | ||
|
||
} |
75 changes: 75 additions & 0 deletions
75
protocol-units/settlement/mcr/contracts/script/StlMoveDeployer.s.sol
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,75 @@ | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
import {stlMoveToken} from "../src/token/stlMoveToken.sol"; | ||
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol"; | ||
import { Helper } from "./helpers/Helper.sol"; | ||
import { Vm } from "forge-std/Vm.sol"; | ||
|
||
contract StlMoveDeployer is Helper { | ||
|
||
function run() external virtual { | ||
|
||
// load config data | ||
_loadConfig(); | ||
|
||
// Load deployment data | ||
_loadDeployments(); | ||
|
||
uint256 signer = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(signer); | ||
|
||
// timelock is required for all deployments | ||
if (deployment.timelock == ZERO) { | ||
timelock = new TimelockController(config.minDelay, config.proposers, config.executors, config.admin); | ||
deployment.timelock = address(timelock); | ||
} | ||
|
||
deployment.stlMoveAdmin == ZERO && deployment.stlMove == ZERO && deployment.move != ZERO ? | ||
_deployStlMove() : deployment.stlMoveAdmin != ZERO && deployment.stlMove != ZERO ? | ||
_upgradeStlMove() : revert("STL: both admin and proxy should be registered"); | ||
|
||
vm.stopBroadcast(); | ||
|
||
// Only write to file if chainid is not running a foundry local chain | ||
if (block.chainid != foundryChainId) { | ||
_writeDeployments(); | ||
} | ||
} | ||
|
||
function _deployStlMove() internal { | ||
console.log("STL: deploying"); | ||
stlMoveToken stlMoveImplementation = new stlMoveToken(); | ||
vm.recordLogs(); | ||
stlMoveProxy = new TransparentUpgradeableProxy( | ||
address(stlMoveImplementation), | ||
address(timelock), | ||
abi.encodeWithSignature(stlMoveSignature, "STL Move Token", "STL", address(moveProxy)) | ||
); | ||
console.log("STL deployment records:"); | ||
console.log("proxy", address(stlMoveProxy)); | ||
deployment.stlMove = address(stlMoveProxy); | ||
deployment.stlMoveAdmin = _storeAdminDeployment(); | ||
} | ||
|
||
function _upgradeStlMove() internal { | ||
console.log("STL: upgrading"); | ||
stlMoveToken newStlMoveImplementation = new stlMoveToken(); | ||
timelock.schedule( | ||
address(deployment.stlMoveAdmin), | ||
0, | ||
abi.encodeWithSignature( | ||
"upgradeAndCall(address,address,bytes)", | ||
address(stlMoveProxy), | ||
address(newStlMoveImplementation), | ||
"" | ||
), | ||
bytes32(0), | ||
bytes32(0), | ||
block.timestamp + 1 days | ||
); | ||
console.log("STL: upgrade scheduled"); | ||
} | ||
|
||
} |
Oops, something went wrong.
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.
Why not UUPS?
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.
UUPS is not as commonly implemented, especially for tokens. Since all of them should follow a similar workflow and there is one danger to UUPS:
