Skip to content

Commit

Permalink
create base code flow
Browse files Browse the repository at this point in the history
  • Loading branch information
fhildeb committed Feb 9, 2024
1 parent 2f10eae commit 80a2353
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions smart-contracts-hardhat/scripts/attachMetadataUP
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// import { ethers } from 'hardhat';
// import * as dotenv from "dotenv";
// import { ERC725YDataKeys } from "@lukso/lsp-smart-contracts";

// // Load the environment variables
// dotenv.config();

// async function attachAssetMetadata(myAssetAddress: string) {
// // Setup the provider
// const provider = new ethers.JsonRpcProvider(
// "https://rpc.testnet.lukso.gateway.fm",
// );

// // Setup the controller used to sign the deployment
// const [signer] = await ethers.getSigners();
// console.log(
// "Updating metadata with Universal Profile Controller: ",
// signer.address,
// );

// // Load the Universal Profile
// const universalProfile = await ethers.getContractAtFromArtifact(
// TODO:,
// process.env.UP_ADDR as string,
// );

// // Set up the token contract
// const token = new ethers.Contract(
// myAssetAddress,
// TODO:,
// signer,
// );

// const metadataKey = ERC725YDataKeys.LSP4["LSP4Metadata"];

// // Read the current token metadata
// const currentMetadata = await token.getData(metadataKey);
// console.log(
// "Current token metadata:",
// JSON.stringify(currentMetadata, undefined, 2),
// );

// // Create the transaction payload for the contract call
// const setDataPayload = token.interface.encodeFunctionData("setData", [
// metadataKey,
// ethers.utils.toUtf8Bytes(TODO:),
// ]);

// // Update the token metadata
// const tx = await universalProfile.connect(signer).getFunction("execute")(
// 0, // Operation type: CALL
// myAssetAddress,
// 0, // Value is empty
// setDataPayload,
// );

// // Wait for the transaction to be included in a block
// const receipt = await tx.wait();
// console.log("Token metadata updated:", receipt);
// }

// attachAssetMetadata(CustomTokenAddress)
// .then(() => process.exit(0))
// .catch((error) => {
// console.error(error);
// process.exit(1);
// });

0 comments on commit 80a2353

Please sign in to comment.