memoscan
← all memos

Memo 0xd7001f64…4d784a on Ethereum

data:application/vnd.facet.tx+json;rule=esip6,{"op":"create","data":{"init_code_hash":"0xd7ecfb5c3eb58b7875a7c70799632006a0c00e4e002aea6b1e03809442f763f8","args":{},"source_code":"pragma(:rubidity, \"1.0.0\")\ncontract(:INFTCollection01, abstract: true) {\n function(:owner, :external, :view, returns: :address)\n}\ncontract(:Upgradeable, abstract: true) {\n address(:public, :upgradeAdmin)\n event(:ContractUpgraded, { oldHash: :bytes32, newHash: :bytes32 })\n event(:UpgradeAdminChanged, { newUpgradeAdmin: :address })\n constructor(upgradeAdmin: :address) {\n s.upgradeAdmin=upgradeAdmin\n }\n function(:setUpgradeAdmin, { newUpgradeAdmin: :address }, :public) {\n require(msg.sender == s.upgradeAdmin, \"NOT_AUTHORIZED\")\n s.upgradeAdmin=newUpgradeAdmin\n emit(:UpgradeAdminChanged, newUpgradeAdmin: newUpgradeAdmin)\n }\n function(:upgradeAndCall, { newHash: :bytes32, newSource: :string, migrationCalldata: :string }, :public) {\n upgrade(newHash: newHash, newSource: newSource)\n (success, data) = address(this).call(migrationCalldata)\n require(success, \"Migration failed\")\n }\n function(:upgrade, { newHash: :bytes32, newSource: :string }, :public) {\n currentHash = this.currentInitCodeHash\n require(msg.sender == s.upgradeAdmin, \"NOT_AUTHORIZED\")\n this.upgradeImplementation(newHash, newSource)\n emit(:ContractUpgraded, oldHash: currentHash, newHash: newHash)\n }\n}\ncontract(:EditionMetadataRenderer01, is: :Upgradeable, upgradeable: true) {\n struct(:TokenEditionInfo) {\n string(:name)\n string(:description)\n string(:imageURI)\n string(:animationURI)\n }\n event(:MediaURIsUpdated, { target: :address, sender: :address, imageURI: :string, animationURI: :string })\n event(:EditionInitialized, { target: :address, description: :string, imageURI: :string, animationURI: :string, name: :string })\n event(:DescriptionUpdated, { target: :address, sender: :address, newDescription: :string })\n mapping(({ address: :TokenEditionInfo }), :public, :tokenInfos)\n constructor {\n self.Upgradeable.constructor(upgradeAdmin: msg.sender)\n }\n function(:requireSenderAdmin, { target: :address }, :internal, :pure) {\n require(target == msg.sender || INFTCollection01(target).owner == msg.sender, \"Admin access only\")\n }\n function(:updateMediaURIs, { target: :address, imageURI: :string, animationURI: :string }, :external) {\n requireSenderAdmin(target)\n s.tokenInfos[target].imageURI=imageURI\n s.tokenInfos[target].animationURI=animationURI\n emit(:MediaURIsUpdated, target: target, sender: msg.sender, imageURI: imageURI, animationURI: animationURI)\n }\n function(:updateDescription, { target: :address, newDescription: :string }, :external) {\n requireSenderAdmin(target)\n s.tokenInfos[target].description=newDescription\n emit(:DescriptionUpdated, target: target, sender: msg.sender, newDescription: newDescription)\n }\n function(:initializeWithData, { info: :TokenEditionInfo }, :external) {\n s.tokenInfos[msg.sender] = info\n emit(:EditionInitialized, target: msg.sender, description: info.description, imageURI: info.imageURI, animationURI: info.animationURI, name: info.name)\n }\n function(:contractURI, :external, :view, returns: :string) {\n target = msg.sender\n editionInfo = s.tokenInfos[target]\n encodeContractURIJSON(editionInfo.name, editionInfo.description, editionInfo.imageURI, editionInfo.animationURI)\n }\n function(:tokenURI, { tokenId: :uint256 }, :external, :view, returns: :string) {\n target = msg.sender\n info = s.tokenInfos[target]\n createMetadataEdition(info.name, info.description, info.imageURI, info.animationURI, tokenId)\n }\n function(:createMetadataEdition, { name: :string, description: :string, imageURI: :string, animationURI: :string, tokenOfEdition: :uint256 }, :internal, :pure, returns: :string) {\n _tokenMediaData = tokenMediaData(imageURI, animationURI)\n json = createMetadataJSON(name, description, _tokenMediaData, tokenOfEdition)\n encodeMetadataJSON(json)\n }\n function(:encodeContractURIJSON, { name: :string, description: :string, imageURI: :string, animationURI: :string }, :internal, :pure, returns: :string) {\n imageSpace = if imageURI.length > 0\n \"\\\", \\\"image\\\": \\\"\" + imageURI\n else\n \"\"\n end\n animationSpace = if animationURI.length > 0\n \"\\\", \\\"animation_url\\\": \\\"\" + animationURI\n else\n \"\"\n end\n encodeMetadataJSON(\"{\\\"name\\\": \\\"\" + name + \"\\\", \\\"description\\\": \\\"\" + description + imageSpace + animationSpace + \"\\\"}\")\n }\n function(:createMetadataJSON, { name: :string, description: :string, mediaData: :string, tokenOfEdition: :uint256 }, :internal, :pure, returns: :string) {\n \"{\\\"name\\\": \\\"\" + name + \" \" + tokenOfEdition.toString + \"\\\", \\\"description\\\": \\\"\" + description + \"\\\", \\\"\" + mediaData + \"properties\\\": {\\\"number\\\": \" + tokenOfEdition.toString + \", \\\"name\\\": \\\"\" + name + \"\\\"}}\"\n }\n function(:encodeMetadataJSON, { json: :string }, :internal, :pure, returns: :string) {\n \"data:application/json;base64,\" + json.base64Encode\n }\n function(:tokenMediaData, { imageUrl: :string, animationUrl: :string }, :internal, :pure, returns: :string) {\n hasImage = imageUrl.length > 0\n hasAnimation = animationUrl.length > 0\n if hasImage && hasAnimation\n return \"image\\\": \\\"\" + imageUrl + \"\\\", \\\"animation_url\\\": \\\"\" + animationUrl + \"\\\", \\\"\"\n else\n if hasImage\n return \"image\\\": \\\"\" + imageUrl + \"\\\", \\\"\"\n else\n if hasAnimation\n return \"animation_url\\\": \\\"\" + animationUrl + \"\\\", \\\"\"\n end\n end\n end\n \"\"\n }\n}\n"}}