Skip to content

Latest commit

 

History

History
434 lines (373 loc) · 12.9 KB

PreviousLoanToken.md

File metadata and controls

434 lines (373 loc) · 12.9 KB

PreviousLoanToken.sol

View Source: contracts/mockup/previousLoanToken/PreviousLoanToken.sol

↗ Extends: AdvancedTokenStorage

PreviousLoanToken contract

Contract Members

Constants & Variables

//public members
address public sovrynContractAddress;
address public wrbtcTokenAddress;

//internal members
address internal target_;

Functions


constructor

function (address _newOwner, address _newTarget, address _sovrynContractAddress, address _wrbtcTokenAddress) public nonpayable

Arguments

Name Type Description
_newOwner address
_newTarget address
_sovrynContractAddress address
_wrbtcTokenAddress address
Source Code
constructor(
        address _newOwner,
        address _newTarget,
        address _sovrynContractAddress,
        address _wrbtcTokenAddress
    ) public {
        transferOwnership(_newOwner);
        _setTarget(_newTarget);
        _setSovrynContractAddress(_sovrynContractAddress);
        _setWrbtcTokenAddress(_wrbtcTokenAddress);
    }

constructor

function () external payable
Source Code
function() external payable {
        if (gasleft() <= 2300) {
            return;
        }

        address target = target_;
        bytes memory data = msg.data;
        assembly {
            let result := delegatecall(gas, target, add(data, 0x20), mload(data), 0, 0)
            let size := returndatasize
            let ptr := mload(0x40)
            returndatacopy(ptr, 0, size)
            switch result
                case 0 {
                    revert(ptr, size)
                }
                default {
                    return(ptr, size)
                }
        }
    }

setTarget

function setTarget(address _newTarget) public nonpayable onlyOwner 

Arguments

Name Type Description
_newTarget address
Source Code
function setTarget(address _newTarget) public onlyOwner {
        _setTarget(_newTarget);
    }

_setTarget

function _setTarget(address _newTarget) internal nonpayable

Arguments

Name Type Description
_newTarget address
Source Code
function _setTarget(address _newTarget) internal {
        require(Address.isContract(_newTarget), "target not a contract");
        target_ = _newTarget;
    }

_setSovrynContractAddress

function _setSovrynContractAddress(address _sovrynContractAddress) internal nonpayable

Arguments

Name Type Description
_sovrynContractAddress address
Source Code
function _setSovrynContractAddress(address _sovrynContractAddress) internal {
        require(Address.isContract(_sovrynContractAddress), "sovryn not a contract");
        sovrynContractAddress = _sovrynContractAddress;
    }

_setWrbtcTokenAddress

function _setWrbtcTokenAddress(address _wrbtcTokenAddress) internal nonpayable

Arguments

Name Type Description
_wrbtcTokenAddress address
Source Code
function _setWrbtcTokenAddress(address _wrbtcTokenAddress) internal {
        require(Address.isContract(_wrbtcTokenAddress), "wrbtc not a contract");
        wrbtcTokenAddress = _wrbtcTokenAddress;
    }

initialize

function initialize(address _loanTokenAddress, string _name, string _symbol) public nonpayable onlyOwner 

Arguments

Name Type Description
_loanTokenAddress address
_name string
_symbol string
Source Code
function initialize(
        address _loanTokenAddress,
        string memory _name,
        string memory _symbol
    ) public onlyOwner {
        loanTokenAddress = _loanTokenAddress;

        name = _name;
        symbol = _symbol;
        decimals = IERC20(loanTokenAddress).decimals();

        initialPrice = 10**18; // starting price of 1
    }

Contracts