Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set gas price dynamically #123

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
},
rinkeby: {
contract_addresses:{
'Conference': '0xDdDf97B54a515172AadD9590d5aBCE524683f390',
'Conference': null,
'ConfirmationRepository': null
},
name: 'RINKEBY NET',
Expand Down
25 changes: 13 additions & 12 deletions contracts/Conference.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ contract Conference is Destructible {
}
}

function registerWithEncryption(string _participant, string _encrypted) public payable onlyActive{
function registerWithEncryption(string _participant, string _encrypted) external payable onlyActive{
registerInternal(_participant);
RegisterEvent(msg.sender, _participant, _encrypted);
}

function register(string _participant) public payable onlyActive{
function register(string _participant) external payable onlyActive{
registerInternal(_participant);
RegisterEvent(msg.sender, _participant, '');
}
Expand All @@ -110,7 +110,7 @@ contract Conference is Destructible {
participants[msg.sender] = Participant(_participant, msg.sender, false, false);
}

function attendWithConfirmation(bytes32 _confirmation) public onlyActive{
function attendWithConfirmation(bytes32 _confirmation) external onlyActive{
require(isRegistered(msg.sender));
require(!isAttended(msg.sender));
require(confirmationRepository.claim(_confirmation, msg.sender));
Expand All @@ -120,15 +120,15 @@ contract Conference is Destructible {
AttendEvent(msg.sender);
}

function withdraw() public onlyEnded{
function withdraw() external onlyEnded{
require(payoutAmount > 0);
Participant participant = participants[msg.sender];
require(participant.addr == msg.sender);
require(cancelled || participant.attended);
require(participant.paid == false);

participant.paid = true;
assert(participant.addr.send(payoutAmount));
participant.addr.transfer(payoutAmount);
WithdrawEvent(msg.sender, payoutAmount);
}

Expand All @@ -137,7 +137,7 @@ contract Conference is Destructible {
return this.balance;
}

function confirmation() constant public returns (bool){
function confirmation() constant external returns (bool){
return address(confirmationRepository) != address(0);
}

Expand All @@ -160,14 +160,14 @@ contract Conference is Destructible {

/* Admin only functions */

function payback() public onlyOwner onlyActive{
function payback() external onlyOwner onlyActive{
payoutAmount = payout();
ended = true;
endedAt = now;
PaybackEvent(payoutAmount);
}

function cancel() public onlyOwner onlyActive{
function cancel() external onlyOwner onlyActive{
payoutAmount = deposit;
cancelled = true;
ended = true;
Expand All @@ -176,19 +176,20 @@ contract Conference is Destructible {
}

/* return the remaining of balance if there are any unclaimed after cooling period */
function clear() public onlyOwner onlyEnded{
function clear() external onlyOwner onlyEnded{
require(now > endedAt + coolingPeriod);
require(ended);
var leftOver = totalBalance();
require(owner.send(leftOver));

owner.transfer(leftOver);
ClearEvent(owner, leftOver);
}

function setLimitOfParticipants(uint _limitOfParticipants) public onlyOwner onlyActive{
function setLimitOfParticipants(uint _limitOfParticipants) external onlyOwner onlyActive{
limitOfParticipants = _limitOfParticipants;
}

function attend(address[] _addresses) public onlyOwner onlyActive{
function attend(address[] _addresses) external onlyOwner onlyActive{
for(uint i=0;i<_addresses.length;i++){
var _addr = _addresses[i];
require(isRegistered(_addr));
Expand Down
1 change: 1 addition & 0 deletions truffle.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = {
host: "localhost",
network_id: 4,
port: 8545,
from: "0xbfb142f5bc1d33b7e173acd77719375faf5c72c1", // default address to use for any transaction Truffle makes during migrations
gasPrice: 50000000000 // 50 gwei,
},
ropsten: {
Expand Down