Transaction #6420

Hash f13997fe1133e5fc5ad8d52b7a3944b1cdefd13a31ddf19bd58bff292da18655
Status Failed
Error Message Exception('Contract already exists.',)
Timestamp 434 days ago - 2/23/2023, 3:27:21 PM UTC+0
Block 6420
Stamps Used 8
Burned Fee 0.00047337 TAU
From d4a1561ae09b8c0a978a1334b33744262c0edeea1940998bf7035808362d5d11 
Contract Name submission
Function Name submit_contract

Additional Info
Nonce 0
Processor a04b5891ef8cd27095373a4f75b899ec2bc0883c02e506a6a5b55b491998cc3f
Signature b7a873e0e359a65d20ae1f43e436c367a3d456b5297e9c459ea8aa4e6cd7bfc7616008b514b73c32b71cdc36dfa87249ff8c3e2c14e986200c45e5e12319a300
Stamps Supplied 500
Stamps per TAU 169

Kwargs

code I = importlib collection_name = Variable() collection_owner = Variable() collection_nfts = Hash(default_value=0) collection_balances = Hash(default_value=0) collection_balances_approvals = Hash(default_value=0) @construct def seed(): collection_name.set("Bad Bunny") collection_owner.set(ctx.caller) @export def mint_nft(name: str, description: str, ipfs_image_url: str, metadata: dict, amount: int): assert name != "", "Name cannot be empty" assert collection_nfts[name] == 0, "Name already exists" assert amount > 0, "You cannot transfer negative amounts" assert collection_owner.get() == ctx.caller, "Only the collection owner can mint NFTs" collection_nfts[name] = {"description": description, "ipfs_image_url": ipfs_image_url, "metadata": metadata, "amount": amount} collection_balances[ctx.caller, name] = amount @export def transfer(name: str, amount:int, to: str): assert amount > 0, "You cannot transfer negative amounts" assert name != "", "Please specify the name of the NFT you want to transfer" assert collection_balances[ctx.caller, name] >= amount, "You dont have enough NFTs to send" collection_balances[ctx.caller, name] -= amount collection_balances[to, name] += amount # Adds amount to receiver @export def approve(amount: int, name: str, to: str): assert amount > 0, "Cannot approve negative amounts" collection_balances_approvals[ctx.caller, to, name] += amount @export def transfer_from(name:str, amount:int, to: str, main_account: str): assert amount > 0, "Cannot send negative balances!" assert collection_balances_approvals[main_account, to, name] >= amount, "Not enough NFTs approved to send! You have {} and are trying to spend {}".format(collection_balances_approvals[main_account, to, name], amount) assert collection_balances[main_account, name] >= amount, "Not enough NFTs to send!" collection_balances_approvals[main_account, to, name] -= amount collection_balances[main_account, name] -= amount collection_balances[to, name] += amount @export def setup_redeem(name: str, redeem_type: str, redeem_contract: str, redeem_amount: float): assert collection_owner.get() == ctx.caller, "You are not the collection creator" assert collection_nfts[name] != 0, f"NFT {name} doesnt exist" assert redeem_type.lower() in ["lp", "token"], "Only redeem types lp and token supported" nft_data = collection_nfts[name] assert "redeem_type" not in nft_data, "NFT is already redeemable!" nft_data["redeem_type"] = redeem_type.lower() nft_data["redeem_contract"] = redeem_contract nft_data["redeem_amount"] = redeem_amount collection_nfts[name] = nft_data # Transfer token if redeem_type.lower() == "token": I.import_module(redeem_contract).transfer_from( amount=redeem_amount, to=ctx.this, main_account=ctx.caller) # Transfer LP elif redeem_type.lower() == "lp": I.import_module("con_rocketswap_official_v1_1").transfer_liquidity_from( contract=redeem_contract, amount=redeem_amount, to=ctx.this, main_account=ctx.caller) @export def redeem(name: str): assert collection_nfts[name] != 0, f"NFT {name} doesnt exist" nft_data = collection_nfts[name] assert "redeem_type" in nft_data, "NFT is not redeemable!" # Get redeem amount for one NFT redeem_amount = nft_data["redeem_amount"] nft_amount = nft_data["amount"] amount = redeem_amount / nft_amount # Transfer redeemable amount if nft_data["redeem_type"].lower() == "token": I.import_module(nft_data["redeem_contract"]).transfer(amount=amount, to=ctx.caller) elif nft_data["redeem_type"].lower() == "lp": I.import_module("con_rocketswap_official_v1_1").transfer_liquidity(contract=nft_data["redeem_contract"], amount=amount, to=ctx.caller) # Burn NFT approve(name=name, amount=1, to=ctx.this) transfer_from(name=name, amount=1, to=ctx.this, main_account=ctx.caller)
name con_bad_bunny_nft

State Changes

Contract currency
Variable balances
Key d4a1561ae09b8c0a978a1334b33744262c0edeea1940998bf7035808362d5d11
New Value 497.982248520710059125