From 9a1c66ee9348a38fef35b3eee4fa1895d981c491 Mon Sep 17 00:00:00 2001 From: Stefan Adolf Date: Thu, 9 Jan 2025 09:21:15 +0100 Subject: [PATCH] timelocked tokens deployment script Signed-off-by: Stefan Adolf --- README.md | 6 +++++ script/prod/RolloutV25Sale.sol | 40 +++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 3e083131..a1027044 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,12 @@ forge script --private-key=$PRIVATE_KEY --rpc-url=$RPC_URL script/prod/RolloutTo // 0xTokenizer 0xNewImpl 0xNewTokenImpl cast send --rpc-url=$RPC_URL --private-key=$PRIVATE_KEY 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e "upgradeToAndCall(address,bytes)" 0x70e0bA845a1A0F2DA3359C97E0285013525FFC49 0x84646c1f000000000000000000000000998abeb3e57409262ae5b751f60747921b33613e +### Timelocked Tokens + +originally the "timelocked token" was an inline concept of the slcs. Timelock contracts weren't reusable among cs impls. This changes as of beginning of 2025. As a rather simple but not very elegant (and certainly not correct) solution we decided to "trust" external locking contracts so you can reuse them among crowdsale instances. This was needed for the VitaRNA crowdsale that's supposed to just support locks, no stakes - and hence required another crowdsale instance. During this upgrade we decided to externalize the timelock token template so upcoming instances can be verified on chain. + +--- + ## Prerequisites To work with this repository you have to install Foundry (). Run the following command in your terminal, then follow the onscreen instructions (macOS and Linux): diff --git a/script/prod/RolloutV25Sale.sol b/script/prod/RolloutV25Sale.sol index 2a24de6f..0b6b89f1 100644 --- a/script/prod/RolloutV25Sale.sol +++ b/script/prod/RolloutV25Sale.sol @@ -10,30 +10,21 @@ import { StakedLockingCrowdSale } from "../../src/crowdsale/StakedLockingCrowdSa import { LockingCrowdSale } from "../../src/crowdsale/LockingCrowdSale.sol"; import { TimelockedToken } from "../../src/TimelockedToken.sol"; import { TokenVesting } from "@moleculeprotocol/token-vesting/TokenVesting.sol"; +import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; TimelockedToken constant timelockedTokenImplementation = TimelockedToken(0xF8F79c1E02387b0Fc9DE0945cD9A2c06F127D851); -address constant moleculeDevMultisig = 0x9d5a6ae551f1117946FF6e0e86ef9A1B20C90Cb0; //mainnet 0xCfA0F84660fB33bFd07C369E5491Ab02C449f71B; +address constant moleculeDevMultisig = 0x9d5a6ae551f1117946FF6e0e86ef9A1B20C90Cb0; -contract RolloutV25Sale is Script { +contract DeployTimelockedTokenTemplate is Script { function run() public { - - TokenVesting vesting = TokenVesting(0x8f80d1183CD983B01B0C9AC6777cC732Ec9800de); //Moldao - vm.startBroadcast(); - StakedLockingCrowdSale stakedLockingCrowdSale = new StakedLockingCrowdSale(timelockedTokenImplementation); - vesting.grantRole(vesting.ROLE_CREATE_SCHEDULE(), address(stakedLockingCrowdSale)); - //stakedLockingCrowdSale.trustLockingContract(IERC20()); - stakedLockingCrowdSale.trustVestingContract(vesting); -// stakedLockingCrowdSale.transferOwnership(moleculeDevMultisig); + TimelockedToken impl = new TimelockedToken(); + impl.initialize(IERC20Metadata(address(0x0))); vm.stopBroadcast(); - console.log("STAKED_LOCKING_CROWDSALE_ADDRESS=%s", address(stakedLockingCrowdSale)); - console.log("timelocked token implementation=%s", address(timelockedTokenImplementation)); - // 0x7c36c64DA1c3a2065074caa9C48e7648FB733aAB - // vestedDaoToken.grantRole(vestedDaoToken.ROLE_CREATE_SCHEDULE(), address(stakedLockingCrowdSale)); - // stakedLockingCrowdSale.trustVestingContract(vestedDaoToken); + console.log("timelocked token implementation=%s", address(impl)); } } @@ -47,6 +38,25 @@ contract RolloutV25LockingSale is Script { console.log("LOCKING_CROWDSALE_ADDRESS=%s", address(lockingCrowdsale)); console.log("timelocked token implementation=%s", address(timelockedTokenImplementation)); + } +} + + +contract RolloutV25StakedSale is Script { + function run() public { + + TokenVesting vesting = TokenVesting(0x8f80d1183CD983B01B0C9AC6777cC732Ec9800de); //Moldao + + vm.startBroadcast(); + StakedLockingCrowdSale stakedLockingCrowdSale = new StakedLockingCrowdSale(timelockedTokenImplementation); + vesting.grantRole(vesting.ROLE_CREATE_SCHEDULE(), address(stakedLockingCrowdSale)); + //stakedLockingCrowdSale.trustLockingContract(IERC20()); + stakedLockingCrowdSale.trustVestingContract(vesting); +// stakedLockingCrowdSale.transferOwnership(moleculeDevMultisig); + vm.stopBroadcast(); + + console.log("STAKED_LOCKING_CROWDSALE_ADDRESS=%s", address(stakedLockingCrowdSale)); + console.log("timelocked token implementation=%s", address(timelockedTokenImplementation)); // 0x7c36c64DA1c3a2065074caa9C48e7648FB733aAB // vestedDaoToken.grantRole(vestedDaoToken.ROLE_CREATE_SCHEDULE(), address(stakedLockingCrowdSale)); // stakedLockingCrowdSale.trustVestingContract(vestedDaoToken);