Skip to content

Commit

Permalink
Merge pull request #22 from aragon/aragonos-4
Browse files Browse the repository at this point in the history
Update to solidity 0.4.24
  • Loading branch information
bingen authored Sep 26, 2018
2 parents 9882b4b + 060725b commit e90d0ec
Show file tree
Hide file tree
Showing 21 changed files with 132 additions and 61 deletions.
11 changes: 4 additions & 7 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
module.exports = {
norpc: true,
testCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage',
skipFiles: [
'IFIFSResolvingRegistrar.sol',
'ens/IPublicResolver.sol',
'ens/',
'interface/ApproveAndCallReceiver.sol',
'misc/Migrations.sol',
'zeppelin/ERC20.sol',
'zeppelin/ERC20Basic.sol',
'zeppelin/Ownable.sol',
],
copyNodeModules: true,
'zeppelin/',
'test/',
]
}
3 changes: 0 additions & 3 deletions .solhintignore

This file was deleted.

6 changes: 6 additions & 0 deletions .soliumignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
contracts/ens
contracts/interface
contracts/misc
contracts/test
contracts/zeppelin
37 changes: 37 additions & 0 deletions .soliumrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extends": "solium:all",
"plugins": ["security"],
"rules": {
"security/no-low-level-calls": "off",
"security/no-inline-assembly": "off",
"error-reason": "off",
"imports-on-top": "error",
"variable-declarations": "error",
"array-declarations": "error",
"operator-whitespace": "error",
"conditionals-whitespace": "error",
"comma-whitespace": "error",
"semicolon-whitespace": "error",
"function-whitespace": "error",
"lbrace": "error",
"mixedcase": "error",
"camelcase": "error",
"uppercase": "error",
"no-empty-blocks": "error",
"no-unused-vars": "error",
"quotes": "error",
"blank-lines": "error",
"indentation": "error",
"arg-overflow": ["error", 8],
"whitespace": "error",
"deprecated-suicide": "error",
"pragma-on-top": "error",
"function-order": "error",
"emit": "error",
"no-constant": "error",
"value-in-payable": "error",
"max-len": "error",
"visibility-first": "error",
"linebreak-style": "error"
}
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ env:
- TASK=coverage
before_script:
- npm prune
script: "npm run $TASK"
script: "travis_wait 60 npm run $TASK"
after_success:
- cat coverage/lcov.info | ./node_modules/.bin/coveralls
12 changes: 6 additions & 6 deletions contracts/DeedHolder.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pragma solidity 0.4.18;
pragma solidity 0.4.24;


contract IENS {
function owner(bytes32 _node) public constant returns (address);
function owner(bytes32 _node) public view returns (address);
function setOwner(bytes32 _node, address _owner) public;
}

Expand All @@ -16,7 +16,7 @@ contract IDeed {
contract IHashRegistrarSimplified {
enum Mode { Open, Auction, Owned, Forbidden, Reveal, NotYetAvailable }

function entries(bytes32 _hash) public constant returns (Mode, address, uint, uint, uint);
function entries(bytes32 _hash) public view returns (Mode, address, uint, uint, uint);
function transfer(bytes32 _hash, address _newOwner) public;
}

Expand Down Expand Up @@ -54,7 +54,7 @@ contract DeedHolder {
_;
}

function DeedHolder(address _ens, bytes32 _registrarNode) public {
constructor(address _ens, bytes32 _registrarNode) public {
ens = IENS(_ens);
registrarNode = _registrarNode;
registrar = IHashRegistrarSimplified(ens.owner(registrarNode));
Expand All @@ -76,7 +76,7 @@ contract DeedHolder {
* @param _node The node hash of the deed to check.
* @return The address owning the deed.
*/
function owner(bytes32 _node) public constant returns(address) {
function owner(bytes32 _node) public view returns(address) {
if (owners[_node] != 0) {
return owners[_node];
}
Expand All @@ -97,6 +97,6 @@ contract DeedHolder {
*/
function transfer(bytes32 _node, address _newOwner) public onlyDeedOwner(_node) {
owners[_node] = _newOwner;
TransferDeed(_node, _newOwner);
emit TransferDeed(_node, _newOwner);
}
}
4 changes: 2 additions & 2 deletions contracts/DelegatingDeedHolder.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.4.18;
pragma solidity 0.4.24;


import "./DeedHolder.sol";
Expand All @@ -15,7 +15,7 @@ import "./DeedHolder.sol";
* DeedHolder also transfers control of the ENS node.
*/
contract DelegatingDeedHolder is DeedHolder {
function DelegatingDeedHolder(address _ens, bytes32 _registrarNode)
constructor(address _ens, bytes32 _registrarNode)
public
DeedHolder(_ens, _registrarNode)
// solhint-disable-next-line no-empty-blocks
Expand Down
4 changes: 2 additions & 2 deletions contracts/FIFSBurnableRegistrar.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.4.18;
pragma solidity 0.4.24;

import "./interface/ApproveAndCallReceiver.sol";
import "./zeppelin/ERC20.sol";
Expand Down Expand Up @@ -26,7 +26,7 @@ contract FIFSBurnableRegistrar is Ownable, ApproveAndCallReceiver, FIFSResolving
* @param _burningToken The token to be burned for claiming addresses.
* @param _startingCost The initial cost of claiming an address.
*/
function FIFSBurnableRegistrar(
constructor(
AbstractENS _ensAddr,
IPublicResolver _resolver,
bytes32 _node,
Expand Down
8 changes: 4 additions & 4 deletions contracts/FIFSResolvingRegistrar.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity 0.4.18;
pragma solidity 0.4.24;

import "@aragon/os/contracts/lib/ens/AbstractENS.sol";
import "./ens/AbstractENS.sol";
import "./ens/IPublicResolver.sol";
import "./IFIFSResolvingRegistrar.sol";

Expand All @@ -26,7 +26,7 @@ contract FIFSResolvingRegistrar is IFIFSResolvingRegistrar {
* @param _defaultResolver The address of the default resolver to use for subdomains.
* @param _node The node that this registrar administers.
*/
function FIFSResolvingRegistrar(AbstractENS _ensAddr, IPublicResolver _defaultResolver, bytes32 _node)
constructor(AbstractENS _ensAddr, IPublicResolver _defaultResolver, bytes32 _node)
public
{
ens = _ensAddr;
Expand Down Expand Up @@ -65,6 +65,6 @@ contract FIFSResolvingRegistrar is IFIFSResolvingRegistrar {
// Give ownership to the claimer
ens.setOwner(node, _owner);

ClaimSubdomain(_subnode, _owner, address(_resolver));
emit ClaimSubdomain(_subnode, _owner, address(_resolver));
}
}
2 changes: 1 addition & 1 deletion contracts/IFIFSResolvingRegistrar.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.4.18;
pragma solidity 0.4.24;

import "./ens/IPublicResolver.sol";

Expand Down
24 changes: 24 additions & 0 deletions contracts/ens/AbstractENS.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pragma solidity ^0.4.15;


interface AbstractENS {
function owner(bytes32 _node) public constant returns (address);
function resolver(bytes32 _node) public constant returns (address);
function ttl(bytes32 _node) public constant returns (uint64);
function setOwner(bytes32 _node, address _owner) public;
function setSubnodeOwner(bytes32 _node, bytes32 label, address _owner) public;
function setResolver(bytes32 _node, address _resolver) public;
function setTTL(bytes32 _node, uint64 _ttl) public;

// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed _node, bytes32 indexed _label, address _owner);

// Logged when the owner of a node transfers ownership to a new account.
event Transfer(bytes32 indexed _node, address _owner);

// Logged when the resolver for a node changes.
event NewResolver(bytes32 indexed _node, address _resolver);

// Logged when the TTL of a node changes
event NewTTL(bytes32 indexed _node, uint64 _ttl);
}
2 changes: 1 addition & 1 deletion contracts/interface/ApproveAndCallReceiver.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.4.18;
pragma solidity 0.4.24;

/*
Copyright 2017, Jordi Baylina (Giveth)
Expand Down
2 changes: 1 addition & 1 deletion test/ens/ENS.sol → contracts/test/ens/ENS.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity ^0.4.0;

import "@aragon/os/contracts/lib/ens/AbstractENS.sol";
import "../../ens/AbstractENS.sol";


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity ^0.4.0;

import "@aragon/os/contracts/lib/ens/AbstractENS.sol";
import "../../ens/AbstractENS.sol";

/**
* A registrar that allocates subdomains to the first person to claim them.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity ^0.4.0;

import "@aragon/os/contracts/lib/ens/AbstractENS.sol";
import "../../ens/AbstractENS.sol";

/**
* A simple resolver anyone can use; only allows the owner of a node to set its
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The plan is to test the basic features and then move to a new contract in at mos
*/


import "@aragon/os/contracts/lib/ens/AbstractENS.sol";
import "../../ens/AbstractENS.sol";


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.4.18;
pragma solidity 0.4.24;

import "../ens/Registrar.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity 0.4.18;
pragma solidity 0.4.24;

import "../../contracts/interface/ApproveAndCallReceiver.sol";
import "../../interface/ApproveAndCallReceiver.sol";


contract MockApproveAndCallERC20 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity 0.4.18;
pragma solidity 0.4.24;

import "@aragon/os/contracts/lib/ens/AbstractENS.sol";
import "../../ens/AbstractENS.sol";


contract MockResolver {
Expand Down
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@aragon/id",
"version": "1.2.4",
"version": "2.0.0",
"description": "",
"scripts": {
"compile": "truffle compile",
"coverage": "cross-env SOLIDITY_COVERAGE=true ./test.sh",
"develop": "truffle develop",
"lint": "solhint 'contracts/**/*.sol'",
"lint": "solium --dir contracts",
"migrate": "truffle migrate",
"test": "./test.sh",
"deploy:devnet": "truffle compile --all; truffle exec --network devnet scripts/deploy-beta-aragonid.js"
Expand Down Expand Up @@ -41,13 +41,9 @@
"ethereumjs-testrpc": "^6.0.1",
"homedir": "^0.6.0",
"js-sha3": "^0.7.0",
"solhint": "^1.1.10",
"solidity-coverage": "0.4.3",
"solidity-coverage": "^0.4.0",
"truffle": "4.0.5",
"solium": "^1.1.8",
"solidity-coverage": "^0.5.8",
"truffle": "4.1.14",
"truffle-hdwallet-provider": "0.0.3"
},
"dependencies": {
"@aragon/os": "^3.1.4"
}
}
46 changes: 30 additions & 16 deletions scripts/deploy-beta-aragonid.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
const namehash = require('eth-ens-namehash').hash
const keccak256 = require('js-sha3').keccak_256

const FIFSResolvingRegistrar = artifacts.require('FIFSResolvingRegistrar')
const ENS = artifacts.require('AbstractENS')

const owner = process.env.OWNER || '0x4cb3fd420555a09ba98845f0b816e45cfb230983'
const ens = process.env.ENS || '0xfbae32d1cde62858bc45f51efc8cc4fa1415447e'
const globalArtifacts = this.artifacts // Not injected unless called directly via truffle
const defaultOwner = process.env.OWNER || '0x4cb3fd420555a09ba98845f0b816e45cfb230983'
const defaultENSAddress = process.env.ENS || '0xfbae32d1cde62858bc45f51efc8cc4fa1415447e'

const tld = namehash('eth')
const label = '0x'+keccak256('aragonid')
const node = namehash('aragonid.eth')

module.exports = async callback => {
const publicResolver = await ENS.at(ens).resolver(namehash('resolver.eth'))
console.log('deploying AragonID')
const aragonID = await FIFSResolvingRegistrar.new(ens, publicResolver, node)

console.log('assigning ENS name to AragonID')
await ENS.at(ens).setSubnodeOwner(tld, label, aragonID.address)

console.log('assigning owner name')
module.exports = async (
truffleExecCallback,
{
artifacts = globalArtifacts,
ensAddress = defaultENSAddress,
owner = defaultOwner,
verbose = true
} = {}
) => {
const log = (...args) => {
if (verbose) { console.log(...args) }
}

log(`Deploying AragonID with ENS: ${ensAddress} and owner: ${owner}`)
const FIFSResolvingRegistrar = artifacts.require('FIFSResolvingRegistrar')
const ENS = artifacts.require('AbstractENS')

const publicResolver = await ENS.at(ensAddress).resolver(namehash('resolver.eth'))
log('deploying AragonID')
const aragonID = await FIFSResolvingRegistrar.new(ensAddress, publicResolver, node)

log('assigning ENS name to AragonID')
await ENS.at(ensAddress).setSubnodeOwner(tld, label, aragonID.address)

log('assigning owner name')
await aragonID.register('0x'+keccak256('owner'), owner)

console.log('===========')
console.log('Deployed AragonID:', aragonID.address)
log('===========')
log('Deployed AragonID:', aragonID.address)
}

// Deployed AragonID: 0x3a06a6544e48708142508d9042f94ddda769d04f

0 comments on commit e90d0ec

Please sign in to comment.