Skip to main content

OsTokenVaultController

Git Source ↗

Inherits: Ownable2Step ↗, IOsTokenVaultController

Over-collateralized staked token controller.

Events​

Mint​

Event emitted on minting shares

event Mint(address indexed vault, address indexed receiver, uint256 assets, uint256 shares);

Parameters

NameTypeDescription
vaultaddressThe address of the Vault
receiveraddressThe address that received the shares
assetsuint256The number of assets collateralized
sharesuint256The number of tokens the owner received

Burn​

Event emitted on burning shares

event Burn(address indexed vault, address indexed owner, uint256 assets, uint256 shares);

Parameters

NameTypeDescription
vaultaddressThe address of the Vault
owneraddressThe address that owns the shares
assetsuint256The total number of assets withdrawn
sharesuint256The total number of shares burned

StateUpdated​

Event emitted on state update

event StateUpdated(uint256 profitAccrued, uint256 treasuryShares, uint256 treasuryAssets);

Parameters

NameTypeDescription
profitAccrueduint256The profit accrued since the last update
treasurySharesuint256The number of shares minted for the treasury
treasuryAssetsuint256The number of assets minted for the treasury

CapacityUpdated​

Event emitted on capacity update

event CapacityUpdated(uint256 capacity);

Parameters

NameTypeDescription
capacityuint256The amount after which the OsToken stops accepting deposits

TreasuryUpdated​

Event emitted on treasury address update

event TreasuryUpdated(address indexed treasury);

Parameters

NameTypeDescription
treasuryaddressThe new treasury address

FeePercentUpdated​

Event emitted on fee percent update

event FeePercentUpdated(uint16 feePercent);

Parameters

NameTypeDescription
feePercentuint16The new fee percent

AvgRewardPerSecondUpdated​

Event emitted on average reward per second update

event AvgRewardPerSecondUpdated(uint256 avgRewardPerSecond);

Parameters

NameTypeDescription
avgRewardPerSeconduint256The new average reward per second

KeeperUpdated​

Event emitted on keeper address update

event KeeperUpdated(address keeper);

Parameters

NameTypeDescription
keeperaddressThe new keeper address

Functions​

capacity​

The OsToken capacity

function capacity() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The amount after which the OsToken stops accepting deposits

treasury​

The DAO treasury address that receives OsToken fees

function treasury() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of the treasury

feePercent​

The fee percent (multiplied by 100)

function feePercent() external view returns (uint64);

Returns

NameTypeDescription
<none>uint64The fee percent applied by the OsToken on the rewards

keeper​

The address that can update avgRewardPerSecond

function keeper() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of the keeper contract

avgRewardPerSecond​

The average reward per second used to mint OsToken rewards

function avgRewardPerSecond() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The average reward per second earned by the Vaults

cumulativeFeePerShare​

The fee per share used for calculating the fee for every position

function cumulativeFeePerShare() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The cumulative fee per share

totalShares​

The total number of shares controlled by the OsToken

function totalShares() external view override returns (uint256);

Returns

NameTypeDescription
<none>uint256The total number of shares

totalAssets​

Total assets controlled by the OsToken

function totalAssets() public view override returns (uint256);

Returns

NameTypeDescription
<none>uint256The total amount of the underlying asset that is "managed" by OsToken

convertToShares​

Converts assets to shares

function convertToShares(uint256 assets) public view override returns (uint256 shares);

Parameters

NameTypeDescription
assetsuint256The amount of assets to convert to shares

Returns

NameTypeDescription
sharesuint256The amount of OsToken shares obtained when exchanging with the amount of assets provided

convertToAssets​

Converts shares to assets

function convertToAssets(uint256 shares) public view override returns (uint256 assets);

Parameters

NameTypeDescription
sharesuint256The amount of shares to convert to assets

Returns

NameTypeDescription
assetsuint256The amount of assets obtained when exchanging with the amount of OsToken shares provided

mintShares​

Mint OsToken shares. Can only be called by the registered vault.

function mintShares(address receiver, uint256 shares) external override returns (uint256 assets);

Parameters

NameTypeDescription
receiveraddressThe address that will receive the shares
sharesuint256The amount of shares to mint

Returns

NameTypeDescription
assetsuint256The amount of assets minted

burnShares​

Burn shares for withdrawn assets. Can only be called by the registered vault.

function burnShares(address owner, uint256 shares) external override returns (uint256 assets);

Parameters

NameTypeDescription
owneraddressThe address that owns the shares
sharesuint256The amount of shares to burn

Returns

NameTypeDescription
assetsuint256The amount of assets withdrawn

setCapacity​

Update capacity. Can only be called by the owner.

function setCapacity(uint256 _capacity) public override onlyOwner;

Parameters

NameTypeDescription
_capacityuint256The amount after which the OsToken stops accepting deposits

setTreasury​

Update treasury address. Can only be called by the owner.

function setTreasury(address _treasury) public override onlyOwner;

Parameters

NameTypeDescription
_treasuryaddressThe new treasury address

setFeePercent​

Update fee percent. Can only be called by the owner. Cannot be larger than 10 000 (100%).

function setFeePercent(uint16 _feePercent) public override onlyOwner;

Parameters

NameTypeDescription
_feePercentuint16The new fee percent

setAvgRewardPerSecond​

Updates average reward per second. Can only be called by the keeper.

function setAvgRewardPerSecond(uint256 _avgRewardPerSecond) external override;

Parameters

NameTypeDescription
_avgRewardPerSeconduint256The new average reward per second

setKeeper​

Update keeper address. Can only be called by the owner.

function setKeeper(address _keeper) external override onlyOwner;

Parameters

NameTypeDescription
_keeperaddressThe new keeper address

updateState​

Updates rewards and treasury fee checkpoint for the OsToken

function updateState() public override;