Skip to content
Verified contractExactMIT

FairConvert

Address0x914e1d88dc0c23993db3cefb3256025c5feff2b1
Balance

0 ETH

 

Transactions

30

 

Compiler

solc 0.8.23

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.23+commit.f704f362
Language
solidity
Optimization
Yes, 200 runs
EVM version
paris
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
19,369,193
Creation transaction
0xfd2ed04b36…7816d9851a

contracts/FairConvert.sol

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

interface IERC20 {
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    function transfer(address recipient, uint256 amount) external returns (bool);
}

contract FairConvert {
    address public tokenA;
    address public tokenB;

    constructor(address _tokenA, address _tokenB) {
        tokenA = _tokenA;
        tokenB = _tokenB;
    }

    function swap(uint256 amount) public {
        // Directly burn token A by transferring from the sender to address(0)
        require(IERC20(tokenA).transferFrom(msg.sender, address(this), amount), "Receiving token A failed");

        uint256 newAmount = amount * 888 / 1000;

        // Transfer token B from this contract to the sender
        require(IERC20(tokenB).transfer(msg.sender, newAmount), "Transfer of token B failed");
    }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "paris",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.