Skip to content

Commit

Permalink
mumbai doesn't have certain contracts so I created a polygon fork
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricedesaxe committed Feb 25, 2022
1 parent cd5f04b commit 3cdf76b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
8 changes: 5 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
ROPSTEN_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
MUMBAI_URL=https://polygon-mumbai.g.alchemy.com/v2/abc123abc123abc123abc123abc123abc123abc
MUMBAI_PRIVATE_KEY=abc123abc123abc123abc123abc123abc123abc

POLYGON_URL=https://polygon-mainnet.g.alchemy.com/v2/abc123abc123abc123abc123abc123abc123abc
POLYGON_PRIVATE_KEY=abc123abc123abc123abc123abc123abc123abc
14 changes: 7 additions & 7 deletions contracts/OffsetHelperStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,30 @@ import "./CO2KEN_contracts/IToucanContractRegistry.sol";
contract OffsetHelperStorage is OwnableUpgradeable {
mapping(string => address) public eligibleTokenAddresses;
address public contractRegistryAddress =
0x6739D490670B2710dc7E79bB12E455DE33EE1cb6;
0x263fA1c180889b3a3f46330F32a4a23287E99FC9;
address public sushiRouterAddress =
0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506; // this is polygon, not mumbai
0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506;

constructor() {
eligibleTokenAddresses[
"BCT"
] = 0xf2438A14f668b1bbA53408346288f3d7C71c10a1;
] = 0x2F800Db0fdb5223b3C3f354886d907A671414A7F;

eligibleTokenAddresses[
"NCT"
] = 0x7beCBA11618Ca63Ead5605DE235f6dD3b25c530E;
] = 0xD838290e877E0188a4A44700463419ED96c16107;

eligibleTokenAddresses[
"USDC"
] = 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174; // this is polygon, not mumbai
] = 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174;

eligibleTokenAddresses[
"WETH"
] = 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619; // this is polygon, not mumbai
] = 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619;

eligibleTokenAddresses[
"WMATIC"
] = 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270; // this is polygon, not mumbai
] = 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270;
}

// @description you can use this to change or add eligible tokens and their addresses if needed
Expand Down
17 changes: 15 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
// Go to https://hardhat.org/config/ to learn more

const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
defaultNetwork: "polygonFork",
solidity: {
version: "0.8.4",
settings: {
Expand All @@ -34,14 +34,27 @@ const config: HardhatUserConfig = {
},
},
networks: {
polygon: {
url: process.env.POLYGON_URL || "",
accounts:
process.env.POLYGON_PRIVATE_KEY !== undefined
? [process.env.POLYGON_PRIVATE_KEY]
: [],
},
mumbai: {
url: process.env.MUMBAI_URL || "",
accounts:
process.env.MUMBAI_PRIVATE_KEY !== undefined
? [process.env.MUMBAI_PRIVATE_KEY]
: [],
},
hardhat: {
polygonFork: {
forking: {
url: process.env.POLYGON_URL || "",
blockNumber: 25276448,
},
},
mumbaiFork: {
forking: {
url: process.env.MUMBAI_URL || "",
blockNumber: 25276448,
Expand Down
5 changes: 2 additions & 3 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import {

const addresses: any = {
myAddress: "0x721F6f7A29b99CbdE1F18C4AA7D7AEb31eb2923B",
tco2Address: "0xa5831eb637dff307395b5183c86B04c69C518681",
bctAddress: "0xf2438A14f668b1bbA53408346288f3d7C71c10a1",
nctAddress: "0x7beCBA11618Ca63Ead5605DE235f6dD3b25c530E",
bctAddress: "0x2F800Db0fdb5223b3C3f354886d907A671414A7F",
nctAddress: "0xD838290e877E0188a4A44700463419ED96c16107",
usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
wethAddress: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
wmaticAddress: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
Expand Down

0 comments on commit 3cdf76b

Please sign in to comment.