Skip to content
This repository has been archived by the owner on Sep 30, 2021. It is now read-only.

Commit

Permalink
Switch back to Rinkeby - new CO2ken contract deployed
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Mar 30, 2020
1 parent 48b48cc commit 20cf86f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions Contracts/co2ken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions Graph/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`

0 comments on commit 20cf86f

Please sign in to comment.