Skip to main content

Staking ERC20 Base

The Staking20Base smart contract implements ERC20 token staking mechanism. It allows composition of two ERC20 token contracts into a staking mechanism.

The base contract provides for customization of staking logic. Contract admins can implement their own reward mechanisms by overriding existing functions.

Unlocked Features

Once deployed, you can use the features made available by these contracts on the SDK and dashboard:

Click on each feature to learn more about what functions are available.

Implementing the Contract Extension

Import the contract extension and make your contract inherit it.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@thirdweb-dev/contracts/base/Staking20Base.sol";

contract MyContract is Staking20Base {
constructor(
uint256 _timeUnit,
uint256 _rewardRatioNumerator,
uint256 _rewardRatioDenominator,
address _stakingToken,
address _rewardToken,
address _nativeTokenWrapper
)
Staking20Base(
_timeUnit,
_rewardRatioNumerator,
_rewardRatioDenominator,
_stakingToken,
_rewardToken,
_nativeTokenWrapper
)
{}
}