-
Notifications
You must be signed in to change notification settings - Fork 4
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
Check prepaid balance #86
Conversation
# Conflicts: # contracts/EthStorageContract.sol # scripts/deploy.js
@@ -30,6 +30,7 @@ contract EthStorageContract is StorageContract, Decoder { | |||
address _treasury, | |||
address _owner | |||
) public payable initializer { | |||
require(msg.value >= prepaidAmount, "prepaid amount is not enough"); |
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.
prepaidAmount
is not set value yet, is it _prepaidAmount
that we should check?
Maybe a better place is inside __init_storage
in StorageContract
?
const ethStorageProxy = await EthStorageUpgradeableProxy.deploy(impl, ownerAddress, data, { gasPrice: gasPrice }); | ||
const ethStorageProxy = await EthStorageUpgradeableProxy.deploy(impl, ownerAddress, data, { | ||
gasPrice: gasPrice, | ||
value: prepaidAmount |
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.
I'm not sure if we allocate 3145 ETH when deploying the contract. Do we?
// const ethStorage = StorageContract.attach(ethStorageProxy.address); | ||
// const tx = await ethStorage.sendValue({ value: hre.ethers.utils.parseEther("0.5") }); | ||
// await tx.wait(); | ||
// console.log("balance of " + ethStorageProxy.address, await hre.ethers.provider.getBalance(ethStorageProxy.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.
Changes made to deploy.js may need to apply to deployL2.js.
@@ -52,16 +53,20 @@ async function deployContract() { | |||
|
|||
const data = implContract.interface.encodeFunctionData("initialize", [ | |||
4718592000, // minimumDiff 5 * 3 * 3600 * 1024 * 1024 / 12 = 4718592000 for 5 replicas that can have 1M IOs in one epoch | |||
3145728000000000000000n, // prepaidAmount - 50% * 2^39 / 131072 * 1500000Gwei, it also means 3145 ETH for half of the shard | |||
prepaidAmount, // prepaidAmount - 50% * 2^39 / 131072 * 1500000Gwei, it also means 3145 ETH for half of the shard |
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.
remove comments?
no need "// prepaidAmount - 50% ..."
I think we can close this PR and related issue since we are implementing this |
Close as the issue resolved by #110 |
Verify whether enough balance has been paid when initializing the contract. #40