Skip to content

Latest commit

 

History

History
316 lines (281 loc) · 10.5 KB

SOV.md

File metadata and controls

316 lines (281 loc) · 10.5 KB

Sovryn Token: SOV is an ERC-20 token contract for Sovryn governance.

  • (SOV.sol)

View Source: contracts/token/SOV.sol

↗ Extends: ERC20, ERC20Detailed, Ownable

SOV contract

This contract accounts for all holders' balances. *

Contract Members

Constants & Variables

string internal constant NAME;
string internal constant SYMBOL;
uint8 internal constant DECIMALS;

Functions


constructor

Constructor called on deployment, initiates the contract.

function (uint256 _initialAmount) public nonpayable ERC20Detailed 

Arguments

Name Type Description
_initialAmount uint256 The amount of tokens to be minted on contract creation.
Source Code
constructor(uint256 _initialAmount) public ERC20Detailed(NAME, SYMBOL, DECIMALS) {
        if (_initialAmount != 0) {
            _mint(msg.sender, _initialAmount);
        }
    }

mint

Creates new tokens and sends them to the recipient.

function mint(address _account, uint256 _amount) public nonpayable onlyOwner 

Arguments

Name Type Description
_account address The recipient address to get the minted tokens.
_amount uint256 The amount of tokens to be minted.
Source Code
function mint(address _account, uint256 _amount) public onlyOwner {
        _mint(_account, _amount);
    }

approveAndCall

Approves and then calls the receiving contract. Useful to encapsulate sending tokens to a contract in one call. Solidity has no native way to send tokens to contracts. ERC-20 tokens require approval to be spent by third parties, such as a contract in this case.

function approveAndCall(address _spender, uint256 _amount, bytes _data) public nonpayable

Arguments

Name Type Description
_spender address The contract address to spend the tokens.
_amount uint256 The amount of tokens to be sent.
_data bytes Parameters for the contract call, such as endpoint signature.
Source Code
function approveAndCall(
        address _spender,
        uint256 _amount,
        bytes memory _data
    ) public {
        approve(_spender, _amount);
        IApproveAndCall(_spender).receiveApproval(msg.sender, _amount, address(this), _data);
    }

Contracts