RepoTokenLinkedListEventEmitter.sol

Git Sourcearrow-up-right

Inherits: Initializable, UUPSUpgradeable, AccessControlUpgradeable, IRepoTokenLinkedListEventsarrow-up-right

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

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

Parameters

Name
Type
Description

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.

Parameters

Name
Type
Description

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.

Parameters

Name
Type
Description

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.

Parameters

Name
Type
Description

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.

Parameters

Name
Type
Description

listingId

uint256

The ID of the cancelled listing.

seller

address

The address of the seller.

amount

uint256

The amount of tokens cancelled.

emitDiscountRateAdapterUpdated

emitPaused

emitUnpaused

emitRepoTokenBlacklistUpdated

emitMinListingAmountUpdated

_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

Last updated