Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = function (eleventyConfig) {
const rdmd = require('@readme/markdown');
const format = require('date-fns/format');
const htmlmin = require('html-minifier');

const embedYouTube = require('eleventy-plugin-youtube-embed');
eleventyConfig.setLibrary('md', { render: rdmd.html });
Expand All @@ -12,7 +13,24 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(embedYouTube);
eleventyConfig.addPassthroughCopy({ _src: '/' });

// Allow us to put rendered markdown in HTML
eleventyConfig.addPairedShortcode('markdown', (content) => {
return rdmd.html(content);
});

// Minify our build to save the bits
eleventyConfig.addTransform('htmlmin', function (content, outputPath) {
if (outputPath?.endsWith('.html')) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
});
return minified;
}

return content;
});
};
15 changes: 5 additions & 10 deletions _includes/main.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@
{% endif %}

<!-- Syntax Highlight-->
<link href="/prism.css" rel="stylesheet" type="text/css">
<script src="/prism.js"></script>
<script src="/tab.js"></script>
<script src="/sul.js"></script>


<link rel="preload" href="/prism.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/prism.css"></noscript>
<script src="/prism.js" defer></script>
<script src="/tab.js" defer></script>
<script src="/sul.js" defer></script>
<link href="/docs.css" rel="stylesheet" type="text/css">

<link href="https://assets-global.website-files.com/5f6b7190899f41fb70882d08/5fa97474da20bc75f63bfdc4_Chainlink-favicon-32.png" rel="shortcut icon" type="image/x-icon">
Expand Down Expand Up @@ -275,10 +274,6 @@
</div>
</div>
</footer>
<script
src="https://d3e54v103j8qbb.cloudfront.net/js/jquery-3.5.1.min.dc5e7f18c8.js?site=5f6b7190899f41fb70882d08"
type="text/javascript" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"></script>

<script>
var links = document.links;
Expand Down
2 changes: 1 addition & 1 deletion _includes/still-questions.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<a class="cl-button--ghost" href="https://github.com/smartcontractkit/chainlink">Github</a>
</div>
<h3>中文开发者社区</h3>
<img height="auto" src="https://files.readme.io/f639125-qr.png" width="30%"/>
<img src="/images/contract-devs/qr.png" width="250" height="252" loading="lazy"/>
</div>
44 changes: 23 additions & 21 deletions _src/ens.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,44 @@
* Tools powering the ENS page
*/
function getDropdownAddress() {
$('#address1-link').attr("href", "");
$('#address1').html("loading...");
const selectedEnsString = $("#pairs option:selected").val();
document.getElementById('address1-link').href= "";
document.getElementById('address1').innerHTML="loading...";
let select = document.getElementById('pairs');
const selectedEnsString = select.options[select.selectedIndex].value;
console.log('selected',selectedEnsString);
const web3 = new Web3("https://mainnet.infura.io/v3/34ed41c4cf28406885f032930d670036");
web3.eth.ens.getAddress(selectedEnsString)
.then((address) => {
$('#address1').html(address);
$('#address1-link').attr("href", "https://etherscan.io/address/" + address);
document.getElementById('address1').innerHTML=address;
document.getElementById('address1-link').href= "https://etherscan.io/address/" + address;
})
.catch((error) => {
$('#address1').html("not found");
$('#address1-link').attr("href", "");
document.getElementById('address1').innerHTML="not found";
document.getElementById('address1-link').href= "";
})
}

function getManualAddress() {
$('#address2-link').attr("href", "");
$('#address2').html("loading...");
$('#address2-label').html("loading...");
$('#address2-label-link').attr("href", "");
const asset1 = $('#asset-1').val().toLowerCase();
const asset2 = $('#asset-2').val().toLowerCase();
document.getElementById('address2-link').href= "";
document.getElementById('address2').innerHTML="loading...";
document.getElementById('address2-label').innerHTML="loading...";
document.getElementById('address2-label-link').href= "";
const asset1 = document.getElementById('asset-1').value.toLowerCase();
const asset2 = document.getElementById('asset-2').value.toLowerCase();
const ensString = asset1+'-'+asset2+'.data.eth';
const web3 = new Web3("https://mainnet.infura.io/v3/34ed41c4cf28406885f032930d670036");
web3.eth.ens.getAddress(ensString)
.then((address) => {
$('#address2-label').html(ensString);
$('#address2-label-link').attr("href", "https://app.ens.domains/name/" + ensString);
$('#address2').html(address);
$('#address2-link').attr("href", "https://etherscan.io/address/" + address);
document.getElementById('address2-label').innerHTML=ensString;
document.getElementById('address2-label-link').href= "https://app.ens.domains/name/" + ensString;
document.getElementById('address2').innerHTML=address;
document.getElementById('address2-link').href= "https://etherscan.io/address/" + address;
})
.catch((error) => {
$('#address2-label').html(ensString);
$('#address2-label-link').attr("href", "");
$('#address2').html("not found");
$('#address2-link').attr("href", "");
document.getElementById('address2-label').innerHTML=ensString;
document.getElementById('address2-label-link').href= "";
document.getElementById('address2').innerHTML="not found";
document.getElementById('address2-link').href= "";
})
}

Expand Down
72 changes: 62 additions & 10 deletions _src/get-latest-price.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,64 @@
function getLatestPrice() {
jQuery('#get-price-field').val("loading...")
const web3 = new Web3("https://kovan.infura.io/v3/34ed41c4cf28406885f032930d670036");
const aggregatorV3InterfaceABI = [{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_roundId","type":"uint80"}],"name":"getRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}];
const addr = "0x9326BFA02ADD2366b30bacB125260Af641031331";
const priceFeed = new web3.eth.Contract(aggregatorV3InterfaceABI, addr);
document.getElementById('get-price-field').value = 'loading...';
const web3 = new Web3(
'https://kovan.infura.io/v3/34ed41c4cf28406885f032930d670036'
);
const aggregatorV3InterfaceABI = [
{
inputs: [],
name: 'decimals',
outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'description',
outputs: [{ internalType: 'string', name: '', type: 'string' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [{ internalType: 'uint80', name: '_roundId', type: 'uint80' }],
name: 'getRoundData',
outputs: [
{ internalType: 'uint80', name: 'roundId', type: 'uint80' },
{ internalType: 'int256', name: 'answer', type: 'int256' },
{ internalType: 'uint256', name: 'startedAt', type: 'uint256' },
{ internalType: 'uint256', name: 'updatedAt', type: 'uint256' },
{ internalType: 'uint80', name: 'answeredInRound', type: 'uint80' },
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'latestRoundData',
outputs: [
{ internalType: 'uint80', name: 'roundId', type: 'uint80' },
{ internalType: 'int256', name: 'answer', type: 'int256' },
{ internalType: 'uint256', name: 'startedAt', type: 'uint256' },
{ internalType: 'uint256', name: 'updatedAt', type: 'uint256' },
{ internalType: 'uint80', name: 'answeredInRound', type: 'uint80' },
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'version',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
];
const addr = '0x9326BFA02ADD2366b30bacB125260Af641031331';
const priceFeed = new web3.eth.Contract(aggregatorV3InterfaceABI, addr);

priceFeed.methods.latestRoundData().call()
.then((roundData) => {
jQuery('#get-price-field').val(roundData.answer)
});
}
priceFeed.methods
.latestRoundData()
.call()
.then((roundData) => {
document.getElementById('get-price-field').value = roundData.answer;
});
}
Binary file modified _src/images/contract-devs/price-aggr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _src/images/contract-devs/qr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/Introduction/tutorials/beginners-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ Chainlink price feeds are sources of data [aggregated from many independent Chai
"images": [
{
"image": [
"https://files.readme.io/2ed2492-bf08b31-5ef7eba-screenshot.png",
"bf08b31-5ef7eba-screenshot.png",
"/images/contract-devs/price-aggr.png",
"Price Aggregation",
3600,
2400,
"#fafafa"
Expand Down
4 changes: 2 additions & 2 deletions docs/Using Price Feeds/historical-price-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.3.0/web3.min.js" integrity="sha512-ppuvbiAokEJLjOUQ24YmpP7tTaLRgzliuldPRZ01ul6MhRC+B8LzcVkXmUsDee7ne9chUfApa9/pWrIZ3rwTFQ==" crossorigin="anonymous"></script>
<script>
function getHistoricalPrice() {
jQuery('#get-price-field').val("loading...")
document.getElementById('get-price-field').value = "loading...";
const web3 = new Web3("https://kovan.infura.io/v3/34ed41c4cf28406885f032930d670036");
const aggregatorV3InterfaceABI = [{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_roundId","type":"uint80"}],"name":"getRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}];
const addr = "0x9326BFA02ADD2366b30bacB125260Af641031331";
Expand All @@ -117,7 +117,7 @@
let validId = BigInt("18446744073709562301");
priceFeed.methods.getRoundData(validId).call()
.then((historicalRoundData) => {
jQuery('#get-price-field').val(historicalRoundData.answer)
document.getElementById('get-price-field').value = historicalRoundData.answer;
})
}
</script>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"date-fns": "^2.21.1",
"eleventy-plugin-youtube-embed": "^1.6.2",
"firebase-tools": "^9.8.0",
"html-minifier": "^4.0.0",
"react": "^16.0.0",
"react-dom": "^16.14.0",
"ts-node": "^9.1.1",
Expand Down
62 changes: 61 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,14 @@ call-me-maybe@^1.0.1:
resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b"
integrity sha1-JtII6onje1y95gJQoV8DHBak1ms=

camel-case@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73"
integrity sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=
dependencies:
no-case "^2.2.0"
upper-case "^1.1.1"

camelcase@^1.0.2:
version "1.2.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
Expand Down Expand Up @@ -1209,7 +1217,7 @@ classnames@^2.2.6:
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce"
integrity sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==

clean-css@^4.1.11:
clean-css@^4.1.11, clean-css@^4.2.1:
version "4.2.3"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.3.tgz#507b5de7d97b48ee53d84adb0160ff6216380f78"
integrity sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA==
Expand Down Expand Up @@ -3004,11 +3012,29 @@ hastscript@^5.0.0:
property-information "^5.0.0"
space-separated-tokens "^1.0.0"

he@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==

home-dir@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/home-dir/-/home-dir-1.0.0.tgz#2917eb44bdc9072ceda942579543847e3017fe4e"
integrity sha1-KRfrRL3JByztqUJXlUOEfjAX/k4=

html-minifier@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-4.0.0.tgz#cca9aad8bce1175e02e17a8c33e46d8988889f56"
integrity sha512-aoGxanpFPLg7MkIl/DDFYtb0iWz7jMFGqFhvEDZga6/4QTjneiD8I/NXL1x5aaoCp7FSIT6h/OhykDdPsbtMig==
dependencies:
camel-case "^3.0.0"
clean-css "^4.2.1"
commander "^2.19.0"
he "^1.2.0"
param-case "^2.1.1"
relateurl "^0.2.7"
uglify-js "^3.5.1"

html-void-elements@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/html-void-elements/-/html-void-elements-1.0.5.tgz#ce9159494e86d95e45795b166c2021c2cfca4483"
Expand Down Expand Up @@ -3952,6 +3978,11 @@ loose-envify@^1.1.0, loose-envify@^1.4.0:
dependencies:
js-tokens "^3.0.0 || ^4.0.0"

lower-case@^1.1.1:
version "1.1.4"
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"
integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw=

lowercase-keys@^1.0.0, lowercase-keys@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f"
Expand Down Expand Up @@ -4354,6 +4385,13 @@ nice-try@^1.0.4:
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==

no-case@^2.2.0:
version "2.3.2"
resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac"
integrity sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==
dependencies:
lower-case "^1.1.1"

node-addon-api@^1.3.0:
version "1.7.2"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.7.2.tgz#3df30b95720b53c24e59948b49532b662444f54d"
Expand Down Expand Up @@ -4609,6 +4647,13 @@ package-json@^6.3.0:
registry-url "^5.0.0"
semver "^6.2.0"

param-case@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/param-case/-/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247"
integrity sha1-35T9jPZTHs915r75oIWPvHK+Ikc=
dependencies:
no-case "^2.2.0"

parse-entities@^1.1.0:
version "1.2.2"
resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.2.2.tgz#c31bf0f653b6661354f8973559cb86dd1d5edf50"
Expand Down Expand Up @@ -5281,6 +5326,11 @@ rehype-stringify@^6.0.0:
hast-util-to-html "^6.0.0"
xtend "^4.0.0"

relateurl@^0.2.7:
version "0.2.7"
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=

remark-breaks@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/remark-breaks/-/remark-breaks-1.0.5.tgz#e9785f8b174f45c05af542fbeb18354b766e1139"
Expand Down Expand Up @@ -6405,6 +6455,11 @@ uglify-js@^3.1.4:
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.13.1.tgz#2749d4b8b5b7d67460b4a418023ff73c3fefa60a"
integrity sha512-EWhx3fHy3M9JbaeTnO+rEqzCe1wtyQClv6q3YWq0voOj4E+bMZBErVS1GAHPDiRGONYq34M1/d8KuQMgvi6Gjw==

uglify-js@^3.5.1:
version "3.13.5"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.13.5.tgz#5d71d6dbba64cf441f32929b1efce7365bb4f113"
integrity sha512-xtB8yEqIkn7zmOyS2zUNBsYCBRhDkvlNxMMY2smuJ/qA8NCHeQvKCF3i9Z4k8FJH4+PJvZRtMrPynfZ75+CSZw==

uglify-to-browserify@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
Expand Down Expand Up @@ -6589,6 +6644,11 @@ update-notifier@^4.1.0, update-notifier@^4.1.1:
semver-diff "^3.1.1"
xdg-basedir "^4.0.0"

upper-case@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598"
integrity sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=

uri-js@^4.2.2:
version "4.4.1"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
Expand Down