MCPcopy Create free account
hub / github.com/circlefin/arc-node / NativeCoinControl

Class NativeCoinControl

tests/helpers/NativeCoinControl.ts:26–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24export const ERR_BLOCKED_ADDRESS = /Blocked address/
25
26export class NativeCoinControl {
27 static readonly address: Address = nativeCoinControlAddress
28
29 static readonly abi = parseAbi([
30 'function blocklist(address account) external returns (bool success)',
31 'function isBlocklisted(address account) external view returns (bool _isBlocklisted)',
32 'function unBlocklist(address account) external returns (bool success)',
33 'event Blocklisted(address indexed account)',
34 'event UnBlocklisted(address indexed account)',
35 ])
36
37 /**
38 * State override that clears the blocklist entry for `address` in
39 * NativeCoinControl's `isBlocklisted` mapping. Needed for simulations where
40 * a blocklisted address (e.g. the NativeFiatToken contract, per genesis)
41 * appears as the tx caller; the EVM handler's pre-execution sender check
42 * would otherwise reject the tx.
43 */
44 static unblockStateOverride = (address: Address) => ({
45 address: NativeCoinControl.address,
46 stateDiff: [
47 {
48 slot: slotForAddressMap(BLOCKLIST_MAPPING_SLOT, address),
49 value: UNBLOCKLISTED_STATUS,
50 },
51 ],
52 })
53
54 static isBlocklisted = async <
55 T extends Transport,
56 C extends Chain | undefined,
57 A extends Account | undefined,
58 R extends RpcSchema | undefined,
59 >(
60 client: PublicClient<T, C, A, R>,
61 account: Address,
62 ): Promise<boolean> => {
63 return await client.readContract({
64 address: NativeCoinControl.address,
65 abi: NativeCoinControl.abi,
66 functionName: 'isBlocklisted',
67 args: [account],
68 })
69 }
70}

Callers

nothing calls this directly

Calls 1

slotForAddressMapFunction · 0.90

Tested by

no test coverage detected