Skip to content

Commit

Permalink
Merge pull request ToucanProtocol#1 from lazaralex98/alexlazar/prod-2…
Browse files Browse the repository at this point in the history
…022-publish-oh-in-new-repo

[PROD-2022] New repo cleanup
  • Loading branch information
mauricedesaxe authored Oct 20, 2022
2 parents 81e9e53 + cf2fbf2 commit 4085539
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 50 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Example Implementations
# Offset Helper

A collection of Solidity contract examples that integrate with or demonstrate the use of Toucan's contracts and infrastructure. Some of these may be used in production.
This contract has the purpose to simplify the carbon offsetting process.

## Contracts
What it does in more exact terms is it abstracts the process of retiring TCO2, which normally looks like so:

- user exchanges USDC for BCT/NCT tokens at one of the DEXs (Uniswap, Sushiswap, etc. depending on network)
- user interacts with the BCT/NCT token contract to redeem the tokens for TCO2
- user interacts with the TCO2 token contract to retire the TCO2

With the OffsetHelper contract, the user only needs to interact with the OffsetHelper contract, which will take care of the rest in a single transaction.

## Deployments

| Contract | Polygon | Mumbai |
| ------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| OffsetHelper | [0xFAFcCd01C395e4542BEed819De61f02f5562fAEa](https://polygonscan.com/address/0xFAFcCd01C395e4542BEed819De61f02f5562fAEa) | [0x30dC279166DCFB69F52C91d6A3380dCa75D0fCa7](https://mumbai.polygonscan.com/address/0x30dC279166DCFB69F52C91d6A3380dCa75D0fCa7) |
| Swapper | [0x1C7f2CCa1Cd52Aae8A25B7BA4b7800c153F48D70](https://polygonscan.com/address/0x1C7f2CCa1Cd52Aae8A25B7BA4b7800c153F48D70) | [0xDd052AcA9AC1492a8b4F1432B68f11989903dE4d](https://mumbai.polygonscan.com/address/0xDd052AcA9AC1492a8b4F1432B68f11989903dE4d) |

## OffsetHelper

Expand Down
46 changes: 0 additions & 46 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "solidity-coverage";
import "solidity-docgen";
import { tokens } from "./utils/tokens";
import addresses, { mumbaiAddresses } from "./utils/addresses";
import { network } from "hardhat";
import { boolean } from "hardhat/internal/core/params/argumentTypes";
import { relative } from "path";

Expand Down Expand Up @@ -68,51 +67,6 @@ task("deployOffsetHelper", "Deploys and verifies OffsetHelper")
}
});

task("deploySwapper", "Deploys and verifies Swapper")
.addOptionalParam(
"verify",
"Set false to not verify the Swapper after deployment",
true,
boolean
)
.setAction(async (taskArgs, hre) => {
const Swapper = await hre.ethers.getContractFactory("Swapper");

const addressesToUse =
hre.network.name == "mumbai" ? mumbaiAddresses : addresses;

const swapper = await Swapper.deploy(tokens, [
addressesToUse.bct,
addressesToUse.nct,
addressesToUse.usdc,
addressesToUse.weth,
addressesToUse.wmatic,
]);
await swapper.deployed();
console.log(`Swapper deployed on ${hre.network.name} to:`, swapper.address);

if (taskArgs.verify === true) {
await swapper.deployTransaction.wait(5);
await hre.run("verify:verify", {
address: swapper.address,
constructorArguments: [
tokens,
[
addressesToUse.bct,
addressesToUse.nct,
addressesToUse.usdc,
addressesToUse.weth,
addressesToUse.wmatic,
],
],
});
console.log(
`Swapper verified on ${hre.network.name} to:`,
swapper.address
);
}
});

const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
solidity: {
Expand Down

0 comments on commit 4085539

Please sign in to comment.