|
@@ -133,21 +133,23 @@ def nfts(sender_wallet: SenderWallet, reply: Reply):
|
|
|
|
|
|
|
|
|
@as_command
|
|
|
-async def blockchain(wallets: Data(RollcoinWallet), wallet_lookup: WalletLookup, state: State):
|
|
|
+async def blockchain(origin: Origin, wallets: Data(RollcoinWallet), wallet_lookup: WalletLookup, state: State):
|
|
|
"""
|
|
|
View the contents of everyone's wallets
|
|
|
"""
|
|
|
response = f"Blockchain:\n\tTreasury: {state.treasury}\n\n"
|
|
|
- names = {v: k.title() for k, v in wallet_lookup.items()}
|
|
|
+ names = {v: k.title() for k, v in wallet_lookup[origin].items()}
|
|
|
wallets = [(sender_id, wallet) async for (sender_id, wallet) in wallets.all()]
|
|
|
for (sender_id, wallet) in sorted(wallets, key=lambda p: p[1].get_valuation(), reverse=True):
|
|
|
- response += names.get(sender_id, f"Unnamed wallet {sender_id}") + ":\n"
|
|
|
- response += "\n".join("\t" + s for s in str(wallet).split("\n")) + "\n\n"
|
|
|
+ if (name := names.get(sender_id, None)) is not None:
|
|
|
+ response += f"{name}:\n"
|
|
|
+ response += "\n".join("\t" + s for s in str(wallet).split("\n")) + "\n\n"
|
|
|
return response.strip()
|
|
|
|
|
|
|
|
|
@as_command
|
|
|
async def tip(
|
|
|
+ origin: Origin,
|
|
|
wallets: Data(RollcoinWallet),
|
|
|
sender_id: Sender,
|
|
|
sender_wallet: SenderWallet,
|
|
@@ -171,7 +173,7 @@ async def tip(
|
|
|
if amount <= 0:
|
|
|
RollbotFailure.INVALID_ARGUMENTS.raise_exc(f"Amount must be positive, not {amount}")
|
|
|
|
|
|
- if (target_id := wallet_lookup.get(target_name.lower(), None)) is None:
|
|
|
+ if (target_id := wallet_lookup[origin].get(target_name.lower(), None)) is None:
|
|
|
RollbotFailure.INVALID_ARGUMENTS.raise_exc(f"Cannot find wallet belonging to {target_name}")
|
|
|
|
|
|
target_wallet = await wallets.load_or(target_id)
|
|
@@ -594,6 +596,7 @@ async def gacha(
|
|
|
|
|
|
@as_command
|
|
|
async def giftcha(
|
|
|
+ origin: Origin,
|
|
|
sender_wallet: SenderWallet,
|
|
|
get_sender_wallet: Lazy(SenderWallet), # used for re-querying to mitigate race condition
|
|
|
sender_id: Sender,
|
|
@@ -616,7 +619,7 @@ async def giftcha(
|
|
|
yield invalid, reply
|
|
|
return
|
|
|
|
|
|
- if (target_id := wallet_lookup.get(target_name.lower(), None)) is None:
|
|
|
+ if (target_id := wallet_lookup[origin].get(target_name.lower(), None)) is None:
|
|
|
RollbotFailure.INVALID_ARGUMENTS.raise_exc(f"Could not find a wallet for {target_name}")
|
|
|
|
|
|
pulled = []
|
|
@@ -691,6 +694,7 @@ async def brrr(
|
|
|
|
|
|
@as_command
|
|
|
async def tax(
|
|
|
+ origin: Origin,
|
|
|
origin_admin: OriginAdmin,
|
|
|
wallet_lookup: WalletLookup,
|
|
|
target_name: Arg(0, missing_msg="Must provide a target to tax"),
|
|
@@ -704,7 +708,7 @@ async def tax(
|
|
|
if not origin_admin:
|
|
|
RollbotFailure.PERMISSIONS.raise_exc("Only admins can tax someone")
|
|
|
|
|
|
- if (target_id := wallet_lookup.get(target_name.lower(), None)) is None or (wallet := await wallet_store.load(target_id)) is None:
|
|
|
+ if (target_id := wallet_lookup[origin].get(target_name.lower(), None)) is None or (wallet := await wallet_store.load(target_id)) is None:
|
|
|
RollbotFailure.INVALID_ARGUMENTS.raise_exc(f"Could not find a wallet for {target_name}")
|
|
|
|
|
|
state = await state_store.load(GLOBAL_STATE_KEY)
|