ETH Price: $1,933.97 (-4.34%)
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Send Request1446008872025-12-03 22:22:3169 days ago1764800551IN
0xb42Bd999...D9b97714c
0 ETH0.0000000365340.00010055
Send Request1445516572025-12-02 19:01:3170 days ago1764702091IN
0xb42Bd999...D9b97714c
0 ETH0.0000003686680.00100025

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FunctionsConsumer

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1000 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {FunctionsClient} from "@chainlink/contracts/src/v0.8/functions/v1_0_0/FunctionsClient.sol";
import {ConfirmedOwner} from "@chainlink/contracts/src/v0.8/shared/access/ConfirmedOwner.sol";
import {FunctionsRequest} from "@chainlink/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsRequest.sol";

/**
 * @title Chainlink Functions example on-demand consumer contract example
 */
contract FunctionsConsumer is FunctionsClient, ConfirmedOwner {
  using FunctionsRequest for FunctionsRequest.Request;

  bytes32 public donId; // DON ID for the Functions DON to which the requests are sent

  bytes32 public s_lastRequestId;
  bytes public s_lastResponse;
  bytes public s_lastError;

  constructor(address router, bytes32 _donId) FunctionsClient(router) ConfirmedOwner(msg.sender) {
    donId = _donId;
  }

  /**
   * @notice Set the DON ID
   * @param newDonId New DON ID
   */
  function setDonId(bytes32 newDonId) external onlyOwner {
    donId = newDonId;
  }

  /**
   * @notice Triggers an on-demand Functions request using remote encrypted secrets
   * @param source JavaScript source code
   * @param secretsLocation Location of secrets (only Location.Remote & Location.DONHosted are supported)
   * @param encryptedSecretsReference Reference pointing to encrypted secrets
   * @param args String arguments passed into the source code and accessible via the global variable `args`
   * @param bytesArgs Bytes arguments passed into the source code and accessible via the global variable `bytesArgs` as hex strings
   * @param subscriptionId Subscription ID used to pay for request (FunctionsConsumer contract address must first be added to the subscription)
   * @param callbackGasLimit Maximum amount of gas used to call the inherited `handleOracleFulfillment` method
   */
  function sendRequest(
    string calldata source,
    FunctionsRequest.Location secretsLocation,
    bytes calldata encryptedSecretsReference,
    string[] calldata args,
    bytes[] calldata bytesArgs,
    uint64 subscriptionId,
    uint32 callbackGasLimit
  ) external onlyOwner {
    FunctionsRequest.Request memory req;
    req.initializeRequest(FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, source);
    req.secretsLocation = secretsLocation;
    req.encryptedSecretsReference = encryptedSecretsReference;
    if (args.length > 0) {
      req.setArgs(args);
    }
    if (bytesArgs.length > 0) {
      req.setBytesArgs(bytesArgs);
    }
    s_lastRequestId = _sendRequest(req.encodeCBOR(), subscriptionId, callbackGasLimit, donId);
  }

  /**
   * @notice Store latest result/error
   * @param requestId The request ID, returned by sendRequest()
   * @param response Aggregated response from the user code
   * @param err Aggregated error from the user code or from the execution pipeline
   * Either response or error parameter will be set, but never both
   */
  function fulfillRequest(bytes32 requestId, bytes memory response, bytes memory err) internal override {
    s_lastResponse = response;
    s_lastError = err;
  }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {IFunctionsRouter} from "./interfaces/IFunctionsRouter.sol";
import {IFunctionsClient} from "./interfaces/IFunctionsClient.sol";

import {FunctionsRequest} from "./libraries/FunctionsRequest.sol";

/// @title The Chainlink Functions client contract
/// @notice Contract developers can inherit this contract in order to make Chainlink Functions requests
abstract contract FunctionsClient is IFunctionsClient {
  using FunctionsRequest for FunctionsRequest.Request;

  IFunctionsRouter internal immutable i_router;

  event RequestSent(bytes32 indexed id);
  event RequestFulfilled(bytes32 indexed id);

  error OnlyRouterCanFulfill();

  constructor(address router) {
    i_router = IFunctionsRouter(router);
  }

  /// @notice Sends a Chainlink Functions request
  /// @param data The CBOR encoded bytes data for a Functions request
  /// @param subscriptionId The subscription ID that will be charged to service the request
  /// @param callbackGasLimit the amount of gas that will be available for the fulfillment callback
  /// @return requestId The generated request ID for this request
  function _sendRequest(
    bytes memory data,
    uint64 subscriptionId,
    uint32 callbackGasLimit,
    bytes32 donId
  ) internal returns (bytes32) {
    bytes32 requestId = i_router.sendRequest(
      subscriptionId,
      data,
      FunctionsRequest.REQUEST_DATA_VERSION,
      callbackGasLimit,
      donId
    );
    emit RequestSent(requestId);
    return requestId;
  }

  /// @notice User defined function to handle a response from the DON
  /// @param requestId The request ID, returned by sendRequest()
  /// @param response Aggregated response from the execution of the user's source code
  /// @param err Aggregated error from the execution of the user code or from the execution pipeline
  /// @dev Either response or error parameter will be set, but never both
  function fulfillRequest(bytes32 requestId, bytes memory response, bytes memory err) internal virtual;

  /// @inheritdoc IFunctionsClient
  function handleOracleFulfillment(bytes32 requestId, bytes memory response, bytes memory err) external override {
    if (msg.sender != address(i_router)) {
      revert OnlyRouterCanFulfill();
    }
    fulfillRequest(requestId, response, err);
    emit RequestFulfilled(requestId);
  }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

/// @title Chainlink Functions client interface.
interface IFunctionsClient {
  /// @notice Chainlink Functions response handler called by the Functions Router
  /// during fullilment from the designated transmitter node in an OCR round.
  /// @param requestId The requestId returned by FunctionsClient.sendRequest().
  /// @param response Aggregated response from the request's source code.
  /// @param err Aggregated error either from the request's source code or from the execution pipeline.
  /// @dev Either response or error parameter will be set, but never both.
  function handleOracleFulfillment(bytes32 requestId, bytes memory response, bytes memory err) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {FunctionsResponse} from "../libraries/FunctionsResponse.sol";

/// @title Chainlink Functions Router interface.
interface IFunctionsRouter {
  /// @notice The identifier of the route to retrieve the address of the access control contract
  /// The access control contract controls which accounts can manage subscriptions
  /// @return id - bytes32 id that can be passed to the "getContractById" of the Router
  function getAllowListId() external view returns (bytes32);

  /// @notice Set the identifier of the route to retrieve the address of the access control contract
  /// The access control contract controls which accounts can manage subscriptions
  function setAllowListId(bytes32 allowListId) external;

  /// @notice Get the flat fee (in Juels of LINK) that will be paid to the Router owner for operation of the network
  /// @return adminFee
  function getAdminFee() external view returns (uint72 adminFee);

  /// @notice Sends a request using the provided subscriptionId
  /// @param subscriptionId - A unique subscription ID allocated by billing system,
  /// a client can make requests from different contracts referencing the same subscription
  /// @param data - CBOR encoded Chainlink Functions request data, use FunctionsClient API to encode a request
  /// @param dataVersion - Gas limit for the fulfillment callback
  /// @param callbackGasLimit - Gas limit for the fulfillment callback
  /// @param donId - An identifier used to determine which route to send the request along
  /// @return requestId - A unique request identifier
  function sendRequest(
    uint64 subscriptionId,
    bytes calldata data,
    uint16 dataVersion,
    uint32 callbackGasLimit,
    bytes32 donId
  ) external returns (bytes32);

  /// @notice Sends a request to the proposed contracts
  /// @param subscriptionId - A unique subscription ID allocated by billing system,
  /// a client can make requests from different contracts referencing the same subscription
  /// @param data - CBOR encoded Chainlink Functions request data, use FunctionsClient API to encode a request
  /// @param dataVersion - Gas limit for the fulfillment callback
  /// @param callbackGasLimit - Gas limit for the fulfillment callback
  /// @param donId - An identifier used to determine which route to send the request along
  /// @return requestId - A unique request identifier
  function sendRequestToProposed(
    uint64 subscriptionId,
    bytes calldata data,
    uint16 dataVersion,
    uint32 callbackGasLimit,
    bytes32 donId
  ) external returns (bytes32);

  /// @notice Fulfill the request by:
  /// - calling back the data that the Oracle returned to the client contract
  /// - pay the DON for processing the request
  /// @dev Only callable by the Coordinator contract that is saved in the commitment
  /// @param response response data from DON consensus
  /// @param err error from DON consensus
  /// @param juelsPerGas - current rate of juels/gas
  /// @param costWithoutFulfillment - The cost of processing the request (in Juels of LINK ), without fulfillment
  /// @param transmitter - The Node that transmitted the OCR report
  /// @param commitment - The parameters of the request that must be held consistent between request and response time
  /// @return fulfillResult -
  /// @return callbackGasCostJuels -
  function fulfill(
    bytes memory response,
    bytes memory err,
    uint96 juelsPerGas,
    uint96 costWithoutFulfillment,
    address transmitter,
    FunctionsResponse.Commitment memory commitment
  ) external returns (FunctionsResponse.FulfillResult, uint96);

  /// @notice Validate requested gas limit is below the subscription max.
  /// @param subscriptionId subscription ID
  /// @param callbackGasLimit desired callback gas limit
  function isValidCallbackGasLimit(uint64 subscriptionId, uint32 callbackGasLimit) external view;

  /// @notice Get the current contract given an ID
  /// @param id A bytes32 identifier for the route
  /// @return contract The current contract address
  function getContractById(bytes32 id) external view returns (address);

  /// @notice Get the proposed next contract given an ID
  /// @param id A bytes32 identifier for the route
  /// @return contract The current or proposed contract address
  function getProposedContractById(bytes32 id) external view returns (address);

  /// @notice Return the latest proprosal set
  /// @return ids The identifiers of the contracts to update
  /// @return to The addresses of the contracts that will be updated to
  function getProposedContractSet() external view returns (bytes32[] memory, address[] memory);

  /// @notice Proposes one or more updates to the contract routes
  /// @dev Only callable by owner
  function proposeContractsUpdate(bytes32[] memory proposalSetIds, address[] memory proposalSetAddresses) external;

  /// @notice Updates the current contract routes to the proposed contracts
  /// @dev Only callable by owner
  function updateContracts() external;

  /// @dev Puts the system into an emergency stopped state.
  /// @dev Only callable by owner
  function pause() external;

  /// @dev Takes the system out of an emergency stopped state.
  /// @dev Only callable by owner
  function unpause() external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {CBOR} from "../../../vendor/solidity-cborutils/v2.0.0/CBOR.sol";

/// @title Library for encoding the input data of a Functions request into CBOR
library FunctionsRequest {
  using CBOR for CBOR.CBORBuffer;

  uint16 public constant REQUEST_DATA_VERSION = 1;
  uint256 internal constant DEFAULT_BUFFER_SIZE = 256;

  enum Location {
    Inline, // Provided within the Request
    Remote, // Hosted through remote location that can be accessed through a provided URL
    DONHosted // Hosted on the DON's storage
  }

  enum CodeLanguage {
    JavaScript
    // In future version we may add other languages
  }

  struct Request {
    Location codeLocation; // ════════════╸ The location of the source code that will be executed on each node in the DON
    Location secretsLocation; // ═════════╸ The location of secrets that will be passed into the source code. *Only Remote secrets are supported
    CodeLanguage language; // ════════════╸ The coding language that the source code is written in
    string source; // ════════════════════╸ Raw source code for Request.codeLocation of Location.Inline, URL for Request.codeLocation of Location.Remote, or slot decimal number for Request.codeLocation of Location.DONHosted
    bytes encryptedSecretsReference; // ══╸ Encrypted URLs for Request.secretsLocation of Location.Remote (use addSecretsReference()), or CBOR encoded slotid+version for Request.secretsLocation of Location.DONHosted (use addDONHostedSecrets())
    string[] args; // ════════════════════╸ String arguments that will be passed into the source code
    bytes[] bytesArgs; // ════════════════╸ Bytes arguments that will be passed into the source code
  }

  error EmptySource();
  error EmptySecrets();
  error EmptyArgs();
  error NoInlineSecrets();

  /// @notice Encodes a Request to CBOR encoded bytes
  /// @param self The request to encode
  /// @return CBOR encoded bytes
  function encodeCBOR(Request memory self) internal pure returns (bytes memory) {
    CBOR.CBORBuffer memory buffer = CBOR.create(DEFAULT_BUFFER_SIZE);

    buffer.writeString("codeLocation");
    buffer.writeUInt256(uint256(self.codeLocation));

    buffer.writeString("language");
    buffer.writeUInt256(uint256(self.language));

    buffer.writeString("source");
    buffer.writeString(self.source);

    if (self.args.length > 0) {
      buffer.writeString("args");
      buffer.startArray();
      for (uint256 i = 0; i < self.args.length; ++i) {
        buffer.writeString(self.args[i]);
      }
      buffer.endSequence();
    }

    if (self.encryptedSecretsReference.length > 0) {
      if (self.secretsLocation == Location.Inline) {
        revert NoInlineSecrets();
      }
      buffer.writeString("secretsLocation");
      buffer.writeUInt256(uint256(self.secretsLocation));
      buffer.writeString("secrets");
      buffer.writeBytes(self.encryptedSecretsReference);
    }

    if (self.bytesArgs.length > 0) {
      buffer.writeString("bytesArgs");
      buffer.startArray();
      for (uint256 i = 0; i < self.bytesArgs.length; ++i) {
        buffer.writeBytes(self.bytesArgs[i]);
      }
      buffer.endSequence();
    }

    return buffer.buf.buf;
  }

  /// @notice Initializes a Chainlink Functions Request
  /// @dev Sets the codeLocation and code on the request
  /// @param self The uninitialized request
  /// @param codeLocation The user provided source code location
  /// @param language The programming language of the user code
  /// @param source The user provided source code or a url
  function initializeRequest(
    Request memory self,
    Location codeLocation,
    CodeLanguage language,
    string memory source
  ) internal pure {
    if (bytes(source).length == 0) revert EmptySource();

    self.codeLocation = codeLocation;
    self.language = language;
    self.source = source;
  }

  /// @notice Initializes a Chainlink Functions Request
  /// @dev Simplified version of initializeRequest for PoC
  /// @param self The uninitialized request
  /// @param javaScriptSource The user provided JS code (must not be empty)
  function initializeRequestForInlineJavaScript(Request memory self, string memory javaScriptSource) internal pure {
    initializeRequest(self, Location.Inline, CodeLanguage.JavaScript, javaScriptSource);
  }

  /// @notice Adds Remote user encrypted secrets to a Request
  /// @param self The initialized request
  /// @param encryptedSecretsReference Encrypted comma-separated string of URLs pointing to off-chain secrets
  function addSecretsReference(Request memory self, bytes memory encryptedSecretsReference) internal pure {
    if (encryptedSecretsReference.length == 0) revert EmptySecrets();

    self.secretsLocation = Location.Remote;
    self.encryptedSecretsReference = encryptedSecretsReference;
  }

  /// @notice Adds DON-hosted secrets reference to a Request
  /// @param self The initialized request
  /// @param slotID Slot ID of the user's secrets hosted on DON
  /// @param version User data version (for the slotID)
  function addDONHostedSecrets(Request memory self, uint8 slotID, uint64 version) internal pure {
    CBOR.CBORBuffer memory buffer = CBOR.create(DEFAULT_BUFFER_SIZE);

    buffer.writeString("slotID");
    buffer.writeUInt64(slotID);
    buffer.writeString("version");
    buffer.writeUInt64(version);

    self.secretsLocation = Location.DONHosted;
    self.encryptedSecretsReference = buffer.buf.buf;
  }

  /// @notice Sets args for the user run function
  /// @param self The initialized request
  /// @param args The array of string args (must not be empty)
  function setArgs(Request memory self, string[] memory args) internal pure {
    if (args.length == 0) revert EmptyArgs();

    self.args = args;
  }

  /// @notice Sets bytes args for the user run function
  /// @param self The initialized request
  /// @param args The array of bytes args (must not be empty)
  function setBytesArgs(Request memory self, bytes[] memory args) internal pure {
    if (args.length == 0) revert EmptyArgs();

    self.bytesArgs = args;
  }
}

File 6 of 11 : FunctionsResponse.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

/// @title Library of types that are used for fulfillment of a Functions request
library FunctionsResponse {
  // Used to send request information from the Router to the Coordinator
  struct RequestMeta {
    bytes data; // ══════════════════╸ CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a request
    bytes32 flags; // ═══════════════╸ Per-subscription flags
    address requestingContract; // ══╗ The client contract that is sending the request
    uint96 availableBalance; // ═════╝ Common LINK balance of the subscription that is controlled by the Router to be used for all consumer requests.
    uint72 adminFee; // ═════════════╗ Flat fee (in Juels of LINK) that will be paid to the Router Owner for operation of the network
    uint64 subscriptionId; //        ║ Identifier of the billing subscription that will be charged for the request
    uint64 initiatedRequests; //     ║ The number of requests that have been started
    uint32 callbackGasLimit; //      ║ The amount of gas that the callback to the consuming contract will be given
    uint16 dataVersion; // ══════════╝ The version of the structure of the CBOR encoded request data
    uint64 completedRequests; // ════╗ The number of requests that have successfully completed or timed out
    address subscriptionOwner; // ═══╝ The owner of the billing subscription
  }

  enum FulfillResult {
    FULFILLED, // 0
    USER_CALLBACK_ERROR, // 1
    INVALID_REQUEST_ID, // 2
    COST_EXCEEDS_COMMITMENT, // 3
    INSUFFICIENT_GAS_PROVIDED, // 4
    SUBSCRIPTION_BALANCE_INVARIANT_VIOLATION, // 5
    INVALID_COMMITMENT // 6
  }

  struct Commitment {
    bytes32 requestId; // ═════════════════╸ A unique identifier for a Chainlink Functions request
    address coordinator; // ═══════════════╗ The Coordinator contract that manages the DON that is servicing a request
    uint96 estimatedTotalCostJuels; // ════╝ The maximum cost in Juels (1e18) of LINK that will be charged to fulfill a request
    address client; // ════════════════════╗ The client contract that sent the request
    uint64 subscriptionId; //              ║ Identifier of the billing subscription that will be charged for the request
    uint32 callbackGasLimit; // ═══════════╝ The amount of gas that the callback to the consuming contract will be given
    uint72 adminFee; // ═══════════════════╗ Flat fee (in Juels of LINK) that will be paid to the Router Owner for operation of the network
    uint72 donFee; //                      ║ Fee (in Juels of LINK) that will be split between Node Operators for servicing a request
    uint40 gasOverheadBeforeCallback; //   ║ Represents the average gas execution cost before the fulfillment callback.
    uint40 gasOverheadAfterCallback; //    ║ Represents the average gas execution cost after the fulfillment callback.
    uint32 timeoutTimestamp; // ═══════════╝ The timestamp at which a request will be eligible to be timed out
  }
}

File 7 of 11 : ConfirmedOwner.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {ConfirmedOwnerWithProposal} from "./ConfirmedOwnerWithProposal.sol";

/// @title The ConfirmedOwner contract
/// @notice A contract with helpers for basic contract ownership.
contract ConfirmedOwner is ConfirmedOwnerWithProposal {
  constructor(address newOwner) ConfirmedOwnerWithProposal(newOwner, address(0)) {}
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IOwnable} from "../interfaces/IOwnable.sol";

/// @title The ConfirmedOwner contract
/// @notice A contract with helpers for basic contract ownership.
contract ConfirmedOwnerWithProposal is IOwnable {
  address private s_owner;
  address private s_pendingOwner;

  event OwnershipTransferRequested(address indexed from, address indexed to);
  event OwnershipTransferred(address indexed from, address indexed to);

  constructor(address newOwner, address pendingOwner) {
    // solhint-disable-next-line gas-custom-errors
    require(newOwner != address(0), "Cannot set owner to zero");

    s_owner = newOwner;
    if (pendingOwner != address(0)) {
      _transferOwnership(pendingOwner);
    }
  }

  /// @notice Allows an owner to begin transferring ownership to a new address.
  function transferOwnership(address to) public override onlyOwner {
    _transferOwnership(to);
  }

  /// @notice Allows an ownership transfer to be completed by the recipient.
  function acceptOwnership() external override {
    // solhint-disable-next-line gas-custom-errors
    require(msg.sender == s_pendingOwner, "Must be proposed owner");

    address oldOwner = s_owner;
    s_owner = msg.sender;
    s_pendingOwner = address(0);

    emit OwnershipTransferred(oldOwner, msg.sender);
  }

  /// @notice Get the current owner
  function owner() public view override returns (address) {
    return s_owner;
  }

  /// @notice validate, transfer ownership, and emit relevant events
  function _transferOwnership(address to) private {
    // solhint-disable-next-line gas-custom-errors
    require(to != msg.sender, "Cannot transfer to self");

    s_pendingOwner = to;

    emit OwnershipTransferRequested(s_owner, to);
  }

  /// @notice validate access
  function _validateOwnership() internal view {
    // solhint-disable-next-line gas-custom-errors
    require(msg.sender == s_owner, "Only callable by owner");
  }

  /// @notice Reverts if called by anyone other than the contract owner.
  modifier onlyOwner() {
    _validateOwnership();
    _;
  }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IOwnable {
  function owner() external returns (address);

  function transferOwnership(address recipient) external;

  function acceptOwnership() external;
}

// SPDX-License-Identifier: BSD-2-Clause
pragma solidity ^0.8.4;

/**
* @dev A library for working with mutable byte buffers in Solidity.
*
* Byte buffers are mutable and expandable, and provide a variety of primitives
* for appending to them. At any time you can fetch a bytes object containing the
* current contents of the buffer. The bytes object should not be stored between
* operations, as it may change due to resizing of the buffer.
*/
library Buffer {
    /**
    * @dev Represents a mutable buffer. Buffers have a current value (buf) and
    *      a capacity. The capacity may be longer than the current value, in
    *      which case it can be extended without the need to allocate more memory.
    */
    struct buffer {
        bytes buf;
        uint capacity;
    }

    /**
    * @dev Initializes a buffer with an initial capacity.
    * @param buf The buffer to initialize.
    * @param capacity The number of bytes of space to allocate the buffer.
    * @return The buffer, for chaining.
    */
    function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {
        if (capacity % 32 != 0) {
            capacity += 32 - (capacity % 32);
        }
        // Allocate space for the buffer data
        buf.capacity = capacity;
        assembly {
            let ptr := mload(0x40)
            mstore(buf, ptr)
            mstore(ptr, 0)
            let fpm := add(32, add(ptr, capacity))
            if lt(fpm, ptr) {
                revert(0, 0)
            }
            mstore(0x40, fpm)
        }
        return buf;
    }

    /**
    * @dev Initializes a new buffer from an existing bytes object.
    *      Changes to the buffer may mutate the original value.
    * @param b The bytes object to initialize the buffer with.
    * @return A new buffer.
    */
    function fromBytes(bytes memory b) internal pure returns(buffer memory) {
        buffer memory buf;
        buf.buf = b;
        buf.capacity = b.length;
        return buf;
    }

    function resize(buffer memory buf, uint capacity) private pure {
        bytes memory oldbuf = buf.buf;
        init(buf, capacity);
        append(buf, oldbuf);
    }

    /**
    * @dev Sets buffer length to 0.
    * @param buf The buffer to truncate.
    * @return The original buffer, for chaining..
    */
    function truncate(buffer memory buf) internal pure returns (buffer memory) {
        assembly {
            let bufptr := mload(buf)
            mstore(bufptr, 0)
        }
        return buf;
    }

    /**
    * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed
    *      the capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @param len The number of bytes to copy.
    * @return The original buffer, for chaining.
    */
    function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {
        require(len <= data.length);

        uint off = buf.buf.length;
        uint newCapacity = off + len;
        if (newCapacity > buf.capacity) {
            resize(buf, newCapacity * 2);
        }

        uint dest;
        uint src;
        assembly {
            // Memory address of the buffer data
            let bufptr := mload(buf)
            // Length of existing buffer data
            let buflen := mload(bufptr)
            // Start address = buffer address + offset + sizeof(buffer length)
            dest := add(add(bufptr, 32), off)
            // Update buffer length if we're extending it
            if gt(newCapacity, buflen) {
                mstore(bufptr, newCapacity)
            }
            src := add(data, 32)
        }

        // Copy word-length chunks while possible
        for (; len >= 32; len -= 32) {
            assembly {
                mstore(dest, mload(src))
            }
            dest += 32;
            src += 32;
        }

        // Copy remaining bytes
        unchecked {
            uint mask = (256 ** (32 - len)) - 1;
            assembly {
                let srcpart := and(mload(src), not(mask))
                let destpart := and(mload(dest), mask)
                mstore(dest, or(destpart, srcpart))
            }
        }

        return buf;
    }

    /**
    * @dev Appends a byte string to a buffer. Resizes if doing so would exceed
    *      the capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @return The original buffer, for chaining.
    */
    function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {
        return append(buf, data, data.length);
    }

    /**
    * @dev Appends a byte to the buffer. Resizes if doing so would exceed the
    *      capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @return The original buffer, for chaining.
    */
    function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {
        uint off = buf.buf.length;
        uint offPlusOne = off + 1;
        if (off >= buf.capacity) {
            resize(buf, offPlusOne * 2);
        }

        assembly {
            // Memory address of the buffer data
            let bufptr := mload(buf)
            // Address = buffer address + sizeof(buffer length) + off
            let dest := add(add(bufptr, off), 32)
            mstore8(dest, data)
            // Update buffer length if we extended it
            if gt(offPlusOne, mload(bufptr)) {
                mstore(bufptr, offPlusOne)
            }
        }

        return buf;
    }

    /**
    * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would
    *      exceed the capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @param len The number of bytes to write (left-aligned).
    * @return The original buffer, for chaining.
    */
    function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {
        uint off = buf.buf.length;
        uint newCapacity = len + off;
        if (newCapacity > buf.capacity) {
            resize(buf, newCapacity * 2);
        }

        unchecked {
            uint mask = (256 ** len) - 1;
            // Right-align data
            data = data >> (8 * (32 - len));
            assembly {
                // Memory address of the buffer data
                let bufptr := mload(buf)
                // Address = buffer address + sizeof(buffer length) + newCapacity
                let dest := add(bufptr, newCapacity)
                mstore(dest, or(and(mload(dest), not(mask)), data))
                // Update buffer length if we extended it
                if gt(newCapacity, mload(bufptr)) {
                    mstore(bufptr, newCapacity)
                }
            }
        }
        return buf;
    }

    /**
    * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed
    *      the capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @return The original buffer, for chhaining.
    */
    function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {
        return append(buf, bytes32(data), 20);
    }

    /**
    * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed
    *      the capacity of the buffer.
    * @param buf The buffer to append to.
    * @param data The data to append.
    * @return The original buffer, for chaining.
    */
    function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {
        return append(buf, data, 32);
    }

    /**
     * @dev Appends a byte to the end of the buffer. Resizes if doing so would
     *      exceed the capacity of the buffer.
     * @param buf The buffer to append to.
     * @param data The data to append.
     * @param len The number of bytes to write (right-aligned).
     * @return The original buffer.
     */
    function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {
        uint off = buf.buf.length;
        uint newCapacity = len + off;
        if (newCapacity > buf.capacity) {
            resize(buf, newCapacity * 2);
        }

        uint mask = (256 ** len) - 1;
        assembly {
            // Memory address of the buffer data
            let bufptr := mload(buf)
            // Address = buffer address + sizeof(buffer length) + newCapacity
            let dest := add(bufptr, newCapacity)
            mstore(dest, or(and(mload(dest), not(mask)), data))
            // Update buffer length if we extended it
            if gt(newCapacity, mload(bufptr)) {
                mstore(bufptr, newCapacity)
            }
        }
        return buf;
    }
}

File 11 of 11 : CBOR.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../../@ensdomains/buffer/v0.1.0/Buffer.sol";

/**
* @dev A library for populating CBOR encoded payload in Solidity.
*
* https://datatracker.ietf.org/doc/html/rfc7049
*
* The library offers various write* and start* methods to encode values of different types.
* The resulted buffer can be obtained with data() method.
* Encoding of primitive types is staightforward, whereas encoding of sequences can result
* in an invalid CBOR if start/write/end flow is violated.
* For the purpose of gas saving, the library does not verify start/write/end flow internally,
* except for nested start/end pairs.
*/

library CBOR {
    using Buffer for Buffer.buffer;

    struct CBORBuffer {
        Buffer.buffer buf;
        uint256 depth;
    }

    uint8 private constant MAJOR_TYPE_INT = 0;
    uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1;
    uint8 private constant MAJOR_TYPE_BYTES = 2;
    uint8 private constant MAJOR_TYPE_STRING = 3;
    uint8 private constant MAJOR_TYPE_ARRAY = 4;
    uint8 private constant MAJOR_TYPE_MAP = 5;
    uint8 private constant MAJOR_TYPE_TAG = 6;
    uint8 private constant MAJOR_TYPE_CONTENT_FREE = 7;

    uint8 private constant TAG_TYPE_BIGNUM = 2;
    uint8 private constant TAG_TYPE_NEGATIVE_BIGNUM = 3;

    uint8 private constant CBOR_FALSE = 20;
    uint8 private constant CBOR_TRUE = 21;
    uint8 private constant CBOR_NULL = 22;
    uint8 private constant CBOR_UNDEFINED = 23;

    function create(uint256 capacity) internal pure returns(CBORBuffer memory cbor) {
        Buffer.init(cbor.buf, capacity);
        cbor.depth = 0;
        return cbor;
    }

    function data(CBORBuffer memory buf) internal pure returns(bytes memory) {
        require(buf.depth == 0, "Invalid CBOR");
        return buf.buf.buf;
    }

    function writeUInt256(CBORBuffer memory buf, uint256 value) internal pure {
        buf.buf.appendUint8(uint8((MAJOR_TYPE_TAG << 5) | TAG_TYPE_BIGNUM));
        writeBytes(buf, abi.encode(value));
    }

    function writeInt256(CBORBuffer memory buf, int256 value) internal pure {
        if (value < 0) {
            buf.buf.appendUint8(
                uint8((MAJOR_TYPE_TAG << 5) | TAG_TYPE_NEGATIVE_BIGNUM)
            );
            writeBytes(buf, abi.encode(uint256(-1 - value)));
        } else {
            writeUInt256(buf, uint256(value));
        }
    }

    function writeUInt64(CBORBuffer memory buf, uint64 value) internal pure {
        writeFixedNumeric(buf, MAJOR_TYPE_INT, value);
    }

    function writeInt64(CBORBuffer memory buf, int64 value) internal pure {
        if(value >= 0) {
            writeFixedNumeric(buf, MAJOR_TYPE_INT, uint64(value));
        } else{
            writeFixedNumeric(buf, MAJOR_TYPE_NEGATIVE_INT, uint64(-1 - value));
        }
    }

    function writeBytes(CBORBuffer memory buf, bytes memory value) internal pure {
        writeFixedNumeric(buf, MAJOR_TYPE_BYTES, uint64(value.length));
        buf.buf.append(value);
    }

    function writeString(CBORBuffer memory buf, string memory value) internal pure {
        writeFixedNumeric(buf, MAJOR_TYPE_STRING, uint64(bytes(value).length));
        buf.buf.append(bytes(value));
    }

    function writeBool(CBORBuffer memory buf, bool value) internal pure {
        writeContentFree(buf, value ? CBOR_TRUE : CBOR_FALSE);
    }

    function writeNull(CBORBuffer memory buf) internal pure {
        writeContentFree(buf, CBOR_NULL);
    }

    function writeUndefined(CBORBuffer memory buf) internal pure {
        writeContentFree(buf, CBOR_UNDEFINED);
    }

    function startArray(CBORBuffer memory buf) internal pure {
        writeIndefiniteLengthType(buf, MAJOR_TYPE_ARRAY);
        buf.depth += 1;
    }

    function startFixedArray(CBORBuffer memory buf, uint64 length) internal pure {
        writeDefiniteLengthType(buf, MAJOR_TYPE_ARRAY, length);
    }

    function startMap(CBORBuffer memory buf) internal pure {
        writeIndefiniteLengthType(buf, MAJOR_TYPE_MAP);
        buf.depth += 1;
    }

    function startFixedMap(CBORBuffer memory buf, uint64 length) internal pure {
        writeDefiniteLengthType(buf, MAJOR_TYPE_MAP, length);
    }

    function endSequence(CBORBuffer memory buf) internal pure {
        writeIndefiniteLengthType(buf, MAJOR_TYPE_CONTENT_FREE);
        buf.depth -= 1;
    }

    function writeKVString(CBORBuffer memory buf, string memory key, string memory value) internal pure {
        writeString(buf, key);
        writeString(buf, value);
    }

    function writeKVBytes(CBORBuffer memory buf, string memory key, bytes memory value) internal pure {
        writeString(buf, key);
        writeBytes(buf, value);
    }

    function writeKVUInt256(CBORBuffer memory buf, string memory key, uint256 value) internal pure {
        writeString(buf, key);
        writeUInt256(buf, value);
    }

    function writeKVInt256(CBORBuffer memory buf, string memory key, int256 value) internal pure {
        writeString(buf, key);
        writeInt256(buf, value);
    }

    function writeKVUInt64(CBORBuffer memory buf, string memory key, uint64 value) internal pure {
        writeString(buf, key);
        writeUInt64(buf, value);
    }

    function writeKVInt64(CBORBuffer memory buf, string memory key, int64 value) internal pure {
        writeString(buf, key);
        writeInt64(buf, value);
    }

    function writeKVBool(CBORBuffer memory buf, string memory key, bool value) internal pure {
        writeString(buf, key);
        writeBool(buf, value);
    }

    function writeKVNull(CBORBuffer memory buf, string memory key) internal pure {
        writeString(buf, key);
        writeNull(buf);
    }

    function writeKVUndefined(CBORBuffer memory buf, string memory key) internal pure {
        writeString(buf, key);
        writeUndefined(buf);
    }

    function writeKVMap(CBORBuffer memory buf, string memory key) internal pure {
        writeString(buf, key);
        startMap(buf);
    }

    function writeKVArray(CBORBuffer memory buf, string memory key) internal pure {
        writeString(buf, key);
        startArray(buf);
    }

    function writeFixedNumeric(
        CBORBuffer memory buf,
        uint8 major,
        uint64 value
    ) private pure {
        if (value <= 23) {
            buf.buf.appendUint8(uint8((major << 5) | value));
        } else if (value <= 0xFF) {
            buf.buf.appendUint8(uint8((major << 5) | 24));
            buf.buf.appendInt(value, 1);
        } else if (value <= 0xFFFF) {
            buf.buf.appendUint8(uint8((major << 5) | 25));
            buf.buf.appendInt(value, 2);
        } else if (value <= 0xFFFFFFFF) {
            buf.buf.appendUint8(uint8((major << 5) | 26));
            buf.buf.appendInt(value, 4);
        } else {
            buf.buf.appendUint8(uint8((major << 5) | 27));
            buf.buf.appendInt(value, 8);
        }
    }

    function writeIndefiniteLengthType(CBORBuffer memory buf, uint8 major)
        private
        pure
    {
        buf.buf.appendUint8(uint8((major << 5) | 31));
    }

    function writeDefiniteLengthType(CBORBuffer memory buf, uint8 major, uint64 length)
        private
        pure
    {
        writeFixedNumeric(buf, major, length);
    }

    function writeContentFree(CBORBuffer memory buf, uint8 value) private pure {
        buf.buf.appendUint8(uint8((MAJOR_TYPE_CONTENT_FREE << 5) | value));
    }
}

Settings
{
  "evmVersion": "paris",
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes32","name":"_donId","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EmptyArgs","type":"error"},{"inputs":[],"name":"EmptySource","type":"error"},{"inputs":[],"name":"NoInlineSecrets","type":"error"},{"inputs":[],"name":"OnlyRouterCanFulfill","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"RequestFulfilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"RequestSent","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"donId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"bytes","name":"response","type":"bytes"},{"internalType":"bytes","name":"err","type":"bytes"}],"name":"handleOracleFulfillment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"s_lastError","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"s_lastRequestId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"s_lastResponse","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"source","type":"string"},{"internalType":"enum FunctionsRequest.Location","name":"secretsLocation","type":"uint8"},{"internalType":"bytes","name":"encryptedSecretsReference","type":"bytes"},{"internalType":"string[]","name":"args","type":"string[]"},{"internalType":"bytes[]","name":"bytesArgs","type":"bytes[]"},{"internalType":"uint64","name":"subscriptionId","type":"uint64"},{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"}],"name":"sendRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newDonId","type":"bytes32"}],"name":"setDonId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040523480156200001157600080fd5b5060405162001a1838038062001a18833981016040819052620000349162000183565b6001600160a01b0382166080523380600081620000985760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000cb57620000cb81620000d8565b50505060025550620001bf565b336001600160a01b03821603620001325760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c6600000000000000000060448201526064016200008f565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600080604083850312156200019757600080fd5b82516001600160a01b0381168114620001af57600080fd5b6020939093015192949293505050565b608051611836620001e26000396000818161018501526109d301526118366000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c806379ba5097116100765780638dbe7b9d1161005b5780638dbe7b9d14610147578063b1e217491461015e578063f2fde38b1461016757600080fd5b806379ba5097146101245780638da5cb5b1461012c57600080fd5b80633944ea3a116100a75780633944ea3a146100eb5780634b0795a81461010957806378ca5de71461011157600080fd5b80630ca76175146100c3578063231c1619146100d8575b600080fd5b6100d66100d13660046110c5565b61017a565b005b6100d66100e6366004611200565b610217565b6100f361036a565b604051610100919061133d565b60405180910390f35b6100f36103f8565b6100d661011f366004611350565b610405565b6100d6610412565b6000546040516001600160a01b039091168152602001610100565b61015060025481565b604051908152602001610100565b61015060035481565b6100d6610175366004611369565b6104d5565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146101dc576040517fc6829f8300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101e78383836104e9565b60405183907f85e1543bf2f84fe80c6badbce3648c8539ad1df4d2b3d822938ca0538be727e690600090a2505050565b61021f610508565b6102606040805160e0810190915280600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b6102a76000808e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250879594939250506105649050565b602081018a60028111156102bd576102bd611392565b908160028111156102d0576102d0611392565b8152505088888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505050608082015285156103295761032961032287896113cc565b82906105fb565b83156103435761034361033c8587611459565b8290610625565b61035961034f8261064f565b84846002546109ce565b600355505050505050505050505050565b60048054610377906114c1565b80601f01602080910402602001604051908101604052809291908181526020018280546103a3906114c1565b80156103f05780601f106103c5576101008083540402835291602001916103f0565b820191906000526020600020905b8154815290600101906020018083116103d357829003601f168201915b505050505081565b60058054610377906114c1565b61040d610508565b600255565b6001546001600160a01b031633146104715760405162461bcd60e51b815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e65720000000000000000000060448201526064015b60405180910390fd5b600080543373ffffffffffffffffffffffffffffffffffffffff19808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6104dd610508565b6104e681610aa0565b50565b60046104f58382611549565b5060056105028282611549565b50505050565b6000546001600160a01b031633146105625760405162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e6572000000000000000000006044820152606401610468565b565b805160000361059f576040517f22ce3edd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b838360028111156105b2576105b2611392565b908160028111156105c5576105c5611392565b905250604084018280156105db576105db611392565b908180156105eb576105eb611392565b9052506060909301929092525050565b805160000361061d5760405163fe936cb760e01b815260040160405180910390fd5b60a090910152565b80516000036106475760405163fe936cb760e01b815260040160405180910390fd5b60c090910152565b6060600061065e610100610b56565b90506106a86040518060400160405280600c81526020017f636f64654c6f636174696f6e000000000000000000000000000000000000000081525082610b7790919063ffffffff16565b82516106c69060028111156106bf576106bf611392565b8290610b95565b60408051808201909152600881527f6c616e67756167650000000000000000000000000000000000000000000000006020820152610705908290610b77565b604083015161071c9080156106bf576106bf611392565b60408051808201909152600681527f736f757263650000000000000000000000000000000000000000000000000000602082015261075b908290610b77565b606083015161076b908290610b77565b60a083015151156108185760408051808201909152600481527f617267730000000000000000000000000000000000000000000000000000000060208201526107b5908290610b77565b6107be81610bd2565b60005b8360a001515181101561080e576107fe8460a0015182815181106107e7576107e7611609565b602002602001015183610b7790919063ffffffff16565b61080781611635565b90506107c1565b5061081881610bf6565b608083015151156109195760008360200151600281111561083b5761083b611392565b03610872576040517fa80d31f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051808201909152600f81527f736563726574734c6f636174696f6e000000000000000000000000000000000060208201526108b1908290610b77565b6108ca836020015160028111156106bf576106bf611392565b60408051808201909152600781527f73656372657473000000000000000000000000000000000000000000000000006020820152610909908290610b77565b6080830151610919908290610c14565b60c083015151156109c65760408051808201909152600981527f62797465734172677300000000000000000000000000000000000000000000006020820152610963908290610b77565b61096c81610bd2565b60005b8360c00151518110156109bc576109ac8460c00151828151811061099557610995611609565b602002602001015183610c1490919063ffffffff16565b6109b581611635565b905061096f565b506109c681610bf6565b515192915050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663461d27628688600188886040518663ffffffff1660e01b8152600401610a2695949392919061164e565b6020604051808303816000875af1158015610a45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a699190611698565b60405190915081907f1131472297a800fee664d1d89cfa8f7676ff07189ecc53f80bbb5f4969099db890600090a295945050505050565b336001600160a01b03821603610af85760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606401610468565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b610b5e610fd1565b8051610b6a9083610c21565b5060006020820152919050565b610b848260038351610c9b565b8151610b909082610dbc565b505050565b8151610ba29060c2610de4565b50610bce8282604051602001610bba91815260200190565b604051602081830303815290604052610c14565b5050565b610bdd816004610e4d565b600181602001818151610bf091906116b1565b90525050565b610c01816007610e4d565b600181602001818151610bf091906116c4565b610b848260028351610c9b565b604080518082019091526060815260006020820152610c416020836116d7565b15610c6957610c516020836116d7565b610c5c9060206116c4565b610c6690836116b1565b91505b602080840183905260405180855260008152908184010181811015610c8d57600080fd5b604052508290505b92915050565b60178167ffffffffffffffff1611610cc25782516105029060e0600585901b168317610de4565b60ff8167ffffffffffffffff1611610d04578251610ceb906018611fe0600586901b1617610de4565b5082516105029067ffffffffffffffff83166001610e64565b61ffff8167ffffffffffffffff1611610d47578251610d2e906019611fe0600586901b1617610de4565b5082516105029067ffffffffffffffff83166002610e64565b63ffffffff8167ffffffffffffffff1611610d8c578251610d7390601a611fe0600586901b1617610de4565b5082516105029067ffffffffffffffff83166004610e64565b8251610da390601b611fe0600586901b1617610de4565b5082516105029067ffffffffffffffff83166008610e64565b604080518082019091526060815260006020820152610ddd83838451610ee9565b9392505050565b6040805180820190915260608152600060208201528251516000610e098260016116b1565b905084602001518210610e2a57610e2a85610e258360026116f9565b610fba565b8451602083820101858153508051821115610e43578181525b5093949350505050565b8151610b9090601f611fe0600585901b1617610de4565b6040805180820190915260608152600060208201528351516000610e8882856116b1565b90508560200151811115610ea557610ea586610e258360026116f9565b60006001610eb5866101006117f4565b610ebf91906116c4565b90508651828101878319825116178152508051831115610edd578281525b50959695505050505050565b6040805180820190915260608152600060208201528251821115610f0c57600080fd5b8351516000610f1b84836116b1565b90508560200151811115610f3857610f3886610e258360026116f9565b855180518382016020019160009180851115610f52578482525b505050602086015b60208610610f925780518252610f716020836116b1565b9150610f7e6020826116b1565b9050610f8b6020876116c4565b9550610f5a565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b8151610fc68383610c21565b506105028382610dbc565b6040518060400160405280610ff9604051806040016040528060608152602001600081525090565b8152602001600081525090565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561104557611045611006565b604052919050565b600067ffffffffffffffff83111561106757611067611006565b61107a601f8401601f191660200161101c565b905082815283838301111561108e57600080fd5b828260208301376000602084830101529392505050565b600082601f8301126110b657600080fd5b610ddd8383356020850161104d565b6000806000606084860312156110da57600080fd5b83359250602084013567ffffffffffffffff808211156110f957600080fd5b611105878388016110a5565b9350604086013591508082111561111b57600080fd5b50611128868287016110a5565b9150509250925092565b60008083601f84011261114457600080fd5b50813567ffffffffffffffff81111561115c57600080fd5b60208301915083602082850101111561117457600080fd5b9250929050565b80356003811061118a57600080fd5b919050565b60008083601f8401126111a157600080fd5b50813567ffffffffffffffff8111156111b957600080fd5b6020830191508360208260051b850101111561117457600080fd5b803567ffffffffffffffff8116811461118a57600080fd5b803563ffffffff8116811461118a57600080fd5b600080600080600080600080600080600060e08c8e03121561122157600080fd5b67ffffffffffffffff808d35111561123857600080fd5b6112458e8e358f01611132565b909c509a5061125660208e0161117b565b99508060408e0135111561126957600080fd5b6112798e60408f01358f01611132565b909950975060608d013581101561128f57600080fd5b61129f8e60608f01358f0161118f565b909750955060808d01358110156112b557600080fd5b506112c68d60808e01358e0161118f565b90945092506112d760a08d016111d4565b91506112e560c08d016111ec565b90509295989b509295989b9093969950565b6000815180845260005b8181101561131d57602081850181015186830182015201611301565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610ddd60208301846112f7565b60006020828403121561136257600080fd5b5035919050565b60006020828403121561137b57600080fd5b81356001600160a01b0381168114610ddd57600080fd5b634e487b7160e01b600052602160045260246000fd5b600067ffffffffffffffff8211156113c2576113c2611006565b5060051b60200190565b60006113df6113da846113a8565b61101c565b80848252602080830192508560051b8501368111156113fd57600080fd5b855b8181101561144d57803567ffffffffffffffff81111561141f5760008081fd5b870136601f8201126114315760008081fd5b61143f36823586840161104d565b8652509382019382016113ff565b50919695505050505050565b60006114676113da846113a8565b80848252602080830192508560051b85013681111561148557600080fd5b855b8181101561144d57803567ffffffffffffffff8111156114a75760008081fd5b6114b336828a016110a5565b865250938201938201611487565b600181811c908216806114d557607f821691505b6020821081036114f557634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610b9057600081815260208120601f850160051c810160208610156115225750805b601f850160051c820191505b818110156115415782815560010161152e565b505050505050565b815167ffffffffffffffff81111561156357611563611006565b6115778161157184546114c1565b846114fb565b602080601f8311600181146115ac57600084156115945750858301515b600019600386901b1c1916600185901b178555611541565b600085815260208120601f198616915b828110156115db578886015182559484019460019091019084016115bc565b50858210156115f95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016116475761164761161f565b5060010190565b67ffffffffffffffff8616815260a06020820152600061167160a08301876112f7565b61ffff9590951660408301525063ffffffff92909216606083015260809091015292915050565b6000602082840312156116aa57600080fd5b5051919050565b80820180821115610c9557610c9561161f565b81810381811115610c9557610c9561161f565b6000826116f457634e487b7160e01b600052601260045260246000fd5b500690565b8082028115828204841417610c9557610c9561161f565b600181815b8085111561174b5781600019048211156117315761173161161f565b8085161561173e57918102915b93841c9390800290611715565b509250929050565b60008261176257506001610c95565b8161176f57506000610c95565b8160018114611785576002811461178f576117ab565b6001915050610c95565b60ff8411156117a0576117a061161f565b50506001821b610c95565b5060208310610133831016604e8410600b84101617156117ce575081810a610c95565b6117d88383611710565b80600019048211156117ec576117ec61161f565b029392505050565b6000610ddd838361175356fea2646970667358221220ac5df61a27639c4cd68f3fa4aa096c3c61e7491e4b1f85bd822d7c3d0a61323f64736f6c63430008130033000000000000000000000000aa8aaa682c9ef150c0c8e96a8d60945bcb21faad66756e2d6f7074696d69736d2d6d61696e6e65742d3100000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100be5760003560e01c806379ba5097116100765780638dbe7b9d1161005b5780638dbe7b9d14610147578063b1e217491461015e578063f2fde38b1461016757600080fd5b806379ba5097146101245780638da5cb5b1461012c57600080fd5b80633944ea3a116100a75780633944ea3a146100eb5780634b0795a81461010957806378ca5de71461011157600080fd5b80630ca76175146100c3578063231c1619146100d8575b600080fd5b6100d66100d13660046110c5565b61017a565b005b6100d66100e6366004611200565b610217565b6100f361036a565b604051610100919061133d565b60405180910390f35b6100f36103f8565b6100d661011f366004611350565b610405565b6100d6610412565b6000546040516001600160a01b039091168152602001610100565b61015060025481565b604051908152602001610100565b61015060035481565b6100d6610175366004611369565b6104d5565b336001600160a01b037f000000000000000000000000aa8aaa682c9ef150c0c8e96a8d60945bcb21faad16146101dc576040517fc6829f8300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101e78383836104e9565b60405183907f85e1543bf2f84fe80c6badbce3648c8539ad1df4d2b3d822938ca0538be727e690600090a2505050565b61021f610508565b6102606040805160e0810190915280600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b6102a76000808e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250879594939250506105649050565b602081018a60028111156102bd576102bd611392565b908160028111156102d0576102d0611392565b8152505088888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505050608082015285156103295761032961032287896113cc565b82906105fb565b83156103435761034361033c8587611459565b8290610625565b61035961034f8261064f565b84846002546109ce565b600355505050505050505050505050565b60048054610377906114c1565b80601f01602080910402602001604051908101604052809291908181526020018280546103a3906114c1565b80156103f05780601f106103c5576101008083540402835291602001916103f0565b820191906000526020600020905b8154815290600101906020018083116103d357829003601f168201915b505050505081565b60058054610377906114c1565b61040d610508565b600255565b6001546001600160a01b031633146104715760405162461bcd60e51b815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e65720000000000000000000060448201526064015b60405180910390fd5b600080543373ffffffffffffffffffffffffffffffffffffffff19808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6104dd610508565b6104e681610aa0565b50565b60046104f58382611549565b5060056105028282611549565b50505050565b6000546001600160a01b031633146105625760405162461bcd60e51b815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e6572000000000000000000006044820152606401610468565b565b805160000361059f576040517f22ce3edd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b838360028111156105b2576105b2611392565b908160028111156105c5576105c5611392565b905250604084018280156105db576105db611392565b908180156105eb576105eb611392565b9052506060909301929092525050565b805160000361061d5760405163fe936cb760e01b815260040160405180910390fd5b60a090910152565b80516000036106475760405163fe936cb760e01b815260040160405180910390fd5b60c090910152565b6060600061065e610100610b56565b90506106a86040518060400160405280600c81526020017f636f64654c6f636174696f6e000000000000000000000000000000000000000081525082610b7790919063ffffffff16565b82516106c69060028111156106bf576106bf611392565b8290610b95565b60408051808201909152600881527f6c616e67756167650000000000000000000000000000000000000000000000006020820152610705908290610b77565b604083015161071c9080156106bf576106bf611392565b60408051808201909152600681527f736f757263650000000000000000000000000000000000000000000000000000602082015261075b908290610b77565b606083015161076b908290610b77565b60a083015151156108185760408051808201909152600481527f617267730000000000000000000000000000000000000000000000000000000060208201526107b5908290610b77565b6107be81610bd2565b60005b8360a001515181101561080e576107fe8460a0015182815181106107e7576107e7611609565b602002602001015183610b7790919063ffffffff16565b61080781611635565b90506107c1565b5061081881610bf6565b608083015151156109195760008360200151600281111561083b5761083b611392565b03610872576040517fa80d31f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051808201909152600f81527f736563726574734c6f636174696f6e000000000000000000000000000000000060208201526108b1908290610b77565b6108ca836020015160028111156106bf576106bf611392565b60408051808201909152600781527f73656372657473000000000000000000000000000000000000000000000000006020820152610909908290610b77565b6080830151610919908290610c14565b60c083015151156109c65760408051808201909152600981527f62797465734172677300000000000000000000000000000000000000000000006020820152610963908290610b77565b61096c81610bd2565b60005b8360c00151518110156109bc576109ac8460c00151828151811061099557610995611609565b602002602001015183610c1490919063ffffffff16565b6109b581611635565b905061096f565b506109c681610bf6565b515192915050565b6000807f000000000000000000000000aa8aaa682c9ef150c0c8e96a8d60945bcb21faad6001600160a01b031663461d27628688600188886040518663ffffffff1660e01b8152600401610a2695949392919061164e565b6020604051808303816000875af1158015610a45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a699190611698565b60405190915081907f1131472297a800fee664d1d89cfa8f7676ff07189ecc53f80bbb5f4969099db890600090a295945050505050565b336001600160a01b03821603610af85760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606401610468565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b610b5e610fd1565b8051610b6a9083610c21565b5060006020820152919050565b610b848260038351610c9b565b8151610b909082610dbc565b505050565b8151610ba29060c2610de4565b50610bce8282604051602001610bba91815260200190565b604051602081830303815290604052610c14565b5050565b610bdd816004610e4d565b600181602001818151610bf091906116b1565b90525050565b610c01816007610e4d565b600181602001818151610bf091906116c4565b610b848260028351610c9b565b604080518082019091526060815260006020820152610c416020836116d7565b15610c6957610c516020836116d7565b610c5c9060206116c4565b610c6690836116b1565b91505b602080840183905260405180855260008152908184010181811015610c8d57600080fd5b604052508290505b92915050565b60178167ffffffffffffffff1611610cc25782516105029060e0600585901b168317610de4565b60ff8167ffffffffffffffff1611610d04578251610ceb906018611fe0600586901b1617610de4565b5082516105029067ffffffffffffffff83166001610e64565b61ffff8167ffffffffffffffff1611610d47578251610d2e906019611fe0600586901b1617610de4565b5082516105029067ffffffffffffffff83166002610e64565b63ffffffff8167ffffffffffffffff1611610d8c578251610d7390601a611fe0600586901b1617610de4565b5082516105029067ffffffffffffffff83166004610e64565b8251610da390601b611fe0600586901b1617610de4565b5082516105029067ffffffffffffffff83166008610e64565b604080518082019091526060815260006020820152610ddd83838451610ee9565b9392505050565b6040805180820190915260608152600060208201528251516000610e098260016116b1565b905084602001518210610e2a57610e2a85610e258360026116f9565b610fba565b8451602083820101858153508051821115610e43578181525b5093949350505050565b8151610b9090601f611fe0600585901b1617610de4565b6040805180820190915260608152600060208201528351516000610e8882856116b1565b90508560200151811115610ea557610ea586610e258360026116f9565b60006001610eb5866101006117f4565b610ebf91906116c4565b90508651828101878319825116178152508051831115610edd578281525b50959695505050505050565b6040805180820190915260608152600060208201528251821115610f0c57600080fd5b8351516000610f1b84836116b1565b90508560200151811115610f3857610f3886610e258360026116f9565b855180518382016020019160009180851115610f52578482525b505050602086015b60208610610f925780518252610f716020836116b1565b9150610f7e6020826116b1565b9050610f8b6020876116c4565b9550610f5a565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b8151610fc68383610c21565b506105028382610dbc565b6040518060400160405280610ff9604051806040016040528060608152602001600081525090565b8152602001600081525090565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561104557611045611006565b604052919050565b600067ffffffffffffffff83111561106757611067611006565b61107a601f8401601f191660200161101c565b905082815283838301111561108e57600080fd5b828260208301376000602084830101529392505050565b600082601f8301126110b657600080fd5b610ddd8383356020850161104d565b6000806000606084860312156110da57600080fd5b83359250602084013567ffffffffffffffff808211156110f957600080fd5b611105878388016110a5565b9350604086013591508082111561111b57600080fd5b50611128868287016110a5565b9150509250925092565b60008083601f84011261114457600080fd5b50813567ffffffffffffffff81111561115c57600080fd5b60208301915083602082850101111561117457600080fd5b9250929050565b80356003811061118a57600080fd5b919050565b60008083601f8401126111a157600080fd5b50813567ffffffffffffffff8111156111b957600080fd5b6020830191508360208260051b850101111561117457600080fd5b803567ffffffffffffffff8116811461118a57600080fd5b803563ffffffff8116811461118a57600080fd5b600080600080600080600080600080600060e08c8e03121561122157600080fd5b67ffffffffffffffff808d35111561123857600080fd5b6112458e8e358f01611132565b909c509a5061125660208e0161117b565b99508060408e0135111561126957600080fd5b6112798e60408f01358f01611132565b909950975060608d013581101561128f57600080fd5b61129f8e60608f01358f0161118f565b909750955060808d01358110156112b557600080fd5b506112c68d60808e01358e0161118f565b90945092506112d760a08d016111d4565b91506112e560c08d016111ec565b90509295989b509295989b9093969950565b6000815180845260005b8181101561131d57602081850181015186830182015201611301565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610ddd60208301846112f7565b60006020828403121561136257600080fd5b5035919050565b60006020828403121561137b57600080fd5b81356001600160a01b0381168114610ddd57600080fd5b634e487b7160e01b600052602160045260246000fd5b600067ffffffffffffffff8211156113c2576113c2611006565b5060051b60200190565b60006113df6113da846113a8565b61101c565b80848252602080830192508560051b8501368111156113fd57600080fd5b855b8181101561144d57803567ffffffffffffffff81111561141f5760008081fd5b870136601f8201126114315760008081fd5b61143f36823586840161104d565b8652509382019382016113ff565b50919695505050505050565b60006114676113da846113a8565b80848252602080830192508560051b85013681111561148557600080fd5b855b8181101561144d57803567ffffffffffffffff8111156114a75760008081fd5b6114b336828a016110a5565b865250938201938201611487565b600181811c908216806114d557607f821691505b6020821081036114f557634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610b9057600081815260208120601f850160051c810160208610156115225750805b601f850160051c820191505b818110156115415782815560010161152e565b505050505050565b815167ffffffffffffffff81111561156357611563611006565b6115778161157184546114c1565b846114fb565b602080601f8311600181146115ac57600084156115945750858301515b600019600386901b1c1916600185901b178555611541565b600085815260208120601f198616915b828110156115db578886015182559484019460019091019084016115bc565b50858210156115f95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016116475761164761161f565b5060010190565b67ffffffffffffffff8616815260a06020820152600061167160a08301876112f7565b61ffff9590951660408301525063ffffffff92909216606083015260809091015292915050565b6000602082840312156116aa57600080fd5b5051919050565b80820180821115610c9557610c9561161f565b81810381811115610c9557610c9561161f565b6000826116f457634e487b7160e01b600052601260045260246000fd5b500690565b8082028115828204841417610c9557610c9561161f565b600181815b8085111561174b5781600019048211156117315761173161161f565b8085161561173e57918102915b93841c9390800290611715565b509250929050565b60008261176257506001610c95565b8161176f57506000610c95565b8160018114611785576002811461178f576117ab565b6001915050610c95565b60ff8411156117a0576117a061161f565b50506001821b610c95565b5060208310610133831016604e8410600b84101617156117ce575081810a610c95565b6117d88383611710565b80600019048211156117ec576117ec61161f565b029392505050565b6000610ddd838361175356fea2646970667358221220ac5df61a27639c4cd68f3fa4aa096c3c61e7491e4b1f85bd822d7c3d0a61323f64736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000aa8aaa682c9ef150c0c8e96a8d60945bcb21faad66756e2d6f7074696d69736d2d6d61696e6e65742d3100000000000000000000

-----Decoded View---------------
Arg [0] : router (address): 0xaA8AaA682C9eF150C0C8E96a8D60945BCB21faad
Arg [1] : _donId (bytes32): 0x66756e2d6f7074696d69736d2d6d61696e6e65742d3100000000000000000000

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000aa8aaa682c9ef150c0c8e96a8d60945bcb21faad
Arg [1] : 66756e2d6f7074696d69736d2d6d61696e6e65742d3100000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.