This repository has been archived by the owner on Apr 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
94 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
// TODO | ||
|
||
pragma solidity ^0.4.12; | ||
pragma solidity ^0.4.23; | ||
|
||
contract Coupon { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
pragma solidity ^0.4.23; | ||
|
||
import "./RegistryInterface.sol"; | ||
|
||
contract CouponDemoRegistry is RegistryInterface { | ||
|
||
string public version = 'v0.2'; | ||
|
||
address owner; | ||
|
||
address[] issuers; | ||
address[] all_campaigns; | ||
|
||
mapping (address => bool) public is_issuer; | ||
mapping (address => bool) public is_campaign; | ||
mapping (address => address[]) campaigns; | ||
|
||
modifier onlyBy(address _account) { | ||
require(msg.sender == _account); | ||
_; | ||
} | ||
|
||
constructor() public { | ||
owner = msg.sender; | ||
} | ||
|
||
function add_campaign(address _a) public { | ||
if (!is_issuer[msg.sender]) { | ||
is_issuer[msg.sender] = true; | ||
issuers.push(msg.sender); | ||
} | ||
all_campaigns.push(_a); | ||
campaigns[msg.sender].push(_a); | ||
is_campaign[_a] = true; | ||
} | ||
|
||
function get_all_count() public view returns(uint count) { | ||
return all_campaigns.length; | ||
} | ||
|
||
function get_all_campaign(uint index) public view returns(address) { | ||
return all_campaigns[index]; | ||
} | ||
|
||
function get_count(address issuer) public view returns(uint count) { | ||
return campaigns[issuer].length; | ||
} | ||
|
||
function get_campaign(address issuer, uint index) public view returns(address) { | ||
return campaigns[issuer][index]; | ||
} | ||
|
||
function get_mycount() public view returns(uint count) { | ||
return campaigns[msg.sender].length; | ||
} | ||
|
||
function get_mycampaign(uint index) public view returns(address) { | ||
return campaigns[msg.sender][index]; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* | ||
The Rouge Project - Blochain Coupon platform | ||
Copyright (C) 2017 Valentin D. Guillois <[email protected]> | ||
Copyright (C) 2017 Christophe Le Bars <[email protected]> | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as | ||
|
@@ -17,15 +18,13 @@ | |
*************************************************** | ||
WARNING : EXPERIMENTAL and NON AUDITED code. | ||
only use for tests purpose (on a testnet!) | ||
*/ | ||
|
||
import "./StandardCoupon.sol"; | ||
|
||
pragma solidity ^0.4.12; | ||
|
||
|
||
contract CouponExample is StandardCoupon { | ||
|
||
string public name; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pragma solidity ^0.4.12; | ||
|
||
pragma solidity ^0.4.23; | ||
|
||
library CouponUserApprovalLib { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
pragma solidity ^0.4.23; | ||
|
||
contract RegistryInterface { | ||
|
||
function add_campaign(address _a) public; | ||
function get_all_count() public view returns(uint count); | ||
function get_all_campaign(uint index) public view returns(address); | ||
function get_count(address issuer) public view returns(uint count); | ||
function get_campaign(address issuer, uint index) public view returns(address); | ||
function get_mycount() public view returns(uint count); | ||
function get_mycampaign(uint index) public view returns(address); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters