false
true
0

Contract Address Details

0x371C8939ab3838D65AD37de4835135265B9773C7

Contract Name
StakingLock
Creator
0x939ce2–bc8b8b at 0xb0e514–c62fef
Balance
0 tPLS
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
26048725
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
StakingLock




Optimization enabled
false
Compiler version
v0.8.28+commit.7893614a




EVM Version
paris




Verified at
2025-08-08T07:00:51.097413Z

contracts/Lock.sol

// contracts/StakingLock.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.28;

contract StakingLock {
    struct Stake {
        uint256 amount;
        uint256 unlockTime;
        bool withdrawn;
    }

    mapping(address => Stake) public stakes;
    event Staked(address indexed user, uint256 amount, uint256 unlockTime);
    event Withdrawn(address indexed user, uint256 amount, uint256 when);

    constructor() {}

    function stake(uint256 _amount, uint256 _durationSeconds) external payable {
        require(_amount > 0, "Amount must be greater than 0");
        require(msg.value == _amount, "Sent value must match amount");
        require(_durationSeconds > 0, "Duration must be greater than 0");

        uint256 newUnlockTime = block.timestamp + _durationSeconds;
        Stake storage userStake = stakes[msg.sender];
        require(
            userStake.amount == 0 || userStake.withdrawn,
            "Existing stake must be withdrawn first"
        );

        stakes[msg.sender] = Stake(_amount, newUnlockTime, false);
        emit Staked(msg.sender, _amount, newUnlockTime);
    }

    function withdraw() external {
        Stake storage userStake = stakes[msg.sender];
        require(userStake.amount > 0, "No stake found");
        require(
            block.timestamp >= userStake.unlockTime,
            "Too early to withdraw"
        );
        require(!userStake.withdrawn, "Already withdrawn");

        uint256 amount = userStake.amount;
        userStake.withdrawn = true;
        emit Withdrawn(msg.sender, amount, block.timestamp);
        payable(msg.sender).transfer(amount);
    }

    function getStake(
        address _user
    )
        external
        view
        returns (uint256 amount, uint256 unlockTime, bool withdrawn)
    {
        Stake memory userStake = stakes[_user];
        return (userStake.amount, userStake.unlockTime, userStake.withdrawn);
    }
}
        

Compiler Settings

{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":200,"enabled":false},"libraries":{},"evmVersion":"paris"}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"Staked","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"unlockTime","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Withdrawn","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"when","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"unlockTime","internalType":"uint256"},{"type":"bool","name":"withdrawn","internalType":"bool"}],"name":"getStake","inputs":[{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"stake","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"uint256","name":"_durationSeconds","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"unlockTime","internalType":"uint256"},{"type":"bool","name":"withdrawn","internalType":"bool"}],"name":"stakes","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[]}]
              

Contract Creation Code

0x6080604052348015600f57600080fd5b50610b638061001f6000396000f3fe60806040526004361061003f5760003560e01c806316934fc4146100445780633ccfd60b146100835780637a7664601461009a5780637b0472f0146100d9575b600080fd5b34801561005057600080fd5b5061006b60048036038101906100669190610672565b6100f5565b60405161007a939291906106d3565b60405180910390f35b34801561008f57600080fd5b5061009861012c565b005b3480156100a657600080fd5b506100c160048036038101906100bc9190610672565b61030f565b6040516100d0939291906106d3565b60405180910390f35b6100f360048036038101906100ee9190610736565b6103ac565b005b60006020528060005260406000206000915090508060000154908060010154908060020160009054906101000a900460ff16905083565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000154116101b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ac906107d3565b60405180910390fd5b80600101544210156101fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101f39061083f565b60405180910390fd5b8060020160009054906101000a900460ff161561024e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610245906108ab565b60405180910390fd5b60008160000154905060018260020160006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc682426040516102bc9291906108cb565b60405180910390a23373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561030a573d6000803e3d6000fd5b505050565b6000806000806000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180606001604052908160008201548152602001600182015481526020016002820160009054906101000a900460ff1615151515815250509050806000015181602001518260400151935093509350509193909250565b600082116103ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103e690610940565b60405180910390fd5b813414610431576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610428906109ac565b60405180910390fd5b60008111610474576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161046b90610a18565b60405180910390fd5b600081426104829190610a67565b905060008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816000015414806104e757508060020160009054906101000a900460ff165b610526576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161051d90610b0d565b60405180910390fd5b6040518060600160405280858152602001838152602001600015158152506000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050503373ffffffffffffffffffffffffffffffffffffffff167f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9085846040516106019291906108cb565b60405180910390a250505050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061063f82610614565b9050919050565b61064f81610634565b811461065a57600080fd5b50565b60008135905061066c81610646565b92915050565b6000602082840312156106885761068761060f565b5b60006106968482850161065d565b91505092915050565b6000819050919050565b6106b28161069f565b82525050565b60008115159050919050565b6106cd816106b8565b82525050565b60006060820190506106e860008301866106a9565b6106f560208301856106a9565b61070260408301846106c4565b949350505050565b6107138161069f565b811461071e57600080fd5b50565b6000813590506107308161070a565b92915050565b6000806040838503121561074d5761074c61060f565b5b600061075b85828601610721565b925050602061076c85828601610721565b9150509250929050565b600082825260208201905092915050565b7f4e6f207374616b6520666f756e64000000000000000000000000000000000000600082015250565b60006107bd600e83610776565b91506107c882610787565b602082019050919050565b600060208201905081810360008301526107ec816107b0565b9050919050565b7f546f6f206561726c7920746f2077697468647261770000000000000000000000600082015250565b6000610829601583610776565b9150610834826107f3565b602082019050919050565b600060208201905081810360008301526108588161081c565b9050919050565b7f416c72656164792077697468647261776e000000000000000000000000000000600082015250565b6000610895601183610776565b91506108a08261085f565b602082019050919050565b600060208201905081810360008301526108c481610888565b9050919050565b60006040820190506108e060008301856106a9565b6108ed60208301846106a9565b9392505050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b600061092a601d83610776565b9150610935826108f4565b602082019050919050565b600060208201905081810360008301526109598161091d565b9050919050565b7f53656e742076616c7565206d757374206d6174636820616d6f756e7400000000600082015250565b6000610996601c83610776565b91506109a182610960565b602082019050919050565b600060208201905081810360008301526109c581610989565b9050919050565b7f4475726174696f6e206d7573742062652067726561746572207468616e203000600082015250565b6000610a02601f83610776565b9150610a0d826109cc565b602082019050919050565b60006020820190508181036000830152610a31816109f5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a728261069f565b9150610a7d8361069f565b9250828201905080821115610a9557610a94610a38565b5b92915050565b7f4578697374696e67207374616b65206d7573742062652077697468647261776e60008201527f2066697273740000000000000000000000000000000000000000000000000000602082015250565b6000610af7602683610776565b9150610b0282610a9b565b604082019050919050565b60006020820190508181036000830152610b2681610aea565b905091905056fea26469706673582212206163f7ae65df8106d47f9a024cd88d4f01f215084f431508b6ff277c3611bb0a64736f6c634300081c0033

Deployed ByteCode

0x60806040526004361061003f5760003560e01c806316934fc4146100445780633ccfd60b146100835780637a7664601461009a5780637b0472f0146100d9575b600080fd5b34801561005057600080fd5b5061006b60048036038101906100669190610672565b6100f5565b60405161007a939291906106d3565b60405180910390f35b34801561008f57600080fd5b5061009861012c565b005b3480156100a657600080fd5b506100c160048036038101906100bc9190610672565b61030f565b6040516100d0939291906106d3565b60405180910390f35b6100f360048036038101906100ee9190610736565b6103ac565b005b60006020528060005260406000206000915090508060000154908060010154908060020160009054906101000a900460ff16905083565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000154116101b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ac906107d3565b60405180910390fd5b80600101544210156101fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101f39061083f565b60405180910390fd5b8060020160009054906101000a900460ff161561024e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610245906108ab565b60405180910390fd5b60008160000154905060018260020160006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc682426040516102bc9291906108cb565b60405180910390a23373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561030a573d6000803e3d6000fd5b505050565b6000806000806000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180606001604052908160008201548152602001600182015481526020016002820160009054906101000a900460ff1615151515815250509050806000015181602001518260400151935093509350509193909250565b600082116103ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103e690610940565b60405180910390fd5b813414610431576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610428906109ac565b60405180910390fd5b60008111610474576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161046b90610a18565b60405180910390fd5b600081426104829190610a67565b905060008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816000015414806104e757508060020160009054906101000a900460ff165b610526576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161051d90610b0d565b60405180910390fd5b6040518060600160405280858152602001838152602001600015158152506000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050503373ffffffffffffffffffffffffffffffffffffffff167f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9085846040516106019291906108cb565b60405180910390a250505050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061063f82610614565b9050919050565b61064f81610634565b811461065a57600080fd5b50565b60008135905061066c81610646565b92915050565b6000602082840312156106885761068761060f565b5b60006106968482850161065d565b91505092915050565b6000819050919050565b6106b28161069f565b82525050565b60008115159050919050565b6106cd816106b8565b82525050565b60006060820190506106e860008301866106a9565b6106f560208301856106a9565b61070260408301846106c4565b949350505050565b6107138161069f565b811461071e57600080fd5b50565b6000813590506107308161070a565b92915050565b6000806040838503121561074d5761074c61060f565b5b600061075b85828601610721565b925050602061076c85828601610721565b9150509250929050565b600082825260208201905092915050565b7f4e6f207374616b6520666f756e64000000000000000000000000000000000000600082015250565b60006107bd600e83610776565b91506107c882610787565b602082019050919050565b600060208201905081810360008301526107ec816107b0565b9050919050565b7f546f6f206561726c7920746f2077697468647261770000000000000000000000600082015250565b6000610829601583610776565b9150610834826107f3565b602082019050919050565b600060208201905081810360008301526108588161081c565b9050919050565b7f416c72656164792077697468647261776e000000000000000000000000000000600082015250565b6000610895601183610776565b91506108a08261085f565b602082019050919050565b600060208201905081810360008301526108c481610888565b9050919050565b60006040820190506108e060008301856106a9565b6108ed60208301846106a9565b9392505050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b600061092a601d83610776565b9150610935826108f4565b602082019050919050565b600060208201905081810360008301526109598161091d565b9050919050565b7f53656e742076616c7565206d757374206d6174636820616d6f756e7400000000600082015250565b6000610996601c83610776565b91506109a182610960565b602082019050919050565b600060208201905081810360008301526109c581610989565b9050919050565b7f4475726174696f6e206d7573742062652067726561746572207468616e203000600082015250565b6000610a02601f83610776565b9150610a0d826109cc565b602082019050919050565b60006020820190508181036000830152610a31816109f5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a728261069f565b9150610a7d8361069f565b9250828201905080821115610a9557610a94610a38565b5b92915050565b7f4578697374696e67207374616b65206d7573742062652077697468647261776e60008201527f2066697273740000000000000000000000000000000000000000000000000000602082015250565b6000610af7602683610776565b9150610b0282610a9b565b604082019050919050565b60006020820190508181036000830152610b2681610aea565b905091905056fea26469706673582212206163f7ae65df8106d47f9a024cd88d4f01f215084f431508b6ff277c3611bb0a64736f6c634300081c0033