Skip to content

Commit

Permalink
added SmartPy/OjusWiZard.py (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
OjusWiZard authored Oct 2, 2022
1 parent 0ac05e0 commit df06d15
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions SmartPy/OjusWiZard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import smartpy as sp

class CoffeeToCode(sp.Contract):
def __init__(self):
self.init(code='')

@sp.entry_point
def to_code(self, params):
sp.set_type(params, sp.TRecord(coffee = sp.TString))
coffee = params.coffee
self.data.code = sp.slice(coffee, 0, 2).open_some() + 'd' + sp.slice(coffee, 5, 1).open_some()


@sp.add_test(name = "Coffee To Code")
def test():
scenario = sp.test_scenario()

scenario.h1("Coffee To Code")
ctc = CoffeeToCode()
scenario += ctc
ctc.to_code(coffee = 'Coffee')

0 comments on commit df06d15

Please sign in to comment.