Blockwell

Ampleforth

About link description

Ampleforth (AMPL) is a cryptocurrency and operates on the Ethereum platform. Ampleforth has a current supply of 171,827,875.82938078 with 121,479,131.2315947 in circulation. The last known price of Ampleforth is 0.96312628 USD and is up 0.10 over the last 24 hours. It is currently trading on 36 active market(s) with $776,459.72 traded over the last 24 hours. More information can be found at https://www.ampleforth.org/.

Stats

Public Functions 6
Event Types 2
Code Size 11,859 bytes

Events (2) keyboard_arrow_up

AdminChanged Event

Parameters help
previousAdmin
address help
newAdmin
address help

Upgraded Event

Parameters help
implementation
address help

ADMIN_SLOT Constant

bytes32 help
0x10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b

IMPLEMENTATION_SLOT Constant

bytes32 help
0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3

Functions Expand All Collapse All

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
function() external payable {
  _fallback();
}

admin keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

ifAdmin checks for the following:
Source Code
function admin() external ifAdmin returns (address) {
  return _admin();
}

implementation keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

ifAdmin checks for the following:
Source Code
function implementation() external ifAdmin returns (address) {
  return _implementation();
}

changeAdmin keyboard_arrow_up

Parameters help

Name Type
newAdmin
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

ifAdmin checks for the following:

Requirements help

Source Code
function changeAdmin(address newAdmin) external ifAdmin {
  require(
    newAdmin != address(0),
    "Cannot change the admin of a proxy to the zero address"
  );
  emit AdminChanged(_admin(), newAdmin);
  _setAdmin(newAdmin);
}

upgradeTo keyboard_arrow_up

Parameters help

Name Type
newImplementation
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

ifAdmin checks for the following:
Source Code
function upgradeTo(address newImplementation) external ifAdmin {
  _upgradeTo(newImplementation);
}

upgradeToAndCall keyboard_arrow_up

Parameters help

Name Type
newImplementation
address help
data
bytes help

Properties

Visibility help public
Mutability help payable

Modifiers help

ifAdmin checks for the following:

Requirements help

Source Code
function upgradeToAndCall(address newImplementation, bytes calldata data)
  external
  payable
  ifAdmin
{
  _upgradeTo(newImplementation);
  (bool success, ) = newImplementation.delegatecall(data);
  require(success);
}

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.

internal BaseAdminUpgradeabilityProxy._admin keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _admin() internal view returns (address adm) {
  bytes32 slot = ADMIN_SLOT;
  assembly {
    adm := sload(slot)
  }
}

internal BaseAdminUpgradeabilityProxy._setAdmin keyboard_arrow_up

Parameters help

Name Type
newAdmin
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _setAdmin(address newAdmin) internal {
  bytes32 slot = ADMIN_SLOT;

  assembly {
    sstore(slot, newAdmin)
  }
}

internal BaseAdminUpgradeabilityProxy._willFallback keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _willFallback() internal {
  require(
    msg.sender != _admin(),
    "Cannot call fallback function from the proxy admin"
  );
  super._willFallback();
}

internal BaseUpgradeabilityProxy._implementation keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _implementation() internal view returns (address impl) {
  bytes32 slot = IMPLEMENTATION_SLOT;
  assembly {
    impl := sload(slot)
  }
}

internal BaseUpgradeabilityProxy._upgradeTo keyboard_arrow_up

Parameters help

Name Type
newImplementation
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _upgradeTo(address newImplementation) internal {
  _setImplementation(newImplementation);
  emit Upgraded(newImplementation);
}

internal BaseUpgradeabilityProxy._setImplementation keyboard_arrow_up

Parameters help

Name Type
newImplementation
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _setImplementation(address newImplementation) internal {
  require(
    ZOSLibAddress.isContract(newImplementation),
    "Cannot set a proxy implementation to a non-contract address"
  );

  bytes32 slot = IMPLEMENTATION_SLOT;

  assembly {
    sstore(slot, newImplementation)
  }
}

internal Proxy._implementation keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _implementation() internal view returns (address);

internal Proxy._delegate keyboard_arrow_up

Parameters help

Name Type
implementation
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _delegate(address implementation) internal {
  assembly {
    // Copy msg.data. We take full control of memory in this inline assembly
    // block because it will not return to Solidity code. We overwrite the
    // Solidity scratch pad at memory position 0.
    calldatacopy(0, 0, calldatasize)

    // Call the implementation.
    // out and outsize are 0 because we don't know the size yet.
    let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0)

    // Copy the returned data.
    returndatacopy(0, 0, returndatasize)

    switch result
    // delegatecall returns 0 on error.
    case 0 {
      revert(0, returndatasize)
    }
    default {
      return(0, returndatasize)
    }
  }
}

internal Proxy._willFallback keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
function _willFallback() internal {}

internal Proxy._fallback keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
function _fallback() internal {
  _willFallback();
  _delegate(_implementation());
}

internal BaseUpgradeabilityProxy._implementation keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _implementation() internal view returns (address impl) {
  bytes32 slot = IMPLEMENTATION_SLOT;
  assembly {
    impl := sload(slot)
  }
}

internal BaseUpgradeabilityProxy._upgradeTo keyboard_arrow_up

Parameters help

Name Type
newImplementation
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _upgradeTo(address newImplementation) internal {
  _setImplementation(newImplementation);
  emit Upgraded(newImplementation);
}

internal BaseUpgradeabilityProxy._setImplementation keyboard_arrow_up

Parameters help

Name Type
newImplementation
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _setImplementation(address newImplementation) internal {
  require(
    ZOSLibAddress.isContract(newImplementation),
    "Cannot set a proxy implementation to a non-contract address"
  );

  bytes32 slot = IMPLEMENTATION_SLOT;

  assembly {
    sstore(slot, newImplementation)
  }
}

internal Proxy._implementation keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _implementation() internal view returns (address);

internal Proxy._delegate keyboard_arrow_up

Parameters help

Name Type
implementation
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _delegate(address implementation) internal {
  assembly {
    // Copy msg.data. We take full control of memory in this inline assembly
    // block because it will not return to Solidity code. We overwrite the
    // Solidity scratch pad at memory position 0.
    calldatacopy(0, 0, calldatasize)

    // Call the implementation.
    // out and outsize are 0 because we don't know the size yet.
    let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0)

    // Copy the returned data.
    returndatacopy(0, 0, returndatasize)

    switch result
    // delegatecall returns 0 on error.
    case 0 {
      revert(0, returndatasize)
    }
    default {
      return(0, returndatasize)
    }
  }
}

internal Proxy._willFallback keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
function _willFallback() internal {}

internal Proxy._fallback keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
function _fallback() internal {
  _willFallback();
  _delegate(_implementation());
}