-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional fees to Auction contract
- Loading branch information
Showing
6 changed files
with
86 additions
and
7 deletions.
There are no files selected for viewing
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,37 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.10; | ||
|
||
import { IBuilderFeeManager } from "./interfaces/IBuilderFeeManager.sol"; | ||
import { Ownable } from "../lib/utils/Ownable.sol"; | ||
|
||
contract BuilderFeeManager is Ownable, IBuilderFeeManager { | ||
mapping(address => uint256) private feeOverride; | ||
uint256 private defaultFeeBPS; | ||
|
||
event FeeOverrideSet(address indexed, uint256 indexed); | ||
event DefaultFeeSet(uint256 indexed); | ||
|
||
constructor(uint256 _defaultFeeBPS, address feeManagerAdmin) { | ||
defaultFeeBPS = _defaultFeeBPS; | ||
_transferOwnership(feeManagerAdmin); | ||
} | ||
|
||
function setDefaultFee(uint256 amountBPS) external onlyOwner { | ||
require(amountBPS < 2001, "Fee too high (not greater than 20%)"); | ||
defaultFeeBPS = amountBPS; | ||
emit DefaultFeeSet(amountBPS); | ||
} | ||
|
||
function setFeeOverride(address tokenContract, uint256 amountBPS) external onlyOwner { | ||
require(amountBPS < 2001, "Fee too high (not greater than 20%)"); | ||
feeOverride[tokenContract] = amountBPS; | ||
emit FeeOverrideSet(tokenContract, amountBPS); | ||
} | ||
|
||
function getBuilderFeesBPS(address mediaContract) external view returns (address payable, uint256) { | ||
if (feeOverride[mediaContract] > 0) { | ||
return (payable(owner()), feeOverride[mediaContract]); | ||
} | ||
return (payable(owner()), defaultFeeBPS); | ||
} | ||
} |
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,6 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.10; | ||
|
||
interface IBuilderFeeManager { | ||
function getBuilderFeesBPS(address sender) external returns (address payable, uint256); | ||
} |
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