This the smart contract to swap and retire carbon tokens.
This smart contract is planned to do the following tasks:
- Receive/Get coins/tokens from the user.
- Exchange for carbon token (NCT) on sushiswap.
- Swap for TCO2 token from a project (default or user selected).
- Retire TCO2s.
- Store the attendee address and offset amount.
- Claim the NFT from Toucan
A more detailed description of the methods in the contract can be found in the automatically generated documentation. We use dodoc to generate it.
The contract is not yet deployed:
Install all dependencies
npm install
copy the "env" file to ".env" and fill in the needed Keys.
Fork the polygon mainnet
hh node
(need to have hardhat shorthand installed for this: npm i -g hardhat-shorthand
)
Deploy the pooling contract with:
hh run scripts/deploy.js
Run tests using:
hh test
You can also run a forked chain locally and then deploy test on it by running:
hh node
in the first terminal window and:
hh test --network localhost
in the second terminal window to run the tests.
You can also locally deploy the contracts manually using:
hh run scripts/deploy.js --network localhost
Manual deployment can be done by first:
hh run scripts/deploy.js --network polygon
and then verify the contract:
hh verify 0xb6A5D547d0A325Ffa0357E2698eB76E165b606BA --network polygon
The contract has been deployed on 2023.02.02 to 0x96F2244A8094a4B1F57257e0641A94a6B13C8827