From 20cf86fba48a3f91c1b936125c200b40f922c954 Mon Sep 17 00:00:00 2001 From: benesjan Date: Mon, 30 Mar 2020 20:50:08 +0200 Subject: [PATCH] Switch back to Rinkeby - new CO2ken contract deployed --- Contracts/co2ken.sol | 16 ++++++++-------- Graph/subgraph.yaml | 4 ++-- README.md | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Contracts/co2ken.sol b/Contracts/co2ken.sol index c480a33..8aa5f93 100644 --- a/Contracts/co2ken.sol +++ b/Contracts/co2ken.sol @@ -39,7 +39,7 @@ contract CO2ken is Ownable { uint256 public balance; - event CarbonOffsetted(address indexed from, uint256 value); + event CarbonOffsetted(address indexed from, uint256 value, uint256 daiAmount); event Minted(string ipfsHash, uint256 dollarValue, uint256 tokensMinted); event Withdrawal(uint256 value); @@ -81,15 +81,15 @@ contract CO2ken is Ownable { /** * @dev allow users to offset using dollar-denominated payment - * @param payment paid in DAI tokens + * @param daiAmount - payment in DAI tokens */ - function offsetCarbon(uint256 payment) public { + function offsetCarbon(uint256 daiAmount) public { // receive the DAI payment - daiToken.transferFrom(_msgSender(), address(this), payment); - uint256 tokensToBurn = payment / storageData.co2kenPrice(); + daiToken.transferFrom(_msgSender(), address(this), daiAmount); + uint256 tokensToBurn = daiAmount / storageData.co2kenPrice(); // burn CO2 balance = balance.sub(tokensToBurn); - emit CarbonOffsetted(_msgSender(), tokensToBurn); + emit CarbonOffsetted(_msgSender(), tokensToBurn, daiAmount); } /** @@ -98,8 +98,8 @@ contract CO2ken is Ownable { */ function offsetCarbonTons(uint256 tons) public { // calculate retire amount using current token price - uint256 payment = rmul(tons, storageData.co2kenPrice()); - offsetCarbon(payment); + uint256 daiAmount = rmul(tons, storageData.co2kenPrice()); + offsetCarbon(daiAmount); } function transferOwnership(address newOwner) public virtual override onlyOwner { diff --git a/Graph/subgraph.yaml b/Graph/subgraph.yaml index 8cb4b29..c4e44fc 100644 --- a/Graph/subgraph.yaml +++ b/Graph/subgraph.yaml @@ -8,9 +8,9 @@ dataSources: name: CO2ken network: ropsten source: - address: "0x11e3C0DE7E93e1b0Bc96A63a43aE0C84C9065673" + address: "0x93Ec2167Da2A83fbBE61567F67F71750C13B9C09" abi: CO2ken - startBlock: 6072715 # The block in which the contract was deployed + startBlock: 6229304 # The block in which the contract was deployed mapping: kind: ethereum/events apiVersion: 0.0.3 diff --git a/README.md b/README.md index 1b4ad55..398e313 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,12 @@ Also contains the `Polluter` contract which `is Green` to demonstrate modifier f ### Contract Addresses -**Ropsten** +**Rinkeby** -CO2kenData - 0x11e3C0DE7E93e1b0Bc96A63a43aE0C84C9065673 +CO2kenData - 0x127AE08f45d687dA7887ceA369F2f4D95cb9baf2 -CO2ken (for demo) - 0x63f6993aBF909718790D2EC082E4FeF110CEaBAB +CO2ken (for demo) - 0x93Ec2167Da2A83fbBE61567F67F71750C13B9C09 Polluter (is Green) - NOT_DEPLOYED -WEENUS (test ERC20) - collect test WEENUS by visiting https://ropsten.etherscan.io/address/0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA#writeContract connecting web3 wallet and write to `drip()` +WEENUS (test ERC20) - collect test WEENUS by visiting https://rinkeby.etherscan.io/token/0xaff4481d10270f50f203e0763e2597776068cbc5#writeContract connecting web3 wallet and write to `drip()`