This repository has been archived by the owner on Feb 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
156 febeウォレット連携前に投稿したトークンをマイページで確認ウォレット連携で振込 (#157)
- Loading branch information
Showing
20 changed files
with
274 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...xy/contract_proxy/core/bingoCard/route.py → .../contract_proxy/core/bingo_token/route.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
functions/contract_proxy/contract_proxy/core/memory_nft/request.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from typing import List | ||
from pydantic import BaseModel, Field | ||
|
||
|
||
class MemoryNftsMintRequest(BaseModel): | ||
memoryTokenIds: List[str] = Field([], description="NFTのIDリスト") |
6 changes: 6 additions & 0 deletions
6
functions/contract_proxy/contract_proxy/core/memory_nft/response.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from typing import List | ||
from pydantic import BaseModel, Field | ||
|
||
|
||
class MemoryNftsMintResponse(BaseModel): | ||
memoryTokenIds: List[str] = Field([], description="NFTのIDリスト") |
22 changes: 22 additions & 0 deletions
22
functions/contract_proxy/contract_proxy/core/memory_nft/route.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from contract_proxy.core.memory_nft.request import MemoryNftsMintRequest | ||
from contract_proxy.core.memory_nft.response import MemoryNftsMintResponse | ||
from contract_proxy.facades.thirdweb.erc1155_memory_nft_contract import ( | ||
add_owner_nfts, | ||
) | ||
from fastapi import APIRouter | ||
|
||
|
||
memory_nft_router = APIRouter( | ||
prefix="/mint-memory-nfts", tags=["mint_memory_nfts"] | ||
) | ||
|
||
|
||
@memory_nft_router.put( | ||
"/{wallet_address}", | ||
) | ||
async def mint_memory_nfts( | ||
wallet_address: str, | ||
request: MemoryNftsMintRequest, | ||
): | ||
add_owner_nfts(wallet_address, request.memoryTokenIds) | ||
return MemoryNftsMintResponse(memoryTokenIds=request.memoryTokenIds) |
23 changes: 23 additions & 0 deletions
23
functions/contract_proxy/contract_proxy/facades/thirdweb/erc1155_memory_nft_contract.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from typing import List | ||
import contract_proxy.config as config | ||
from contract_proxy.facades.thirdweb import sdk | ||
|
||
|
||
contract = sdk.get_contract(config.ERC1155_CONTRACT_ADDRESS) | ||
|
||
|
||
def add_owner_nfts(address: str, memoryTokenIds: List[str]): | ||
for memoryTokenId in memoryTokenIds: | ||
try: | ||
tx = contract.erc1155.mint_additional_supply(memoryTokenId, 1) | ||
token_id = tx.id | ||
_ = tx.data() | ||
print(f"mint_additional_supply Success. token_id: {token_id}") | ||
except Exception as e: | ||
print("mint_additional_supply Error", e) | ||
|
||
try: | ||
_ = contract.erc1155.transfer(address, memoryTokenId, 1) | ||
print(f"transfer Success. address: {address}, ") | ||
except Exception as e: | ||
print("transfer Error", e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
functions/create_complete_movie/create_complete_movie/facades/firestore/user.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from typing import Union | ||
from create_complete_movie.facades.firestore import db | ||
from create_complete_movie.models.bingo_card import BingoCardCell | ||
|
||
|
||
COLLECTION_PREFIX = "users" | ||
|
||
|
||
def update_pre_grant_memory_nft_token_ids( | ||
token_id: str, uids: list[str] | ||
) -> Union[list[BingoCardCell], None]: | ||
"""ユーザーが取得漏れたNFTの一覧を更新する | ||
Args: | ||
token_id (str): _description_ | ||
uids (list[str]): _description_ | ||
Returns: | ||
Union[list[BingoCardCell], None]: _description_ | ||
""" | ||
for uid in uids: | ||
user = db.fetch(collection=COLLECTION_PREFIX, id=uid) | ||
# preGrantMemoryNftTokenIdsが存在しない場合は、初期化する | ||
if "preGrantMemoryNftTokenIds" not in user: | ||
user["preGrantMemoryNftTokenIds"] = [] | ||
|
||
user["preGrantMemoryNftTokenIds"].append(str(token_id)) | ||
db().collection(COLLECTION_PREFIX).document(uid).set(user) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
functions/create_complete_movie/create_complete_movie/models/user.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from typing import Optional | ||
from pydantic import BaseModel, Field | ||
|
||
|
||
class User(BaseModel): | ||
uid: str = Field(..., description="ユーザーID") | ||
walletAddress: Optional[str] = Field(None, description="ウォレットアドレス") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.