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>
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { version } from '../../package.json';
|
|
|
|
export const ozVersion = () => version;
|
|
|
|
export const readmePath = opts => {
|
|
return 'contracts/' + opts.data.root.id.replace(/\.adoc$/, '') + '/README.adoc';
|
|
};
|
|
|
|
export const names = params => params?.map(p => p.name).join(', ');
|
|
|
|
export const typedParams = params => {
|
|
return params?.map(p => `${p.type}${p.indexed ? ' indexed' : ''}${p.name ? ' ' + p.name : ''}`).join(', ');
|
|
};
|
|
|
|
export const slug = str => {
|
|
if (str === undefined) {
|
|
throw new Error('Missing argument');
|
|
}
|
|
return str.replace(/\W/g, '-');
|
|
};
|
|
|
|
const linksCache = new WeakMap();
|
|
|
|
function getAllLinks(items) {
|
|
if (linksCache.has(items)) {
|
|
return linksCache.get(items);
|
|
}
|
|
const res = {};
|
|
linksCache.set(items, res);
|
|
for (const item of items) {
|
|
res[`xref-${item.anchor}`] = `xref:${item.__item_context.page}#${item.anchor}`;
|
|
res[slug(item.fullName)] = `pass:normal[xref:${item.__item_context.page}#${item.anchor}[\`${item.fullName}\`]]`;
|
|
}
|
|
return res;
|
|
}
|
|
|
|
export const withPrelude = opts => {
|
|
const links = getAllLinks(opts.data.site.items);
|
|
const contents = opts.fn();
|
|
const neededLinks = contents
|
|
.match(/\{[-._a-z0-9]+\}/gi)
|
|
.map(m => m.replace(/^\{(.+)\}$/, '$1'))
|
|
.filter(k => k in links);
|
|
const prelude = neededLinks.map(k => `:${k}: ${links[k]}`).join('\n');
|
|
return prelude + '\n' + contents;
|
|
};
|