-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy paths3push.js
More file actions
72 lines (56 loc) · 2.05 KB
/
s3push.js
File metadata and controls
72 lines (56 loc) · 2.05 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
const AWS = require('aws-sdk');
const fs = require('fs');
const registryArtifact = JSON.parse(fs.readFileSync('build/contracts/Registry.json'));
const plcrArtifact = JSON.parse(fs.readFileSync('build/contracts/PLCRVoting.json'));
const parameterizerArtifact = JSON.parse(fs.readFileSync('build/contracts/Parameterizer.json'));
const saleArtifact = JSON.parse(fs.readFileSync('build/contracts/Sale.json'));
const tokenArtifact = JSON.parse(fs.readFileSync('build/contracts/HumanStandardToken.json'));
const BUCKET = 'adchain-registry-contracts';
const secrets = JSON.parse(fs.readFileSync('secrets.json', 'utf8'));
const accessKeyId = secrets.accessKeyId;
const secretAccessKey = secrets.secretAccessKey;
const s3 = new AWS.S3({
apiVersion: '2006-03-01',
accessKeyId,
secretAccessKey,
});
const uploadParams = {
Bucket: BUCKET,
ACL: 'public-read',
Body: '',
};
const registryParams = uploadParams;
registryParams.Key = 'Registry.json';
registryParams.Body = JSON.stringify(registryArtifact, null, ' ');
s3.upload(registryParams, (err) => {
if (err) { throw err; }
console.log('Uploaded registry');
});
const plcrParams = uploadParams;
plcrParams.Key = 'PLCRVoting.json';
plcrParams.Body = JSON.stringify(plcrArtifact, null, ' ');
s3.upload(plcrParams, (err) => {
if (err) { throw err; }
console.log('Uploaded plcr');
});
const parameterizerParams = uploadParams;
parameterizerParams.Key = 'Parameterizer.json';
parameterizerParams.Body = JSON.stringify(parameterizerArtifact, null, ' ');
s3.upload(parameterizerParams, (err) => {
if (err) { throw err; }
console.log('Uploaded parameterizer');
});
const saleParams = uploadParams;
saleParams.Key = 'Sale.json';
saleParams.Body = JSON.stringify(saleArtifact, null, ' ');
s3.upload(saleParams, (err) => {
if (err) { throw err; }
console.log('Uploaded sale');
});
const tokenParams = uploadParams;
tokenParams.Key = 'HumanStandardToken.json';
tokenParams.Body = JSON.stringify(tokenArtifact, null, ' ');
s3.upload(tokenParams, (err) => {
if (err) { throw err; }
console.log('Uploaded token');
});