def list_private_token(session, token):
     listed_token = Listing()
     listed_token.token_address = token['address']
     listed_token.is_public = False
     listed_token.max_holding_quantity = 1
     listed_token.max_sell_amount = 1000
     session.add(listed_token)
コード例 #2
0
 def list_token(session, token):
     listed_token = Listing()
     listed_token.token_address = token["address"]
     listed_token.is_public = True
     listed_token.max_holding_quantity = 1
     listed_token.max_sell_amount = 1000
     session.add(listed_token)
コード例 #3
0
def listing_token(session, token):
    listing = Listing()
    listing.token_address = token['address']
    listing.is_public = True
    listing.max_holding_quantity = 1
    listing.max_sell_amount = 1000
    session.add(listing)
コード例 #4
0
 def insert_listing_data(session, _token):
     token = Listing()
     token.token_address = _token["token_address"]
     token.is_public = _token["is_public"]
     token.max_holding_quantity = _token["max_holding_quantity"]
     token.max_sell_amount = _token["max_sell_amount"]
     token.owner_address = "0x9467ABe171e0da7D6aBDdA23Ba6e6Ec5BE0b4F7b"
     session.add(token)
コード例 #5
0
 def insert_listing_data(session, _token):
     token = Listing()
     token.token_address = _token["token_address"]
     token.is_public = _token["is_public"]
     token.max_holding_quantity = _token["max_holding_quantity"]
     token.max_sell_amount = _token["max_sell_amount"]
     token.owner_address = _token["owner_address"]
     session.add(token)
コード例 #6
0
 def list_token(session, token, issuer):
     listed_token = Listing()
     listed_token.token_address = token["address"]
     listed_token.is_public = True
     listed_token.max_holding_quantity = 1
     listed_token.max_sell_amount = 1000
     listed_token.owner_address = issuer["account_address"]
     session.add(listed_token)
コード例 #7
0
ファイル: admin.py プロジェクト: BoostryJP/ibet-Wallet-API
    def on_post(self, req, res):
        LOG.info("v2.token.Tokens(POST)")

        session = req.context["session"]

        # 入力値チェック
        request_json = self.validate(req)
        contract_address = request_json["contract_address"]

        # 既存レコードの存在チェック
        _listing = session.query(Listing). \
            filter(Listing.token_address == contract_address). \
            first()
        if _listing is not None:
            raise InvalidParameterError("contract_address already exist")

        _executable_contract = session.query(ExecutableContract). \
            filter(ExecutableContract.contract_address == contract_address). \
            first()
        if _executable_contract is not None:
            raise InvalidParameterError("contract_address already exist")

        # token情報をTokenListコントラクトから取得
        ListContract = Contract.get_contract(
            'TokenList', config.TOKEN_LIST_CONTRACT_ADDRESS)

        token = ListContract.functions.getTokenByAddress(
            contract_address).call()
        # contract_addressの有効性チェック
        if token[1] is None or token[1] not in self.available_token_template():
            raise InvalidParameterError(
                "contract_address is invalid token address")

        owner_address = token[2]

        # 新規レコードの登録
        is_public = request_json["is_public"]
        max_holding_quantity = request_json[
            "max_holding_quantity"] if "max_holding_quantity" in request_json else None
        max_sell_amount = request_json[
            "max_sell_amount"] if "max_sell_amount" in request_json else None

        listing = Listing()
        listing.token_address = contract_address
        listing.is_public = is_public
        listing.max_holding_quantity = max_holding_quantity
        listing.max_sell_amount = max_sell_amount
        listing.owner_address = owner_address
        session.add(listing)

        executable_contract = ExecutableContract()
        executable_contract.contract_address = contract_address
        session.add(executable_contract)

        session.commit()

        self.on_success(res)
コード例 #8
0
 def insert_listing(session, listing: dict):
     _listing = Listing()
     _listing.token_address = listing["token_address"]
     _listing.is_public = listing["is_public"]
     session.add(_listing)
コード例 #9
0
 def _insert_listing(session, token_address, owner_address):
     listing = Listing()
     listing.token_address = token_address
     listing.is_public = True
     listing.owner_address = owner_address
     session.add(listing)