Skip to content

Commit b1fa8a8

Browse files
committed
Merge branch 'audit/ackee'
2 parents ba6dd0a + 281c60b commit b1fa8a8

File tree

97 files changed

+23009
-16626
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+23009
-16626
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,14 @@ Code coverage for the token system can be checked with [solidity-coverage](https
186186

187187
![Code coverage](docs/code-coverage.png)
188188

189+
## Smart contract audit
190+
191+
The smart contracts were audited by [Ackee Blockchain Security](https://ackeeblockchain.com). The report is available [here](docs/ackee-blockchain-monerium-smart-contracts-report-1.2.pdf).
192+
189193
## License
190194

191195
```text
192-
Copyright 2022 Monerium ehf.
196+
Copyright 2023 Monerium ehf.
193197
194198
Licensed under the Apache License, Version 2.0 (the "License");
195199
you may not use this file except in compliance with the License.

assets/tokens/eur/info.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "Monerium EUR emoney",
3+
"symbol": "EURe",
4+
"ticker": "EUR",
5+
"decimals": "18",
6+
"website": "https://monerium.com",
7+
"source_code": "https://github.com/monerium/smart-contracts",
8+
"short_description": "The Monerium e-money offers programmable fiat money on blockchains, an indispensable building block for the nascent blockchain economy.",
9+
"networks": {
10+
"1" : {
11+
"name": "Ethereum Mainnet",
12+
"short_name": "eth",
13+
"chain": "ETH",
14+
"network": "mainnet",
15+
"chain_id": 1,
16+
"network_id": 1,
17+
"contract_address": "0x3231cb76718cdef2155fc47b5286d82e6eda273f",
18+
"ens": "eur.monerium.com",
19+
"explorer": "https://etherscan.io/token/0x3231cb76718cdef2155fc47b5286d82e6eda273f"
20+
21+
},
22+
"3" : {
23+
"name": "Ethereum Ropsten",
24+
"short_name": "rop",
25+
"chain": "ETH",
26+
"network": "ropsten",
27+
"chain_id": 3,
28+
"network_id": 3,
29+
"contract_address": "0x0ae91c2b9e31e92871129117d908b0963c054048",
30+
"explorer": "https:/ropsten./etherscan.io/token/0x0ae91c2b9e31e92871129117d908b0963c054048"
31+
32+
},
33+
"4" : {
34+
"name": "Ethereum Rinkeby",
35+
"short_name": "rin",
36+
"chain": "ETH",
37+
"network": "rinkeby",
38+
"chain_id": 4,
39+
"network_id": 4,
40+
"contract_address": "0x25c13fc529dc4afe4d488bd1f2ee5e1ec4918e0b",
41+
"explorer": "https://rinkeby.etherscan.io/token/0x25c13fc529dc4afe4d488bd1f2ee5e1ec4918e0b"
42+
43+
},
44+
"42" : {
45+
"name": "Ethereum Kovan",
46+
"short_name": "kov",
47+
"chain": "ETH",
48+
"network": "kovan",
49+
"chain_id": 42,
50+
"network_id": 42,
51+
"contract_address": "0x9b8fd8fcfaa2438d11e7ed77d5afb6c2e1044b37",
52+
"explorer": "https://kovan.etherscan.io/token/0x9b8fd8fcfaa2438d11e7ed77d5afb6c2e1044b37"
53+
54+
}
55+
}
56+
}

assets/tokens/gbp/info.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "Monerium GBP emoney",
3+
"symbol": "GBPe",
4+
"ticker": "GBP",
5+
"decimals": "18",
6+
"website": "https://monerium.com",
7+
"source_code": "https://github.com/monerium/smart-contracts",
8+
"short_description": "The Monerium e-money offers programmable fiat money on blockchains, an indispensable building block for the nascent blockchain economy.",
9+
"networks": {
10+
"1" : {
11+
"name": "Ethereum Mainnet",
12+
"short_name": "eth",
13+
"chain": "ETH",
14+
"network": "mainnet",
15+
"chain_id": 1,
16+
"network_id": 1,
17+
"contract_address": "0x7ba92741bf2a568abc6f1d3413c58c6e0244f8fd",
18+
"ens": "gbp.monerium.com",
19+
"explorer": "https://etherscan.io/token/0x7ba92741bf2a568abc6f1d3413c58c6e0244f8fd"
20+
21+
},
22+
"3" : {
23+
"name": "Ethereum Ropsten",
24+
"short_name": "rop",
25+
"chain": "ETH",
26+
"network": "ropsten",
27+
"chain_id": 3,
28+
"network_id": 3,
29+
"contract_address": "0xd9979346224e7b147caddf399b56357e20d3e67c",
30+
"explorer": "https:/ropsten./etherscan.io/token/0xd9979346224e7b147caddf399b56357e20d3e67c"
31+
32+
},
33+
"4" : {
34+
"name": "Ethereum Rinkeby",
35+
"short_name": "rin",
36+
"chain": "ETH",
37+
"network": "rinkeby",
38+
"chain_id": 4,
39+
"network_id": 4,
40+
"contract_address": "0x01df10e345d0364d3a5b8422a66af6305803bd1e",
41+
"explorer": "https://rinkeby.etherscan.io/token/0x01df10e345d0364d3a5b8422a66af6305803bd1e"
42+
43+
},
44+
"42" : {
45+
"name": "Ethereum Kovan",
46+
"short_name": "kov",
47+
"chain": "ETH",
48+
"network": "kovan",
49+
"chain_id": 42,
50+
"network_id": 42,
51+
"contract_address": "0xe28884ed5bd43e3f9f1dd733d254c9f5c6f983d2",
52+
"explorer": "https://kovan.etherscan.io/token/0xe28884ed5bd43e3f9f1dd733d254c9f5c6f983d2"
53+
54+
}
55+
}
56+
}

contracts/BlacklistValidator.sol

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
pragma solidity ^0.8.11;
18+
pragma solidity 0.8.11;
1919

20-
import "./ownership/Claimable.sol";
20+
import "./ClaimableSystemRole.sol";
2121
import "./ownership/NoOwner.sol";
2222
import "./ownership/CanReclaimToken.sol";
2323
import "./IValidator.sol";
@@ -26,9 +26,13 @@ import "./IValidator.sol";
2626
* @title BlacklistValidator
2727
* @dev Implements a validator which rejects transfers to blacklisted addresses.
2828
*/
29-
contract BlacklistValidator is IValidator, Claimable, CanReclaimToken, NoOwner {
30-
31-
mapping (address => bool) public blacklist;
29+
contract BlacklistValidator is
30+
IValidator,
31+
ClaimableSystemRole,
32+
CanReclaimToken,
33+
NoOwner
34+
{
35+
mapping(address => bool) public blacklist;
3236

3337
/**
3438
* @dev Emitted when an address is added to the blacklist.
@@ -42,11 +46,22 @@ contract BlacklistValidator is IValidator, Claimable, CanReclaimToken, NoOwner {
4246
*/
4347
event Unban(address indexed friend);
4448

49+
constructor() {
50+
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
51+
}
52+
4553
/**
4654
* @dev Adds an address to the blacklist.
4755
* @param adversary Address to add.
4856
*/
49-
function ban(address adversary) external onlyOwner {
57+
function ban(address adversary) external {
58+
require(
59+
owner == msg.sender ||
60+
hasRole(SYSTEM_ROLE, msg.sender) ||
61+
hasRole(ADMIN_ROLE, msg.sender),
62+
"BlacklistValidator: must have admin role to ban"
63+
);
64+
5065
blacklist[adversary] = true;
5166
emit Ban(adversary);
5267
}
@@ -64,10 +79,11 @@ contract BlacklistValidator is IValidator, Claimable, CanReclaimToken, NoOwner {
6479
* @dev Validates token transfer.
6580
* Implements IValidator interface.
6681
*/
67-
function validate(address from, address to, uint amount)
68-
external
69-
returns (bool valid)
70-
{
82+
function validate(
83+
address from,
84+
address to,
85+
uint256 amount
86+
) external returns (bool valid) {
7187
if (blacklist[from]) {
7288
valid = false;
7389
} else {
@@ -80,7 +96,41 @@ contract BlacklistValidator is IValidator, Claimable, CanReclaimToken, NoOwner {
8096
* @dev Explicit override of transferOwnership from Claimable and Ownable
8197
* @param newOwner Address to transfer ownership to.
8298
*/
83-
function transferOwnership(address newOwner) public override(Claimable, Ownable) {
84-
Claimable.transferOwnership(newOwner);
99+
function transferOwnership(
100+
address newOwner
101+
) public override(ClaimableSystemRole, Ownable) {
102+
ClaimableSystemRole.transferOwnership(newOwner);
103+
}
104+
105+
/**
106+
* @dev Explicit override of addSystemAccount from ClaimableSystemRole
107+
* @param account Address to add as system account.
108+
*/
109+
function addSystemAccount(address account) public override onlyOwner {
110+
super.addSystemAccount(account);
111+
}
112+
113+
/**
114+
* @dev Explicit override of removeSystemAccount from ClaimableSystemRole
115+
* @param account Address to remove as system account.
116+
*/
117+
function removeSystemAccount(address account) public override onlyOwner {
118+
super.removeSystemAccount(account);
119+
}
120+
121+
/**
122+
* @dev Explicit override of addAdminAccount from ClaimableSystemRole
123+
* @param account Address to add as admin account.
124+
*/
125+
function addAdminAccount(address account) public override onlyOwner {
126+
super.addAdminAccount(account);
127+
}
128+
129+
/**
130+
* @dev Explicit override of removeAdminAccount from ClaimableSystemRole
131+
* @param account Address to remove as admin account.
132+
*/
133+
function removeAdminAccount(address account) public override onlyOwner {
134+
super.removeAdminAccount(account);
85135
}
86136
}

contracts/ClaimableSystemRole.sol

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.11;
3+
4+
import "./SystemRole.sol";
5+
6+
/**
7+
* @title ClaimableSystemRole
8+
* @dev Extension for the SystemRole contract, where the ownership needs to be claimed.
9+
* This allows the new owner to accept the transfer.
10+
*/
11+
abstract contract ClaimableSystemRole is SystemRole {
12+
address public pendingOwner;
13+
14+
/**
15+
* @dev emitted when the pendingOwner address is changed
16+
* @param previousPendingOwner previous pendingOwner address
17+
* @param newPendingOwner new pendingOwner address
18+
*/
19+
event OwnershipTransferPending(
20+
address indexed previousPendingOwner,
21+
address indexed newPendingOwner
22+
);
23+
24+
/**
25+
* @dev Modifier throws if called by any account other than the pendingOwner.
26+
*/
27+
modifier onlyPendingOwner() {
28+
require(msg.sender == pendingOwner);
29+
_;
30+
}
31+
32+
/**
33+
* @dev Allows the current owner to set the pendingOwner address.
34+
* @param newOwner The address to transfer ownership to.
35+
*/
36+
function transferOwnership(
37+
address newOwner
38+
) public virtual override onlyOwner {
39+
emit OwnershipTransferPending(pendingOwner, newOwner);
40+
pendingOwner = newOwner;
41+
}
42+
43+
/**
44+
* @dev Allows the pendingOwner address to finalize the transfer.
45+
*/
46+
function claimOwnership() public onlyPendingOwner {
47+
emit OwnershipTransferred(owner, pendingOwner);
48+
owner = pendingOwner;
49+
_setupRole(DEFAULT_ADMIN_ROLE, owner);
50+
pendingOwner = address(0);
51+
}
52+
}

0 commit comments

Comments
 (0)