This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example code is designed to quickly deploy an example contract using Remix. | |
pragma solidity ^0.6.7; | |
import "https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; | |
contract PriceConsumerV3 { | |
AggregatorV3Interface internal priceFeed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example code is designed to quickly deploy an example contract using Remix. | |
pragma solidity ^0.6.0; | |
import "https://github.com/smartcontractkit/chainlink/evm-contracts/src/v0.6/ChainlinkClient.sol"; | |
contract CoinGeckoConsumer is ChainlinkClient { | |
address private oracle; | |
bytes32 private jobId; | |
uint256 private fee; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example code is designed to quickly deploy an example contract using Remix. | |
pragma solidity ^0.6.0; | |
import "https://raw.githubusercontent.com/smartcontractkit/chainlink/master/evm-contracts/src/v0.6/ChainlinkClient.sol"; | |
contract APIConsumer is ChainlinkClient { | |
uint256 public volume; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example code is designed to quickly deploy an example contract using Remix. | |
pragma solidity 0.6.6; | |
import "https://raw.githubusercontent.com/smartcontractkit/chainlink/master/evm-contracts/src/v0.6/VRFConsumerBase.sol"; | |
contract RandomNumberConsumer is VRFConsumerBase { | |
bytes32 internal keyHash; | |
uint256 internal fee; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example code is designed to quickly deploy an example contract using Remix. | |
pragma solidity ^0.6.7; | |
import "https://github.com/smartcontractkit/chainlink/evm-contracts/src/v0.6/interfaces/AggregatorInterface.sol"; | |
/** | |
* Consumer contract which retrieves the latest and historical | |
* price data from the ETH/USD price feed on the Ropsten network. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example code is designed to quickly deploy an example contract using Remix. | |
pragma solidity ^0.6.7; | |
import "https://github.com/smartcontractkit/chainlink/evm-contracts/src/v0.6/interfaces/AggregatorInterface.sol"; | |
contract PriceConsumer { | |
AggregatorInterface internal priceFeed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.6.7; | |
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorInterface.sol"; | |
contract PriceConsumer { | |
AggregatorInterface internal priceFeed; | |
/** | |
* Network: Kovan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get reserve data | |
const reserveData = await lendingPool.methods.getReserveData("0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE").call() | |
.catch((e) => { | |
throw Error(`Error getting aave reserve data: ${e.message}`) | |
}); | |
// Get aToken address | |
const aTokenAddress = reserveData.aTokenAddress; | |
// Load aToken | |
const aTokenInstance = new web3.eth.Contract(aTokenABI, aTokenAddress); | |
// Redeem asset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aTokenInstance.methods.redeem(withdrawAmount).send({from: account}) | |
.once('transactionHash', (hash) => { | |
// transaction hash | |
}) | |
.on('confirmation', (number, receipt) => { | |
// number of confirmations | |
}) | |
.on('error', (error) => { | |
console.log(error); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const aTokenInstance = new web3.eth.Contract(aTokenABI, aTokenAddress); |