Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: whitelist #86

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions scripts/whitelistPayment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { ethers } from 'hardhat';
import { Payment } from '../typechain';

async function main() {
const paymentContractAddress = process.env.PAYMENT_CONTRACT!;
const addressToWhitelist = process.env.PAYMENT_CONTRACT_WHITELIST_ADDRESS!;
const paymentContract = await ethers.getContractAt('Payment', paymentContractAddress!);

console.log(`${addressToWhitelist} is whitelisted before: ${await paymentContract.whitelist(addressToWhitelist)}`);
const tx = await paymentContract.addToWhitelist(addressToWhitelist);
await tx.wait(1);
console.log(`${addressToWhitelist} is whitelisted after: ${await paymentContract.whitelist(addressToWhitelist)}`);

// Script for payment redeploy
// const accounts = await ethers.getSigners();
// console.log(await accounts[0].getBalance());
// let paymentContract: Payment;
// {
// paymentContract = await ethers.getContractAt('Payment', paymentContractAddress!);
// const paymentReceiverA = await paymentContract.paymentReceiverA();
// const paymentReceiverB = await paymentContract.paymentReceiverB();

// const priceCampaign = [];
// for (let index = 0; index < 3; index++) {
// priceCampaign[index] = await paymentContract.priceCampaign(index);
// }
// const priceCampaignExtension = await paymentContract.priceCampaignExtension();

// const discount = [];
// for (let index = 0; index < 3; index++) {
// discount[index] = await paymentContract.discounts(index);
// }

// console.log('payment receiverA', paymentReceiverA);
// console.log('payment receiverB', paymentReceiverB);
// console.log('Pricecampaign', priceCampaign);
// console.log('priceCampaign extension', priceCampaignExtension);
// console.log('discount', discount);

// const usdtToken = '0xeFAeeE334F0Fd1712f9a8cc375f427D9Cdd40d73';
// const wusdtToken = '0x122CDB7aCfDa67Fb2Ae308a9F8819c962622C324';

// // console.log(`${addressToWhitelist} is whitelisted before: ${await paymentContract.whitelist(addressToWhitelist)}`);
// // const tx = await paymentContract.addToWhitelist(addressToWhitelist);
// // await tx.wait(1);
// // console.log(`${addressToWhitelist} is whitelisted after: ${await paymentContract.whitelist(addressToWhitelist)}`);

// const PaymentContract = await ethers.getContractFactory('Payment');
// paymentContract = await PaymentContract.deploy(
// paymentReceiverA,
// paymentReceiverB,
// usdtToken,
// wusdtToken,
// priceCampaign as any,
// priceCampaignExtension,
// discount as any
// );
// console.log(`Deploying contract at ${paymentContract.address}`);
// await paymentContract.deployTransaction.wait(1);
// }

// {
// const paymentReceiverA = await paymentContract.paymentReceiverA();
// const paymentReceiverB = await paymentContract.paymentReceiverB();

// const priceCampaign = [];
// for (let index = 0; index < 3; index++) {
// priceCampaign[index] = await paymentContract.priceCampaign(index);
// }
// const priceCampaignExtension = await paymentContract.priceCampaignExtension();

// const discount = [];
// for (let index = 0; index < 3; index++) {
// discount[index] = await paymentContract.discounts(index);
// }

// console.log('payment receiverA', paymentReceiverA);
// console.log('payment receiverB', paymentReceiverB);
// console.log('Pricecampaign', priceCampaign);
// console.log('priceCampaign extension', priceCampaignExtension);
// console.log('discount', discount);
// }
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});