Initial build for QIE Mainnet Hackathon 3.0 (DeFi & Financial Infrastructure track). Includes: - packages/contracts: constant-product AMM (factory/pair/router), over-collateralized lending vault, and an oracle adapter wrapping QIE's real deployed price-feed contracts. 25/25 Foundry tests pass locally. Clean-room: no existing DEX/lending protocol source was read or copied. - packages/core: TypeScript SDK (viem-based) for QIE's chain, the real (corrected) oracle ABI, a fail-closed QUSDC helper, a Blockscout explorer client, and QIE Wallet connection constants. Live-verified against real testnet (chain 1983) and mainnet (chain 1990) RPCs and the real oracle contracts. - packages/cli: a small CLI built on @qie-forge/core. Real findings from building this, documented in README.md and docs/STATUS.md: the previously-documented testnet RPC URL is dead (replacement found and verified live); QIE's own oracle docs describe a getPrice(string) function that reverts on the real deployed contracts, which actually implement a Chainlink AggregatorV3-style interface (verified live via raw eth_call); the oracle is deployed on Mainnet only, not Testnet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
118 lines
4.4 KiB
Solidity
118 lines
4.4 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.8.20;
|
|
|
|
import "../patched/access/manager/AccessManager.sol";
|
|
import "../patched/utils/TransientSlot.sol";
|
|
|
|
contract AccessManagerHarness is AccessManager {
|
|
// override with a storage slot that can basically take any value.
|
|
uint32 private _minSetback;
|
|
|
|
constructor(address initialAdmin) AccessManager(initialAdmin) {}
|
|
|
|
// FV
|
|
function minSetback() public view override returns (uint32) {
|
|
return _minSetback;
|
|
}
|
|
|
|
function canCall_immediate(address caller, address target, bytes4 selector) external view returns (bool result) {
|
|
(result,) = canCall(caller, target, selector);
|
|
}
|
|
|
|
function canCall_delay(address caller, address target, bytes4 selector) external view returns (uint32 result) {
|
|
(,result) = canCall(caller, target, selector);
|
|
}
|
|
|
|
function canCallExtended(address caller, address target, bytes calldata data) external view returns (bool, uint32) {
|
|
return _canCallExtended(caller, target, data);
|
|
}
|
|
|
|
function canCallExtended_immediate(address caller, address target, bytes calldata data) external view returns (bool result) {
|
|
(result,) = _canCallExtended(caller, target, data);
|
|
}
|
|
|
|
function canCallExtended_delay(address caller, address target, bytes calldata data) external view returns (uint32 result) {
|
|
(,result) = _canCallExtended(caller, target, data);
|
|
}
|
|
|
|
function getAdminRestrictions_restricted(bytes calldata data) external view returns (bool result) {
|
|
(result,,) = _getAdminRestrictions(data);
|
|
}
|
|
|
|
function getAdminRestrictions_roleAdminId(bytes calldata data) external view returns (uint64 result) {
|
|
(,result,) = _getAdminRestrictions(data);
|
|
}
|
|
|
|
function getAdminRestrictions_executionDelay(bytes calldata data) external view returns (uint32 result) {
|
|
(,,result) = _getAdminRestrictions(data);
|
|
}
|
|
|
|
function hasRole_isMember(uint64 roleId, address account) external view returns (bool result) {
|
|
(result,) = hasRole(roleId, account);
|
|
}
|
|
|
|
function hasRole_executionDelay(uint64 roleId, address account) external view returns (uint32 result) {
|
|
(,result) = hasRole(roleId, account);
|
|
}
|
|
|
|
function getAccess_since(uint64 roleId, address account) external view returns (uint48 result) {
|
|
(result,,,) = getAccess(roleId, account);
|
|
}
|
|
|
|
function getAccess_currentDelay(uint64 roleId, address account) external view returns (uint32 result) {
|
|
(,result,,) = getAccess(roleId, account);
|
|
}
|
|
|
|
function getAccess_pendingDelay(uint64 roleId, address account) external view returns (uint32 result) {
|
|
(,,result,) = getAccess(roleId, account);
|
|
}
|
|
|
|
function getAccess_effect(uint64 roleId, address account) external view returns (uint48 result) {
|
|
(,,,result) = getAccess(roleId, account);
|
|
}
|
|
|
|
function getTargetAdminDelay_after(address target) public view virtual returns (uint32 result) {
|
|
(,result,) = _getTargetAdminDelayFull(target);
|
|
}
|
|
|
|
function getTargetAdminDelay_effect(address target) public view virtual returns (uint48 result) {
|
|
(,,result) = _getTargetAdminDelayFull(target);
|
|
}
|
|
|
|
function getRoleGrantDelay_after(uint64 roleId) public view virtual returns (uint32 result) {
|
|
(,result,) = _getRoleGrantDelayFull(roleId);
|
|
}
|
|
|
|
function getRoleGrantDelay_effect(uint64 roleId) public view virtual returns (uint48 result) {
|
|
(,,result) = _getRoleGrantDelayFull(roleId);
|
|
}
|
|
|
|
function hashExecutionId(address target, bytes4 selector) external pure returns (bytes32) {
|
|
return _hashExecutionId(target, selector);
|
|
}
|
|
|
|
function executionId() external view returns (bytes32) {
|
|
return TransientSlot.tload(_executionId);
|
|
}
|
|
|
|
// Pad with zeros (and don't revert) if data is too short.
|
|
function getSelector(bytes calldata data) external pure returns (bytes4) {
|
|
return bytes4(data);
|
|
}
|
|
|
|
function getFirstArgumentAsAddress(bytes calldata data) external pure returns (address) {
|
|
return abi.decode(data[0x04:0x24], (address));
|
|
}
|
|
|
|
function getFirstArgumentAsUint64(bytes calldata data) external pure returns (uint64) {
|
|
return abi.decode(data[0x04:0x24], (uint64));
|
|
}
|
|
|
|
function _checkAuthorized() internal override {
|
|
// We need this hack otherwise certora will assume _checkSelector(_msgData()) can return anything :/
|
|
require(msg.sig == _checkSelector(_msgData()));
|
|
super._checkAuthorized();
|
|
}
|
|
}
|