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

Check prepaid balance #86

Closed
wants to merge 3 commits into from
Closed

Check prepaid balance #86

wants to merge 3 commits into from

Conversation

iteyelmp
Copy link
Contributor

@iteyelmp iteyelmp commented May 16, 2024

Verify whether enough balance has been paid when initializing the contract. #40

@iteyelmp iteyelmp requested review from qizhou and qzhodl May 16, 2024 02:23
# Conflicts:
#	contracts/EthStorageContract.sol
#	scripts/deploy.js
@iteyelmp iteyelmp requested a review from syntrust July 10, 2024 09:31
@@ -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");
Copy link
Contributor

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
Copy link
Contributor

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));

Copy link
Contributor

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
Copy link
Contributor

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% ..."

@qzhodl
Copy link
Contributor

qzhodl commented Sep 26, 2024

I think we can close this PR and related issue since we are implementing this

@syntrust
Copy link
Contributor

Close as the issue resolved by #110

@syntrust syntrust closed this Sep 27, 2024
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.

4 participants