updated scripts for everything almost
This commit is contained in:
parent
0677ee477d
commit
4b4922e40b
|
@ -0,0 +1,21 @@
|
|||
const Wrapper = artifacts.require("CurioERC1155Wrapper");
|
||||
const IMastersFedi = artifacts.require("IMastersFedi");
|
||||
|
||||
module.exports = async (callback) => {
|
||||
const nftId1 = parseInt(process.argv[6]);
|
||||
|
||||
const wrapper = await Wrapper.deployed();
|
||||
const tokenContractAddress1 = await wrapper.contracts(nftId1);
|
||||
const tokenContract1 = await IMastersFedi.at(tokenContractAddress1);
|
||||
const tokenName1 = await tokenContract1.name();
|
||||
console.log(`Token name: "${tokenName1}"`);
|
||||
|
||||
const [account,] = await web3.eth.getAccounts();
|
||||
|
||||
const wrappedBalance1 = await wrapper.balanceOf(account, nftId1);
|
||||
const tokenBalance1 = await tokenContract1.balanceOf(account);
|
||||
console.log(`Wrapped: ${wrappedBalance1}`);
|
||||
console.log(`Unwrapped: ${tokenBalance1}`);
|
||||
|
||||
callback();
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
const Wrapper = artifacts.require("CurioERC1155Wrapper");
|
||||
const IMastersFedi = artifacts.require("IMastersFedi");
|
||||
|
||||
module.exports = async (callback) => {
|
||||
const nftId1 = parseInt(process.argv[6]);
|
||||
const quantity1 = parseInt(process.argv[7]);
|
||||
const nftId2 = parseInt(process.argv[8]);
|
||||
const quantity2 = parseInt(process.argv[9]);
|
||||
|
||||
const wrapper = await Wrapper.deployed();
|
||||
const tokenContractAddress1 = await wrapper.contracts(nftId1);
|
||||
const tokenContractAddress2 = await wrapper.contracts(nftId2);
|
||||
const tokenContract1 = await IMastersFedi.at(tokenContractAddress1);
|
||||
const tokenContract2 = await IMastersFedi.at(tokenContractAddress2);
|
||||
const tokenName1 = await tokenContract1.name();
|
||||
const tokenName2 = await tokenContract2.name();
|
||||
console.log(`Token names: "${tokenName1}", "${tokenName2}"`);
|
||||
|
||||
const [account,] = await web3.eth.getAccounts();
|
||||
|
||||
try {
|
||||
console.log("Batch unwrapping...");
|
||||
const finalResult = await wrapper.unwrapBatch(
|
||||
[nftId1, nftId2],
|
||||
[quantity1, quantity2],
|
||||
{ from: account }
|
||||
);
|
||||
|
||||
console.log(`Tx: ${finalResult.tx}`);
|
||||
|
||||
const wrappedBalance1 = await wrapper.balanceOf(account, nftId1);
|
||||
const wrappedBalance2 = await wrapper.balanceOf(account, nftId2);
|
||||
|
||||
console.log(`New wrapped balances: ${wrappedBalance1}, ${wrappedBalance2}`);
|
||||
|
||||
const tokenBalance1 = await tokenContract1.balanceOf(account);
|
||||
const tokenBalance2 = await tokenContract2.balanceOf(account);
|
||||
console.log(`New unwrapped balances: ${tokenBalance1}, ${tokenBalance2}`);
|
||||
}
|
||||
catch (e) {
|
||||
console.error(`FAILED: ${e}`);
|
||||
}
|
||||
|
||||
console.log("Done.");
|
||||
callback();
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
const Wrapper = artifacts.require("CurioERC1155Wrapper");
|
||||
const IMastersFedi = artifacts.require("IMastersFedi");
|
||||
|
||||
module.exports = async (callback) => {
|
||||
const nftId1 = parseInt(process.argv[6]);
|
||||
const quantity1 = parseInt(process.argv[7]);
|
||||
const nftId2 = parseInt(process.argv[8]);
|
||||
const quantity2 = parseInt(process.argv[9]);
|
||||
|
||||
const wrapper = await Wrapper.deployed();
|
||||
const tokenContractAddress1 = await wrapper.contracts(nftId1);
|
||||
const tokenContractAddress2 = await wrapper.contracts(nftId2);
|
||||
const tokenContract1 = await IMastersFedi.at(tokenContractAddress1);
|
||||
const tokenContract2 = await IMastersFedi.at(tokenContractAddress2);
|
||||
const tokenName1 = await tokenContract1.name();
|
||||
const tokenName2 = await tokenContract2.name();
|
||||
console.log(`Token names: "${tokenName1}", "${tokenName2}"`);
|
||||
|
||||
const [account,] = await web3.eth.getAccounts();
|
||||
const tokenBalance1 = await tokenContract1.balanceOf(account);
|
||||
const tokenBalance2 = await tokenContract2.balanceOf(account);
|
||||
console.log(`Unwrapped balances: ${tokenBalance1}, ${tokenBalance2}`);
|
||||
|
||||
|
||||
try {
|
||||
console.log(`Approving token 1...`);
|
||||
const result1 = await tokenContract1.approve(wrapper.address, quantity1, { from: account });
|
||||
console.log(`Approving token 2...`);
|
||||
const result2 = await tokenContract2.approve(wrapper.address, quantity2, { from: account });
|
||||
|
||||
console.log("Batch wrapping...");
|
||||
const finalResult = await wrapper.wrapBatch(
|
||||
[nftId1, nftId2],
|
||||
[quantity1, quantity2],
|
||||
{ from: account }
|
||||
);
|
||||
|
||||
console.log(`Tx: ${finalResult.tx}`);
|
||||
}
|
||||
catch (e) {
|
||||
console.error(`FAILED: ${e}`);
|
||||
}
|
||||
|
||||
console.log("Done.");
|
||||
callback();
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
const Wrapper = artifacts.require("CurioERC1155Wrapper");
|
||||
|
||||
module.exports = async (callback) => {
|
||||
const wrapper = await Wrapper.deployed();
|
||||
|
||||
const name = await wrapper.name();
|
||||
const symbol = await wrapper.symbol();
|
||||
|
||||
console.log(`Name: "${name}", symbol: "${symbol}"`);
|
||||
|
||||
const royaltyInfo = await wrapper.royaltyInfo(1, "10000000000");
|
||||
console.log(JSON.stringify(royaltyInfo, null, 4));
|
||||
|
||||
callback();
|
||||
}
|
Loading…
Reference in New Issue