예제 #1
0
 def post(
     self,
     name,
     symbol,
     bonding_collateral_equation,
     bonding_liquidity_spread,
     params_expiration_time,
     params_min_participation_pct,
     params_support_required_pct,
 ):
     return create_transaction(
         None,
         (
             db.session.query(Contract)
             .filter_by(contract_type="BAND_FACTORY")
             .one_or_none()
             or abort(400, message="Band factory not found")
         ).address,
         "createCommunity(string,string,uint256[],uint256,uint256,uint256,uint256)",
         ("string", name),
         ("string", symbol),
         (
             "uint256[]",
             [int(token, 0) for token in bonding_collateral_equation],
         ),
         ("uint256", bonding_liquidity_spread),
         ("uint256", params_expiration_time),
         ("uint256", params_min_participation_pct),
         ("uint256", params_support_required_pct),
     )
예제 #2
0
 def post(
     self,
     addr,
     prefix,
     decay_function,
     min_deposit,
     apply_stage_length,
     dispensation_percentage,
     commit_time,
     reveal_time,
     min_participation_pct,
     support_required_pct,
 ):
     return create_transaction(
         None,
         addr,
         "createTCR(bytes8,uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256)",
         ("bytes8", bytes(prefix, "utf-8")),
         ("uint256[]", [int(token, 0) for token in decay_function]),
         ("uint256", min_deposit),
         ("uint256", apply_stage_length),
         ("uint256", dispensation_percentage),
         ("uint256", commit_time),
         ("uint256", reveal_time),
         ("uint256", min_participation_pct),
         ("uint256", support_required_pct),
     )
예제 #3
0
 def post(self, addr, reward_owner, challenge_id):
     return create_transaction(
         reward_owner,
         addr,
         "claimReward(address,uint256)",
         ("address", reward_owner),
         ("uint256", challenge_id),
     )
예제 #4
0
 def post(self, addr, sender, data_hash):
     return create_transaction(
         sender,
         addr,
         "exit(address,bytes32)",
         ("address", sender),
         ("bytes32", to_bytes(hexstr=data_hash)),
     )
예제 #5
0
파일: withdraw.py 프로젝트: prin-r/tcrapi
 def post(self, addr, sender, data_hash, amount):
     return create_transaction(
         sender,
         addr,
         "withdraw(address,bytes32,uint256)",
         ("address", sender),
         ("bytes32", to_bytes(hexstr=data_hash)),
         ("uint256", amount),
     )
예제 #6
0
 def post(self, sender, withdraw_ownership, data_source, addr):
     return create_transaction(
         sender,
         addr,
         "withdraw(address,uint256,address)",
         ("address", sender),
         ("uint256", withdraw_ownership),
         ("address", data_source),
     )
예제 #7
0
 def post(self, sender, to, value, addr, comm):
     token_contract = comm.token_collection[0]
     return create_transaction(
         sender,
         token_contract.address,
         "transferFeeless(address,address,uint256)",
         ("address", sender),
         ("address", to),
         ("uint256", value),
     )
예제 #8
0
 def post(self, sender, reason_hash, addr, comm, param, keys, values):
     return create_transaction(
         sender,
         param.address,
         "propose(address,bytes32,bytes32[],uint256[])",
         ("address", sender),
         ("bytes32", to_bytes(hexstr=reason_hash)),
         ("bytes32[]", [bytes(key, "utf-8") for key in keys]),
         ("uint256[]", [int(value, 0) for value in values]),
     )
예제 #9
0
 def post(self, addr, sender, yes_vote, no_vote, on_chain_id,
          poll_contract):
     return create_transaction(
         sender,
         get_voting_address(poll_contract.address),
         "castVote(address,address,uint256,uint256,uint256)",
         ("address", sender),
         ("address", poll_contract.address),
         ("uint256", on_chain_id),
         ("uint256", yes_vote),
         ("uint256", no_vote),
     )
예제 #10
0
 def post(self, sender, to, value):
     band_contract = (
         db.session.query(Contract)
         .filter_by(contract_type="BAND_TOKEN")
         .one_or_none()
     ) or abort(400)
     return create_transaction(
         sender,
         band_contract.address,
         "transferFeeless(address,address,uint256)",
         ("address", sender),
         ("address", to),
         ("uint256", value),
     )
예제 #11
0
 def post(
     self,
     addr,
     min_provider_stake,
     max_provider_count,
     owner_revenue_pct,
     query_price,
 ):
     return create_transaction(
         None,
         addr,
         "createTCD(uint256,uint256,uint256,uint256)",
         ("uint256", min_provider_stake),
         ("uint256", max_provider_count),
         ("uint256", owner_revenue_pct),
         ("uint256", query_price),
     )
예제 #12
0
파일: commitvote.py 프로젝트: prin-r/tcrapi
 def post(
     self,
     addr,
     sender,
     commit_hash,
     total_weight,
     on_chain_id,
     poll_contract,
 ):
     return create_transaction(
         sender,
         get_voting_address(poll_contract.address),
         "commitVote(address,address,uint256,bytes32,bytes32,uint256,uint256 )",
         ("address", sender),
         ("address", poll_contract.address),
         ("uint256", on_chain_id),
         ("bytes32", to_bytes(hexstr=commit_hash)),
         ("bytes32", b""),
         ("uint256", total_weight),
         ("uint256", 0),
     )
예제 #13
0
파일: get_data.py 프로젝트: prin-r/tcrapi
 def post(self, key, addr):
     return create_transaction(None, addr, "getAsNumber(bytes32)",
                               ("bytes32", to_bytes(text=key)))
예제 #14
0
 def post(self, token_amount, addr):
     return create_transaction(None, addr, "distributeFee(uint256)",
                               ("uint256", token_amount))
예제 #15
0
 def post(self, data_source, addr):
     return create_transaction(None, addr, "kick(address)",
                               ("address", data_source))