Blockwell

Synthetix Network Token

About

Stats

Public Functions 6
Event Types 3
Code Size 6,361 bytes

Events (3) keyboard_arrow_up

OwnerChanged Event

Parameters help
oldOwner
address help
newOwner
address help

OwnerNominated Event

Parameters help
newOwner
address help

TargetUpdated Event

Parameters help
newTarget
Proxyable help

target Variable

address help

useDELEGATECALL Variable

bool help

owner Variable

address help

nominatedOwner Variable

address help

Functions Expand All Collapse All

nominateNewOwner keyboard_arrow_up

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function nominateNewOwner(address _owner) external onlyOwner {
  nominatedOwner = _owner;
  emit OwnerNominated(_owner);
}

acceptOwnership keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function acceptOwnership() external {
  require(msg.sender == nominatedOwner);
  emit OwnerChanged(owner, nominatedOwner);
  owner = nominatedOwner;
  nominatedOwner = address(0);
}

setTarget keyboard_arrow_up

Parameters help

Name Type
_target
Proxyable help

Properties

Visibility help public
Mutability help transaction
Source Code
function setTarget(Proxyable _target) external onlyOwner {
  target = _target;
  emit TargetUpdated(_target);
}

setUseDELEGATECALL keyboard_arrow_up

Parameters help

Name Type
value
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function setUseDELEGATECALL(bool value) external onlyOwner {
  useDELEGATECALL = value;
}

_emit keyboard_arrow_up

Parameters help

Name Type
callData
bytes help
numTopics
uint help
topic1
bytes32 help
topic2
bytes32 help
topic3
bytes32 help
topic4
bytes32 help

Properties

Visibility help public
Mutability help transaction
Source Code
function _emit(
  bytes callData,
  uint256 numTopics,
  bytes32 topic1,
  bytes32 topic2,
  bytes32 topic3,
  bytes32 topic4
) external onlyTarget {
  uint256 size = callData.length;
  bytes memory _callData = callData;

  assembly {
    /* The first 32 bytes of callData contain its length (as specified by the abi).
     * Length is assumed to be a uint256 and therefore maximum of 32 bytes
     * in length. It is also leftpadded to be a multiple of 32 bytes.
     * This means moving call_data across 32 bytes guarantees we correctly access
     * the data itself. */
    switch numTopics
    case 0 {
      log0(add(_callData, 32), size)
    }
    case 1 {
      log1(add(_callData, 32), size, topic1)
    }
    case 2 {
      log2(add(_callData, 32), size, topic1, topic2)
    }
    case 3 {
      log3(add(_callData, 32), size, topic1, topic2, topic3)
    }
    case 4 {
      log4(add(_callData, 32), size, topic1, topic2, topic3, topic4)
    }
  }
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
function() external payable {
  if (useDELEGATECALL) {
    assembly {
      /* Copy call data into free memory region. */
      let free_ptr := mload(0x40)
      calldatacopy(free_ptr, 0, calldatasize)

      /* Forward all gas and call data to the target contract. */
      let result := delegatecall(
        gas,
        sload(target_slot),
        free_ptr,
        calldatasize,
        0,
        0
      )
      returndatacopy(free_ptr, 0, returndatasize)

      /* Revert if the call failed, otherwise return the result. */
      if iszero(result) {
        revert(free_ptr, returndatasize)
      }
      return(free_ptr, returndatasize)
    }
  } else {
    /* Here we are as above, but must send the messageSender explicitly
     * since we are using CALL rather than DELEGATECALL. */
    target.setMessageSender(msg.sender);
    assembly {
      let free_ptr := mload(0x40)
      calldatacopy(free_ptr, 0, calldatasize)

      /* We must explicitly forward ether to the underlying contract as well. */
      let result := call(
        gas,
        sload(target_slot),
        callvalue,
        free_ptr,
        calldatasize,
        0,
        0
      )
      returndatacopy(free_ptr, 0, returndatasize)

      if iszero(result) {
        revert(free_ptr, returndatasize)
      }
      return(free_ptr, returndatasize)
    }
  }
}

Internal Functions Expand All Collapse All

Internal functions are parts of the contract that can't be used directly, but instead are used by the public functions listed above.