script to set default royalty info
This commit is contained in:
parent
c2b3b04df7
commit
a4fcf451f5
|
@ -0,0 +1,32 @@
|
|||
const Wrapper = artifacts.require("CurioERC1155Wrapper");
|
||||
|
||||
const MAX = 7.5;
|
||||
|
||||
module.exports = async (callback) => {
|
||||
const receiver = process.argv[6];
|
||||
if (/0x[0-9a-fA-F]{40}/.test(receiver)) {
|
||||
const percentage = parseFloat(process.argv[7]);
|
||||
if (percentage > 0 && percentage <= MAX) {
|
||||
const numerator = Math.ceil(percentage * 100);
|
||||
console.log(`Numerator to be used: ${numerator}`);
|
||||
|
||||
const wrapper = await Wrapper.deployed();
|
||||
|
||||
console.log("Exeuting transaction...");
|
||||
try {
|
||||
await wrapper.setDefaultRoyalty(receiver, numerator);
|
||||
}
|
||||
catch (e) {
|
||||
console.error(`FAILED: ${e}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.error(`Royalty must be greater than zero and less than %${percentage}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.error("Invalid receiver address");
|
||||
}
|
||||
|
||||
callback();
|
||||
}
|
Loading…
Reference in New Issue