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.
42 lines
1.6 KiB
Solidity
42 lines
1.6 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.23;
|
|
|
|
import "@openzeppelin/contracts/access/Ownable.sol";
|
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
|
|
/**
|
|
* @title AereVaultRelayer
|
|
* @notice Token allowance proxy for the AereSettlement batch DEX.
|
|
* Users approve THIS contract once for each token they intend to trade
|
|
* (typically MaxUint256). AereSettlement calls into the relayer to pull
|
|
* tokens during batch settlement.
|
|
*
|
|
* Following CoW Protocol's GPv2VaultRelayer pattern — separates token
|
|
* allowances from the settlement contract so the settlement contract
|
|
* can be upgraded without users having to re-approve.
|
|
*/
|
|
contract AereVaultRelayer is Ownable {
|
|
using SafeERC20 for IERC20;
|
|
|
|
/// The single authorised caller (AereSettlement). Owner can rotate it.
|
|
address public settlement;
|
|
|
|
event SettlementChanged(address indexed previousSettlement, address indexed newSettlement);
|
|
|
|
modifier onlySettlement() {
|
|
require(msg.sender == settlement, "Relayer: caller not settlement");
|
|
_;
|
|
}
|
|
|
|
function setSettlement(address _settlement) external onlyOwner {
|
|
emit SettlementChanged(settlement, _settlement);
|
|
settlement = _settlement;
|
|
}
|
|
|
|
/// Pull `amount` of `token` from `from` to `to`. Only callable by the settlement contract.
|
|
function transferFromUser(IERC20 token, address from, address to, uint256 amount) external onlySettlement {
|
|
token.safeTransferFrom(from, to, amount);
|
|
}
|
|
}
|