SDL Pool Secondary

The SDLPoolSecondary performs the same functions as the SDLPoolSecondary with a few restrictions. Performing any state changes on reSDL positions including minting, burning, and updating requires the action to be queued at which point the NFT will be non-transferrable until an update is sent to the primary chain (updates are sent periodically). If there are no queued actions for an reSDL NFT, it can be transferred as normal.

This contract is deployed on all supported chains besides the primary chain.

ERC721 Functions

All standard IERC721 and IERC721Metadata functions are implemented for SDLPoolSecondary

View Functions

tokenPools

Returns the rewards pool for a token

function tokenPools(address _token) external view returns (address)

Parameters

NameTypeDescription

_token

address

address of token

Return Values

NameTypeDescription

rewardsPool

address

address of rewards pool

supportedTokens

Returns a list of supported tokens

function supportedTokens() external view returns (address[])

Return Values

NameTypeDescription

tokens

address[]

list of token addresses

isTokenSupported

Returns true/false to whether a given token is supported

function isTokenSupported(address _token) public view returns (bool)

Parameters

NameTypeDescription

_token

address

address of token

Return Values

NameTypeDescription

isSupported

bool

is token supported

tokenBalances

Returns balances of supported tokens within the controller

function tokenBalances() external view returns (address[], uint256[])

Return Values

NameTypeDescription

tokens

address[]

list of supported tokens

balances

uint256[]

list of token balances

staked

Returns an account's staked amount for use by reward pools controlled by this contract

function staked(address _account) external view virtual returns (uint256)

Parameters

NameTypeDescription

_account

address

address of account

Return Values

NameTypeDescription

staked

uint256

account's staked amount

totalStaked

Returns the total staked amount for use by reward pools controlled by this contract

function totalStaked() external view virtual returns (uint256)

Return Values

NameTypeDescription

totalStaked

uint256

total staked amount

withdrawableRewards

Returns a list of withdrawable rewards for an account

function withdrawableRewards(address _account) external view returns (uint256[])

Parameters

NameTypeDescription

_account

address

address of account

Return Values

NameTypeDescription

withdrawableRewards

uint256[]

list of withdrawable reward amounts for each token

sdlToken

Returns the address of the SDL token

function sdlToken() external view returns (address)

Return Values

NameTypeDescription

sdlToken

address

address of SDL token

boostController

Returns the address of the boost controller

function boostController() external view returns (address)

Return Values

NameTypeDescription

boostController

address

address of boost controller

lastLockId

Returns the id of the most recently minted lock

function lastLockId() external view returns (uint256)

Return Values

NameTypeDescription

lastLockId

uint256

latest lock id

ccipController

Returns the address of the CCIP controller for this contract

function ccipController() external view returns (address)

Return Values

NameTypeDescription

ccipController

address

address of CCIP controller

effectiveBalanceOf

Returns the effective stake balance of an account (the effective stake balance includes the actual amount of tokens an account has staked across all locks plus any applicable boost gained by locking)

function effectiveBalanceOf(address _account) external view returns (uint256)

Parameters

NameTypeDescription

_account

address

address of account

Return Values

NameTypeDescription

effectiveBalance

uint256

effective stake balance

totalEffectiveBalance

Returns the sum of effective balances across all accounts

function totalEffectiveBalance() external view returns (uint256)

Return Values

NameTypeDescription

totalEffectiveBalance

uint256

total effective balance

getLocks

Returns the list of locks that corresponds to _lockIds

function getLocks(uint256[] _lockIds) external view returns (struct SDLPool.Lock[])

Parameters

NameTypeDescription

_lockIds

uint256[]

list of lock ids

Return Values

NameTypeDescription

locks

struct SDLPool.Lock[]

list of locks

getLockIdsByOwner

Returns a list of lockIds owned by an account

function getLockIdsByOwner(address _owner) external view returns (uint256[])

Parameters

NameTypeDescription

_owner

address

address of account

Return Values

NameTypeDescription

lockIds

uint256[]

list of lockIds

queuedNewLockLimit

Returns the maximum number of queued new locks an account can have at one time

function queuedNewLockLimit() external view returns (uint256)

Return Values

NameTypeDescription

queuedNewLockLimit

uint256

max num of queued new locks

updateBatchIndex

Returns the index of the current update batch

function updateBatchIndex() external view returns (uint128)

Return Values

NameTypeDescription

updateBatchIndex

uint128

index of current batch

queuedRESDLSupplyChange

Returns the current queued reSDL supply change to be sent in the next update

int256 queuedRESDLSupplyChange

Return Values

NameTypeDescription

queuedRESDLSupplyChange

int256

queued reSDL supply change

getQueuedNewLocksByOwner

Returns a list of queued new locks for an owner

function getQueuedNewLocksByOwner(address _owner) external view returns (struct SDLPool.Lock[], uint256[])

Parameters

NameTypeDescription

_owner

address

owner of locks

Return Values

NameTypeDescription

queuedLocks

Lock[]

list of queued locks

batchIndexes

uint256[]

corresponding batch indexes

getQueuedLockUpdates

Returns queued lock updates for a list of lock ids

function getQueuedLockUpdates(uint256[] _lockIds) external view returns (struct SDLPoolSecondary.LockUpdate[][])

Parameters

NameTypeDescription

_lockIds

uint256[]

list of lock ids

Return Values

NameTypeDescription

lockUpdates

LockUpdate[][]

list of queued lock updates corresponding to each lock id

shouldUpdate

Returns whether an update should be sent to the primary chain

function shouldUpdate() external view returns (bool)

Return Values

NameTypeDescription

shouldUpdate

bool

whether update should be sent

updateInProgress

Returns whether a cross chain update is in progress

function isUpdateInProgress() external view returns (bool)

Return Values

NameTypeDescription

updateInProgress

bool

whether update is in progress

Write Functions

distributeTokens

Distributes token balances to their respective rewards pools

function distributeTokens(address[] _tokens) public

Parameters

NameTypeDescription

_tokens

address[]

list of token addresses

distributeToken

Distributes a token to its respective rewards pool

function distributeToken(address _token) public

Parameters

NameTypeDescription

_token

address

address of token

withdrawRewards

Withdraws an account's earned rewards for a list of tokens

function withdrawRewards(address[] _tokens) public

Parameters

NameTypeDescription

_tokens

address[]

list of token addresses to withdraw rewards from

addToken

Adds a new token

function addToken(address _token, address _rewardsPool) public

Parameters

NameTypeDescription

_token

address

address of token to add

_rewardsPool

address

address of token rewards pool to add

removeToken

Removes a supported token

function removeToken(address _token) external

Parameters

NameTypeDescription

_token

address

address of token

setBaseURI

Sets the base URI for all tokens

function setBaseURI(string _baseURI) external

Parameters

NameTypeDescription

_baseURI_

string

base URI

setBoostController

Sets the boost controller

function setBoostController(address _boostController) external

Parameters

NameTypeDescription

_boostController

address

address of boost controller

setCCIPController

Sets the CCIP controller

function setCCIPController(address _ccipController) external

Parameters

NameTypeDescription

_ccipController

address

address of CCIP controller

onTokenTransfer

ERC677 implementation to stake/lock SDL tokens or distribute rewards

function onTokenTransfer(address _sender, uint256 _value, bytes _calldata) external

Parameters

NameTypeDescription

_sender

address

sender of the stake

_value

uint256

value of the token transfer

_calldata

bytes

encoded lockId (uint256) and lockingDuration (uint64)

extendLockDuration

Extends the locking duration of a lock

function extendLockDuration(uint256 _lockId, uint64 _lockingDuration) external

Parameters

NameTypeDescription

_lockId

uint256

id of lock

_lockingDuration

uint64

new locking duration to set

initiateUnlock

Initiates the unlock period for a lock

function initiateUnlock(uint256 _lockId) external

Parameters

NameTypeDescription

_lockId

uint256

id of lock

withdraw

Withdraws unlocked SDL

function withdraw(uint256 _lockId, uint256 _amount) external

Parameters

NameTypeDescription

_lockId

uint256

id of the lock

_amount

uint256

amount to withdraw from the lock

executeQueuedOperations

Executes queued operations for the sender

function executeQueuedOperations(uint256[] _lockIds) external

Parameters

NameTypeDescription

_lockIds

uint256[]

ids of locks to execute updates for

handleOutgoingRESDL

Handles the outgoing transfer of an reSDL lock to another chain

function handleOutgoingRESDL(address _sender, uint256 _lockId, address _sdlReceiver) external returns (struct SDLPool.Lock)

Parameters

NameTypeDescription

_sender

address

sender of the transfer

_lockId

uint256

id of lock

_sdlReceiver

address

address to receive underlying SDL on this chain

Return Values

NameTypeDescription

lock

Lock

the lock being transferred

handleIncomingRESDL

Handles the incoming transfer of an reSDL lock from another chain

function handleIncomingRESDL(address _receiver, uint256 _lockId, struct SDLPool.Lock _lock) external

Parameters

NameTypeDescription

_receiver

address

receiver of the transfer

_lockId

uint256

id of lock

_lock

Lock

lock

handleOutgoingUpdate

Handles an outgoing update to the primary chain

function handleOutgoingUpdate() external returns (uint256, int256)

Return Values

NameTypeDescription

numNewLocks

uint256

the number of new locks to mint

resdlSupplyChange

int256

the reSDL supply change since the last update

handleIncomingUpdate

Handles an incoming update from the primary chain

function handleIncomingUpdate(uint256 _mintStartIndex) external

Parameters

NameTypeDescription

_mintStartIndex

uint256

start index to use for minting new locks in the lastest batch

Last updated