-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(contracts): 🎸update contract so its possible to control minters
- Loading branch information
1 parent
f45ea6b
commit 2e60d59
Showing
12 changed files
with
248 additions
and
11 deletions.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
contracts/artifacts/build-info/fdd9c5e1222ec4644fba7d05a6b0a6ea.json
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
contracts/artifacts/contracts/NFTContract.sol/NFTContract.dbg.json
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../build-info/fdd9c5e1222ec4644fba7d05a6b0a6ea.json" | ||
"buildInfo": "../../build-info/e0d27f44f97abb5534e508a66a390154.json" | ||
} |
94 changes: 92 additions & 2 deletions
94
contracts/artifacts/contracts/NFTContract.sol/NFTContract.json
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
contracts/artifacts/contracts/utils/ExpiryHelper.sol/ExpiryHelper.dbg.json
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../build-info/fdd9c5e1222ec4644fba7d05a6b0a6ea.json" | ||
"buildInfo": "../../../build-info/e0d27f44f97abb5534e508a66a390154.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
contracts/artifacts/contracts/utils/HederaResponseCodes.sol/HederaResponseCodes.dbg.json
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../build-info/fdd9c5e1222ec4644fba7d05a6b0a6ea.json" | ||
"buildInfo": "../../../build-info/e0d27f44f97abb5534e508a66a390154.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
contracts/artifacts/contracts/utils/HederaTokenService.sol/HederaTokenService.dbg.json
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../build-info/fdd9c5e1222ec4644fba7d05a6b0a6ea.json" | ||
"buildInfo": "../../../build-info/e0d27f44f97abb5534e508a66a390154.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
contracts/artifacts/contracts/utils/IHederaTokenService.sol/IHederaTokenService.dbg.json
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../build-info/fdd9c5e1222ec4644fba7d05a6b0a6ea.json" | ||
"buildInfo": "../../../build-info/e0d27f44f97abb5534e508a66a390154.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
contracts/artifacts/contracts/utils/KeyHelper.sol/Bits.dbg.json
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../build-info/fdd9c5e1222ec4644fba7d05a6b0a6ea.json" | ||
"buildInfo": "../../../build-info/e0d27f44f97abb5534e508a66a390154.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
contracts/artifacts/contracts/utils/KeyHelper.sol/KeyHelper.dbg.json
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../build-info/fdd9c5e1222ec4644fba7d05a6b0a6ea.json" | ||
"buildInfo": "../../../build-info/e0d27f44f97abb5534e508a66a390154.json" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { | ||
AccountId, | ||
ContractExecuteTransaction, | ||
ContractFunctionParameters, | ||
ContractId, | ||
Hbar, | ||
} from "@hashgraph/sdk"; | ||
import { clientSetup } from "../client"; | ||
|
||
// Get command line arguments | ||
const [contractId, minterId] = process.argv.slice(2); | ||
|
||
if (!contractId || !minterId) { | ||
console.error("Missing required arguments"); | ||
console.error("Usage: npx ts-node addMinter.ts <contractId> <minterId>"); | ||
console.error("Example: npx ts-node addMinter.ts 0.0.123456 0.0.789101"); | ||
process.exit(1); | ||
} | ||
|
||
const addMinter = async () => { | ||
try { | ||
// Create client and set operator | ||
const client = clientSetup(); | ||
|
||
console.log("\n----- Adding New Minter -----"); | ||
console.log(`Contract ID: ${contractId}`); | ||
console.log(`Minter ID: ${minterId}`); | ||
|
||
// Convert IDs to correct format | ||
const contractIdObj = ContractId.fromString(contractId); | ||
const minterIdObj = AccountId.fromString(minterId); | ||
const minterAddress = minterIdObj.toSolidityAddress(); | ||
|
||
// Create and execute the transaction | ||
const addMinterTx = new ContractExecuteTransaction() | ||
.setContractId(contractIdObj) | ||
.setGas(1000000) | ||
.setMaxTransactionFee(new Hbar(20)) | ||
.setFunction( | ||
"addMinter", | ||
new ContractFunctionParameters().addAddress(minterAddress), | ||
); | ||
|
||
const txResponse = await addMinterTx.execute(client); | ||
const receipt = await txResponse.getReceipt(client); | ||
|
||
console.log("\nMinter added successfully!"); | ||
console.log("Transaction ID:", txResponse.transactionId.toString()); | ||
|
||
client.close(); | ||
} catch (error) { | ||
console.error("Error adding minter:", error); | ||
throw error; | ||
} | ||
}; | ||
|
||
addMinter(); |
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,56 @@ | ||
import { | ||
AccountId, | ||
ContractExecuteTransaction, | ||
ContractFunctionParameters, | ||
ContractId, | ||
Hbar, | ||
} from "@hashgraph/sdk"; | ||
import { clientSetup } from "../client"; | ||
|
||
// Get command line arguments | ||
const [contractId, minterId] = process.argv.slice(2); | ||
|
||
if (!contractId || !minterId) { | ||
console.error("Missing required arguments"); | ||
console.error("Usage: npx ts-node removeMinter.ts <contractId> <minterId>"); | ||
console.error("Example: npx ts-node removeMinter.ts 0.0.123456 0.0.789101"); | ||
process.exit(1); | ||
} | ||
|
||
const removeMinter = async () => { | ||
try { | ||
const client = clientSetup(); | ||
|
||
console.log("\n----- Removing Minter -----"); | ||
console.log(`Contract ID: ${contractId}`); | ||
console.log(`Minter ID: ${minterId}`); | ||
|
||
// Convert IDs to correct format | ||
const contractIdObj = ContractId.fromString(contractId); | ||
const minterIdObj = AccountId.fromString(minterId); | ||
const minterAddress = minterIdObj.toSolidityAddress(); | ||
|
||
// Create and execute the transaction | ||
const removeMinterTx = new ContractExecuteTransaction() | ||
.setContractId(contractIdObj) | ||
.setGas(1000000) | ||
.setMaxTransactionFee(new Hbar(20)) | ||
.setFunction( | ||
"removeMinter", | ||
new ContractFunctionParameters().addAddress(minterAddress), | ||
); | ||
|
||
const txResponse = await removeMinterTx.execute(client); | ||
const receipt = await txResponse.getReceipt(client); | ||
|
||
console.log("\nMinter removed successfully!"); | ||
console.log("Transaction ID:", txResponse.transactionId.toString()); | ||
|
||
client.close(); | ||
} catch (error) { | ||
console.error("Error removing minter:", error); | ||
throw error; | ||
} | ||
}; | ||
|
||
removeMinter(); |