Skip to content

Commit 2ba69ad

Browse files
Merge pull request #13 from sky-ring/milestone-2
Impl: Milestone 2 Features
2 parents 8f655b2 + 836c28e commit 2ba69ad

164 files changed

Lines changed: 7926 additions & 408 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Rift
44

5-
[![PyPI version](https://img.shields.io/badge/rift--framework-0.7.5-informational?style=flat-square&color=FFFF91&labelColor=360825)](https://pypi.org/project/rift-framework/)
6-
[![Telegram](https://img.shields.io/badge/Telegram-@rift__framework-informational?style=flat-square&color=0088cc&labelColor=360825)](https://t.me/d_builder)
5+
[![PyPI version](https://img.shields.io/badge/rift--framework-0.9.6-informational?style=flat-square&color=FFFF91&labelColor=360825)](https://pypi.org/project/rift-framework/)
6+
[![Telegram](https://img.shields.io/badge/Telegram-@skyring__org-informational?style=flat-square&color=0088cc&labelColor=360825)](https://t.me/skyring_org)
77
[![Telegram](https://img.shields.io/badge/Docs-docs.skyring.io/rift-informational?style=flat-square&color=6A0F49&labelColor=360825)](https://docs.skyring.io/rift/)
8-
> _A magical **Python3** -> **FunC** portal_
8+
> _A magical **Python3** -> **TON** portal_
99
1010
Rift is smart contract development framework in Python for [TON (The Open Network)](https://ton.org). Its purpose is to make the development, testing, and deployment procedures much easier!
1111

@@ -104,9 +104,9 @@ Until then, you may look at standard contracts implementation; they cover the ma
104104
- [x] Providing standard smart contracts implementation with Rift
105105

106106
### Milestone 2: deploying, testing, interaction capabilities
107-
- [ ] Simple interaction interface with TON Blockchain
108-
- [ ] Simple deploying options of developed contracts
109-
- [ ] Testing framework for the contracts developed with Rift
107+
- [x] Simple interaction interface with TON Blockchain
108+
- [x] Simple deploying options of developed contracts
109+
- [x] Testing framework for the contracts developed with Rift
110110

111111
## Contributing
112112
If you're interested in contributing to Rift, please see [CONTRIBUTING.md](https://github.com/sky-ring/rift/blob/main/CONTRIBUTING.md) for the necessary specifications and procedure.

poetry.lock

Lines changed: 355 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "rift-framework"
3-
version = "0.7.5"
4-
description = "A magical Python3 -> FunC portal"
3+
version = "0.9.6"
4+
description = "The magical Python -> TON Portal"
55
authors = ["Amin Rezaei <AminRezaei0x443@gmail.com>"]
66
license = "MIT"
77
readme = "README.md"
@@ -16,6 +16,11 @@ click = "~8.1.3"
1616
libcst = "~0.4.7"
1717
PyYAML = "~6.0"
1818
tomlkit = "~0.11.4"
19+
pytonlib = "~0.0.42"
20+
appdirs = "~1.4.4"
21+
colorful = "~0.5.4"
22+
tqdm = "^4.64.1"
23+
setuptools = "^65.6.3"
1924

2025
[tool.poetry.group.dev.dependencies]
2126
black = "^22.6.0"
@@ -25,7 +30,7 @@ flake8 = "^5.0.4"
2530
rift = "rift.cli.entry:entry"
2631

2732
[build-system]
28-
requires = ["poetry-core"]
33+
requires = ["poetry-core", "setuptools", "requests", "tqdm"]
2934
build-backend = "poetry.core.masonry.api"
3035

3136
[tool.black]

requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ click~=8.1.3
33
libcst~=0.4.7
44
PyYAML~=6.0
55
setuptools~=62.6.0
6-
tomlkit~=0.11.4
6+
tomlkit~=0.11.4
7+
pytonlib~=0.24
8+
appdirs~=1.4.4
9+
colorful~=0.5.4

rift/ast/ast_patcher.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from rift.ast.patchers import (
1212
AssertPatcher,
1313
AssignPatcher,
14+
BreakPatcher,
1415
IfPatcher,
1516
RaisePatcher,
1617
ReturnPatcher,
@@ -24,6 +25,7 @@ def patch(node):
2425
UnaryPatcher(),
2526
AssertPatcher(),
2627
AssignPatcher(),
28+
BreakPatcher(),
2729
IfPatcher(),
2830
RaisePatcher(),
2931
ReturnPatcher(),

rift/ast/calls.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ def add_statement(cls, type, *args):
5050
cls.current_contract.add_statement(s)
5151
return s.node_id()
5252

53+
@classmethod
54+
def break_(cls):
55+
# TODO: Add when FunC supports or we move to TVM Engine
56+
# cls.add_statement(Statement.BREAK)
57+
raise Exception("FunC doesn't support break keyword!")
58+
5359
@classmethod
5460
def return_(cls, entity):
5561
ReferenceTable.mark(entity)

rift/ast/patchers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from rift.ast.patchers.assert_patcher import AssertPatcher
22
from rift.ast.patchers.assign_patcher import AssignPatcher
3+
from rift.ast.patchers.break_patcher import BreakPatcher
34
from rift.ast.patchers.if_patcher import IfPatcher
45
from rift.ast.patchers.raise_patcher import RaisePatcher
56
from rift.ast.patchers.return_patcher import ReturnPatcher

rift/ast/patchers/assign_patcher.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,13 @@ def visit_Assign(self, node):
143143
value=c_expr,
144144
)
145145
else:
146-
a_expr = ast.Expr(
146+
a_expr = ast.Assign(
147+
targets=[target],
147148
value=c_expr,
148149
)
150+
# a_expr = ast.Expr(
151+
# value=c_expr,
152+
# )
149153
nodes.append(a_expr)
150154
for g_node in nodes:
151155
ast.fix_missing_locations(g_node)

rift/ast/patchers/break_patcher.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import ast
2+
from typing import Any
3+
4+
5+
class BreakPatcher(ast.NodeTransformer):
6+
"""Transforms the AST to handle raise exprs."""
7+
8+
def visit_Break(self, node: ast.Break) -> Any:
9+
u_node = ast.Expr(
10+
value=ast.Call(
11+
func=ast.Attribute(
12+
value=ast.Name(id="helpers", ctx=ast.Load()),
13+
attr="_break",
14+
ctx=ast.Load(),
15+
),
16+
args=[],
17+
keywords=[],
18+
),
19+
)
20+
ast.fix_missing_locations(u_node)
21+
return u_node

rift/ast/types/block.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def __init__(self):
1717
super().__init__()
1818
self.parent = None
1919
self.symbols = BoolDict()
20+
# Just a simple patch to not define _ as a variable
21+
self.symbols["_"] = True
2022
self.statements = []
2123

2224
def add_statement(self, statement):

0 commit comments

Comments
 (0)