Compare commits
2 Commits
4b4922e40b
...
a4fcf451f5
Author | SHA1 | Date |
---|---|---|
Moon Man | a4fcf451f5 | |
Moon Man | c2b3b04df7 |
|
@ -8,8 +8,11 @@ module.exports = async (callback) => {
|
|||
|
||||
console.log(`Name: "${name}", symbol: "${symbol}"`);
|
||||
|
||||
const royaltyInfo = await wrapper.royaltyInfo(1, "10000000000");
|
||||
console.log(JSON.stringify(royaltyInfo, null, 4));
|
||||
const { 0:receiver, 1:hexAmount} = await wrapper.royaltyInfo(1, "1000000000000000000");
|
||||
console.log(`Default royalty recipient: ${receiver}`);
|
||||
|
||||
const ubiqAmount = web3.utils.fromWei(hexAmount, "ether");
|
||||
console.log(`Royalty on a 1 Ubiq fee: ${ubiqAmount}`);
|
||||
|
||||
callback();
|
||||
}
|
||||
|
|
|
@ -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