diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ce103a..a204920 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ - Add MinimumAggregator: An aggregation strategy that returns the minimum price and the total token and quote token liquidity. - Add MaximumAggregator: An aggregation strategy that returns the maximum price and the total token and quote token liquidity. +### Utils +- Add NotAnErc20: An ERC20 implementation meant to be used in Adrastia oracle contracts to provide custom quote token metadata. + ## v4.1.0 ### Accumulators - Add AaveV3SBAccumulator and CometSBAccumulator diff --git a/contracts/utils/NotAnErc20.sol b/contracts/utils/NotAnErc20.sol new file mode 100644 index 0000000..a9eb178 --- /dev/null +++ b/contracts/utils/NotAnErc20.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity =0.8.13; + +import "@openzeppelin-v4/contracts/token/ERC20/ERC20.sol"; + +/** + * @title NotAnErc20 + * @author TRILEZ SOFTWARE INC. dba. Adrastia + * @notice An ERC20 implementation meant to be used in Adrastia oracle contracts to provide custom quote token metadata. + */ +contract NotAnErc20 is ERC20 { + uint8 internal immutable _decimals; + + constructor(string memory name_, string memory symbol_, uint8 decimals_) ERC20(name_, symbol_) { + _decimals = decimals_; + } + + function decimals() public view virtual override returns (uint8) { + return _decimals; + } +} diff --git a/package.json b/package.json index 00035b3..e735731 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adrastia-oracle/adrastia-core", - "version": "4.2.0-rc.1", + "version": "4.2.0", "main": "index.js", "author": "TRILEZ SOFTWARE INC.", "license": "BUSL-1.1", diff --git a/scripts/verify/maximum-aggregation-strategy.js b/scripts/verify/maximum-aggregation-strategy.js new file mode 100644 index 0000000..07d623d --- /dev/null +++ b/scripts/verify/maximum-aggregation-strategy.js @@ -0,0 +1,18 @@ +const hre = require("hardhat"); + +const contractAddress = "0x92Eb6895550Fd2EFc1519De69f8b85A819A1fDC1"; + +async function main() { + await hre.run("verify:verify", { + contract: "contracts/strategies/aggregation/MaximumAggregator.sol:MaximumAggregator", + address: contractAddress, + constructorArguments: [], + }); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/verify/minimum-aggregation-strategy.js b/scripts/verify/minimum-aggregation-strategy.js new file mode 100644 index 0000000..1ed9707 --- /dev/null +++ b/scripts/verify/minimum-aggregation-strategy.js @@ -0,0 +1,18 @@ +const hre = require("hardhat"); + +const contractAddress = "0x90C8E14d36bfc6ea6c871F5874eE095631d4eDC6"; + +async function main() { + await hre.run("verify:verify", { + contract: "contracts/strategies/aggregation/MinimumAggregator.sol:MinimumAggregator", + address: contractAddress, + constructorArguments: [], + }); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/test/utils/not-an-erc20.js b/test/utils/not-an-erc20.js new file mode 100644 index 0000000..83f3895 --- /dev/null +++ b/test/utils/not-an-erc20.js @@ -0,0 +1,38 @@ +const { expect } = require("chai"); +const { ethers } = require("hardhat"); + +describe("NotAnErc20#constructor", function () { + var factory; + + beforeEach(async function () { + factory = await ethers.getContractFactory("NotAnErc20"); + }); + + it("Sets the name and symbol", async function () { + const name = "Token name"; + const symbol = "TKN"; + + const notAnErc20 = await factory.deploy(name, symbol, 18); + + expect(await notAnErc20.name()).to.equal(name); + expect(await notAnErc20.symbol()).to.equal(symbol); + }); + + it("Sets the decimals to 0", async function () { + const notAnErc20 = await factory.deploy("", "", 0); + + expect(await notAnErc20.decimals()).to.equal(0); + }); + + it("Sets the decimals to 6", async function () { + const notAnErc20 = await factory.deploy("", "", 6); + + expect(await notAnErc20.decimals()).to.equal(6); + }); + + it("Sets the decimals to 18", async function () { + const notAnErc20 = await factory.deploy("", "", 18); + + expect(await notAnErc20.decimals()).to.equal(18); + }); +});