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

L1 fees for optimism communities call #14166

Closed
alaibe opened this issue Mar 26, 2024 · 2 comments · Fixed by status-im/status-go#5071 or #14621
Closed

L1 fees for optimism communities call #14166

alaibe opened this issue Mar 26, 2024 · 2 comments · Fixed by status-im/status-go#5071 or #14621
Assignees
Labels
backend-team E:Desktop Comm Perms and Minting MVP Misc tasks about Community permissions that are not part of another Epic, due for the MVP feature
Milestone

Comments

@alaibe
Copy link
Contributor

alaibe commented Mar 26, 2024

Following up on:
status-im/status-go#4923

L1 fees needs to also be computed for all transaction done by communities.

Suggestion:
on top of function likes:

func (api *API) DeployCollectiblesEstimate(ctx context.Context, chainID uint64, fromAddress string) (uint64, error) {
    ethClient, err := api.s.manager.rpcClient.EthClient(chainID)
    if err != nil {
        log.Error(err.Error())
        return 0, err
    }

    collectiblesABI, err := abi.JSON(strings.NewReader(collectibles.CollectiblesABI))
    if err != nil {
        return 0, err
    }

    // use random parameters, they will not have impact on deployment results
    data, err := collectiblesABI.Pack("" /*constructor name is empty*/, "name", "SYMBOL", big.NewInt(20), true, false, "tokenUri",
        common.HexToAddress("0x77b48394c650520012795a1a25696d7eb542d110"), common.HexToAddress("0x77b48394c650520012795a1a25696d7eb542d110"))
    if err != nil {
        return 0, err
    }

    callMsg := ethereum.CallMsg{
        From:  common.HexToAddress(fromAddress),
        To:    nil,
        Value: big.NewInt(0),
        Data:  append(common.FromHex(collectibles.CollectiblesBin), data...),
    }
    estimate, err := ethClient.EstimateGas(ctx, callMsg)
    if err != nil {
        return 0, err
    }

    finalEstimation := estimate + uint64(float32(estimate)*0.1)
    log.Debug("Collectibles deployment gas estimation: ", finalEstimation)
    return finalEstimation, nil
}

Create functions likes:

func (api *API) DeployCollectiblesL1Fees(ctx context.Context, chainID uint64, fromAddress string) (uint64, error) { 

For the body of this function, check the above PR, it should be:
1 - build the tx
2 - call the oracle contract via the fees manager.
Which will compute L1 fees.

The L1 fees needs to be added to the fees

@jrainville jrainville added this to the 2.29.0 Beta milestone Mar 26, 2024
@jrainville jrainville added the E:Desktop Comm Perms and Minting MVP Misc tasks about Community permissions that are not part of another Epic, due for the MVP label Mar 26, 2024
@endulab
Copy link
Contributor

endulab commented Apr 17, 2024

I am a bot confused by the fees for Optimism. Eg. when I try to airdrop a token I have following estimations:

gasUnits: 148692
suggetsed Fees: SuggestedFees(
    gasPrice:0.001000263,
    baseFee:1.0,
    maxPriorityFeePerGas:0.001,
    maxFeePerGasL:2.63e-07,
    maxFeePerGasM:1.0,
    maxFeePerGasH:2.0,
    l1GasFee: 388000.0,  // in gwei
    eip1559Enabled:true
  )

After the operation I check etherscan and I see this:
image

I see some discrepancy with baseFee. Also I can't find l1 fee anwhere (or anything similar).

Any idea @saledjenic

https://sepolia-optimism.etherscan.io//tx/0x6117373258592fe933f84c9c441574e37071aa4ac4a6dbb0d215b85910b092ab

endulab added a commit that referenced this issue Apr 18, 2024
…tions

There is only one status-go call for all fees: suggested fees, gas and l1 fee.

Issue #14166
@saledjenic
Copy link
Contributor

@endulab yes, I've noticed the same, like L1 fee estimation is 100 times higher in magnitude than the real L1 fee for a tx placed on L2, not sure why it's like that, but that's the value we're getting from the network.

endulab added a commit that referenced this issue May 7, 2024
…tions

There is only one status-go call for all fees: suggested fees, gas and l1 fee.

Issue #14166
endulab added a commit that referenced this issue May 7, 2024
@endulab endulab linked a pull request May 7, 2024 that will close this issue
endulab added a commit that referenced this issue May 16, 2024
…tions

There is only one status-go call for all fees: suggested fees, gas and l1 fee.

Issue #14166
endulab added a commit that referenced this issue May 16, 2024
endulab added a commit that referenced this issue May 17, 2024
endulab added a commit that referenced this issue May 17, 2024
…tions

There is only one status-go call for all fees: suggested fees, gas and l1 fee.

Issue #14166
endulab added a commit that referenced this issue May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend-team E:Desktop Comm Perms and Minting MVP Misc tasks about Community permissions that are not part of another Epic, due for the MVP feature
Projects
Status: Done
4 participants