Actions

AccessControlledOffchainAggregator Deployment: Difference between revisions

From Chainlink Community Wiki

No edit summary
No edit summary
Line 74: Line 74:
* <code>'''_LINKGWEIPEROBSERVATION'''</code> : This is the fourth billing value; It sets the amount of LINK (in gwei) to pay to all Chainlink Nodes that participate in reaching an agreed upon value of the asset.
* <code>'''_LINKGWEIPEROBSERVATION'''</code> : This is the fourth billing value; It sets the amount of LINK (in gwei) to pay to all Chainlink Nodes that participate in reaching an agreed upon value of the asset.
* <code>'''_LINKGWEIPERTRANSMISSION'''</code> : This is the final billing value.  It sets the transmission "bonus" that he transmitter receives for getting the collection of observations written on-chain.
* <code>'''_LINKGWEIPERTRANSMISSION'''</code> : This is the final billing value.  It sets the transmission "bonus" that he transmitter receives for getting the collection of observations written on-chain.
* <code>_LINK</code> : This is the LINK token contract address for the chain that the feed runs on.
* <code>_LINK</code> : This is the LINK token contract address for the chain that the feed runs on.  [[LINK Token Address Index|Full list of supported LINK contract addresses available here]].
* <code>_MINANSWER</code> : This is the minimum value that the contract will accept.  This value is dependent upon the <code>_decimals</code> variable.  If you have it set to <code>1000000</code> with <code>8</code> decimals, the lowest value it will accept is <code>0.01</code>
* <code>_MINANSWER</code> : This is the minimum value that the contract will accept.  This value is dependent upon the <code>_decimals</code> variable.  If you have it set to <code>1000000</code> with <code>8</code> decimals, the lowest value it will accept is <code>0.01</code>
* <code>_MAXANSWER</code> : This is the maximum value that the contract will accept.  This value is dependent upon the <code>_decimals</code> variable.  If you have it set to <code>100000000000</code> with <code>8</code> decimals, the largest value it will accept is <code>1000.00</code>
* <code>_MAXANSWER</code> : This is the maximum value that the contract will accept.  This value is dependent upon the <code>_decimals</code> variable.  If you have it set to <code>100000000000</code> with <code>8</code> decimals, the largest value it will accept is <code>1000.00</code>

Revision as of 15:21, 30 May 2022

The purpose of this page is to provide highly detailed instructions on how to deploy the AccessControlledOffchainAggregator.sol contract

Deploying the AccessControlledOffchainAggregator Via Remix

Import the Contract into Remix

Navigate to remix.ethereum.org

Once there, create a new doc by clicking on the little page icon

NewRemixProject.png

You can try to import the contract from github, but I've had mixed results from that.

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "https://github.com/DexTrac-Devlin/single-ocr/blob/main/condensed_AccessControlledOffchainAggregator.sol";

Due to the mixed experience I've had, this guide will assume that you have simply copy and pasted the flattened contract from the below link.

https://raw.githubusercontent.com/DexTrac-Devlin/single-ocr/main/condensed_AccessControlledOffchainAggregator.sol

It should look like the below image:

ImportedOCRContract.png

With the contract imported into remix, We'll need to compile it


Compile the Contract

Once Pasted into Remix, navigate to the Compile page.

NavigateToCompile.png


In the image above, you can see that the COMPILER version is 0.7.6+...

When deploying the AccessControlledOffchainAggregator.sol contract, we want to be sure that the version selected here is 0.7.6+commit.7338295f

With the correct version selected, go ahead and compile the contract by clicking the blue button with the circular arrows

RemixCompileButton.png

Once that succeeds, we can then deploy the contract.

Note: You'll likely see some Orange warning boxes when compiling. For the sake of this doc, we'll ignore those.


Deploy the Contract

With the contract compiled, we then need to navigate to the Deploy & run transactions tab

DeployContractPage.png

Once on the Deploy & run transactions tab, we want to be sure that we have the correct contract selected in the drop down menu

SelectAccessControlledOffchainAggregator.png

With the correct contract deployed, we'll want to open the drop down menu to the right of the Orange Deploy button.

ExpandDeploymentVariables.png

With the drop down expanded, we will want to populate the empty fields with the desired values.

OCRDeploymentVariables.png

The values in the above example are not recommended to deploy with. They're just place holder values. Additional context around each of the above values is below:

(the OCR Aggregators' billing values are in bold)

  • _MAXIMUMGASPRICE : This value is used by the contract when calculating the amount of LINK to reimburse for the transmission fee reimbursement -- it's a billing value. In this example, the contract will only reimburse up to 2000GWEI
  • _REASONABLEGASPRICE : This is another billing value. Any transmission that gets on-chain with a gas price below this value is compensated >100%. For example, if a transmission is broadcast at 20 gwei, the Chainlink Node that got the transmission on-chain will be reimbursed for 60 gwei.
  • _MICROLINKPERETH : This is also a billing value; It sets the price ratio of LINK to ETH used to reimburse for transmission costs.
  • _LINKGWEIPEROBSERVATION : This is the fourth billing value; It sets the amount of LINK (in gwei) to pay to all Chainlink Nodes that participate in reaching an agreed upon value of the asset.
  • _LINKGWEIPERTRANSMISSION : This is the final billing value. It sets the transmission "bonus" that he transmitter receives for getting the collection of observations written on-chain.
  • _LINK : This is the LINK token contract address for the chain that the feed runs on. Full list of supported LINK contract addresses available here.
  • _MINANSWER : This is the minimum value that the contract will accept. This value is dependent upon the _decimals variable. If you have it set to 1000000 with 8 decimals, the lowest value it will accept is 0.01
  • _MAXANSWER : This is the maximum value that the contract will accept. This value is dependent upon the _decimals variable. If you have it set to 100000000000 with 8 decimals, the largest value it will accept is 1000.00
  • _BILLINGACCESSCONTROLLER : This is the address of the SimpleWriteAccessController that is configured to control which address(es) are allowed to write changes to the OCR Aggregators' billing values provided above.
  • _REQUESTERACCESSCONTROLLER : This is teh address of the SimpleWriteAccessController that is configured to control with address(es) are allowed to transmit observations to the OCR Aggregator. You should whitelist all Chainlink Nodes' AccountAddresses that you want on the feed.
  • _DECIMALS : This is the number of decimal places used for the on-chain price. Reference the _MINANSWER and _MAXANSER above for examples.
  • DESCRIPTION : This is the friendly name of the Aggregator contract. An example would be LINK / USD for the the LINK / USD price feed.

Additional information regarding these values is available at the AccessControlledOffchainAggregator Reads page.

The LINK token contract addresses are available at the official Chainlink docs page as well as here in the wiki's LINK Token Contract Address Index.

Your _BILLINGACCESSCONTROLLER and _REQUESTERACCESSCONTROLLER addresses are the two SimpleWriteAccessController.sol contracts you had previously deployed.

Note:

Once you have populated all of those fields, go ahead and click Deploy!

DeployButton.png