skittles 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/lib/compiler.js +3 -3
- package/lib/get-abi.js +3 -3
- package/lib/{get-fox-class.js → get-skittles-class.js} +54 -54
- package/lib/get-yul.js +26 -26
- package/lib/index.js +5 -2
- package/lib/types/skittles-class.js +31 -0
- package/package.json +7 -7
- package/lib/types/fox-class.js +0 -31
package/README.md
CHANGED
|
@@ -2,9 +2,10 @@ Make it a cli app
|
|
|
2
2
|
Create and deploy package
|
|
3
3
|
save artifacts/build
|
|
4
4
|
Remove tabs in yul, surely this can be automated or somethign
|
|
5
|
-
Use the `
|
|
5
|
+
Use the `SkittlesOperator` strings for the assemby stuff
|
|
6
6
|
Try changing balance to 1 in the contract and run tests
|
|
7
7
|
add prepublish
|
|
8
|
+
tsconfig error
|
|
8
9
|
|
|
9
10
|
Add more support
|
|
10
11
|
remove Token.yul
|
package/lib/compiler.js
CHANGED
|
@@ -14,11 +14,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.compileTypeScriptToBytecode = void 0;
|
|
16
16
|
const get_bytecode_1 = __importDefault(require("./get-bytecode"));
|
|
17
|
-
const
|
|
17
|
+
const get_skittles_class_1 = __importDefault(require("./get-skittles-class"));
|
|
18
18
|
const get_yul_1 = __importDefault(require("./get-yul"));
|
|
19
19
|
const compileTypeScriptToBytecode = (fileName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
const
|
|
20
|
+
const skittlesClass = (0, get_skittles_class_1.default)(fileName);
|
|
21
21
|
const yul = (0, get_yul_1.default)(fileName);
|
|
22
|
-
return (0, get_bytecode_1.default)(
|
|
22
|
+
return (0, get_bytecode_1.default)(skittlesClass.name, yul);
|
|
23
23
|
});
|
|
24
24
|
exports.compileTypeScriptToBytecode = compileTypeScriptToBytecode;
|
package/lib/get-abi.js
CHANGED
|
@@ -21,10 +21,10 @@ const getMethodAbi = (method) => {
|
|
|
21
21
|
stateMutability: method.view ? "view" : "payable",
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
const getAbi = (
|
|
24
|
+
const getAbi = (skittlesClass) => {
|
|
25
25
|
return [
|
|
26
|
-
...
|
|
27
|
-
...
|
|
26
|
+
...skittlesClass.properties.filter((p) => !p.private).map(getPropertyAbi),
|
|
27
|
+
...skittlesClass.methods.filter((p) => !p.private).map(getMethodAbi),
|
|
28
28
|
];
|
|
29
29
|
};
|
|
30
30
|
exports.default = getAbi;
|
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getSkittlesParameters = void 0;
|
|
7
7
|
const typescript_1 = require("typescript");
|
|
8
8
|
const get_ast_1 = __importDefault(require("./get-ast"));
|
|
9
9
|
const ast_helper_1 = require("./helpers/ast-helper");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const skittles_class_1 = require("./types/skittles-class");
|
|
11
|
+
const getSkittlesType = (syntaxKind) => {
|
|
12
12
|
if (!syntaxKind)
|
|
13
13
|
return "void";
|
|
14
14
|
switch (syntaxKind) {
|
|
@@ -26,63 +26,63 @@ const getFoxType = (syntaxKind) => {
|
|
|
26
26
|
throw new Error(`Unknown syntax kind: ${syntaxKind}`);
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
const
|
|
29
|
+
const getSkittlesOperator = (syntaxKind) => {
|
|
30
30
|
switch (syntaxKind) {
|
|
31
31
|
case typescript_1.SyntaxKind.PlusToken:
|
|
32
|
-
return
|
|
32
|
+
return skittles_class_1.SkittlesOperator.Plus;
|
|
33
33
|
case typescript_1.SyntaxKind.MinusToken:
|
|
34
|
-
return
|
|
34
|
+
return skittles_class_1.SkittlesOperator.Minus;
|
|
35
35
|
case typescript_1.SyntaxKind.AsteriskToken:
|
|
36
|
-
return
|
|
36
|
+
return skittles_class_1.SkittlesOperator.Multiply;
|
|
37
37
|
case typescript_1.SyntaxKind.SlashToken:
|
|
38
|
-
return
|
|
38
|
+
return skittles_class_1.SkittlesOperator.Divide;
|
|
39
39
|
case typescript_1.SyntaxKind.PercentToken:
|
|
40
|
-
return
|
|
40
|
+
return skittles_class_1.SkittlesOperator.Modulo;
|
|
41
41
|
case typescript_1.SyntaxKind.AmpersandAmpersandToken:
|
|
42
|
-
return
|
|
42
|
+
return skittles_class_1.SkittlesOperator.And;
|
|
43
43
|
case typescript_1.SyntaxKind.BarBarToken:
|
|
44
|
-
return
|
|
44
|
+
return skittles_class_1.SkittlesOperator.Or;
|
|
45
45
|
case typescript_1.SyntaxKind.EqualsEqualsToken:
|
|
46
|
-
return
|
|
46
|
+
return skittles_class_1.SkittlesOperator.Equals;
|
|
47
47
|
case typescript_1.SyntaxKind.ExclamationEqualsToken:
|
|
48
|
-
return
|
|
48
|
+
return skittles_class_1.SkittlesOperator.NotEquals;
|
|
49
49
|
case typescript_1.SyntaxKind.LessThanToken:
|
|
50
|
-
return
|
|
50
|
+
return skittles_class_1.SkittlesOperator.LessThan;
|
|
51
51
|
case typescript_1.SyntaxKind.LessThanEqualsToken:
|
|
52
|
-
return
|
|
52
|
+
return skittles_class_1.SkittlesOperator.LessThanOrEqual;
|
|
53
53
|
case typescript_1.SyntaxKind.GreaterThanToken:
|
|
54
|
-
return
|
|
54
|
+
return skittles_class_1.SkittlesOperator.GreaterThan;
|
|
55
55
|
case typescript_1.SyntaxKind.GreaterThanEqualsToken:
|
|
56
|
-
return
|
|
56
|
+
return skittles_class_1.SkittlesOperator.GreaterThanOrEqual;
|
|
57
57
|
default:
|
|
58
58
|
throw new Error(`Unknown syntax kind: ${syntaxKind}`);
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
const
|
|
61
|
+
const getSkittlesExpression = (expression) => {
|
|
62
62
|
if ((0, typescript_1.isLiteralExpression)(expression)) {
|
|
63
63
|
return {
|
|
64
|
-
expressionType:
|
|
64
|
+
expressionType: skittles_class_1.SkittlesExpressionType.Value,
|
|
65
65
|
value: expression.text,
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
if ((0, typescript_1.isIdentifier)(expression)) {
|
|
69
69
|
return {
|
|
70
|
-
expressionType:
|
|
70
|
+
expressionType: skittles_class_1.SkittlesExpressionType.Value,
|
|
71
71
|
value: expression.escapedText,
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
if ((0, typescript_1.isPropertyAccessExpression)(expression)) {
|
|
75
75
|
return {
|
|
76
|
-
expressionType:
|
|
76
|
+
expressionType: skittles_class_1.SkittlesExpressionType.Storage,
|
|
77
77
|
variable: (0, ast_helper_1.getNodeName)(expression),
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
if ((0, typescript_1.isBinaryExpression)(expression)) {
|
|
81
81
|
return {
|
|
82
|
-
expressionType:
|
|
83
|
-
left:
|
|
84
|
-
right:
|
|
85
|
-
operator:
|
|
82
|
+
expressionType: skittles_class_1.SkittlesExpressionType.Binary,
|
|
83
|
+
left: getSkittlesExpression(expression.left),
|
|
84
|
+
right: getSkittlesExpression(expression.right),
|
|
85
|
+
operator: getSkittlesOperator(expression.operatorToken.kind),
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
throw new Error(`Unknown expression type: ${expression.kind}`);
|
|
@@ -96,14 +96,14 @@ const isNodePrivate = (node) => {
|
|
|
96
96
|
});
|
|
97
97
|
return isPrivate;
|
|
98
98
|
};
|
|
99
|
-
const
|
|
99
|
+
const getSkittlesProperty = (astProperty) => {
|
|
100
100
|
if (!astProperty.type)
|
|
101
101
|
throw new Error("Could not get property type");
|
|
102
102
|
const initializer = astProperty.initializer;
|
|
103
103
|
return {
|
|
104
104
|
name: (0, ast_helper_1.getNodeName)(astProperty),
|
|
105
|
-
type:
|
|
106
|
-
value: initializer ?
|
|
105
|
+
type: getSkittlesType(astProperty.type.kind),
|
|
106
|
+
value: initializer ? getSkittlesExpression(initializer) : undefined,
|
|
107
107
|
private: isNodePrivate(astProperty),
|
|
108
108
|
};
|
|
109
109
|
};
|
|
@@ -123,53 +123,53 @@ const isNodeView = (node) => {
|
|
|
123
123
|
});
|
|
124
124
|
return isView;
|
|
125
125
|
};
|
|
126
|
-
const
|
|
126
|
+
const getSkittlesParameters = (node) => {
|
|
127
127
|
const inputs = [];
|
|
128
128
|
(0, typescript_1.forEachChild)(node, (node) => {
|
|
129
129
|
var _a;
|
|
130
130
|
if ((0, typescript_1.isParameter)(node)) {
|
|
131
131
|
inputs.push({
|
|
132
132
|
name: (0, ast_helper_1.getNodeName)(node),
|
|
133
|
-
type:
|
|
133
|
+
type: getSkittlesType((_a = node.type) === null || _a === void 0 ? void 0 : _a.kind),
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
137
|
return inputs;
|
|
138
138
|
};
|
|
139
|
-
exports.
|
|
140
|
-
const
|
|
139
|
+
exports.getSkittlesParameters = getSkittlesParameters;
|
|
140
|
+
const getSkittlesStatement = (node, returnType) => {
|
|
141
141
|
if ((0, typescript_1.isExpressionStatement)(node)) {
|
|
142
142
|
const expression = node.expression;
|
|
143
143
|
if ((0, typescript_1.isBinaryExpression)(expression)) {
|
|
144
144
|
if ((0, typescript_1.isPropertyAccessExpression)(expression.left)) {
|
|
145
145
|
if ((0, ast_helper_1.isEquals)(expression)) {
|
|
146
146
|
return {
|
|
147
|
-
statementType:
|
|
147
|
+
statementType: skittles_class_1.SkittlesStatementType.StorageUpdate,
|
|
148
148
|
variable: (0, ast_helper_1.getNodeName)(expression.left),
|
|
149
|
-
value:
|
|
149
|
+
value: getSkittlesExpression(expression.right),
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
if ((0, ast_helper_1.isPlusEquals)(expression)) {
|
|
153
153
|
return {
|
|
154
|
-
statementType:
|
|
154
|
+
statementType: skittles_class_1.SkittlesStatementType.StorageUpdate,
|
|
155
155
|
variable: (0, ast_helper_1.getNodeName)(expression.left),
|
|
156
156
|
value: {
|
|
157
|
-
expressionType:
|
|
158
|
-
operator:
|
|
159
|
-
left:
|
|
160
|
-
right:
|
|
157
|
+
expressionType: skittles_class_1.SkittlesExpressionType.Binary,
|
|
158
|
+
operator: skittles_class_1.SkittlesOperator.Plus,
|
|
159
|
+
left: getSkittlesExpression(expression.left),
|
|
160
|
+
right: getSkittlesExpression(expression.right),
|
|
161
161
|
},
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
if ((0, ast_helper_1.isMinusEquals)(expression)) {
|
|
165
165
|
return {
|
|
166
|
-
statementType:
|
|
166
|
+
statementType: skittles_class_1.SkittlesStatementType.StorageUpdate,
|
|
167
167
|
variable: (0, ast_helper_1.getNodeName)(expression.left),
|
|
168
168
|
value: {
|
|
169
|
-
expressionType:
|
|
170
|
-
operator:
|
|
171
|
-
left:
|
|
172
|
-
right:
|
|
169
|
+
expressionType: skittles_class_1.SkittlesExpressionType.Binary,
|
|
170
|
+
operator: skittles_class_1.SkittlesOperator.Minus,
|
|
171
|
+
left: getSkittlesExpression(expression.left),
|
|
172
|
+
right: getSkittlesExpression(expression.right),
|
|
173
173
|
},
|
|
174
174
|
};
|
|
175
175
|
}
|
|
@@ -185,34 +185,34 @@ const getFoxStatement = (node, returnType) => {
|
|
|
185
185
|
throw new Error("Return statement has no expression");
|
|
186
186
|
if ((0, typescript_1.isBinaryExpression)(expression)) {
|
|
187
187
|
return {
|
|
188
|
-
statementType:
|
|
188
|
+
statementType: skittles_class_1.SkittlesStatementType.Return,
|
|
189
189
|
type: returnType,
|
|
190
|
-
value:
|
|
190
|
+
value: getSkittlesExpression(node.expression),
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
throw new Error(`Unknown statement type: ${node.kind}`);
|
|
195
195
|
};
|
|
196
|
-
const
|
|
196
|
+
const getSkittlesMethod = (astMethod) => {
|
|
197
197
|
var _a, _b;
|
|
198
198
|
return {
|
|
199
199
|
name: (0, ast_helper_1.getNodeName)(astMethod),
|
|
200
|
-
returns:
|
|
200
|
+
returns: getSkittlesType((_a = astMethod.type) === null || _a === void 0 ? void 0 : _a.kind),
|
|
201
201
|
private: isNodePrivate(astMethod),
|
|
202
202
|
view: isNodeView(astMethod),
|
|
203
|
-
parameters: (0, exports.
|
|
204
|
-
statements: ((_b = astMethod.body) === null || _b === void 0 ? void 0 : _b.statements.map((statement) => { var _a; return
|
|
203
|
+
parameters: (0, exports.getSkittlesParameters)(astMethod),
|
|
204
|
+
statements: ((_b = astMethod.body) === null || _b === void 0 ? void 0 : _b.statements.map((statement) => { var _a; return getSkittlesStatement(statement, getSkittlesType((_a = astMethod.type) === null || _a === void 0 ? void 0 : _a.kind)); })) || [],
|
|
205
205
|
};
|
|
206
206
|
};
|
|
207
|
-
const
|
|
207
|
+
const getSkittlesClass = (file) => {
|
|
208
208
|
const ast = (0, get_ast_1.default)(file);
|
|
209
209
|
const classNode = (0, ast_helper_1.getClassNode)(ast);
|
|
210
210
|
const astProperties = classNode.members.filter(typescript_1.isPropertyDeclaration);
|
|
211
211
|
const astMethods = classNode.members.filter(typescript_1.isMethodDeclaration);
|
|
212
212
|
return {
|
|
213
213
|
name: (0, ast_helper_1.getNodeName)(classNode),
|
|
214
|
-
properties: astProperties.map(
|
|
215
|
-
methods: astMethods.map(
|
|
214
|
+
properties: astProperties.map(getSkittlesProperty),
|
|
215
|
+
methods: astMethods.map(getSkittlesMethod),
|
|
216
216
|
};
|
|
217
217
|
};
|
|
218
|
-
exports.default =
|
|
218
|
+
exports.default = getSkittlesClass;
|
package/lib/get-yul.js
CHANGED
|
@@ -29,8 +29,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
const yul_template_1 = __importStar(require("./data/yul-template"));
|
|
30
30
|
const get_abi_1 = __importDefault(require("./get-abi"));
|
|
31
31
|
const get_selector_1 = __importDefault(require("./get-selector"));
|
|
32
|
-
const
|
|
33
|
-
const
|
|
32
|
+
const get_skittles_class_1 = __importDefault(require("./get-skittles-class"));
|
|
33
|
+
const skittles_class_1 = require("./types/skittles-class");
|
|
34
34
|
const addToSection = (yul, section, lines) => {
|
|
35
35
|
const sectionIndex = yul.findIndex((line) => line.includes(`- ${section} -`));
|
|
36
36
|
if (sectionIndex === -1) {
|
|
@@ -82,33 +82,33 @@ const addMethodDispatcher = (yul, abi, method) => {
|
|
|
82
82
|
const getBinaryYul = (expression) => {
|
|
83
83
|
const { left, right, operator } = expression;
|
|
84
84
|
switch (operator) {
|
|
85
|
-
case
|
|
85
|
+
case skittles_class_1.SkittlesOperator.Plus:
|
|
86
86
|
return `safeAdd(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
87
|
-
case
|
|
87
|
+
case skittles_class_1.SkittlesOperator.Minus:
|
|
88
88
|
return `sub(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
89
|
-
case
|
|
89
|
+
case skittles_class_1.SkittlesOperator.Multiply:
|
|
90
90
|
return `mul(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
91
|
-
case
|
|
91
|
+
case skittles_class_1.SkittlesOperator.Divide:
|
|
92
92
|
return `div(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
93
|
-
case
|
|
93
|
+
case skittles_class_1.SkittlesOperator.Modulo:
|
|
94
94
|
return `mod(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
95
|
-
case
|
|
95
|
+
case skittles_class_1.SkittlesOperator.Equals:
|
|
96
96
|
return `eq(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
97
|
-
case
|
|
97
|
+
case skittles_class_1.SkittlesOperator.NotEquals:
|
|
98
98
|
return `not(eq(${getExpressionYul(left)}, ${getExpressionYul(right)}))`;
|
|
99
|
-
case
|
|
99
|
+
case skittles_class_1.SkittlesOperator.GreaterThan:
|
|
100
100
|
return `gt(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
101
|
-
case
|
|
101
|
+
case skittles_class_1.SkittlesOperator.LessThan:
|
|
102
102
|
return `lt(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
103
|
-
case
|
|
103
|
+
case skittles_class_1.SkittlesOperator.GreaterThanOrEqual:
|
|
104
104
|
return `gte(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
105
|
-
case
|
|
105
|
+
case skittles_class_1.SkittlesOperator.LessThanOrEqual:
|
|
106
106
|
return `lte(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
107
|
-
case
|
|
107
|
+
case skittles_class_1.SkittlesOperator.And:
|
|
108
108
|
return `and(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
109
|
-
case
|
|
109
|
+
case skittles_class_1.SkittlesOperator.Or:
|
|
110
110
|
return `or(${getExpressionYul(left)}, ${getExpressionYul(right)})`;
|
|
111
|
-
case
|
|
111
|
+
case skittles_class_1.SkittlesOperator.Not:
|
|
112
112
|
return `not(${getExpressionYul(left)})`;
|
|
113
113
|
default:
|
|
114
114
|
throw new Error(`Unsupported binary operator ${operator}`);
|
|
@@ -116,11 +116,11 @@ const getBinaryYul = (expression) => {
|
|
|
116
116
|
};
|
|
117
117
|
const getExpressionYul = (expression) => {
|
|
118
118
|
switch (expression.expressionType) {
|
|
119
|
-
case
|
|
119
|
+
case skittles_class_1.SkittlesExpressionType.Binary:
|
|
120
120
|
return getBinaryYul(expression);
|
|
121
|
-
case
|
|
121
|
+
case skittles_class_1.SkittlesExpressionType.Value:
|
|
122
122
|
return expression.value;
|
|
123
|
-
case
|
|
123
|
+
case skittles_class_1.SkittlesExpressionType.Storage:
|
|
124
124
|
return `${expression.variable}Storage()`;
|
|
125
125
|
default:
|
|
126
126
|
throw new Error("Unsupported expression");
|
|
@@ -136,9 +136,9 @@ const getReturnYul = (statement) => {
|
|
|
136
136
|
};
|
|
137
137
|
const getStatementYul = (statement) => {
|
|
138
138
|
switch (statement.statementType) {
|
|
139
|
-
case
|
|
139
|
+
case skittles_class_1.SkittlesStatementType.StorageUpdate:
|
|
140
140
|
return getStorageUpdateYul(statement);
|
|
141
|
-
case
|
|
141
|
+
case skittles_class_1.SkittlesStatementType.Return:
|
|
142
142
|
return getReturnYul(statement);
|
|
143
143
|
default:
|
|
144
144
|
throw new Error("Unsupported statement");
|
|
@@ -178,18 +178,18 @@ const addStorageAccess = (yul, property) => {
|
|
|
178
178
|
};
|
|
179
179
|
const getYul = (file) => {
|
|
180
180
|
// Getting base data
|
|
181
|
-
const
|
|
182
|
-
const abi = (0, get_abi_1.default)(
|
|
183
|
-
let yul = getBaseYul(
|
|
181
|
+
const skittlesClass = (0, get_skittles_class_1.default)(file);
|
|
182
|
+
const abi = (0, get_abi_1.default)(skittlesClass);
|
|
183
|
+
let yul = getBaseYul(skittlesClass.name);
|
|
184
184
|
// Adding properties
|
|
185
|
-
|
|
185
|
+
skittlesClass.properties.forEach((property, index) => {
|
|
186
186
|
yul = addPropertyDispatcher(yul, abi, property);
|
|
187
187
|
yul = addStorageLayout(yul, property, index);
|
|
188
188
|
yul = addStorageAccess(yul, property);
|
|
189
189
|
// TODO Handle private properties
|
|
190
190
|
});
|
|
191
191
|
// Adding methods
|
|
192
|
-
|
|
192
|
+
skittlesClass.methods.forEach((method) => {
|
|
193
193
|
yul = addMethodDispatcher(yul, abi, method);
|
|
194
194
|
yul = addMethodFunction(yul, method);
|
|
195
195
|
// TODO Handle private methods
|
package/lib/index.js
CHANGED
|
@@ -15,9 +15,12 @@ const compiler_1 = require("./compiler");
|
|
|
15
15
|
const file_helper_1 = require("./helpers/file-helper");
|
|
16
16
|
// clear();
|
|
17
17
|
// console.log(
|
|
18
|
-
// chalk.red(figlet.textSync("
|
|
18
|
+
// chalk.red(figlet.textSync("skittles-cli", { horizontalLayout: "full" }))
|
|
19
19
|
// );
|
|
20
|
-
commander_1.program
|
|
20
|
+
commander_1.program
|
|
21
|
+
.name("skittles")
|
|
22
|
+
.description("CLI for the Skittles compiler")
|
|
23
|
+
.version("0.1.0");
|
|
21
24
|
// program
|
|
22
25
|
// .command("compile")
|
|
23
26
|
// .description("Compile TypeScript file")
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkittlesStatementType = exports.SkittlesOperator = exports.SkittlesExpressionType = void 0;
|
|
4
|
+
var SkittlesExpressionType;
|
|
5
|
+
(function (SkittlesExpressionType) {
|
|
6
|
+
SkittlesExpressionType["Binary"] = "Binary";
|
|
7
|
+
SkittlesExpressionType["Value"] = "Value";
|
|
8
|
+
SkittlesExpressionType["Storage"] = "Storage";
|
|
9
|
+
})(SkittlesExpressionType = exports.SkittlesExpressionType || (exports.SkittlesExpressionType = {}));
|
|
10
|
+
var SkittlesOperator;
|
|
11
|
+
(function (SkittlesOperator) {
|
|
12
|
+
SkittlesOperator["Plus"] = "+";
|
|
13
|
+
SkittlesOperator["Minus"] = "-";
|
|
14
|
+
SkittlesOperator["Multiply"] = "*";
|
|
15
|
+
SkittlesOperator["Divide"] = "/";
|
|
16
|
+
SkittlesOperator["Modulo"] = "%";
|
|
17
|
+
SkittlesOperator["Equals"] = "==";
|
|
18
|
+
SkittlesOperator["NotEquals"] = "!=";
|
|
19
|
+
SkittlesOperator["GreaterThan"] = ">";
|
|
20
|
+
SkittlesOperator["LessThan"] = "<";
|
|
21
|
+
SkittlesOperator["GreaterThanOrEqual"] = ">=";
|
|
22
|
+
SkittlesOperator["LessThanOrEqual"] = "<=";
|
|
23
|
+
SkittlesOperator["And"] = "&&";
|
|
24
|
+
SkittlesOperator["Or"] = "||";
|
|
25
|
+
SkittlesOperator["Not"] = "!";
|
|
26
|
+
})(SkittlesOperator = exports.SkittlesOperator || (exports.SkittlesOperator = {}));
|
|
27
|
+
var SkittlesStatementType;
|
|
28
|
+
(function (SkittlesStatementType) {
|
|
29
|
+
SkittlesStatementType["StorageUpdate"] = "StorageUpdate";
|
|
30
|
+
SkittlesStatementType["Return"] = "Return";
|
|
31
|
+
})(SkittlesStatementType = exports.SkittlesStatementType || (exports.SkittlesStatementType = {}));
|
package/package.json
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skittles",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "TypeScript Smart Contract Language for the EVM",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
7
|
+
"skittles": "./lib/index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"start": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts",
|
|
11
11
|
"create": "yarn run build && yarn run test",
|
|
12
12
|
"build": "tsc -p .",
|
|
13
13
|
"refresh": "rm -rf ./node_modules ./package-lock.json && yarn",
|
|
14
|
-
"local": "sudo yarn global add &&
|
|
14
|
+
"local": "sudo yarn global add && skittles",
|
|
15
15
|
"test": "hardhat test"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "git+https://github.com/chase-manning/
|
|
19
|
+
"url": "git+https://github.com/chase-manning/skittles.git"
|
|
20
20
|
},
|
|
21
21
|
"author": "Chase Manning",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"bugs": {
|
|
24
|
-
"url": "https://github.com/chase-manning/
|
|
24
|
+
"url": "https://github.com/chase-manning/skittles/issues"
|
|
25
25
|
},
|
|
26
|
-
"homepage": "https://github.com/chase-manning/
|
|
26
|
+
"homepage": "https://github.com/chase-manning/skittles#readme",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"chalk": "4.1.2",
|
|
29
29
|
"clear": "^0.1.0",
|
|
30
30
|
"commander": "^9.4.0",
|
|
31
|
+
"ethers": "^5.6.9",
|
|
31
32
|
"figlet": "^1.5.2",
|
|
32
33
|
"path": "^0.12.7",
|
|
33
34
|
"solc": "^0.8.16",
|
|
@@ -56,7 +57,6 @@
|
|
|
56
57
|
"eslint-plugin-prettier": "^3.4.1",
|
|
57
58
|
"eslint-plugin-promise": "^5.2.0",
|
|
58
59
|
"ethereum-waffle": "^3.4.4",
|
|
59
|
-
"ethers": "^5.6.9",
|
|
60
60
|
"hardhat": "^2.10.1",
|
|
61
61
|
"hardhat-gas-reporter": "^1.0.8",
|
|
62
62
|
"nodemon": "^2.0.19",
|
package/lib/types/fox-class.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FoxStatementType = exports.FoxOperator = exports.FoxExpressionType = void 0;
|
|
4
|
-
var FoxExpressionType;
|
|
5
|
-
(function (FoxExpressionType) {
|
|
6
|
-
FoxExpressionType["Binary"] = "Binary";
|
|
7
|
-
FoxExpressionType["Value"] = "Value";
|
|
8
|
-
FoxExpressionType["Storage"] = "Storage";
|
|
9
|
-
})(FoxExpressionType = exports.FoxExpressionType || (exports.FoxExpressionType = {}));
|
|
10
|
-
var FoxOperator;
|
|
11
|
-
(function (FoxOperator) {
|
|
12
|
-
FoxOperator["Plus"] = "+";
|
|
13
|
-
FoxOperator["Minus"] = "-";
|
|
14
|
-
FoxOperator["Multiply"] = "*";
|
|
15
|
-
FoxOperator["Divide"] = "/";
|
|
16
|
-
FoxOperator["Modulo"] = "%";
|
|
17
|
-
FoxOperator["Equals"] = "==";
|
|
18
|
-
FoxOperator["NotEquals"] = "!=";
|
|
19
|
-
FoxOperator["GreaterThan"] = ">";
|
|
20
|
-
FoxOperator["LessThan"] = "<";
|
|
21
|
-
FoxOperator["GreaterThanOrEqual"] = ">=";
|
|
22
|
-
FoxOperator["LessThanOrEqual"] = "<=";
|
|
23
|
-
FoxOperator["And"] = "&&";
|
|
24
|
-
FoxOperator["Or"] = "||";
|
|
25
|
-
FoxOperator["Not"] = "!";
|
|
26
|
-
})(FoxOperator = exports.FoxOperator || (exports.FoxOperator = {}));
|
|
27
|
-
var FoxStatementType;
|
|
28
|
-
(function (FoxStatementType) {
|
|
29
|
-
FoxStatementType["StorageUpdate"] = "StorageUpdate";
|
|
30
|
-
FoxStatementType["Return"] = "Return";
|
|
31
|
-
})(FoxStatementType = exports.FoxStatementType || (exports.FoxStatementType = {}));
|