Skip to main content

Quick Start

Set up Metamask

Visit Torus Testnet | Chainlist and press "Connect Wallet" or download Metamask here and configure a new network with the following details.

PropertyValue
Network nameTorus Horn Testnet
RPC URLhttps://rpc.testnet.toruschain.com/
Chain ID8194
Currency SymboltTQF
Block explorer URLhttps://testnet.toruscan.com/

Deploy Timelock Smart Contract to Testnet

Get testnet funds

There are currently no available faucets. Please request testnet funds from the Torus team.

Write, Deploy and Interact with a contract

Visit Remix IDE and prepare the smart contract.

Create a new Solitidy file in the Remix editor and write your contract. In this example, a timelock contract was implemented.

// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.28;

contract Timelock {
address public immutable owner;
uint public immutable unlockTimestamp;

constructor(uint _unlockDays) payable {
owner = msg.sender;
unlockTimestamp = block.timestamp + (_unlockDays * 1 days);
}

function withdraw() public {
require(msg.sender == owner, "not the owner");
require(block.timestamp > unlockTimestamp, "too early");

uint256 contractBalance = address(this).balance;
payable (owner).transfer(contractBalance);
}
}

"Quickstart Timelock Code"

Navigate to Solidity Compiler pane, make sure your compiler is configured with EVM version set to London under Advanced Configuration and click Compile Timelock.sol.

"Quickstart Timelock Compile"

Navigate to Deploy & run transactions pane, switch Remix to Injected Provider - MetaMask under Environment and switch MetaMask to Torus Testnet. Set the value you would like to send to the constructor, as well as the constructor arguments and click deploy. A MetaMask window will pop up asking you to sign the transaction, you will need to do that in order to deploy your contract. In this example, the constructor receives 10 TQF and is called with the argument 7. This locks 10 TQF for a duration of 7 days.

"Quickstart Timelock Deploy"

You can now copy the contract address or interact with the contract using the functions available under "Deployed Contracts". For this example you can read the owner, read the unlock timestamp and trigger the withdraw transaction.

"Quickstart Timelock Interact"