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

Can you write withdrawal scripts? #3

Open
mmsaki opened this issue Mar 11, 2023 · 1 comment
Open

Can you write withdrawal scripts? #3

mmsaki opened this issue Mar 11, 2023 · 1 comment

Comments

@mmsaki
Copy link

mmsaki commented Mar 11, 2023

I noticed that you are withdrawing from the verified contract. Are you able to add scripts to show how to withdraw from the contract? I am struggling writing scripts to withdraw and woulf appreciate if you can provide any help.

@mmsaki
Copy link
Author

mmsaki commented Mar 11, 2023

I would like to contribute if you don't mind.
Here's what I have written so far after adding a scripts/withdraw.js

npx hardhat run scripts/withdraw.js --network zkEVM

require('hardhat');
const { ethers } = require('hardhat');

LOCK_CONTRACT = '0xB443C3A8f2B1EfF232E1A47EA9D43C88f33B8D52';

async function main() {
  // contract
  deployedContact = await ethers.getContractAt('Lock', LOCK_CONTRACT);

  // owner
  const owner = await deployedContact.owner();

  // unlock time
  const unlockTime = await deployedContact.unlockTime().then((time) => {
    return time.toString();
  });

  // withdraw deposit
  // const withdrawTx = deployedContact.withdraw();

  console.log('owner is : ', owner);
  console.log('unlock time is : ', unlockTime);
  // console.log('withdraw transaction : ', withdrawTx);
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

getting stdout for my owner address and lockTime

owner is :  0xFE948CB2122FDD87bAf43dCe8aFa254B1242c199
unlock time is :  1678502015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant