Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@tokamak-network/titan-contracts
Advanced tools
@tokamak-network/titan-contracts
contains the various Solidity smart contracts used within the Titan network.
Some of these contracts are meant to be deployed to Ethereum ("Layer 1"), while others are meant to be deployed to Titan ("Layer 2").
You can import @tokamak-network/titan-contracts
to use the Titan contracts within your own codebase.
Install via npm
or yarn
:
npm install @tokamak-network/titan-contracts
Within your contracts:
import { SomeContract } from "@tokamak-network/titan-contracts/path/to/SomeContract.sol";
Note that the /path/to/SomeContract.sol
is the path to the target contract within the contracts folder inside of this package.
For example, the L1CrossDomainMessenger contract is located at packages/contracts/contracts/L1/messaging/L1CrossDomainMessenger.sol
, relative to this README.
You would therefore import the contract as:
import { L1CrossDomainMessenger } from "@tokamak-network/titan-contracts/L1/messaging/L1CrossDomainMessenger.sol";
Install the following:
Clone the repo:
git clone https://github.com/tokamak-network/tokamak-titan.git
cd packages/tokamak/contracts
Install npm
packages:
yarn install
Tests are executed via yarn
:
yarn test
Run specific tests by giving a path to the file you want to run:
yarn test ./test/path/to/my/test.spec.ts
yarn test:coverage
The output is most easily viewable by opening the html file in your browser:
open ./coverage/index.html
Compile and build the various required with the build
command:
yarn build
You must set several required environment variables before you can execute a deployment.
Duplicate the file .env.example
and rename your duplicate to .env
.
Fill out each of the environment variables before continuing.
Before you can carry out a deployment, you must create a deployment configuration file inside of the deploy-config folder.
Deployment configuration files are TypeScript files that export an object that conforms to the DeployConfig
type.
See mainnet.ts for an example deployment configuration.
We recommend duplicating an existing deployment config and modifying it to satisfy your requirements.
Once you've created your deploy config, you can execute a deployment with the following command:
npx hardhat deploy --network <my network name>
Note that this only applies to fresh deployments. If you want to upgrade an existing system (instead of deploying a new system from scratch), you must use the following command instead:
npx hardhat deploy --network <my network name> --tags upgrade
During the deployment process, you will be asked to transfer ownership of several contracts to a special contract address. You will also be asked to verify various configuration values. This is a safety mechanism to make sure that actions within an upgrade are performed atomically. Ownership of these addresses will be automatically returned to the original owner address once the upgrade is complete. The original owner can always recover ownership from the upgrade contract in an emergency. Please read these instructions carefully, verify each of the presented configuration values, and carefully confirm that the contract you are giving ownership to has not been compromised (e.g., check the code on Etherscan).
After your deployment is complete, your new contracts will be written to an artifacts directory in ./deployments/<my network name>
.
FAQs
L1 and L2 smart contracts for Titan
We found that @tokamak-network/titan-contracts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.