11# SmartPy Code
22import smartpy as sp
33
44class StoreValue(sp.Contract):
55 def __init__(self, value):
66 self.init(storedValue = value)
77
88 @sp.entry_point
99 def replace(self, value):
1010 self.data.storedValue = value
1111
1212 @sp.entry_point
1313 def double(self):
1414 self.data.storedValue *= 2
1515
1616@sp.add_test(name = "StoreValue")
1717def test():
1818 scenario = sp.test_scenario()
1919 scenario.h1("Store Value")
2020 contract = StoreValue(1)
2121 scenario += contract
2222 scenario += contract.replace(2)
2323 scenario += contract.double()
24