Skip to content

Commit

Permalink
Fix SmartDec audit issues
Browse files Browse the repository at this point in the history
  • Loading branch information
protinam committed Dec 26, 2017
1 parent a7754d7 commit cb19153
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion contracts/Migrations.sol
@@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity 0.4.18;

contract Migrations {

Expand Down
2 changes: 1 addition & 1 deletion contracts/TestDAO.sol
Expand Up @@ -4,7 +4,7 @@
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "./dao/DelegatedShareholderAssociation.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/TestToken.sol
Expand Up @@ -4,7 +4,7 @@
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "zeppelin-solidity/contracts/token/StandardToken.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/WyvernDAO.sol
Expand Up @@ -4,7 +4,7 @@
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "./dao/DelegatedShareholderAssociation.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/WyvernExchange.sol
Expand Up @@ -4,7 +4,7 @@
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "./exchange/Exchange.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/WyvernToken.sol
Expand Up @@ -4,7 +4,7 @@
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "zeppelin-solidity/contracts/token/BurnableToken.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/common/ArrayUtils.sol
@@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity 0.4.18;

/**
* @title ArrayUtils
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/TokenRecipient.sol
Expand Up @@ -4,7 +4,7 @@
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "zeppelin-solidity/contracts/token/ERC20.sol";

Expand Down
14 changes: 8 additions & 6 deletions contracts/dao/DelegatedShareholderAssociation.sol
Expand Up @@ -42,7 +42,7 @@
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "zeppelin-solidity/contracts/token/ERC20.sol";
import "../common/TokenRecipient.sol";
Expand Down Expand Up @@ -78,7 +78,7 @@ contract DelegatedShareholderAssociation is TokenRecipient {

event ProposalAdded(uint proposalID, address recipient, uint amount, bytes metadataHash);
event Voted(uint proposalID, bool position, address voter);
event ProposalTallied(uint proposalID, uint result, uint quorum, bool active);
event ProposalTallied(uint proposalID, uint yea, uint nay, uint quorum, bool active);
event ChangeOfRules(uint newMinimumQuorum, uint newDebatingPeriodInMinutes, address newSharesTokenAddress);
event TokensDelegated(address indexed delegator, uint numberOfTokens, address indexed delegate);
event TokensUndelegated(address indexed delegator, uint numberOfTokens, address indexed delegate);
Expand Down Expand Up @@ -141,11 +141,11 @@ contract DelegatedShareholderAssociation is TokenRecipient {
* @param delegate the address to which votes equal to the number of tokens locked will be delegated
*/
function setDelegateAndLockTokens(uint tokensToLock, address delegate) public onlyShareholders onlyUndelegated {
require(ERC20(sharesTokenAddress).transferFrom(msg.sender, address(this), tokensToLock));
lockedDelegatingTokens[msg.sender] = tokensToLock;
delegatedAmountsByDelegate[delegate] += tokensToLock;
totalLockedTokens += tokensToLock;
delegatesByDelegator[msg.sender] = delegate;
require(ERC20(sharesTokenAddress).transferFrom(msg.sender, address(this), tokensToLock));
TokensDelegated(msg.sender, tokensToLock, delegate);
}

Expand Down Expand Up @@ -328,20 +328,22 @@ contract DelegatedShareholderAssociation is TokenRecipient {
require(quorum >= minimumQuorum);

if (yea > nay) {
/* Proposal passed; execute the transaction. */
/* Mark proposal as passed. */
p.executed = true;
p.proposalPassed = true;

/* Execute the function. */
require(p.recipient.call.value(p.amount)(transactionBytecode));

/* Prevent the DAO from sending the locked shares tokens (and thus potentially being unable to release locked tokens to delegating shareholders). */
require(ERC20(sharesTokenAddress).balanceOf(address(this)) >= totalLockedTokens);

p.proposalPassed = true;
} else {
/* Proposal failed. */
p.proposalPassed = false;
}

/* Log event. */
ProposalTallied(proposalNumber, yea - nay, quorum, p.proposalPassed);
ProposalTallied(proposalNumber, yea, nay, quorum, p.proposalPassed);
}
}
2 changes: 1 addition & 1 deletion contracts/exchange/AuthenticatedProxy.sol
Expand Up @@ -6,7 +6,7 @@
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "../common/ArrayUtils.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/exchange/DirectEscrowProvider.sol
@@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "zeppelin-solidity/contracts/token/ERC20.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/exchange/ERC721.sol
Expand Up @@ -4,7 +4,7 @@ ERC721 (draft) non-fungible token interface. See https://github.com/ethereum/EIP
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

/**
* @title ERC721
Expand Down
2 changes: 1 addition & 1 deletion contracts/exchange/EscrowProvider.sol
@@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "zeppelin-solidity/contracts/token/ERC20.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/exchange/Exchange.sol
Expand Up @@ -6,7 +6,7 @@
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "zeppelin-solidity/contracts/token/ERC20.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/exchange/NonFungibleAssetInterface.sol
@@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "zeppelin-solidity/contracts/ownership/Claimable.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/exchange/SaleKindInterface.sol
@@ -1,4 +1,4 @@
pragma solidity ^0.4.18;
pragma solidity 0.4.18;

/**
* @title SaleKindInterface
Expand Down
3 changes: 2 additions & 1 deletion contracts/token/DelayedReleaseToken.sol
Expand Up @@ -6,7 +6,7 @@
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "zeppelin-solidity/contracts/token/StandardToken.sol";

Expand Down Expand Up @@ -36,6 +36,7 @@ contract DelayedReleaseToken is StandardToken {
require((msg.sender == temporaryAdmin) && (!hasBeenReleased));
hasBeenReleased = true;
balances[destination] = numberOfDelayedTokens;
Transfer(address(0), destination, numberOfDelayedTokens);
TokensReleased(destination, numberOfDelayedTokens);
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/token/UTXORedeemableToken.sol
Expand Up @@ -16,7 +16,7 @@
*/

pragma solidity ^0.4.18;
pragma solidity 0.4.18;

import "zeppelin-solidity/contracts/token/StandardToken.sol";
import "zeppelin-solidity/contracts/MerkleProof.sol";
Expand Down

0 comments on commit cb19153

Please sign in to comment.