Skip to content

Latest commit

 

History

History
310 lines (276 loc) · 10.3 KB

GovernorVault.md

File metadata and controls

310 lines (276 loc) · 10.3 KB

Governance Vault. (GovernorVault.sol)

View Source: contracts/governance/GovernorVault.sol

↗ Extends: Ownable

GovernorVault contract

This contract stores tokens and rBTC only transfereble by owner, i.e. Sovryn governance.

Events

event Deposited(address indexed sender, uint256  amount);
event TokensTransferred(address indexed receiver, address indexed token, uint256  amount);
event RbtcTransferred(address indexed receiver, uint256  amount);

Functions


transferTokens

Transfer tokens.

function transferTokens(address _receiver, address _token, uint256 _amount) public nonpayable onlyOwner 

Arguments

Name Type Description
_receiver address The receiver of tokens.
_token address The address of token contract.
_amount uint256 The amount to be transferred.
Source Code
function transferTokens(
        address _receiver,
        address _token,
        uint256 _amount
    ) public onlyOwner {
        require(_receiver != address(0), "Invalid receiver address");
        require(_token != address(0), "Invalid token address");

        require(IERC20(_token).transfer(_receiver, _amount), "Transfer failed");
        emit TokensTransferred(_receiver, _token, _amount);
    }

transferRbtc

Transfer RBTC.

function transferRbtc(address payable _receiver, uint256 _amount) public nonpayable onlyOwner 

Arguments

Name Type Description
_receiver address payable The receiver of RBTC.
_amount uint256 The amount to be transferred.
Source Code
function transferRbtc(address payable _receiver, uint256 _amount) public onlyOwner {
        require(_receiver != address(0), "Invalid receiver address");

        address(_receiver).transfer(_amount);
        emit RbtcTransferred(_receiver, _amount);
    }

constructor

Fallback function is to react to receiving value (rBTC).

function () external payable
Source Code
function() external payable {
        if (msg.value > 0) {
            emit Deposited(msg.sender, msg.value);
        }
    }

Contracts