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

Commit a6175cd

Browse files
committed
migrate to solidity 0.8. xDAI list
1 parent ac1f7f1 commit a6175cd

File tree

13 files changed

+43118
-1584
lines changed

13 files changed

+43118
-1584
lines changed

contracts/IRGEToken.sol

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// SPDX-License-Identifier: AGPL-3.0-only
2-
/*
32

4-
RGE token Interface
5-
6-
*/
7-
8-
pragma solidity ^0.6.0;
3+
pragma solidity ^0.8.0;
94

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

contracts/Migrations.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: AGPL-3.0-only
22

3-
pragma solidity ^0.6.0;
3+
pragma solidity ^0.8.0;
44

55
contract Migrations {
66

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

15-
constructor() public {
15+
constructor() {
1616
owner = msg.sender;
1717
}
1818

contracts/BridgeRGEToken.sol renamed to contracts/POA/BridgeRGEToken.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
*/
99

10-
pragma solidity ^0.6.0;
10+
pragma solidity ^0.8.0;
1111

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

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

35-
constructor(uint _network, address _validator, address _homeBridge, address _homeValidator, string memory _name, string memory _symbol) public ERC20(_name, _symbol) {
35+
constructor(uint _network, address _validator, address _homeBridge, address _homeValidator, string memory _name, string memory _symbol) ERC20(_name, _symbol) {
3636
owner = msg.sender;
3737
network = _network;
3838
validator = _validator;
3939
homeBridge = _homeBridge;
4040
homeValidator = _homeValidator;
41-
_setupDecimals(6);
4241
}
4342

43+
function decimals() public pure override returns (uint8) {
44+
return 6;
45+
}
46+
4447
function newOwner(address _account) onlyBy(owner) public {
4548
owner = _account;
4649
}

contracts/TestRGEToken.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
*/
99

10-
pragma solidity ^0.6.0;
10+
pragma solidity ^0.8.0;
1111

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

@@ -32,12 +32,15 @@ contract TestRGEToken is ERC20 {
3232
_;
3333
}
3434

35-
constructor() public ERC20("TEST Rouge", "RGE") {
35+
constructor() ERC20("TEST Rouge", "RGE") {
3636
owner = msg.sender;
37-
_setupDecimals(DECIMALS);
3837
_mint(owner, _totalSupply);
3938
}
4039

40+
function decimals() public view override returns (uint8) {
41+
return DECIMALS;
42+
}
43+
4144
function giveMeRGE(uint256 _value) public returns (bool success) {
4245
require(balanceOf(msg.sender) + _value <= maxBalance);
4346
require(balanceOf(owner) >= ownerMin + _value);

contracts/IRougeFactory.sol renamed to contracts/v0/IRougeFactory.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
66
*/
77

8-
pragma solidity ^0.6.0;
8+
pragma solidity ^0.8.0;
99

10-
import "./IRGEToken.sol";
10+
import "../IRGEToken.sol";
1111

1212
interface IRougeFactory {
1313

contracts/RougeBridge.sol renamed to contracts/v0/RougeBridge.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
66
*/
77

8-
pragma solidity ^0.6.0;
8+
pragma solidity ^0.8.0;
99

10-
import "./IRGEToken.sol";
10+
import "../IRGEToken.sol";
1111

1212
contract RougeBridge {
1313

@@ -22,7 +22,7 @@ contract RougeBridge {
2222

2323
IRGEToken public rge;
2424

25-
constructor(address _rge) public {
25+
constructor(address _rge) {
2626
owner = msg.sender;
2727
rge = IRGEToken(_rge);
2828
}

contracts/RougeFactory.sol renamed to contracts/v0/RougeFactory.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
*/
77

8-
pragma solidity ^0.6.0;
8+
pragma solidity ^0.8.0;
99

1010
import "./SimpleRougeCampaign.sol";
1111

@@ -19,7 +19,7 @@ contract RougeFactory {
1919

2020
address owner;
2121

22-
constructor() public {
22+
constructor() {
2323
owner = msg.sender;
2424
}
2525

contracts/SimpleRougeCampaign.sol renamed to contracts/v0/SimpleRougeCampaign.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
66
*/
77

8-
pragma solidity ^0.6.0;
8+
pragma solidity ^0.8.0;
99

10-
import "./IRGEToken.sol";
10+
import "../IRGEToken.sol";
1111

1212
import "./IRougeFactory.sol";
1313

@@ -78,7 +78,7 @@ contract SimpleRougeCampaign {
7878
uint32 public acquired;
7979
uint32 public redeemed;
8080

81-
constructor(address payable _issuer, uint32 _issuance, address _rge, uint256 _tare, address _factory) public {
81+
constructor(address payable _issuer, uint32 _issuance, address _rge, uint256 _tare, address _factory) {
8282
require(_issuance > 0);
8383

8484
issuer = _issuer;
@@ -177,8 +177,8 @@ contract SimpleRougeCampaign {
177177
require(rgeBalance >= issuance * tare);
178178

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

183183
name = _name;
184184
campaignIssued = true;
@@ -205,7 +205,7 @@ contract SimpleRougeCampaign {
205205

206206
modifier CampaignOpen() {
207207
require(campaignIssued);
208-
require(now < campaignExpiration);
208+
require(block.timestamp < campaignExpiration);
209209
_;
210210
}
211211

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

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

308308
function acceptRedemption(address payable _bearer, bytes32 _hash, uint8 v, bytes32 r, bytes32 s)

migrations/2_deploy_contracts.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
const RGETokenInterface = artifacts.require("./RGETokenInterface.sol")
2+
const IRGEToken = artifacts.require("./IRGEToken.sol")
33
const TestRGEToken = artifacts.require("./TestRGEToken.sol")
4-
const RougeFactory = artifacts.require("./RougeFactory.sol")
4+
const RougeFactory = artifacts.require("./v0/RougeFactory.sol")
55

6-
const RougeBridge = artifacts.require("./RougeBridge.sol")
6+
const RougeBridge = artifacts.require("./v0/RougeBridge.sol")
77
// const BridgeRGEToken = artifacts.require("./BridgeRGEToken.sol")
88

99
module.exports = async function(deployer, network) {
@@ -39,7 +39,7 @@ module.exports = async function(deployer, network) {
3939

4040
if (network && rgeAddress[network]) {
4141

42-
const rge = await RGETokenInterface.at(rgeAddress[network])
42+
const rge = await IRGEToken.at(rgeAddress[network])
4343

4444
await deployer.deploy(RougeFactory)
4545
const factory = await RougeFactory.deployed()

misc/rouge-tokenlist.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,22 @@
2828
"tags": [
2929
"voucher"
3030
]
31+
},
32+
{
33+
"chainId": 100,
34+
"address": "0x01ffe9982CB900dA7b6Faa84fF06a2BF43a149cd",
35+
"symbol": "RGE",
36+
"name": "Rouge on xDAI",
37+
"decimals": 6,
38+
"logoURI": "https://rouge.network/logo-100.png",
39+
"tags": [
40+
"voucher"
41+
]
3142
}
3243
],
3344
"version": {
3445
"major": 1,
35-
"minor": 0,
36-
"patch": 2
46+
"minor": 1,
47+
"patch": 1
3748
}
3849
}

0 commit comments

Comments
 (0)