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

Commit

Permalink
migrate to solidity 0.8. xDAI list
Browse files Browse the repository at this point in the history
  • Loading branch information
clbrge committed Apr 24, 2021
1 parent ac1f7f1 commit a6175cd
Show file tree
Hide file tree
Showing 13 changed files with 43,118 additions and 1,584 deletions.
7 changes: 1 addition & 6 deletions contracts/IRGEToken.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-only
/*

RGE token Interface
*/

pragma solidity ^0.6.0;
pragma solidity ^0.8.0;

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

Expand Down
4 changes: 2 additions & 2 deletions contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-only

pragma solidity ^0.6.0;
pragma solidity ^0.8.0;

contract Migrations {

Expand All @@ -12,7 +12,7 @@ contract Migrations {
if (msg.sender == owner) _;
}

constructor() public {
constructor() {
owner = msg.sender;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

pragma solidity ^0.6.0;
pragma solidity ^0.8.0;

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

Expand All @@ -32,15 +32,18 @@ contract BridgeRGEToken is ERC20 {
address public homeBridge;
address public homeValidator; /* validator in the RougeBridge contract on the home RGE network */

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

function decimals() public pure override returns (uint8) {
return 6;
}

function newOwner(address _account) onlyBy(owner) public {
owner = _account;
}
Expand Down
9 changes: 6 additions & 3 deletions contracts/TestRGEToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

pragma solidity ^0.6.0;
pragma solidity ^0.8.0;

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

Expand All @@ -32,12 +32,15 @@ contract TestRGEToken is ERC20 {
_;
}

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

function decimals() public view override returns (uint8) {
return DECIMALS;
}

function giveMeRGE(uint256 _value) public returns (bool success) {
require(balanceOf(msg.sender) + _value <= maxBalance);
require(balanceOf(owner) >= ownerMin + _value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

pragma solidity ^0.6.0;
pragma solidity ^0.8.0;

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

interface IRougeFactory {

Expand Down
6 changes: 3 additions & 3 deletions contracts/RougeBridge.sol → contracts/v0/RougeBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

pragma solidity ^0.6.0;
pragma solidity ^0.8.0;

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

contract RougeBridge {

Expand All @@ -22,7 +22,7 @@ contract RougeBridge {

IRGEToken public rge;

constructor(address _rge) public {
constructor(address _rge) {
owner = msg.sender;
rge = IRGEToken(_rge);
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/RougeFactory.sol → contracts/v0/RougeFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

pragma solidity ^0.6.0;
pragma solidity ^0.8.0;

import "./SimpleRougeCampaign.sol";

Expand All @@ -19,7 +19,7 @@ contract RougeFactory {

address owner;

constructor() public {
constructor() {
owner = msg.sender;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

pragma solidity ^0.6.0;
pragma solidity ^0.8.0;

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

import "./IRougeFactory.sol";

Expand Down Expand Up @@ -78,7 +78,7 @@ contract SimpleRougeCampaign {
uint32 public acquired;
uint32 public redeemed;

constructor(address payable _issuer, uint32 _issuance, address _rge, uint256 _tare, address _factory) public {
constructor(address payable _issuer, uint32 _issuance, address _rge, uint256 _tare, address _factory) {
require(_issuance > 0);

issuer = _issuer;
Expand Down Expand Up @@ -177,8 +177,8 @@ contract SimpleRougeCampaign {
require(rgeBalance >= issuance * tare);

// minimum campaign duration 12 hours, maximum 360 days (XXX could be a param for tare ?)
require(_campaignExpiration >= now + 60*60*12);
require(_campaignExpiration <= now + 60*60*24*360);
require(_campaignExpiration >= block.timestamp + 60*60*12);
require(_campaignExpiration <= block.timestamp + 60*60*24*360);

name = _name;
campaignIssued = true;
Expand All @@ -205,7 +205,7 @@ contract SimpleRougeCampaign {

modifier CampaignOpen() {
require(campaignIssued);
require(now < campaignExpiration);
require(block.timestamp < campaignExpiration);
_;
}

Expand Down Expand Up @@ -242,7 +242,7 @@ contract SimpleRougeCampaign {
require(_hash == keccak256(abi.encodePacked('acceptAcquisition', this, msg.sender)));
require(isAuthorized[_attestor][uint(Authorization.All)] || isAuthorized[_attestor][uint(Authorization.Acquisition)]);
require(ecrecover(RougeCampaign.prefixed(_hash), v, r, s) == _attestor);
return acquisition(msg.sender);
return acquisition(payable(msg.sender));
}

function distributeNote(address payable _bearer) CampaignOpen isAttestor(Authorization.Acquisition) public returns (bool success) {
Expand Down Expand Up @@ -302,7 +302,7 @@ contract SimpleRougeCampaign {
require(_hash == keccak256(abi.encodePacked('acceptRedemption', this, msg.sender)));
require(isAuthorized[_attestor][uint(Authorization.All)] || isAuthorized[_attestor][uint(Authorization.Redemption)]);
require(ecrecover(RougeCampaign.prefixed(_hash), v, r, s) == _attestor);
return redemption(msg.sender);
return redemption(payable(msg.sender));
}

function acceptRedemption(address payable _bearer, bytes32 _hash, uint8 v, bytes32 r, bytes32 s)
Expand Down
8 changes: 4 additions & 4 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

const RGETokenInterface = artifacts.require("./RGETokenInterface.sol")
const IRGEToken = artifacts.require("./IRGEToken.sol")
const TestRGEToken = artifacts.require("./TestRGEToken.sol")
const RougeFactory = artifacts.require("./RougeFactory.sol")
const RougeFactory = artifacts.require("./v0/RougeFactory.sol")

const RougeBridge = artifacts.require("./RougeBridge.sol")
const RougeBridge = artifacts.require("./v0/RougeBridge.sol")
// const BridgeRGEToken = artifacts.require("./BridgeRGEToken.sol")

module.exports = async function(deployer, network) {
Expand Down Expand Up @@ -39,7 +39,7 @@ module.exports = async function(deployer, network) {

if (network && rgeAddress[network]) {

const rge = await RGETokenInterface.at(rgeAddress[network])
const rge = await IRGEToken.at(rgeAddress[network])

await deployer.deploy(RougeFactory)
const factory = await RougeFactory.deployed()
Expand Down
15 changes: 13 additions & 2 deletions misc/rouge-tokenlist.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,22 @@
"tags": [
"voucher"
]
},
{
"chainId": 100,
"address": "0x01ffe9982CB900dA7b6Faa84fF06a2BF43a149cd",
"symbol": "RGE",
"name": "Rouge on xDAI",
"decimals": 6,
"logoURI": "https://rouge.network/logo-100.png",
"tags": [
"voucher"
]
}
],
"version": {
"major": 1,
"minor": 0,
"patch": 2
"minor": 1,
"patch": 1
}
}
Loading

0 comments on commit a6175cd

Please sign in to comment.