Contrat
Contrat
0x881f1316f5…92ef088fb0
0x881f1316f51cf425b2077d45a27c3992ef088fb0
Solde WTG
0 WTG
≈ 0,00 FCFA (@ 23,45 FCFA/WTG)
Avoirs en tokens
0 token
≈ 0,00 FCFA
Plus d'infos
Transactions envoyées0
Dernière activité—
Première activitéil y a 2 sem.
Financé par
—
Code du contrat
✓ VérifiéWCFA · Solidity v0.8.35 · optimiseur activé (200 runs) · licence MIT
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract WCFA {
string public name = "WINTG CFA";
string public symbol = "WCFA";
uint8 public decimals = 18;
uint256 public totalSupply;
address public owner;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor() { owner = msg.sender; }
function mint(address to, uint256 amt) external {
require(msg.sender == owner, "!owner");
totalSupply += amt;
balanceOf[to] += amt;
emit Transfer(address(0), to, amt);
}
function transfer(address to, uint256 amt) external returns (bool) { _t(msg.sender, to, amt); return true; }
function approve(address s, uint256 amt) external returns (bool) {
allowance[msg.sender][s] = amt; emit Approval(msg.sender, s, amt); return true;
}
function transferFrom(address f, address to, uint256 amt) external returns (bool) {
uint256 a = allowance[f][msg.sender];
require(a >= amt, "allow");
if (a != type(uint256).max) allowance[f][msg.sender] = a - amt;
_t(f, to, amt); return true;
}
function _t(address f, address to, uint256 amt) internal {
require(balanceOf[f] >= amt, "bal");
balanceOf[f] -= amt; balanceOf[to] += amt; emit Transfer(f, to, amt);
}
}
contract TestToken {
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
address public owner;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(string memory n, string memory s, uint256 supply) {
name = n; symbol = s; owner = msg.sender;
totalSupply = supply; balanceOf[msg.sender] = supply;
emit Transfer(address(0), msg.sender, supply);
}
function mint(address to, uint256 amt) external {
require(msg.sender == owner, "!owner");
totalSupply += amt; balanceOf[to] += amt; emit Transfer(address(0), to, amt);
}
function transfer(address to, uint256 amt) external returns (bool) { _t(msg.sender, to, amt); return true; }
function approve(address sp, uint256 amt) external returns (bool) {
allowance[msg.sender][sp] = amt; emit Approval(msg.sender, sp, amt); return true;
}
function transferFrom(address f, address to, uint256 amt) external returns (bool) {
uint256 a = allowance[f][msg.sender]; require(a >= amt, "allow");
if (a != type(uint256).max) allowance[f][msg.sender] = a - amt;
_t(f, to, amt); return true;
}
function _t(address f, address to, uint256 amt) internal {
require(balanceOf[f] >= amt, "bal");
balanceOf[f] -= amt; balanceOf[to] += amt; emit Transfer(f, to, amt);
}
}
contract TestNFT {
string public name;
string public symbol;
uint256 public totalSupply;
address public owner;
mapping(uint256 => address) public ownerOf;
mapping(address => uint256) public balanceOf;
mapping(uint256 => address) public getApproved;
event Transfer(address indexed from, address indexed to, uint256 indexed id);
event Approval(address indexed owner, address indexed approved, uint256 indexed id);
constructor(string memory n, string memory s) { name = n; symbol = s; owner = msg.sender; }
function mint(address to) external returns (uint256 id) {
id = ++totalSupply; ownerOf[id] = to; balanceOf[to]++; emit Transfer(address(0), to, id);
}
function transferFrom(address from, address to, uint256 id) external {
require(ownerOf[id] == from, "own");
require(msg.sender == from || getApproved[id] == msg.sender, "auth");
ownerOf[id] = to; balanceOf[from]--; balanceOf[to]++; delete getApproved[id];
emit Transfer(from, to, id);
}
function approve(address a, uint256 id) external {
require(ownerOf[id] == msg.sender, "own"); getApproved[id] = a; emit Approval(msg.sender, a, id);
}
}
interface IERC20 {
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
function balanceOf(address) external view returns (uint256);
}
contract GasBurner {
uint256 public acc;
function churn(uint256 rounds) external {
uint256 a = acc;
assembly {
for { let i := 0 } lt(i, rounds) { i := add(i, 1) } {
mstore(0x00, a)
mstore(0x20, i)
a := keccak256(0x00, 0x40)
}
}
acc = a;
}
}
contract WtgPool {
IERC20 public quote;
address public owner;
event Swap(address indexed who, bool wtgIn, uint256 amountIn, uint256 amountOut);
constructor(address _quote) { quote = IERC20(_quote); owner = msg.sender; }
function getReserves() external view returns (uint256 wtgReserve, uint256 quoteReserve) {
return (address(this).balance, quote.balanceOf(address(this)));
}
function addLiquidity(uint256 quoteAmount) external payable {
require(quote.transferFrom(msg.sender, address(this), quoteAmount), "quote in");
}
function _out(uint256 amountIn, uint256 rIn, uint256 rOut) internal pure returns (uint256) {
uint256 inWithFee = amountIn * 997;
return (inWithFee * rOut) / (rIn * 1000 + inWithFee);
}
function swapWtgForQuote(uint256 minOut) external payable returns (uint256 out) {
uint256 rWtg = address(this).balance - msg.value;
uint256 rQuote = quote.balanceOf(address(this));
out = _out(msg.value, rWtg, rQuote);
require(out >= minOut && out < rQuote, "slip");
require(quote.transfer(msg.sender, out), "quote out");
emit Swap(msg.sender, true, msg.value, out);
}
function swapQuoteForWtg(uint256 amountIn, uint256 minOut) external returns (uint256 out) {
require(quote.transferFrom(msg.sender, address(this), amountIn), "quote in");
uint256 rQuote = quote.balanceOf(address(this)) - amountIn;
uint256 rWtg = address(this).balance;
out = _out(amountIn, rQuote, rWtg);
require(out >= minOut && out < rWtg, "slip");
(bool ok, ) = msg.sender.call{value: out}("");
require(ok, "wtg out");
emit Swap(msg.sender, false, amountIn, out);
}
receive() external payable {}
}
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "s",
"type": "address"
},
{
"internalType": "uint256",
"name": "amt",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amt",
"type": "uint256"
}
],
"name": "mint",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amt",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "f",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amt",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]
Aucun transfert de token.