The security module contract is responsible for managing the pausing and unpausing of the protocol. It is a simple contract that inherits from the OpenZeppelin AccessControlUpgradeable
and PausableUpgradeable
contracts. The contract has a single role, PAUSE_ROLE
, which is used to control who can pause and unpause the protocol.
Functions
depositAndLock
External function to deposit and lock tokens.
function depositAndLock(
address _subject,
uint256 _amount,
uint256 _lockPeriodInSec
)
external
whenNotPaused
onlyValidLockPeriod(_lockPeriodInSec)
returns (uint256 unlockTimeInSec_)
Parameters
Name | Type | Description |
---|
_subject | address | The subject of the Fan Token. |
_amount | uint256 | The amount of Fan Token to deposit. |
_lockPeriodInSec | uint256 | The lock period in seconds. |
Return Values
Name | Type | Description |
---|
unlockTimeInSec_ | uint256 | Unlock times for the locks. |
depositAndLockFor
External function to deposit and lock tokens for a beneficiary.
function depositAndLockFor(
address _subject,
uint256 _amount,
uint256 _lockPeriodInSec,
address _beneficiary
)
external
whenNotPaused
onlyValidLockPeriod(_lockPeriodInSec)
returns (uint256 unlockTimeInSec_)
Parameters
Name | Type | Description |
---|
_subject | address | Subject address for which tokens are getting deposited. |
_amount | uint256 | amount of tokens getting deposited. |
_lockPeriodInSec | uint256 | lock period for the tokens. |
_beneficiary | address | Address of the beneficiary for the lock. |
Return Values
Name | Type | Description |
---|
unlockTimeInSec_ | bool | Unlock times for the locks. |
depositAndLockMultiple
External function to deposit and lock multiple tokens.
function depositAndLockMultiple(
address[] memory _subjects,
uint256[] memory _amounts,
uint256 _lockPeriodInSec
)
external
whenNotPaused
onlyValidLockPeriod(_lockPeriodInSec)
returns (uint256 unlockTimeInSec_)
Parameters
Name | Type | Description |
---|
_subjects | address[] | Subject addresses for which tokens are getting deposited. |
_amounts | uint256[] | Amounts of tokens getting deposited. |
_lockPeriodInSec | uint256 | Lock periods for the tokens. |
Return Values
Name | Type | Description |
---|
unlockTimeInSec_ | uint256 | Unlock times for the locks. |
depositAndLockMultipleFor
External function to deposit and lock multiple tokens.
function depositAndLockMultipleFor(
address[] memory _subjects,
uint256[] memory _amounts,
uint256 _lockPeriodInSec,
address _beneficiary
)
external
whenNotPaused
onlyValidLockPeriod(_lockPeriodInSec)
returns (uint256 unlockTimeInSec_)
Parameters
Name | Type | Description |
---|
_subjects | address[] | Subject addresses for which tokens are getting deposited. |
_amounts | address[] | Amounts of tokens getting deposited. |
_lockPeriodInSec | address | Lock periods for the tokens. |
_beneficiary | address | Address of the beneficiary for the lock. |
Return Values
Name | Type | Description |
---|
unlockTimeInSec_ | uint256 | Unlock times for the locks. |
buyAndLock
External function to buy & lock tokens.
function buyAndLock(
address _subject,
uint256 _depositAmount,
uint256 _minReturnAmountAfterFee,
uint256 _lockPeriodInSec
)
external
whenNotPaused
onlyValidLockPeriod(_lockPeriodInSec)
returns (uint256 amount_, uint256 unlockTimeInSec_)
Parameters
Name | Type | Description |
---|
_subject | addres | Subject address for which tokens are getting bought & deposited. |
_depositAmount | uint256 | amount of moxie tokens getting deposited. |
_minReturnAmountAfterFee | uint256 | Slippage setting which determines minimum amount of tokens after fee. |
_lockPeriodInSec | uint256 | Lock period for the tokens. |
Return Values
Name | Type | Description |
---|
amount_ | uint256 | Amount of tokens bought & locked. |
unlockTimeInSec_ | uint256 | Unlock times for the locks. |
buyAndLockFor
External function to buy & lock tokens on behalf of another address.
function buyAndLockFor(
address _subject,
uint256 _depositAmount,
uint256 _minReturnAmountAfterFee,
uint256 _lockPeriodInSec,
address _beneficiary
)
external
whenNotPaused
onlyValidLockPeriod(_lockPeriodInSec)
returns (uint256 amount_, uint256 unlockTimeInSec_)
Parameters
Name | Type | Description |
---|
_subject | addres | Subject address for which tokens are getting bought & deposited. |
_depositAmount | uint256 | amount of moxie tokens getting deposited. |
_minReturnAmountAfterFee | uint256 | Slippage setting which determines minimum amount of tokens after fee. |
_lockPeriodInSec | uint256 | Lock period for the tokens. |
_beneficiary | address | Address of the beneficiary for the lock. |
Return Values
Name | Type | Description |
---|
amount_ | uint256 | Amount of tokens bought & locked. |
unlockTimeInSec_ | uint256 | Unlock times for the locks. |
buyAndLockMultiple
External function to buy & lock multiple tokens.
function buyAndLockMultiple(
address[] memory _subjects,
uint256[] memory _depositAmounts,
uint256[] memory _minReturnAmountsAfterFee,
uint256 _lockPeriodInSec
)
external
whenNotPaused
onlyValidLockPeriod(_lockPeriodInSec)
returns (uint256[] memory amounts_, uint256 unlockTimeInSec_)
Parameters
Name | Type | Description |
---|
_subjects | addres[] | Subject addresses for which tokens are getting bought & deposited. |
_depositAmounts | uint256[] | amount of moxie tokens getting deposited. |
_minReturnAmountAfterFees | uint256[] | Slippage setting which determines minimum amount of tokens after fee. |
_lockPeriodInSec | uint256 | Lock period for the tokens. |
Return Values
Name | Type | Description |
---|
amount_ | uint256 | Amount of tokens bought & locked. |
unlockTimeInSec_ | uint256 | Unlock times for the locks. |
buyAndLockMultipleFor
External function to buy & lock multiple tokens on behalf of other wallet address.
function buyAndLockMultipleFor(
address[] memory _subjects,
uint256[] memory _depositAmounts,
uint256[] memory _minReturnAmountsAfterFee,
uint256 _lockPeriodInSec,
address _beneficiary
)
external
whenNotPaused
onlyValidLockPeriod(_lockPeriodInSec)
returns (uint256[] memory amounts_, uint256 unlockTimeInSec_)
Parameters
Name | Type | Description |
---|
_subjects | addres[] | Subject addresses for which tokens are getting bought & deposited. |
_depositAmounts | uint256[] | amount of moxie tokens getting deposited. |
_minReturnAmountAfterFees | uint256[] | Slippage setting which determines minimum amount of tokens after fee. |
_lockPeriodInSec | uint256 | Lock period for the tokens. |
_beneficiary | address | Address of the beneficiary for the lock. |
Return Values
Name | Type | Description |
---|
amount_ | uint256 | Amount of tokens bought & locked. |
unlockTimeInSec_ | uint256 | Unlock times for the locks. |
withdraw
External function to withdraw locked tokens.
function withdraw(
address _subject,
uint256[] memory _indexes
) external whenNotPaused returns (uint256 totalAmount_)
Parameters
Name | Type | Description |
---|
_subject | address | Subject address for which tokens are getting withdrawn. |
_indexes | uint256[] | Indexes of the locks to be withdrawn. |
Return Values
Name | Type | Description |
---|
totalAmount_ | uint256 | Total amount of tokens withdrawn. |
extendLock
External function to extend the lock period of the tokens.
function extendLock(
address _subject,
uint256[] memory _indexes,
uint256 _lockPeriodInSec
)
external
whenNotPaused
onlyValidLockPeriod(_lockPeriodInSec)
returns (uint256 totalAmount_, uint256 unlockTimeInSec_)
Parameters
Name | Type | Description |
---|
_subject | address | Subject address for which tokens are being extended. |
_indexes | uint256[] | Indexes of the locks to be extended. |
_lockPeriodInSec | uint256 | Lock periods for the tokens. |
Return Values
Name | Type | Description |
---|
totalAmount_ | uint256 | Total amount of tokens extended for lock. |
unlockTimeInSec_ | uint256 | unlock time is the timestamp of the extended lock. |
extendLockFor
External function to extend the lock period of the tokens on behalf of other wallet address.
function extendLockFor(
address _subject,
uint256[] memory _indexes,
uint256 _lockPeriodInSec,
address _beneficiary
)
external
whenNotPaused
onlyValidLockPeriod(_lockPeriodInSec)
returns (uint256 totalAmount_, uint256 unlockTimeInSec_)
Parameters
Name | Type | Description |
---|
_subject | address | Subject address for which tokens are being extended. |
_indexes | uint256[] | Indexes of the locks to be extended. |
_lockPeriodInSec | uint256 | Lock periods for the tokens. |
_beneficiary | address | Address of the beneficiary for the lock. |
Return Values
Name | Type | Description |
---|
totalAmount_ | uint256 | Total amount of tokens extended for lock. |
unlockTimeInSec_ | uint256 | unlock time is the timestamp of the extended lock. |
getTotalStakedAmount
External function to get the total staked amount for a user & subject token.
function getTotalStakedAmount(
address _user,
address _subject,
uint256[] calldata _indexes
) external view returns (uint256 totalAmount_)
Parameters
Name | Type | Description |
---|
_user | address | User address for which total staked amount is being calculated. |
_subject | address | Subject address for which total staked amount is being calculated. |
_indexes | uint256[] | Indexes of the locks for which total staked amount is being calculated. |
Return Values
Name | Type | Description |
---|
totalAmount_ | uint256 | Total staked amount by the inputted user |