Skip to content
Verified contractExactMIT

TimedLockToken

Address0x3729458d47e6fa19a6f16846f353177ab6b6fa2f
Balance

0 ETH

 

Transactions

2

 

Compiler

solc 0.8.28

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.28+commit.7893614a
Language
solidity
Optimization
No
EVM version
paris
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
22,448,503
Creation transaction
0x81d15ca8db…6479f0895f

contracts/testTokenWithLock.sol

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

contract TimedLockToken {
    string public name = "Draknos";
    string public symbol = "Draknos";
    uint8 public decimals = 18;
    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;
    mapping(address => uint256) public lastTransferTime;

    uint256 public lockDuration = 10 minutes;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

    constructor(uint256 initialSupply) {
        totalSupply = initialSupply * (10 ** uint256(decimals));
        balanceOf[msg.sender] = totalSupply;
        emit Transfer(address(0), msg.sender, totalSupply);
    }

    function transfer(address to, uint256 value) public returns (bool) {
        require(balanceOf[msg.sender] >= value, "Not enought tokens");
        require(block.timestamp >= lastTransferTime[msg.sender] + lockDuration, "Temporarily locked");

        balanceOf[msg.sender] -= value;
        balanceOf[to] += value;
        lastTransferTime[msg.sender] = block.timestamp;
        emit Transfer(msg.sender, to, value);
        return true;
    }

    function approve(address spender, uint256 value) public returns (bool) {
        allowance[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;
    }

    function transferFrom(address from, address to, uint256 value) public returns (bool) {
        require(balanceOf[from] >= value, "Not enought tokens on Sender");
        require(allowance[from][msg.sender] >= value, "No permission to transfer");
        require(block.timestamp >= lastTransferTime[from] + lockDuration, "Tokens temporarily locked");

        balanceOf[from] -= value;
        allowance[from][msg.sender] -= value;
        balanceOf[to] += value;
        lastTransferTime[from] = block.timestamp;
        emit Transfer(from, to, value);
        return true;
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "evmVersion": "paris"
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.