RepoTokenLinkedList.sol#RepoTokenLinkedList
Inherits: Initializable, UUPSUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable, PausableUpgradeable, RepoTokenLinkedListStorageV1
A marketplace for trading repo tokens
Implements upgradeable patterns and various security features
State Variables
TERM_CONTROLLER
REPO_TOKEN_LINKED_LIST_EVENT_EMITTER
ADMIN_ROLE
DEVOPS_ROLE
RATE_PRECISION
MAX_MARKUP
REDEMPTION_VALUE_PRECISION
THREESIXTY_DAYCOUNT_SECONDS
USDC
WETH
Functions
constructor
Contract constructor
Parameters
termController
address
Address of the term controller contract
repoTokenLinkedListEventEmitter
address
Address of the event emitter contract
initialize
Initializes the contract with admin and devops roles
Sets up roles and initializes the contract using OpenZeppelin's upgradeable pattern
See: https://docs.openzeppelin.com/contracts/4.x/upgradeable
Parameters
discountRateAdapter_
address
The address of the discount rate oracle
adminWallet_
address
The address to be granted the admin role
devopsWallet_
address
The address to be granted the devops role
onlyValidatedRepoToken
Modifier to check if a repo token is valid
setRepoTokenBlacklist
Sets the blacklist status for a repo token
Parameters
repoToken
address
The address of the repo token
blacklisted
bool
The blacklist status to set
setDiscountRateAdapter
Sets a new discount rate adapter
Parameters
newAdapter
address
The address of the new discount rate adapter
setDiscountRateMarkup
Sets a new value for the discount rate markup
Only callable by accounts with the ADMIN_ROLE
Parameters
newMarkup
uint256
The new markup value to set
manageMinimumListing
pause
Pauses the contract
unpause
Unpauses the contract
createListing
Creates a new listing for a repo token
Parameters
repoToken
address
The address of the repo token to list
amount
uint256
The amount of tokens to list
purchase
Allows a user to purchase repo tokens
Parameters
desiredAmount
uint256
The amount of tokens to purchase
repoToken
address
The address of the repo token to purchase
swapExactPurchaseForRepo
Allows a user to purchase repo tokens
Parameters
purchaseTokenAmount
uint256
The amount of purchase tokens to spend in purchase
repoToken
address
The address of the repo token to purchase
_purchase
Internal function to handle the purchase logic
Parameters
repoToken
address
The address of the repo token to purchase
purchaseToken
address
The address of the token used for purchase
desiredAmount
uint256
The amount of tokens to purchase
pricePerToken
uint256
The price per token
_emitAndTransfer
cancelListing
Allows a seller to cancel their listing
Parameters
listingId
uint256
The ID of the listing to cancel
skipRedeem
bool
Whether to skip the redeem process
batchCancelListings
Repotokens can be redeemed by anyone on behalf of any third-party
removeListing
Internal function to remove a listing
Parameters
repoToken
address
The address of the repo token
listingId
uint256
The ID of the listing to remove
getListing
Retrieves the details of a listing
Parameters
listingId
uint256
The ID of the listing to retrieve
Returns
seller
address
The address of the seller
token
address
The address of the token being sold
amount
uint256
The amount of tokens being sold
getTotalListings
Gets the total number of active listings
Parameters
repoToken
address
The address of the repo token
Returns
<none>
uint256
The total number of listings
isRepoTokenValid
Checks if a repo token is valid
Parameters
repoToken
address
The address of the repo token to check
Returns
<none>
bool
bool indicating if the repo token is valid
_authorizeUpgrade
Ensures only authorized addresses can upgrade the contract
Overrides the UUPSUpgradeable _authorizeUpgrade function to include role checks.
required override by the OpenZeppelin UUPS module
Parameters
<none>
address
Last updated