Contrat
Contrat
0x7dff5bfbdb…1e334a6325
0x7dff5bfbdb31e804483a9a2ec4fb0d1e334a6325
Solde WTG
51037.380864 WTG
≈ 987 558,44 FCFA (@ 19,35 FCFA/WTG)
Plus d'infos
Transactions envoyées1
Dernière activitéil y a 3 min
Première activitéil y a 1 j
Financé par
—
Code du contrat
✓ VérifiéWtgPool · Solidity v0.8.35 · optimiseur activé (200 runs) · licence MIT
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/// Jeton de cotation (peg FCFA) — mintable par le déployeur, pour seed la liquidité.
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);
}
}
/// Jeton ERC-20 de test générique (nom/symbole/offre au déploiement).
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);
}
}
/// Collection NFT ERC-721 minimale (émet Transfer à 3 topics indexés → détecté ERC-721).
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);
}
/// Brûleur de gaz : consomme du gaz de façon contrôlée (vrais opcodes, vrai gaz)
/// pour simuler la DEMANDE réseau sur le devnet — les blocs se remplissent, le base
/// fee EIP-1559 monte/descend selon l'intensité, et le burn de frais devient réel.
contract GasBurner {
uint256 public acc;
function churn(uint256 rounds) external {
uint256 a = acc;
// Mémoire de travail FIXE (scratch 0x00-0x40) → coût de gaz CONSTANT par tour.
// (abi.encodePacked dans une boucle allouerait de la mémoire à chaque tour →
// coût quadratique → la calibration sous-estime → out-of-gas.)
assembly {
for { let i := 0 } lt(i, rounds) { i := add(i, 1) } {
mstore(0x00, a)
mstore(0x20, i)
a := keccak256(0x00, 0x40)
}
}
acc = a;
}
}
/// Pool AMM x*y=k : WTG natif (réserve = solde du contrat) ⟷ WCFA. Frais 0,3 %.
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; }
/// Prix = quoteReserve / wtgReserve. Sélecteur 0x0902f1ac (compatible lecture explorer).
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);
}
/// Vend du WTG (msg.value), reçoit de la WCFA → fait BAISSER le prix.
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);
}
/// Vend de la WCFA, reçoit du WTG → fait MONTER le prix.
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": [
{
"internalType": "address",
"name": "_quote",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "who",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "wtgIn",
"type": "bool"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"name": "Swap",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "quoteAmount",
"type": "uint256"
}
],
"name": "addLiquidity",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "getReserves",
"outputs": [
{
"internalType": "uint256",
"name": "wtgReserve",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteReserve",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "quote",
"outputs": [
{
"internalType": "contract IERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "minOut",
"type": "uint256"
}
],
"name": "swapQuoteForWtg",
"outputs": [
{
"internalType": "uint256",
"name": "out",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "minOut",
"type": "uint256"
}
],
"name": "swapWtgForQuote",
"outputs": [
{
"internalType": "uint256",
"name": "out",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
0x6080604052600436106100595760003560e01c80630902f1ac1461006557806351c6590a1461009457806352d782ce146100a95780638da5cb5b146100ca578063999b93af14610102578063af707b371461012257600080fd5b3661006057005b600080fd5b34801561007157600080fd5b5061007a610142565b604080519283526020830191909152015b60405180910390f35b6100a76100a23660046106d0565b6101bb565b005b6100bc6100b73660046106d0565b610275565b60405190815260200161008b565b3480156100d657600080fd5b506001546100ea906001600160a01b031681565b6040516001600160a01b03909116815260200161008b565b34801561010e57600080fd5b506000546100ea906001600160a01b031681565b34801561012e57600080fd5b506100bc61013d3660046106e9565b61043e565b600080546040516370a0823160e01b8152306004820152829147916001600160a01b03909116906370a0823190602401602060405180830381865afa15801561018f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b3919061070b565b915091509091565b6000546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610212573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102369190610724565b6102725760405162461bcd60e51b815260206004820152600860248201526738bab7ba329034b760c11b60448201526064015b60405180910390fd5b50565b6000806102823447610763565b600080546040516370a0823160e01b815230600482015292935090916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156102d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f4919061070b565b905061030134838361068b565b925083831015801561031257508083105b6103475760405162461bcd60e51b8152600401610269906020808252600490820152630736c69760e41b604082015260600190565b60005460405163a9059cbb60e01b8152336004820152602481018590526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bc9190610724565b6103f45760405162461bcd60e51b81526020600482015260096024820152681c5d5bdd19481bdd5d60ba1b6044820152606401610269565b604080516001815234602082015290810184905233907fbfd50a04f1e6e4aee344f5d0e7f15d74d0dbb58cd1f711daa6463094ca9508cd9060600160405180910390a25050919050565b600080546040516323b872dd60e01b8152336004820152306024820152604481018590526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610496573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ba9190610724565b6104f15760405162461bcd60e51b815260206004820152600860248201526738bab7ba329034b760c11b6044820152606401610269565b600080546040516370a0823160e01b815230600482015285916001600160a01b0316906370a0823190602401602060405180830381865afa15801561053a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055e919061070b565b6105689190610763565b90504761057685838361068b565b925083831015801561058757508083105b6105bc5760405162461bcd60e51b8152600401610269906020808252600490820152630736c69760e41b604082015260600190565b604051600090339085908381818185875af1925050503d80600081146105fe576040519150601f19603f3d011682016040523d82523d6000602084013e610603565b606091505b505090508061063e5760405162461bcd60e51b81526020600482015260076024820152661ddd19c81bdd5d60ca1b6044820152606401610269565b60408051600081526020810188905290810185905233907fbfd50a04f1e6e4aee344f5d0e7f15d74d0dbb58cd1f711daa6463094ca9508cd9060600160405180910390a250505092915050565b60008061069a856103e561077c565b9050806106a9856103e861077c565b6106b39190610793565b6106bd848361077c565b6106c791906107a6565b95945050505050565b6000602082840312156106e257600080fd5b5035919050565b600080604083850312156106fc57600080fd5b50508035926020909101359150565b60006020828403121561071d57600080fd5b5051919050565b60006020828403121561073657600080fd5b8151801515811461074657600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156107765761077661074d565b92915050565b80820281158282048414176107765761077661074d565b808201808211156107765761077661074d565b6000826107c357634e487b7160e01b600052601260045260246000fd5b50049056fea26469706673582212204120cc75dfb59d9947c414ea16e8ed29a047ce6121ec2a18d845324a1afb775c64736f6c63430008230033