/LinkToken

LINK Token Contracts for the Chainlink Network

Primary LanguageSolidityMIT LicenseMIT

LINK Token Contracts

The LINK token is an EIP20 token with additional ERC677 functionality.

The total supply of the token is 1,000,000,000, and each token is divisible up to 18 decimal places.

To prevent accidental burns, the token does not allow transfers to the contract itself and to 0x0.

Security audit for 0.4 version of the contracts is available here.

Details

Setup

The project contains 0.4 contracts that were used for LINK Ethereum Mainnet deployment in 2017. For deployments moving forward, we use the updated 0.6 contracts which use a more recent version of solc and the OpenZeppelin token standards. These updates include a minor ABI change around approval/allowance naming.

To mitigate supply chain attack type of risk, we currently avoid using NPM modules to pull Solidity vendor code, but instead use git submodules. Make sure you pull submodules explicitly:

git submodule update --init --recursive

After submodules are updated, we can run:

yarn

Setup contracts:

yarn setup

NOTICE: This will compile all versions of the contracts, but as Hardhat doesn't have robust support for multiple Solidity versions the resulting artifacts will include only final (latest) compiler output. To make sure you compile the specific version please use the specific command:

Setup v0.6 contracts using Solidity 0.6 compiler:

build:contracts:0.6

ABI

You can also find interfaces and ABIs after running through the install yarn setup process.

Testing

Run tests:

yarn test

This will run unit tests for all versions of the contracts.

Integration testing

Integration tests are currently setup for Optimism contracts, and to run them make sure you have a local network running first.

The network can be started using a helpful script, which will clone the Optimism monorepo, build the :

yarn script:oe:up

Run tests:

yarn test --network optimism

This will run unit tests for all versions of the contracts, plus supported integration tests against the local L1 & L2 networks.

The network can be stopped using another script:

yarn script:oe:down

Or use the clean script, which will also delete all the images:

yarn script:oe:clean