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

Batch deposit helper script #11

Merged
merged 3 commits into from
Oct 26, 2021
Merged

Batch deposit helper script #11

merged 3 commits into from
Oct 26, 2021

Conversation

k1rill-fedoseev
Copy link
Contributor

No description provided.

@@ -0,0 +1,15 @@
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=0000000000000000000000000000000000000000000000000000000000000000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, it is not a deployment account but the account owning stake tokens, isn't it? Consider to change the parameter to "STAKING_ACCOUNT_PRIVATE_KEY"


RPC_URL=https://dai.poa.network

# number of deposits in one transaction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it clear - the number cannot exceed 128.

return
}

if (!deposits.every(d => d.amount === 32000000000)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to check that the staking account owns the corresponding amount of tokens?

if (count === batchSize || i === deposits.length - 1) {
const amount = web3.utils.toBN(32 * count).mul(web3.utils.toBN('1000000000000000000'))
const call = token.methods.transferAndCall(DEPOSIT_CONTRACT_ADDRESS, amount, data)
const gas = await call.estimateGas({ from: address })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to check in advance that the staking account has enough funds to make deposit transactions?

@akolotov akolotov merged commit 60f8e7b into master Oct 26, 2021
@akolotov akolotov deleted the batch-deposit-script branch October 26, 2021 17:47
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

Successfully merging this pull request may close these issues.

2 participants