added some comments & updated solcpiler
This commit is contained in:
parent
7baa39c62f
commit
ed7c4b8b47
|
@ -1,7 +1,7 @@
|
|||
pragma solidity ^0.4.0;
|
||||
|
||||
/*
|
||||
Copyright 2017, Jordi Baylina
|
||||
Copyright 2018, Jordi Baylina
|
||||
Contributors: Adrià Massanet <adria@codecontext.io>, RJ Ewing, Griff
|
||||
Green, Arthur Lunn
|
||||
|
||||
|
|
|
@ -27,12 +27,23 @@ import "./LiquidPledgingBase.sol";
|
|||
/// to allow for expanded functionality.
|
||||
contract LiquidPledging is LiquidPledgingBase {
|
||||
|
||||
/// Create a "giver" pledge admin for the sender & donate
|
||||
/// @param idReceiver The Admin receiving the donation; can be any Admin:
|
||||
/// the Giver themselves, another Giver, a Delegate or a Project
|
||||
/// @param token The address of the token being donated.
|
||||
/// @param amount The amount of tokens being donated
|
||||
function addGiverAndDonate(uint64 idReceiver, address token, uint amount)
|
||||
public
|
||||
{
|
||||
addGiverAndDonate(idReceiver, msg.sender, token, amount);
|
||||
}
|
||||
|
||||
/// Create a "giver" pledge admin for the given `donorAddress` & donate
|
||||
/// @param idReceiver The Admin receiving the donation; can be any Admin:
|
||||
/// the Giver themselves, another Giver, a Delegate or a Project
|
||||
/// @param donorAddress The address of the "giver" of this donation
|
||||
/// @param token The address of the token being donated.
|
||||
/// @param amount The amount of tokens being donated
|
||||
function addGiverAndDonate(uint64 idReceiver, address donorAddress, address token, uint amount)
|
||||
public
|
||||
{
|
||||
|
@ -50,6 +61,8 @@ contract LiquidPledging is LiquidPledgingBase {
|
|||
/// @param idGiver The id of the Giver donating
|
||||
/// @param idReceiver The Admin receiving the donation; can be any Admin:
|
||||
/// the Giver themselves, another Giver, a Delegate or a Project
|
||||
/// @param token The address of the token being donated.
|
||||
/// @param amount The amount of tokens being donated
|
||||
function donate(uint64 idGiver, uint64 idReceiver, address token, uint amount)
|
||||
public
|
||||
{
|
||||
|
|
|
@ -233,20 +233,11 @@ contract LiquidPledgingBase is AragonApp, LiquidPledgingStorage, PledgeAdmins, P
|
|||
if (receiver.adminType == PledgeAdminType.Delegate) {
|
||||
uint receiverDIdx = _getDelegateIdx(p, idReceiver);
|
||||
|
||||
// And not in the delegationChain
|
||||
if (receiverDIdx == NOTFOUND) {
|
||||
idPledge = _undelegate(
|
||||
idPledge,
|
||||
amount,
|
||||
p.delegationChain.length - senderDIdx - 1
|
||||
);
|
||||
_appendDelegate(idPledge, amount, idReceiver);
|
||||
return;
|
||||
|
||||
// And part of the delegationChain and is after the sender, then
|
||||
// all of the other delegates after the sender are removed and
|
||||
// the receiver is appended at the end of the delegationChain
|
||||
} else if (receiverDIdx > senderDIdx) {
|
||||
// And not in the delegationChain or part of the delegationChain
|
||||
// is after the sender, then all of the other delegates after
|
||||
// the sender are removed and the receiver is appended at the
|
||||
// end of the delegationChain
|
||||
if (receiverDIdx == NOTFOUND || receiverDIdx > senderDIdx) {
|
||||
idPledge = _undelegate(
|
||||
idPledge,
|
||||
amount,
|
||||
|
@ -259,7 +250,6 @@ contract LiquidPledgingBase is AragonApp, LiquidPledgingStorage, PledgeAdmins, P
|
|||
// And is already part of the delegate chain but is before the
|
||||
// sender, then the sender and all of the other delegates after
|
||||
// the RECEIVER are removed from the delegationChain
|
||||
//TODO Check for Game Theory issues (from Arthur) this allows the sender to sort of go komakosi and remove himself and the delegates between himself and the receiver... should this authority be allowed?
|
||||
_undelegate(
|
||||
idPledge,
|
||||
amount,
|
||||
|
|
|
@ -96,13 +96,12 @@ contract LiquidPledgingPlugins is AragonApp, LiquidPledgingStorage, LiquidPledgi
|
|||
function getCodeHash(address addr) public view returns(bytes32) {
|
||||
bytes memory o_code;
|
||||
assembly {
|
||||
// retrieve the size of the code, this needs assembly
|
||||
// retrieve the size of the code
|
||||
let size := extcodesize(addr)
|
||||
// allocate output byte array - this could also be done without assembly
|
||||
// by using o_code = new bytes(size)
|
||||
// allocate output byte array
|
||||
o_code := mload(0x40)
|
||||
mstore(o_code, size) // store length in memory
|
||||
// actually retrieve the code, this needs assembly
|
||||
// actually retrieve the code
|
||||
extcodecopy(addr, add(o_code, 0x20), 0, size)
|
||||
}
|
||||
return keccak256(o_code);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "giveth-liquidpledging",
|
||||
"version": "1.0.0-beta.5",
|
||||
"version": "1.0.0-beta.6",
|
||||
"description": "Liquid Pledging Smart Contract",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
|
@ -45,7 +45,7 @@
|
|||
"lerna": "^2.2.0",
|
||||
"mocha": "^3.5.0",
|
||||
"random-bytes": "^1.0.0",
|
||||
"solcpiler": "1.0.0-beta.5",
|
||||
"solcpiler": "1.0.0-beta.7",
|
||||
"web3": "1.0.0-beta.34"
|
||||
},
|
||||
"homepage": "https://github.com/Giveth/liquidpledging#readme",
|
||||
|
|
Loading…
Reference in New Issue