import os import time import unittest from Auction_test_base import AuctionTest sys.path.append(os.environ['TEST4_PATH'] + '/ts4_py_lib') s2b = ts4.str2bytes b2s = ts4.bytes2str # Set a directory where the artifacts of the used contracts are located ts4.set_tests_path(os.environ['OUT_PATH'] + '/') # Toggle to print additional execution info ts4.set_verbose(True) class AuctionTest_earlier_bid_wins(AuctionTest): def test_earlier_bid_wins(self): seed2 = 54 (b2_pk, b2_pu) = ts4.make_keypair() bidder2 = ts4.BaseContract('TestAuctionBidder', dict(bid_key=b2_pu, seed=seed2), pubkey=b2_pu, private_key=b2_pk) seed3 = 42 (b3_pk, b3_pu) = ts4.make_keypair()
''' This script demonstrate how to exploit the droneContract smart contract. ''' import tonos_ts4.ts4 as ts4 # Set a directory where the artifacts of the used contracts are located ts4.set_tests_path('') # Toggle to print additional execution info ts4.set_verbose(False) #Load the contract dron = ts4.BaseContract('droneContract', {}) class dron(ts4.BaseContract): def __init__(self): self.create_keypair() # We pass a public key to the constructor that will identify the contract owner super(dron, self).__init__('droneContract', {}, pubkey=self.public_key_) # Create a method to call setNumber without the owner's signature def setNumber(self, value, expect_ec=0): return self.call_method('setNumber', {'value': value}, expect_ec=expect_ec) # Create a method to call setNumber with the owner's signature