Skip to main content
Version: pre-release (v0.78)

ERC20 Staking Bridge (Vega_Staking_Bridge.sol)

View Source: contracts/Vega_Staking_Bridge.sol

↗ Extends: IStake

Vega_Staking_Bridge

This contract manages the vesting of the Vega V2 ERC20 token

Contract Members

Constants & Variables

address internal _staking_token;

user => amount staked

mapping(address => mapping(bytes32 => uint256)) internal stakes;

Functions

function (address token) public nonpayable

Arguments

NameTypeDescription
tokenaddress

stake

This stakes the given amount of tokens and credits them to the provided Vega public keyEmits Stake_Deposited event

function stake(uint256 amount, bytes32 vega_public_key) public nonpayable

Arguments

NameTypeDescription
amountuint256Token amount to stake
vega_public_keybytes32Target Vega public key to be credited with the stake

remove_stake

This removes specified amount of stake of available to userEmits Stake_Removed event if successful

function remove_stake(uint256 amount, bytes32 vega_public_key) public nonpayable

Arguments

NameTypeDescription
amountuint256Amount of tokens to remove from staking
vega_public_keybytes32Target Vega public key from which to deduct stake

transfer_stake

This transfers all stake from the sender's address to the "new_address"Emits Stake_Transfered event if successful

function transfer_stake(uint256 amount, address new_address, bytes32 vega_public_key) public nonpayable

Arguments

NameTypeDescription
amountuint256Stake amount to transfer
new_addressaddressTarget ETH address to recieve the stake
vega_public_keybytes32Target Vega public key to be credited with the transfer

staking_token

This is IStake.staking_token

function staking_token() external view
returns(address)

Returns

the address of the token that is able to be staked

Arguments

NameTypeDescription

stake_balance

This is IStake.stake_balance

function stake_balance(address target, bytes32 vega_public_key) external view
returns(uint256)

Returns

the number of tokens staked for that address->vega_public_key pair

Arguments

NameTypeDescription
targetaddressTarget address to check
vega_public_keybytes32Target vega public key to check

total_staked

This is IStake.total_staked

function total_staked() external view
returns(uint256)

Returns

total tokens staked on contract

Arguments

NameTypeDescription