Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
upgrade to solidity 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
clbrge committed Nov 8, 2020
1 parent c047b25 commit 92ed83f
Show file tree
Hide file tree
Showing 13 changed files with 1,485 additions and 7,392 deletions.
14 changes: 4 additions & 10 deletions contracts/BridgeRGEToken.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: AGPL-3.0-only
/*
Bridged ERC20 RGE contract to be used on a FOREIGN CHAIN (not Ethereum mainnet, i.e. "home")
Expand All @@ -6,15 +7,12 @@
*/

pragma solidity >=0.5.0 <0.7.0;
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract BridgeRGEToken is ERC20 {

/* ERC20 */
uint8 public decimals = 6;

/* RGEToken - keeping the bridged RGE interface as similar as the home RGE */
address owner;
string public version = 'v1.0-0.4'; /* composition rge version + bridge version */
Expand All @@ -34,17 +32,13 @@ contract BridgeRGEToken is ERC20 {
address public homeBridge;
address public homeValidator; /* validator in the RougeBridge contract on the home RGE network */

string public name;
string public symbol;

constructor(uint _network, address _validator, address _homeBridge, address _homeValidator, string memory _name, string memory _symbol) public {
constructor(uint _network, address _validator, address _homeBridge, address _homeValidator, string memory _name, string memory _symbol) public ERC20(_name, _symbol) {
owner = msg.sender;
network = _network;
validator = _validator;
homeBridge = _homeBridge;
homeValidator = _homeValidator;
name = _name;
symbol = _symbol;
_setupDecimals(6);
}

function newOwner(address _account) onlyBy(owner) public {
Expand Down
34 changes: 34 additions & 0 deletions contracts/IRGEToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: AGPL-3.0-only
/*
RGE token Interface
*/

pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IRGEToken is IERC20 {

/*
uint8 public decimals;
address public crowdsale;
uint public endTGE;
string public version;
uint256 public reserveY1;
uint256 public reserveY2;
address public factory;
*/

function setFactory(address _factory) external;

function newCampaign(uint32 _issuance, uint256 _value) external;

event Burn(address indexed burner, uint256 value);

function burn(uint256 _value) external returns (bool success);

}
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
// SPDX-License-Identifier: AGPL-3.0-only
/*
Abstract contract for Rouge Factory contracts
*/

pragma solidity >=0.5.0 <0.7.0;
pragma solidity ^0.6.0;

import "./RGETokenInterface.sol";
import "./IRGEToken.sol";

contract RougeFactoryInterface {

interface IRougeFactory {

/*
// The Rouge Token contract address
RGETokenInterface public rge;
IRGEToken public rge;
// Price in RGE of the tare deposit (per token)
uint256 public tare;
// owner of the factory
address owner;
*/

// owner can (re)set tare price or RGE contract address
function setParams (address _rge, uint256 _tare) public;
function setParams (address _rge, uint256 _tare) external;

event NewRougeCampaign(address issuer, address campaign, uint32 _issuance);

function createCampaign(address _issuer, uint32 _issuance, uint256 _tokens) public;
function createCampaign(address _issuer, uint32 _issuance, uint256 _tokens) external;

}
3 changes: 2 additions & 1 deletion contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity >=0.5.0 <0.7.0;
pragma solidity ^0.6.0;

contract Migrations {

Expand Down
35 changes: 0 additions & 35 deletions contracts/RGETokenInterface.sol

This file was deleted.

9 changes: 5 additions & 4 deletions contracts/RougeBridge.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// SPDX-License-Identifier: AGPL-3.0-only
/*
Bridge to send RGE in other chains (eg POA, ...)
*/

pragma solidity >=0.5.0 <0.7.0;
pragma solidity ^0.6.0;

import "./RGETokenInterface.sol";
import "./IRGEToken.sol";

contract RougeBridge {

Expand All @@ -19,11 +20,11 @@ contract RougeBridge {
_;
}

RGETokenInterface public rge;
IRGEToken public rge;

constructor(address _rge) public {
owner = msg.sender;
rge = RGETokenInterface(_rge);
rge = IRGEToken(_rge);
}

function newOwner(address _account) onlyBy(owner) public {
Expand Down
7 changes: 4 additions & 3 deletions contracts/RougeFactory.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// SPDX-License-Identifier: AGPL-3.0-only
/*
Simple Rouge factory and campaign contracts
*/

pragma solidity >=0.5.0 <0.7.0;
pragma solidity ^0.6.0;

import "./SimpleRougeCampaign.sol";

Expand All @@ -13,7 +14,7 @@ contract RougeFactory {
bytes2 public version = 0x0021;

// The Rouge Token contract address
RGETokenInterface public rge;
IRGEToken public rge;
uint256 public tare;

address owner;
Expand All @@ -30,7 +31,7 @@ contract RougeFactory {
event SetFactory(address indexed _rge, uint256 _tare);

function setParams (address _rge, uint256 _tare) onlyBy(owner) public {
rge = RGETokenInterface(_rge);
rge = IRGEToken(_rge);
tare = _tare;
emit SetFactory(_rge, tare);
}
Expand Down
17 changes: 9 additions & 8 deletions contracts/SimpleRougeCampaign.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// SPDX-License-Identifier: AGPL-3.0-only
/*
Simple campaign contract
*/

pragma solidity >=0.5.0 <0.7.0;
pragma solidity ^0.6.0;

import "./RGETokenInterface.sol";
import "./IRGEToken.sol";

import "./RougeFactoryInterface.sol";
import "./IRougeFactory.sol";

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

Expand Down Expand Up @@ -37,10 +38,10 @@ contract SimpleRougeCampaign {
bytes2 public version = 0x0021;

// The Rouge Token contract address
RGETokenInterface public rge;
IRGEToken public rge;

// Factory address & tare settings
RougeFactoryInterface public factory;
IRougeFactory public factory;
uint256 public tare;

address payable public issuer; // TODO owner != initial issuer
Expand Down Expand Up @@ -82,9 +83,9 @@ contract SimpleRougeCampaign {

issuer = _issuer;
issuance = _issuance;
rge = RGETokenInterface(_rge);
rge = IRGEToken(_rge);
tare = _tare;
factory = RougeFactoryInterface(_factory);
factory = IRougeFactory(_factory);

// bootstrap role system
isAuthorized[issuer][uint(Authorization.All)] = true;
Expand Down Expand Up @@ -286,7 +287,7 @@ contract SimpleRougeCampaign {
IERC721 _erc721 = IERC721(attachments[i].caller);
for (uint j = 0; j < attachments[i].qty; j++) {
_erc721.safeTransferFrom(address(this), _bearer, erc721TokenIds[erc721TokenIds.length - 1]);
erc721TokenIds.length--;
erc721TokenIds.pop();
}
}
}
Expand Down
19 changes: 9 additions & 10 deletions contracts/TestRGEToken.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: AGPL-3.0-only
/*
Same interface/code as RGEToken but for testnet networks
Expand All @@ -6,36 +7,34 @@
*/

pragma solidity >=0.5.0 <0.7.0;
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract TestRGEToken is ERC20 {

/* ERC20 */
string public name = 'TEST Rouge';
string public symbol = 'RGE';
uint8 public decimals = 6;

uint8 DECIMALS = 6;

/* RGEToken */
address owner;
string public version = 'v0.6';
uint256 public reserveY1 = 0;
uint256 public reserveY2 = 0;

/* Testnet specific: set a maximum per address, minimum for owner for giveMeRGE function */
uint256 public maxBalance = 100000 * 10**uint(decimals);
uint256 public ownerMin = 300000000 * 10**uint(decimals);
uint256 public maxBalance = 100000 * 10**uint(DECIMALS);
uint256 public ownerMin = 300000000 * 10**uint(DECIMALS);

uint256 private _totalSupply = 1000000000 * 10**uint(decimals);
uint256 private _totalSupply = 1000000000 * 10**uint(DECIMALS);

modifier onlyBy(address _address) {
require(msg.sender == _address);
_;
}

constructor() public {
constructor() public ERC20("TEST Rouge", "RGE") {
owner = msg.sender;
_setupDecimals(DECIMALS);
_mint(owner, _totalSupply);
}

Expand Down
Loading

0 comments on commit 92ed83f

Please sign in to comment.