RepoTokenLinkedListEventEmitter.sol
Inherits: Initializable, UUPSUpgradeable, AccessControlUpgradeable, IRepoTokenLinkedListEvents
Handles the emission of events for the term token marketplace contract system.
This contract extends OpenZeppelin's upgradeable contract suite for access control and upgradeability, implementing the ITokenMarketplaceEvents interface.
State Variables
ADMIN_ROLE
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");DEVOPS_ROLE
bytes32 public constant DEVOPS_ROLE = keccak256("DEVOPS_ROLE");LISTING_CONTRACT
bytes32 public constant LISTING_CONTRACT = keccak256("LISTING_CONTRACT");Functions
constructor
Note: oz-upgrades-unsafe-allow: constructor
constructor();initialize
Initializes the contract with admin and devops wallets
Initializes upgradeability features and sets up initial roles.
See: https://docs.openzeppelin.com/contracts/4.x/upgradeable
function initialize(address adminWallet_, address devopsWallet_) external initializer;Parameters
adminWallet_
address
Address of the admin wallet
devopsWallet_
address
Address of the devops wallet
pairListingContract
Assigns the LISTING_CONTRACT role to a listing contract address
Only ADMIN_ROLE can call this function to pair a listing contract for event emission.
function pairListingContract(address listingContract) external onlyRole(ADMIN_ROLE);Parameters
listingContract
address
Address of the listing contract to pair
emitNewListing
Emits an event for a new listing.
Restricted to only addresses with the LISTING_CONTRACT role.
function emitNewListing(uint256 listingId, address seller, address repoToken, uint256 amount)
external
onlyRole(LISTING_CONTRACT);Parameters
listingId
uint256
The ID of the listing.
seller
address
The address of the seller.
repoToken
address
The address of the repo token.
amount
uint256
The amount of the repo token.
emitPurchase
Emits a purchase event with the given parameters.
Restricted to only addresses with the LISTING_CONTRACT role.
function emitPurchase(
uint256 listingId,
address buyer,
address seller,
address repoToken,
uint256 amount,
address purchaseToken,
uint256 cost
) external onlyRole(LISTING_CONTRACT);Parameters
listingId
uint256
The ID of the listing.
buyer
address
The address of the buyer.
seller
address
The address of the seller.
repoToken
address
The address of the repo token.
amount
uint256
The amount of tokens purchased.
purchaseToken
address
The address of the purchase token.
cost
uint256
The cost of amount in purchase token.
emitListingCancelled
Emits an event when a listing is cancelled.
Restricted to only addresses with the LISTING_CONTRACT role.
function emitListingCancelled(uint256 listingId, address seller, uint256 amount) external onlyRole(LISTING_CONTRACT);Parameters
listingId
uint256
The ID of the cancelled listing.
seller
address
The address of the seller.
amount
uint256
The amount of tokens cancelled.
emitDiscountRateAdapterUpdated
function emitDiscountRateAdapterUpdated(address oldAdapter, address newAdapter) external onlyRole(LISTING_CONTRACT);emitPaused
function emitPaused() external onlyRole(LISTING_CONTRACT);emitUnpaused
function emitUnpaused() external onlyRole(LISTING_CONTRACT);emitRepoTokenBlacklistUpdated
function emitRepoTokenBlacklistUpdated(address repoToken, bool blacklisted) external onlyRole(LISTING_CONTRACT);emitMinListingAmountUpdated
function emitMinListingAmountUpdated(uint256 oldAmount, uint256 newAmount) external onlyRole(LISTING_CONTRACT);_authorizeUpgrade
Ensures that only authorized addresses can upgrade the contract
Overrides the UUPSUpgradeable _authorizeUpgrade function to include a role check.
required override by the OpenZeppelin UUPS module
function _authorizeUpgrade(address) internal view override onlyRole(DEVOPS_ROLE);Last updated