예제 #1
0
 def get_proposal_list(self):
     nr_proposals = self.sim.get_storage_data(self.contract,
                                              coerce_to_bytes(2**162 - 1))
     proposals = []
     for idx in range(nr_proposals):
         proposals.append(
             coerce_addr_to_hex(
                 self.sim.get_storage_data(self.contract,
                                           coerce_to_bytes(2**162 + idx))))
     return proposals
예제 #2
0
 def get_account_list(self):
     nr_accounts = self.sim.get_storage_data(self.contract,
                                             coerce_to_bytes(2**160 - 1))
     accounts = []
     for idx in range(nr_accounts):
         accounts.append(
             coerce_addr_to_hex(
                 self.sim.get_storage_data(self.contract,
                                           coerce_to_bytes(2**160 + idx))))
     return accounts
 def test_exhibit(self):
     data = ["exhibit"]
     response = self.sim.tx(self.accounts["artist"], self.contract, 0, data)
     print response
     work = ''
     for fragment in response:
         work += coerce_to_bytes(fragment)
     assert work == self.WORK
예제 #4
0
def result(ans):
    if ans[0] != 0:
        # error
        if len(ans) > 1:
            raise ContractError(coerce_to_bytes(ans[1]))
        else:
            raise ContractError()
    else:
        return ans[1:]
예제 #5
0
def result(ans):
    if ans[0] != 0:
        # error
        if len(ans) > 1:
            raise ContractError(coerce_to_bytes(ans[1]))
        else:
            raise ContractError()
    else:
        return ans[1:]
 def test_create_work(self):
     data = []
     response = self.sim.tx(self.accounts["beholder"], self.contract, 0, data)
     assert coerce_to_bytes(response[0]) == self.ARTWORK
     assert response[1] == self.ARTWORK_NUMBER
예제 #7
0
 def get_proposal_votes(self, proposal):
     proposal_id = self.get_proposal_id(proposal)
     return self.sim.get_storage_data(self.contract, coerce_to_bytes(proposal_id + 2**163 + 2))
예제 #8
0
 def get_proposal_list(self):
     nr_proposals = self.sim.get_storage_data(self.contract, coerce_to_bytes(2**162-1))
     proposals = []
     for idx in range(nr_proposals):
         proposals.append(coerce_addr_to_hex(self.sim.get_storage_data(self.contract, coerce_to_bytes(2**162 + idx))))
     return proposals
예제 #9
0
 def get_account_list(self):
     nr_accounts = self.sim.get_storage_data(self.contract, coerce_to_bytes(2**160-1))
     accounts = []
     for idx in range(nr_accounts):
         accounts.append(coerce_addr_to_hex(self.sim.get_storage_data(self.contract, coerce_to_bytes(2**160 + idx))))
     return accounts
예제 #10
0
 def get_proposal_recipient(self, proposal):
     proposal_id = self.get_proposal_id(proposal)
     return coerce_addr_to_hex(self.sim.get_storage_data(self.contract, coerce_to_bytes(proposal_id + 2**163)))
예제 #11
0
 def test_toggle(self):
     data = ["toggle"]
     ans = self.sim.tx(self.accounts["artist"], self.contract, 0, data)
     assert coerce_to_bytes(ans[0]) == "is"
     ans = self.sim.tx(self.accounts["artist"], self.contract, 0, data)
     assert coerce_to_bytes(ans[0]) == "is not"
예제 #12
0
 def get_commons_balance(self):
     return self.sim.get_storage_data(self.contract, coerce_to_bytes(42))
예제 #13
0
 def get_account_timestamp(self, address):
     return self.sim.get_storage_data(
         self.contract, coerce_to_bytes(int(address, 16) + 2**161 + 1))
 def test_work(self):
     data = []
     response = self.sim.tx(self.accounts["artist"], self.contract, 0, data)
     assert coerce_to_bytes(response[0]) == self.WORK
예제 #15
0
 def get_account_tax_credits(self, address):
     return self.sim.get_storage_data(
         self.contract, coerce_to_bytes(int(address, 16) + 2**161 + 2))
예제 #16
0
 def get_proposal_votes(self, proposal):
     proposal_id = self.get_proposal_id(proposal)
     return self.sim.get_storage_data(
         self.contract, coerce_to_bytes(proposal_id + 2**163 + 2))
예제 #17
0
 def get_proposal_recipient(self, proposal):
     proposal_id = self.get_proposal_id(proposal)
     return coerce_addr_to_hex(
         self.sim.get_storage_data(self.contract,
                                   coerce_to_bytes(proposal_id + 2**163)))
 def test_exhibit(self):
     data = ["exhibit"]
     response = self.sim.tx(self.accounts["beholder"], self.contract, 0, data)
     assert coerce_to_bytes(response[0]) == self.WORK
예제 #19
0
 def get_commons_balance(self):
     return self.sim.get_storage_data(self.contract, coerce_to_bytes(42))
 def test_create_work(self):
     data = ["create"]
     response = self.sim.tx(self.accounts["beholder"], self.contract, 0, data)
     artwork = "".join([coerce_to_bytes(fragment) for fragment in response])
     assert artwork == self.ARTWORK_FOR_BEHOLDER
예제 #21
0
 def get_account_timestamp(self, address):
     return self.sim.get_storage_data(self.contract, coerce_to_bytes(int(address, 16) + 2**161 + 1))
예제 #22
0
 def test_do_nothing(self):
     data = []
     ans = self.sim.tx(self.accounts["artist"], self.contract, 0, data)
     assert coerce_to_bytes(ans[0]) == "is not"
예제 #23
0
 def get_account_tax_credits(self, address):
     return self.sim.get_storage_data(self.contract, coerce_to_bytes(int(address, 16) + 2**161 + 2))