Skip to content
Verified contractPartialUNLICENSED

Tws1Refund

Address0xd273c1bb189d60ff06fbaeba7afa1619ec2b3698
Balance

0 ETH

 

Transactions

90

 

Compiler

solc 0.8.4

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.4+commit.c7e474f2
Language
solidity
Optimization
No
License
UNLICENSED
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
14,378,277
Creation transaction
0x6399954bf2…5f2f4ab08a

Tws1Refund.sol

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



interface Tws1BalanceOf {
  function balanceOf(address account, uint256 id) external view returns (uint256);
}

contract Tws1Refund {
  address public immutable owner;
  Tws1BalanceOf public immutable tws1;
  mapping(address => bool) public isRefunded;

  event Refund(address recipient, uint256 tws1Balance, uint256 amountRefunded);

  constructor(address _owner, address _tws1) {
    owner = _owner;
    tws1 = Tws1BalanceOf(_tws1);
  }

  function adminDeposit() external payable {
    require(msg.sender == owner, "not owner");
  }

  function adminWithdraw() external {
    require(msg.sender == owner, "not owner");
    (bool sent,) = msg.sender.call{
      value: address(this).balance
    }("");
    require(sent, "Failed to send Ether");
  }
  
  function refund() external {
    require(isRefunded[msg.sender] == false, "already refunded");
    uint256 tws1BalanceOwned = Tws1BalanceOf(tws1).balanceOf(msg.sender, 1);
    uint256 amountToRefund = tws1BalanceOwned * 0.06 ether;

    (bool sent,) = msg.sender.call{
      value: amountToRefund
    }("");
    require(sent, "Failed to send Ether");
    isRefunded[msg.sender] = true;

    emit Refund(msg.sender, tws1BalanceOwned, amountToRefund);
  }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 0,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.