Compare commits
1 Commits
new-final-
...
d0d456b357
| Author | SHA1 | Date | |
|---|---|---|---|
| d0d456b357 |
@@ -31,35 +31,18 @@ contract Reimbursement is Initializable {
|
|||||||
|
|
||||||
uint32 public blocksToWait;
|
uint32 public blocksToWait;
|
||||||
|
|
||||||
// The address that deployed the contract
|
|
||||||
address public deployer;
|
|
||||||
|
|
||||||
// Data migration flag
|
|
||||||
bool public migrationDone;
|
|
||||||
|
|
||||||
event ReimbursementAdded(uint32 id, address indexed addedByAccount, uint256 amount);
|
event ReimbursementAdded(uint32 id, address indexed addedByAccount, uint256 amount);
|
||||||
event ReimbursementVetoed(uint32 id, address vetoedByAccount);
|
event ReimbursementVetoed(uint32 id, address vetoedByAccount);
|
||||||
|
|
||||||
|
function initialize() public initializer {
|
||||||
|
blocksToWait = 40320; // 7 days; 15 seconds block time
|
||||||
|
}
|
||||||
|
|
||||||
modifier onlyCore {
|
modifier onlyCore {
|
||||||
require(contributorContract.addressIsCore(tx.origin), "Core only");
|
require(contributorContract.addressIsCore(tx.origin), "Core only");
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier onlyDeployer {
|
|
||||||
require(msg.sender == deployer, "Deployer only");
|
|
||||||
_;
|
|
||||||
}
|
|
||||||
|
|
||||||
function initialize() public initializer {
|
|
||||||
deployer = msg.sender;
|
|
||||||
migrationDone = false;
|
|
||||||
blocksToWait = 40320; // 7 days; 15 seconds block time
|
|
||||||
}
|
|
||||||
|
|
||||||
function finishMigration() public onlyDeployer {
|
|
||||||
migrationDone = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setContributorContract(address contributor) public {
|
function setContributorContract(address contributor) public {
|
||||||
require(address(contributorContract) == address(0) || contributorContract.addressIsCore(msg.sender), "Core only");
|
require(address(contributorContract) == address(0) || contributorContract.addressIsCore(msg.sender), "Core only");
|
||||||
contributorContract = ContributorInterface(contributor);
|
contributorContract = ContributorInterface(contributor);
|
||||||
@@ -99,8 +82,7 @@ contract Reimbursement is Initializable {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function add(uint256 amount, address token, uint32 recipientId, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, uint256 confirmedAtBlock, bool vetoed) public onlyCore {
|
function add(uint256 amount, address token, uint32 recipientId, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public onlyCore {
|
||||||
require((confirmedAtBlock == 0 && vetoed == false) || migrationDone == false, "Extra arguments not allowed");
|
|
||||||
uint32 reimbursementId = reimbursementsCount + 1;
|
uint32 reimbursementId = reimbursementsCount + 1;
|
||||||
ReimbursementData storage r = reimbursements[reimbursementId];
|
ReimbursementData storage r = reimbursements[reimbursementId];
|
||||||
r.exists = true;
|
r.exists = true;
|
||||||
@@ -110,14 +92,7 @@ contract Reimbursement is Initializable {
|
|||||||
r.hashDigest = hashDigest;
|
r.hashDigest = hashDigest;
|
||||||
r.hashFunction = hashFunction;
|
r.hashFunction = hashFunction;
|
||||||
r.hashSize = hashSize;
|
r.hashSize = hashSize;
|
||||||
|
r.confirmedAtBlock = block.number + blocksToWait;
|
||||||
if (confirmedAtBlock > 0) {
|
|
||||||
r.confirmedAtBlock = confirmedAtBlock;
|
|
||||||
} else {
|
|
||||||
r.confirmedAtBlock = block.number + 1 + blocksToWait;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vetoed) { r.vetoed = true; }
|
|
||||||
|
|
||||||
reimbursementsCount++;
|
reimbursementsCount++;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user