aere-contracts/contracts/WAERE.sol
Aere Network a13a649b77
Some checks are pending
contracts-ci / Install (lockfile) → compile → full test suite (push) Waiting to run
contracts-ci / PQC known-answer tests (NIST vectors) (push) Waiting to run
contracts-ci / Coverage (scoped, with artifacts) (push) Waiting to run
Initial public release
Aere Network public source. Everything here can be checked against the live
chain (chain id 2800, https://rpc.aere.network).

Scope note, stated up front rather than buried: consensus on chain 2800 is
classical secp256k1 ECDSA QBFT. The post-quantum work in this repository is at
the signature, precompile, account and transport layers. Nothing here makes the
consensus post-quantum, and no document in it should be read as claiming so.
2026-07-20 01:02:37 +03:00

69 lines
2.4 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/**
* @title Wrapped AERE (WAERE)
* @notice ERC-20 wrapper for the native AERE token, enabling DeFi compatibility
* @dev Mirrors the WETH9 design — deposit native AERE, receive WAERE 1:1
*
* Native AERE is the gas/value token of AERE Network (Chain ID 2800). Many
* DeFi protocols (DEXes, lending, etc.) operate on ERC-20 interfaces and need
* a wrapped representation. WAERE provides that.
*/
contract WAERE {
string public constant name = "Wrapped AERE";
string public constant symbol = "WAERE";
uint8 public constant decimals = 18;
event Approval(address indexed src, address indexed guy, uint256 wad);
event Transfer(address indexed src, address indexed dst, uint256 wad);
event Deposit(address indexed dst, uint256 wad);
event Withdrawal(address indexed src, uint256 wad);
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
receive() external payable {
deposit();
}
function deposit() public payable {
balanceOf[msg.sender] += msg.value;
emit Deposit(msg.sender, msg.value);
}
function withdraw(uint256 wad) external {
require(balanceOf[msg.sender] >= wad, "WAERE: insufficient balance");
balanceOf[msg.sender] -= wad;
(bool ok, ) = msg.sender.call{value: wad}("");
require(ok, "WAERE: AERE transfer failed");
emit Withdrawal(msg.sender, wad);
}
function totalSupply() external view returns (uint256) {
return address(this).balance;
}
function approve(address guy, uint256 wad) external returns (bool) {
allowance[msg.sender][guy] = wad;
emit Approval(msg.sender, guy, wad);
return true;
}
function transfer(address dst, uint256 wad) external returns (bool) {
return transferFrom(msg.sender, dst, wad);
}
function transferFrom(address src, address dst, uint256 wad) public returns (bool) {
require(balanceOf[src] >= wad, "WAERE: insufficient balance");
if (src != msg.sender && allowance[src][msg.sender] != type(uint256).max) {
require(allowance[src][msg.sender] >= wad, "WAERE: insufficient allowance");
allowance[src][msg.sender] -= wad;
}
balanceOf[src] -= wad;
balanceOf[dst] += wad;
emit Transfer(src, dst, wad);
return true;
}
}