Skip to content

Commit

Permalink
made it a flat fee.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanIliev545 committed Dec 10, 2024
1 parent 4795668 commit 260ac24
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion contracts/deployment_scripts/testnet/layer2/003_set_fee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Owner = ${owner}`);
console.log(`Signer = ${l2Accounts.deployer}`);

const tx = await fees.setMessageFee(10000);
const tx = await fees.setMessageFee(32*10000);
const receipt =await tx.wait();

if (receipt.status != 1) {
Expand Down
64 changes: 32 additions & 32 deletions contracts/generated/Fees/Fees.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/generated/MessageBus/MessageBus.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/generated/SystemDeployer/SystemDeployer.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/src/messaging/MessageBus.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ contract MessageBus is IMessageBus, Initializable, OwnableUpgradeable {
}

function getPublishFee() public view returns (uint256) {
return fees.messageFee(32); //just a hash
return fees.messageFee();
}

// This method is called from contracts to publish messages to the other linked message bus.
Expand Down
18 changes: 9 additions & 9 deletions contracts/src/system/Fees.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ 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);
function messageFee() external view returns (uint256);
}

// Contract that will contain fees for contracts that need to apply them
contract Fees is Initializable, OwnableUpgradeable {
contract Fees is Initializable, OwnableUpgradeable, IFees {

uint256 private _messageFeePerByte;
uint256 private _messageFee;

// Constructor disables initializer;
// Only owner functions will not be callable on implementation
Expand All @@ -20,20 +20,20 @@ contract Fees is Initializable, OwnableUpgradeable {
}

// initialization function to be used by the proxy.
function initialize(uint256 initialMessageFeePerByte, address eoaOwner) public initializer {
function initialize(uint256 flatFee, address eoaOwner) public initializer {
__Ownable_init(eoaOwner);
_messageFeePerByte = initialMessageFeePerByte;
_messageFee = flatFee;
}

// Helper function to calculate the fee for a message
function messageFee(uint256 messageSize) external view returns (uint256) {
return _messageFeePerByte * messageSize;
function messageFee() external view returns (uint256) {
return _messageFee;
}

// 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;
function setMessageFee(uint256 newFeeForMessage) external onlyOwner{
_messageFee = newFeeForMessage;
}

// The EOA owner can collect the fees
Expand Down

0 comments on commit 260ac24

Please sign in to comment.