Преглед изворни кода

Add documentation to TokenTimelock

Francisco Giordano пре 3 година
родитељ
комит
dee772a55f
1 измењених фајлова са 10 додато и 4 уклоњено
  1. 10 4
      contracts/token/ERC20/utils/TokenTimelock.sol

+ 10 - 4
contracts/token/ERC20/utils/TokenTimelock.sol

@@ -24,6 +24,11 @@ contract TokenTimelock {
     // timestamp when token release is enabled
     uint256 private immutable _releaseTime;
 
+    /**
+     * @dev Deploys a timelock instance that is able to hold the token specified, and will only release it to
+     * `beneficiary_` when {release} is invoked after `releaseTime_`. The release time is specified as a Unix timestamp
+     * (in seconds).
+     */
     constructor(
         IERC20 token_,
         address beneficiary_,
@@ -36,28 +41,29 @@ contract TokenTimelock {
     }
 
     /**
-     * @return the token being held.
+     * @dev Returns the token being held.
      */
     function token() public view virtual returns (IERC20) {
         return _token;
     }
 
     /**
-     * @return the beneficiary of the tokens.
+     * @dev Returns the beneficiary that will receive the tokens.
      */
     function beneficiary() public view virtual returns (address) {
         return _beneficiary;
     }
 
     /**
-     * @return the time when the tokens are released.
+     * @dev Returns the time when the tokens are released in seconds since Unix epoch (i.e. Unix timestamp).
      */
     function releaseTime() public view virtual returns (uint256) {
         return _releaseTime;
     }
 
     /**
-     * @notice Transfers tokens held by timelock to beneficiary.
+     * @dev Transfers tokens held by the timelock to the beneficiary. Will only succeed if invoked after the release
+     * time.
      */
     function release() public virtual {
         require(block.timestamp >= releaseTime(), "TokenTimelock: current time is before release time");