-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontracts.ts
More file actions
144 lines (139 loc) · 3.84 KB
/
contracts.ts
File metadata and controls
144 lines (139 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import type { Address } from 'viem'
export const ADDRESSES = {
sentinelGuardian: (process.env.NEXT_PUBLIC_GUARDIAN_ADDRESS ??
'0x5F938e4c62991Eb4af3Dd89097978A1f376e6CC8') as Address,
agentRegistry: (process.env.NEXT_PUBLIC_REGISTRY_ADDRESS ??
'0xFA7deF53FEaC45dB96A5B15C32ca4E6B009b25e6') as Address,
}
export const MOCK_API_URL =
process.env.NEXT_PUBLIC_MOCK_API_URL ?? 'http://localhost:3002'
export const SENTINEL_GUARDIAN_ABI = [
{
name: 'getAgentPolicy',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'agentId', type: 'bytes32' }],
outputs: [
{ name: 'maxTransactionValue', type: 'uint256' },
{ name: 'maxDailyVolume', type: 'uint256' },
{ name: 'maxMintAmount', type: 'uint256' },
{ name: 'rateLimit', type: 'uint256' },
{ name: 'rateLimitWindow', type: 'uint256' },
{ name: 'requireMultiAiConsensus', type: 'bool' },
{ name: 'isActive', type: 'bool' },
],
},
{
name: 'isAgentActive',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'agentId', type: 'bytes32' }],
outputs: [{ name: '', type: 'bool' }],
},
{
name: 'agentStates',
type: 'function',
stateMutability: 'view',
inputs: [{ name: '', type: 'bytes32' }],
outputs: [{ name: '', type: 'uint8' }],
},
{
name: 'agentExists',
type: 'function',
stateMutability: 'view',
inputs: [{ name: '', type: 'bytes32' }],
outputs: [{ name: '', type: 'bool' }],
},
{
name: 'getActionStats',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'agentId', type: 'bytes32' }],
outputs: [
{ name: 'approved', type: 'uint256' },
{ name: 'denied', type: 'uint256' },
{ name: 'currentWindowActions', type: 'uint256' },
{ name: 'currentDailyVolume', type: 'uint256' },
],
},
{
name: 'getIncidentCount',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'agentId', type: 'bytes32' }],
outputs: [{ name: '', type: 'uint256' }],
},
{
name: 'getIncident',
type: 'function',
stateMutability: 'view',
inputs: [
{ name: 'agentId', type: 'bytes32' },
{ name: 'index', type: 'uint256' },
],
outputs: [
{
name: '',
type: 'tuple',
components: [
{ name: 'timestamp', type: 'uint64' },
{ name: 'agentId', type: 'bytes32' },
{ name: 'incidentType', type: 'uint8' },
{ name: 'reason', type: 'string' },
{ name: 'targetContract', type: 'address' },
{ name: 'attemptedValue', type: 'uint256' },
],
},
],
},
] as const
export const AGENT_REGISTRY_ABI = [
{
name: 'getAgent',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'agentId', type: 'bytes32' }],
outputs: [
{
name: '',
type: 'tuple',
components: [
{ name: 'name', type: 'string' },
{ name: 'description', type: 'string' },
{ name: 'owner', type: 'address' },
{ name: 'registeredAt', type: 'uint64' },
{ name: 'exists', type: 'bool' },
],
},
],
},
{
name: 'getAgentCount',
type: 'function',
stateMutability: 'view',
inputs: [],
outputs: [{ name: '', type: 'uint256' }],
},
{
name: 'getAgentIdAt',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'index', type: 'uint256' }],
outputs: [{ name: '', type: 'bytes32' }],
},
{
name: 'isRegistered',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'agentId', type: 'bytes32' }],
outputs: [{ name: '', type: 'bool' }],
},
] as const
export const AGENT_STATE_LABELS = ['Active', 'Frozen', 'Revoked'] as const
export const INCIDENT_TYPE_LABELS = [
'PolicyViolation',
'ConsensusFailure',
'RateLimit',
'AnomalyDetected',
'ManualFreeze',
] as const