Skip to content

Latest commit

 

History

History
305 lines (263 loc) · 9.14 KB

StakingPoolBase.md

File metadata and controls

305 lines (263 loc) · 9.14 KB

StakingPoolBase.sol

View Source: contracts/pool/Staking/StakingPoolBase.sol

↗ Extends: IStakingPools, Recoverable ↘ Derived Contracts: StakingPoolReward

StakingPoolBase

Functions

function (IStore s) internal nonpayable Recoverable 

Arguments

Name Type Description
s IStore
Source Code
constructor(IStore s) Recoverable(s) {}

addOrEditPool

Adds or edits the pool by key

function addOrEditPool(bytes32 key, string name, enum IStakingPools.StakingPoolType poolType, address[] addresses, uint256[] values) external nonpayable nonReentrant 

Arguments

Name Type Description
key bytes32 Enter the key of the pool you want to create or edit
name string Enter a name for this pool
poolType enum IStakingPools.StakingPoolType Specify the pool type: TokenStaking or PODStaking
addresses address[] [0] stakingToken The token which is staked in this pool
values uint256[] [0] stakingTarget Specify the target amount in the staking token. You can not exceed the target.
Source Code
function addOrEditPool(
    bytes32 key,
    string calldata name,
    StakingPoolType poolType,
    address[] calldata addresses,
    uint256[] calldata values
  ) external override nonReentrant {
    // @suppress-zero-value-check The uint values are checked in the function `addOrEditPoolInternal`
    s.mustNotBePaused();
    AccessControlLibV1.mustBeAdmin(s);

    s.addOrEditPoolInternal(key, name, addresses, values);
    emit PoolUpdated(key, name, poolType, addresses[0], addresses[1], addresses[2], addresses[3], values[5], values[1], values[3], values[4], values[2]);
  }

closePool

function closePool(bytes32 key) external nonpayable nonReentrant 

Arguments

Name Type Description
key bytes32
Source Code
function closePool(bytes32 key) external override nonReentrant {
    s.mustNotBePaused();
    AccessControlLibV1.mustBeAdmin(s);
    require(s.getBoolByKeys(StakingPoolCoreLibV1.NS_POOL, key), "Unknown Pool");

    s.deleteBoolByKeys(StakingPoolCoreLibV1.NS_POOL, key);
    emit PoolClosed(key, s.getStringByKeys(StakingPoolCoreLibV1.NS_POOL, key));
  }

version

Version number of this contract

function version() external pure
returns(bytes32)

Arguments

Name Type Description
Source Code
function version() external pure override returns (bytes32) {
    return "v0.1";
  }

getName

Name of this contract

function getName() external pure
returns(bytes32)

Arguments

Name Type Description
Source Code
function getName() external pure override returns (bytes32) {
    return ProtoUtilV1.CNAME_STAKING_POOL;
  }

Contracts