Skip to content

Commit

Permalink
timelocked tokens deployment script
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Adolf <[email protected]>
  • Loading branch information
elmariachi111 committed Jan 9, 2025
1 parent 483a566 commit 9a1c66e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 15 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<https://getfoundry.sh>). Run the following command in your terminal, then follow the onscreen instructions (macOS and Linux):
Expand Down
40 changes: 25 additions & 15 deletions script/prod/RolloutV25Sale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand All @@ -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);
Expand Down

0 comments on commit 9a1c66e

Please sign in to comment.