hoodquidity/packages/contracts/lib/openzeppelin-contracts/test/utils/CAIP.test.js
Денис Зефиров dba2811447 Hoodquidity: liquidity campaigns for Robinhood Chain stock token markets
Full build: Vite/React acid-terminal frontend (BEARER design system,
Panchang/Sentient/Fragment Mono, neon layer, palette audit script),
HoodquidityVaults Foundry contracts (single+dual deposits via Chainlink-style
feeds, hybrid exit, 10% platform fee, boost, Genesis LP), Reown AppKit wallet
connect with Robinhood Chain testnet (46630), live data from Dexscreener and
onchain reads, partner portal, design-sync setup for claude.ai/design.

Deploy: static via Forgejo Actions platform, BUILD_DIR=apps/web/dist (.env).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 08:32:28 +04:00

56 lines
1.7 KiB
JavaScript

const { ethers } = require('hardhat');
const { expect } = require('chai');
const { CHAINS, getLocalChain } = require('../helpers/chains');
describe('CAIP utilities', function () {
before(async function () {
this.local = await getLocalChain();
});
describe('CAIP-2', function () {
before(async function () {
this.mock = await ethers.deployContract('$CAIP2');
});
it('local()', async function () {
const { caip2 } = this.local;
expect(await this.mock.$local()).to.equal(caip2);
});
for (const { namespace, reference, caip2 } of Object.values(CHAINS)) {
it(`format(${namespace}, ${reference})`, async function () {
expect(await this.mock.$format(namespace, reference)).to.equal(caip2);
});
it(`parse(${caip2})`, async function () {
expect(await this.mock.$parse(caip2)).to.deep.equal([namespace, reference]);
});
}
});
describe('CAIP-10', function () {
const { address: account } = ethers.Wallet.createRandom();
before(async function () {
this.mock = await ethers.deployContract('$CAIP10');
});
it(`local(${account})`, async function () {
const caip10 = this.local.toCaip10(account);
expect(await this.mock.$local(ethers.Typed.address(account))).to.equal(caip10);
});
for (const { caip2, toCaip10 } of Object.values(CHAINS)) {
const caip10 = toCaip10(account);
it(`format(${caip2}, ${account})`, async function () {
expect(await this.mock.$format(ethers.Typed.string(caip2), ethers.Typed.string(account))).to.equal(caip10);
});
it(`parse(${caip10})`, async function () {
expect(await this.mock.$parse(caip10)).to.deep.equal([caip2, account]);
});
}
});
});