const Wrapper = artifacts.require("CurioERC1155Wrapper"); const IMastersFedi = artifacts.require("IMastersFedi"); const quantity = parseInt(process.argv[6]); module.exports = async (callback) => { if (quantity > 0) { const wrapper = await Wrapper.deployed(); let approveSuccess = false; console.log("Approving all contracts for transfer"); try { for (let id = 2; id <= 9; ++id) { const tokenContractAddress = await wrapper.contracts(id); const tokenContract = await IMastersFedi.at(tokenContractAddress); console.log(`Approving ID ${id}...`); await tokenContract.approve(wrapper.address, quantity); } approveSuccess = true; } catch (e) { console.error(`FAILED: ${e}`); } } else { console.error("Invalid quantity"); } callback(); }