# Technical Implementation

## Protocol

All XFT token contracts implement the ERC-20 standard, enabling the storage and transfer of tokensbalances across individual accounts. It supports additional functionalities such as minting and burning, controlled by privileged accounts, and incorporates asset freezing mechanisms to prevent financial crimes.

Most XFT tokenized products implement the following ERC-20 token logic. See [Equities](#equity-protocol) for logic update.

```
FEATURES
- Access control
- Rebasing token mechanism
- Minting and burning functionality
- Block/Unblock accounts
- Pausing emergency stop mechanism
- Reward multiplier system
- EIP-2612 permit support
- OpenZeppelin UUPS upgrade pattern


PUBLIC AND EXTERNAL FUNCTIONS
initialize(string memory name_, string memory symbol_, address owner): Initializes the contract.
name(): Returns the name of the token.
symbol(): Returns the symbol of the token.
decimals(): Returns the number of decimals the token uses.
convertToShares(uint256 amount): Converts an amount of tokens to shares.
convertToTokens(uint256 shares): Converts an amount of shares to tokens.
totalShares(): Returns the total amount of shares.
totalSupply(): Returns the total supply.
balanceOf(address account): Returns the account balance.
sharesOf(address account): Returns the account shares.
mint(address to, uint256 amount): Creates new tokens to the specified address.
burn(address from, uint256 amount): Destroys tokens from the specified address.
transfer(address to, uint256 amount): Transfers tokens between addresses.
blockAccounts(address[] addresses): Blocks multiple accounts at once.
unblockAccounts(address[] addresses): Unblocks multiple accounts at once.
isBlocked(address account): Checks if an account is blocked.
pause(): Pauses the contract, halting token transfers.
unpause(): Unpauses the contract, allowing token transfers.
setRewardMultiplier(uint256 _rewardMultiplier): Sets the reward multiplier.
addRewardMultiplier(uint256 _rewardMultiplierIncrement): Adds the given amount to the current reward multiplier.
approve(address spender, uint256 amount): Approves an allowance for a spender.
allowance(address owner, address spender): Returns the allowance for a spender.
transferFrom(address from, address to, uint256 amount): Moves tokens from an address to another one using the allowance mechanism.
increaseAllowance(address spender, uint256 addedValue): Increases the allowance granted to spender by the caller.
decreaseAllowance(address spender, uint256 subtractedValue): Decreases the allowance granted to spender by the caller.
DOMAIN_SEPARATOR(): Returns the EIP-712 domain separator.
nonces(address owner): Returns the nonce for the specified address.
permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s): Implements EIP-2612 permit functionality.


PRIVATE AND INTERNAL FUNCTIONS
_authorizeUpgrade(address newImplementation): Internal function to authorize an upgrade.
_mint(address to, uint256 amount): Internal function to mint tokens to the specified address.
_burn(address account, uint256 amount): Internal function to burn tokens from the specified address.
_beforeTokenTransfer(address from, address to, uint256 amount): Hook that is called before any transfer of tokens.
_afterTokenTransfer(address from, address to, uint256 amount): Hook that is called after any transfer of tokens.
_transfer(address from, address to, uint256 amount): Internal function to transfer tokens between addresses.
_blockAccount(address account): Internal function to block account.
_unblockAccount(address account): Internal function to unblock an account.
_setRewardMultiplier(uint256 _rewardMultiplier): Internal function to set the reward multiplier.
_spendAllowance(address owner, address spender, uint256 amount): Internal function to spend an allowance.
_useNonce(address owner): Increments and returns the current nonce for a given address.
_approve(address owner, address spender, uint256 amount): Internal function to approve an allowance for a spender.


EVENTS
Transfer(from indexed addr, to uint256, amount uint256): Emitted when transferring tokens.
RewardMultiplier(uint256 indexed value): Emitted when the reward multiplier has changed.
Approval(address indexed owner, address indexed spender, uint256 value): Emitted when the allowance of a spender for an owner is set.
AccountBlocked(address indexed addr): Emitted when an address is blocked.
AccountUnblocked(address indexed addr): Emitted when an address is removed from the blocklist.
Paused(address account): Emitted when the pause is triggered by account.
Unpaused(address account): Emitted when the unpause is triggered by account.
Upgraded(address indexed implementation): Emitted when the implementation is upgraded.


ROLES 
DEFAULT_ADMIN_ROLE: Grants the ability to grant roles.
MINTER_ROLE: Grants the ability to mint tokens.
BURNER_ROLE: Grants the ability to burn tokens.
BLOCKLIST_ROLE: Grants the ability to manage the blocklist.
ORACLE_ROLE: Grants the ability to update the reward multiplier.
UPGRADE_ROLE: Grants the ability to upgrade the contract.
PAUSE_ROLE: Grants the ability to pause/unpause the contract.
```

```
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"sharesNeeded","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"ERC2612ExpiredDeadline","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"ERC2612InvalidSignature","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"USDXBlockedSender","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"sharesNeeded","type":"uint256"}],"name":"USDXInsufficientBurnBalance","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"USDXInvalidBlockedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"USDXInvalidBurnSender","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"USDXInvalidMintReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"rewardMultiplier","type":"uint256"}],"name":"USDXInvalidRewardMultiplier","type":"error"},{"inputs":[],"name":"USDXPausedTransfers","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"}],"name":"AccountBlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"}],"name":"AccountUnblocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"value","type":"uint256"}],"name":"RewardMultiplier","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"BLOCKLIST_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BURNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ORACLE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardMultiplierIncrement","type":"uint256"}],"name":"addRewardMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"name":"blockAccounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isBlocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardMultiplier","type":"uint256"}],"name":"setRewardMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"sharesOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"name":"unblockAccounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]
```

## Dependencies

The contracts build their foundation on top of OpenZeppelin Contracts library, widely used and recognized battle-tested components throughout the Ethereum ecosystem:

* AccessControlUpgradeable.sol
* PausableUpgradeable.sol
* UUPSUpgradeable.sol
* CountersUpgradeable.sol
* ECDSAUpgradeable.sol
* EIP712Upgradeable.sol
* IERC20PermitUpgradeable.sol
* IERC20MetadataUpgradeable.sol

## Income & Yield Distribution

XFT uses a process called "rebasing" or changing the total supply of tokens, a reward multiplier, and share-based accounting to distribute bond income to token holders. Under the hood, USDX holders own a fixed amount of shares in a mutual fund.

`balanceOf(account) = shares[account] * rewardMultiplier`

When underlying mutual fund assets accrue yield, XFT increases the reward multiplier. This proportionally mints additional USDX tokens to each holder's wallet based on the number of shares they own.

* `shares` - map of account share of the total supply.
* `rewardMultiplier` - sum of addRewardMultiplier.

#### Rebasing Example

If a user purchased 100 USDX tokens when the reward multiplier was 1.00, that user would receive 100 shares. If the reward multiplier was updated to reflect a 3.8% return, that user would then have 103.8 USDX tokens but still have the same 100 shares.

| Time | USDX (balanceOf) | Shares | rewardMultiplier |
| ---- | ---------------- | ------ | ---------------- |
| 1    | 100              | 100    | 1                |
| 2    | 103.8            | 100    | 1.038            |

## Role-Based Access Control

The USDX contract implements a simple Role-Based Access Control (RBAC) system. This ensures that only authorized accounts can perform certain actions, enhancing security and operational integrity.

* DEFAULT\_ADMIN\_ROLE: Grants the ability to grant roles.
* MINTER\_ROLE: Grants the ability to mint tokens.
* BURNER\_ROLE: Grants the ability to burn tokens.
* BLOCKLIST\_ROLE: Grants the ability to manage the blocklist.
* ORACLE\_ROLE: Grants the ability to update the reward multiplier.
* UPGRADE\_ROLE: Grants the ability to upgrade the contract.
* PAUSE\_ROLE: Grants the ability to pause/unpause the contract.

#### Example role assignments

| Role                 | Function                 | Participants                                                                                                            |
| -------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
| DEFAULT\_ADMIN\_ROLE | Grant roles              | XFT                                                                                                                     |
| MINTER\_ROLE         | Mint tokens              | <p>• Principal Underwriter<br>• Distributor<br>• Customer<br>• Robinhood<br>• Bridge<br>• Securitize</p>                |
| BURNER\_ROLE         | Burn tokens              | <p>• Principal Underwriter<br>• Distributor<br>• Customer<br>• Robinhood<br>• Bridge<br>• Securitize</p>                |
| BLOCKLIST\_ROLE      | Manage blocklist         | Fund Administrator, KYC/AML                                                                                             |
| ORACLE\_ROLE         | Update reward multiplier | Investment Advisor, portfolio management                                                                                |
| UPGRADE\_ROLE        | Upgrade contract         | XFT                                                                                                                     |
| PAUSE\_ROLE          | Pause/unpause            | <p>• NYSE, market close<br>• DTCC, market close<br>• Custodian, redemption pressure<br>• Circuit breaker mechanisms</p> |

## Bond Protocol

* **Symbol:** ISIN
* **Name:** \[issuer] \[coupon] \[maturity]

Example:

* Symbol = ISIN = US48251W5004
* Name = Ticker = KKR 6.25 03/01/28

### Real Estate Protocol

* **Symbol:** \[[UPI](https://upi.reso.org/builder/index.html)] OR \[BBL/BIN]
* **Name:** \[address]
  * LN, ST, AVE, BLVD, RD

Example:

* Symbol = UPI = 65-001-120  \
  Name = Property Address = 315 HEPBURN ST WILLIAMSPORT PA 17701&#x20;
* Symbol = BIN-BBL = 1015862-1008350041  \
  Name: EMPIRE STATE BUILDING

### Equity Protocol

All tokenized stocks implement the following modified or net new ERC-20 logic. See [ERC-8056](http://xft.sh/erc8056).

```
FEATURES
- Share multiplier mechanism
- Distribution multiplier mechanism
- Raw and effective share classes

PUBLIC AND EXTERNAL FUNCTIONS
totalShares(): Returns the total amount of shares.
totalRawShares(): Returns the total amount of effective shares.
totalEffectiveShares(): Returns the total amount of effective shares.
totalSupply(): Returns the total supply.
convertToShares(uint256 amount): Converts an amount of tokens to shares.
convertToTokens(uint256 shares): Converts an amount of shares to tokens.
setRewardMultiplier(uint256 _rewardMultiplier): Sets the reward multiplier.
addRewardMultiplier(uint256 _rewardMultiplierIncrement): Adds the given amount to the current reward multiplier.
setShareMultiplier(uint256 _shareMultiplier): Sets the share multiplier.
addShareMultiplier(uint256 _shareMultiplierIncrement): Adds the given amount to the current share multiplier.

PRIVATE AND INTERNAL FUNCTIONS
_setRewardMultiplier(uint256 _rewardMultiplier): Internal function to set the reward multiplier.
_setShareMultiplier(uint256 _ShareMultiplier): Internal function to set the share multiplier.

EVENTS
RewardMultiplier(uint256 indexed value): Emitted when the reward multiplier has changed.
ShareMultiplier(uint256 indexed value): Emitted when the share multiplier has changed.

ROLES
ORACLE_ROLE: Grants the ability to update the multipliers.
```

## Distributions & Corporate Actions

`effectiveShares = rawShares * shareMultiplier`

#### Stock split example

<table><thead><tr><th width="118"></th><th width="123.5555419921875">totalShares</th><th width="124.666748046875">totalSupply</th><th width="146.888916015625">shareMultiplier</th><th width="154.5555419921875">rewardMultiplier</th><th width="118">balanceOf</th><th data-hidden>share/token</th></tr></thead><tbody><tr><td>t0</td><td>100.0000</td><td>100.0000</td><td>1.0000</td><td>1.0000</td><td>50</td><td>1.0000</td></tr><tr><td>Distribution</td><td>100.0000</td><td>103.8000</td><td>1.0000</td><td>1.0380</td><td>51.9</td><td>0.9634</td></tr><tr><td>2-for-1 split</td><td>200.0000</td><td>103.8000</td><td>2.0000</td><td>1.0380</td><td>51.9</td><td>1.9268</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xft.finance/technical-implementation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
