-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Fees.sol and wiring it up. (#2148)
* Adding Fees.sol and wiring it up. * Remove initial fee. * fix tenscan. * Some book keeping. * Addressed PR comments. * Generated ABI bindings. --------- Co-authored-by: StefanIliev545 <[email protected]>
- Loading branch information
1 parent
f3ebdce
commit 183bba1
Showing
20 changed files
with
869 additions
and
68 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
34 changes: 17 additions & 17 deletions
34
contracts/generated/MerkleTreeMessageBus/MerkleTreeMessageBus.go
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; | ||
|
||
interface IFees { | ||
function messageFee(uint256 messageSize) external view returns (uint256); | ||
} | ||
|
||
// Contract that will contain fees for contracts that need to apply them | ||
contract Fees is Initializable, OwnableUpgradeable { | ||
|
||
uint256 private _messageFeePerByte; | ||
|
||
// Constructor disables initializer; | ||
// Only owner functions will not be callable on implementation | ||
constructor() { | ||
_disableInitializers(); | ||
} | ||
|
||
// initialization function to be used by the proxy. | ||
function initialize(uint256 initialMessageFeePerByte, address eoaOwner) public initializer { | ||
__Ownable_init(eoaOwner); | ||
_messageFeePerByte = initialMessageFeePerByte; | ||
} | ||
|
||
// Helper function to calculate the fee for a message | ||
function messageFee(uint256 messageSize) external view returns (uint256) { | ||
return _messageFeePerByte * messageSize; | ||
} | ||
|
||
// The EOA owner can set the message fee to ensure sequencer is not publishing | ||
// at a loss | ||
function setMessageFee(uint256 newMessageFeePerByte) external onlyOwner{ | ||
_messageFeePerByte = newMessageFeePerByte; | ||
} | ||
|
||
// The EOA owner can collect the fees | ||
function withdrawalCollectedFees() external onlyOwner { | ||
payable(owner()).transfer(address(this).balance); | ||
} | ||
|
||
// For now just the whole balance as we only collect fees | ||
// from the message bus | ||
function collectedFees() external view returns (uint256) { | ||
return address(this).balance; | ||
} | ||
|
||
// For now channel all here as we only collect fees | ||
// from the message bus | ||
receive() external payable { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters