-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
1f43cf7
to
2812065
Compare
2812065
to
57a6b53
Compare
scripts/.env.example
Outdated
@@ -0,0 +1,15 @@ | |||
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=0000000000000000000000000000000000000000000000000000000000000000 |
There was a problem hiding this comment.
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"
scripts/.env.example
Outdated
|
||
RPC_URL=https://dai.poa.network | ||
|
||
# number of deposits in one transaction |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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?
scripts/deposit.js
Outdated
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 }) |
There was a problem hiding this comment.
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?
No description provided.