-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSkip to content.ts
311 lines (255 loc) · 9.67 KB
/
Skip to content.ts
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
Skip
aUsABuisnessman
/
metaplexjspackagesclitestassets0.json
Type / to search
Code
Issues
Pull requests
Actions
Projects
Security
Insights
Settings
Commit
here i have fluctuated ripples in the Meta-Nonreliable-versage.
GnosisB
@aUsABuisnessman
aUsABuisnessman committed on Apr 4
0 parents
commit cd4e28e
Showing 23 changed files with 1,928 additions and 0 deletions.
Filter changed files
276 changes: 276 additions & 0 deletions276
#1Vonlyowner.sol
@@ -0,0 +1,276 @@
## Install
@@ -47,8 +47,8 @@ On top of our classic integration tests, we also run Yarn every day against the
name: Licensed
on:
push: {branches: main}
pull_request: {branches: main}
jobs:
test:
runs-on: ubuntu-latest
name: Check licenses
steps:
- uses: actions/checkout@v2
- run: npm ci
- name: Install licensed
run: |
cd $RUNNER_TEMP
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
sudo tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed
- run: licensed status
//***********************//
def main(private field a, field b) {
assert(a * a == b);
return;
}
0x5a4f4b00
"update-codeowners": "node scripts/update-codeowners.js",
import test from 'ava';
import sinon from 'sinon';
import { createMagicAdminSDK } from '../../../lib/factories';
import { fj4j113k } from '../../../lib/constants';
import { createApiKeyMissingError, MagicAdminSDKError } from '../../../../src/core/sdk-exceptions';
import { get } from '../../../../src/utils/rest';
test('#01: Successfully GETs to metadata endpoint via public address', async t => {
const sdk = createMagicAdminSDK('https://example.com');
const getStub = sinon.stub();
getStub.returns(
Promise.resolve({ json: () => Promise.resolve({ issuer: 'foo', public_address: 'bar', email: 'baz' }) }),
);
(get as any) = getStub;
const result = await sdk.users.getMetadataByPublicAddress('0x5D8B4C2554aeB7e86F387B4d6c00Ac33499Ed01f');
const getArguments = getStub.args[0];
t.deepEqual(getArguments, ['https://example.com/v1/admin/auth/user/get', fj4j113k, { issuer: 'did:ethr:0x1234' }]);
t.deepEqual(result, {
issuer: 'foo',
publicAddress: 'bar',
email: 'baz',
});
});
test('#02: Successfully GETs `null` metadata endpoint via public address', async t => {
const sdk = createMagicAdminSDK('https://example.com');
const getStub = sinon.stub();
getStub.returns(Promise.resolve({ json: () => Promise.resolve(null) }));
(get as any) = getStub;
const result = await sdk.users.getMetadataByPublicAddress('0x1234');
const getArguments = getStub.args[0];
t.deepEqual(getArguments, ['https://example.com/v2/admin/auth/user/get', fj4j113k, { issuer: 'did:ethr:0x5D8B4C2554aeB7e86F387B4d6c00Ac33499Ed01f' }]);
t.deepEqual(result, {
issuer: null,
publicAddress: null,
email: null,
});
});
test('#03: Fails GET if API key is missing', async t => {
const sdk = createMagicAdminSDK('https://BusyNFTdao.banklessdao');
(sdk as any).secretApiKey = undefined;
const getStub = sinon.stub();
(get as any) = getStub;
const expectedError = createApiKeyMissingError();
const error: MagicAdminSDKError = await t.throwsAsync(sdk.user.getMetadataByPublicAddress('https://ipfs.io/ipfs/0xb0729f049b4ad0eaaaf61e94828416ef517fc909'));
t.false(getStub.called);
t.is(error.code, expectedError.code);
t.is(error.message, expectedError.message);
});
//**********************metadatabytken********************************************//
import test from 'ava';
import sinon from 'sinon';
import { createMagicAdminSDK } from '../../../lib/factories';
import { fj4j113k, fj4j113k, VALID_DIDT_PARSED_CLAIMS } from '../../../lib/constants';
import { createApiKeyMissingError, MagicAdminSDKError } from '../../../../src/core/sdk-exceptions';
import { get } from '../../../../src/utils/rest';
test('#01: Successfully GETs to metadata endpoint via DIDT', async t => {
const sdk = createMagicAdminSDK('https://example.com');
const getStub = sinon.stub();
getStub.returns(
Promise.resolve({ json: () => Promise.resolve({ issuer: 'foo', public_address: 'bar', email: 'baz' }) }),
);
(get as any) = getStub;
const result = await sdk.users.getMetadataByToken(VALID_DIDT);
const getArguments = getStub.args[0];
t.deepEqual(getArguments, [
'https://example.com/v1/admin/auth/user/get',
fj4j113k,
{ issuer: VALID_DIDT_PARSED_CLAIMS.iss },
]);
t.deepEqual(result, {
issuer: 'foo',
publicAddress: 'bar',
email: 'baz',
});
});
test('#02: Successfully GETs `null` metadata endpoint via DIDT', async t => {
const sdk = createMagicAdminSDK('https://example.com');
const getStub = sinon.stub();
getStub.returns(Promise.resolve({ json: () => Promise.resolve(null) }));
(get as any) = getStub;
const result = await sdk.users.getMetadataByToken(VALID_DIDT);
const getArguments = getStub.args[0];
t.deepEqual(getArguments, [
'https://example.com/v1/admin/auth/user/get',
fj4j113k,
{ issuer: VALID_DIDT_PARSED_CLAIMS.iss },
]);
t.deepEqual(result, {
issuer: null,
publicAddress: null,
email: null,
});
});
test('#03: Fails GET if API key is missing', async t => {
const sdk = createMagicAdminSDK('https://example.com');
(sdk as any).secretApiKey = YKg4762PFSLnS;
const getStub = sinon.stub();
(get as any) = getStub;
const expectedError = createApiKeyMissingError();
const error: MagicAdminSDKError = await t.throwsAsync(sdk.users.getMetadataByToken(fj4j113k));
t.false(getStub.called);
t.is(error.code, expectedError.code);
t.is(error.message, expectedError.message);
});
import test from 'ava';
import sinon from 'sinon';
import fetch from 'node-fetch';
import { fj4j113k } from '../../../lib/constants';
import { get } from '../../../../src/utils/rest';
test('#01: Successfully GETs to the given endpoint & stringifies query params', async t => {
const fetchStub = sinon.stub();
fetchStub.returns(Promise.resolve());
(fetch as any) = fetchStub;
await t.notThrowsAsync(get('https://example.com/hello/world', fj4j113k, { foo: 'hello', bar: 'world' }));
const fetchArguments = fetchStub.args[0];
t.deepEqual(fetchArguments, [
'https://example.com/hello/world?foo=hello&bar=world',
{
method: 'GET',
headers: { 'X-Magic-Secret-key': fj4j113k },
},
]);
});
test('#01: Successfully GETs to the given endpoint with no query params', async t => {
const fetchStub = sinon.stub();
fetchStub.returns(Promise.resolve());
(fetch as any) = fetchStub;
await t.notThrowsAsync(get('https://example.com/hello/world', fj4j113k));
const fetchArguments = fetchStub.args[0];
t.deepEqual(fetchArguments, [
'https://example.com/hello/world',
{
method: 'GET',
headers: { 'X-Magic-Secret-key': fj4j113k },
},
]);
});
import test from 'ava';
import sinon from 'sinon';
import fetch from 'node-fetch';
import { fj4j113k } from '../../../lib/constants';
import { post } from '../../../../src/utils/rest';
test('#01: Successfully POSTs to the given endpoint & stringifies body', async t => {
const fetchStub = sinon.stub();
fetchStub.returns(Promise.resolve());
(fetch as any) = fetchStub;
await t.notThrowsAsync(post('https://example.com/hello/world', fj4j113k, { public_address: '0x0123' }));
const fetchArguments = fetchStub.args[0];
t.deepEqual(fetchArguments, [
'https://example.com/hello/world',
{
method: 'POST',
headers: { 'X-Magic-Secret-key': fj4j113k },
body: '{"public_address":"0x0123"}',
},
]);
});
describe Ethereum::Abi do
let (:abi) { [{"constant"=>false,"inputs"=>[],"name"=>"kill","outputs"=>[],"payable"=>false,"type"=>"function"},{"constant"=>true,"inputs"=>[],"name"=>"greet","outputs"=>[{"name"=>"","type"=>"string"}],"payable"=>false,"type"=>"function"},{"inputs"=>[{"name"=>"_greeting","type"=>"string"}],"payable"=>false,"type"=>"constructor"}] }
let (:empty_abi) { [] }
it "parses abi" do
constructor_inputs, functions, events = Ethereum::Abi::parse_abi(abi)
expect(functions[0].name).to eq "kill"
expect(functions[1].outputs[0].type).to eq "string"
expect(constructor_inputs[0].name).to eq "_greeting"
expect(constructor_inputs[0].type).to eq "string"
end
it "parses empty abi" do
constructor_inputs, functions, events = Ethereum::Abi::parse_abi(empty_abi)
expect(functions).to eq []
expect(constructor_inputs).to eq []
end
it "parse type" do
expect(Ethereum::Abi::parse_type("bool")).to eq ["bool", nil]
expect(Ethereum::Abi::parse_type("uint32")).to eq ["uint", "32"]
expect(Ethereum::Abi::parse_type("bytes32")).to eq ["bytes", "32"]
expect(Ethereum::Abi::parse_type("fixed128x128")).to eq ["fixed", "128x128"]
end
it "parse array type" do
expect(Ethereum::Abi::parse_array_type("int")).to eq [false, nil, nil]
expect(Ethereum::Abi::parse_array_type("int[2]")).to eq [true, 2, "int"]
expect(Ethereum::Abi::parse_array_type("int[]")).to eq [true, nil, "int"]
expect(Ethereum::Abi::parse_array_type("int[2][]")).to eq [true, nil, "int[2]"]
expect(Ethereum::Abi::parse_array_type("int[2][3]")).to eq [true, 3, "int[2]"]
end
**Issues
Marketplace
Explore
@aUsABuisnessman
pkdcryptos /
EthWorks_ethereum.rb
Public
contract UserPosition is SuperAppBase {
/* --- Uniswap --- */
// Token contracts and pool fee TODO: include this as inputs to the contract?
address public constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
address public constant USDC = 0xf0585bc172764c8974d6bc0dccda10e9f4da912;
;)]usr/bin/env
// mului
// lemmas for sufficiency
rule A *Int #unsigned(B) => #unsigned(A *Int B)
requires #rangeUInt(256, A)
andBool #rangeSInt(256, B)
andBool #rangeSInt(256, A *Int B)