Skip to content

Commit 491ce1b

Browse files
author
francois branciard
committed
FIX #24 useless RLC address getter
1 parent 5c700b0 commit 491ce1b

File tree

6 files changed

+11
-18
lines changed

6 files changed

+11
-18
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Features:
1818
* [#16](https://github.com/iExecBlockchainComputing/PoCo/issues/16) add counters info in Hub
1919

2020
Bugfixes:
21+
* [#24](https://github.com/iExecBlockchainComputing/PoCo/issues/24) possibly useless RLC address getter
2122

2223

2324
### [v1.0.12](https://github.com/iExecBlockchainComputing/PoCo/releases/tag/v1.0.12)

contracts/IexecAPI.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ contract IexecAPI is OwnableOZ, IexecHubAccessor, IexecCallbackInterface
4747
return true;
4848
}
4949

50-
function approveIexecHub(uint256 amount) public onlyOwner returns (bool)
50+
function approveIexecHub(uint256 amount, address rlcAddress) public onlyOwner returns (bool)
5151
{
52-
RLC rlc = RLC(iexecHubInterface.getRLCAddress());
52+
RLC rlc = RLC(rlcAddress);
5353
require(rlc.approve(iexecHubAddress, amount));
5454
emit ApproveIexecHub(iexecHubAddress, amount);
5555
return true;
5656
}
5757

58-
function withdrawRLCFromIexecAPI(uint256 amount) public onlyOwner returns (bool)
58+
function withdrawRLCFromIexecAPI(uint256 amount, address rlcAddress) public onlyOwner returns (bool)
5959
{
60-
RLC rlc = RLC(iexecHubInterface.getRLCAddress());
60+
RLC rlc = RLC(rlcAddress);
6161
require(rlc.transfer(msg.sender, amount));
6262
emit WithdrawRLCFromIexecAPI(msg.sender, amount);
6363
return true;
@@ -70,10 +70,10 @@ contract IexecAPI is OwnableOZ, IexecHubAccessor, IexecCallbackInterface
7070
return true;
7171
}
7272

73-
function withdrawRLCFromIexecHub(uint256 amount) public onlyOwner returns (bool)
73+
function withdrawRLCFromIexecHub(uint256 amount, address rlcAddress) public onlyOwner returns (bool)
7474
{
7575
require(iexecHubInterface.withdraw(amount));
76-
require(withdrawRLCFromIexecAPI(amount));
76+
require(withdrawRLCFromIexecAPI(amount,rlcAddress));
7777
emit WithdrawRLCFromIexecHub(iexecHubAddress, amount);
7878
return true;
7979
}

contracts/IexecHub.sol

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,6 @@ contract IexecHub
377377
);
378378
}
379379

380-
function getRLCAddress() public view returns (address rlcAddress)
381-
{
382-
return tokenAddress;
383-
}
384-
385380
function getWorkerStatus(address _worker) public view returns (address workerPool, uint256 workerScore)
386381
{
387382
return (workerPoolHub.getWorkerAffectation(_worker), m_scores[_worker]);

contracts/IexecHubInterface.sol

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ contract IexecHubInterface
104104
address _worker)
105105
public view returns (uint256 workerScore);
106106

107-
function getRLCAddress()
108-
public view returns (address rlc);
109-
110107
function registerToPool(address _worker)
111108
public returns (bool subscribed);
112109

test/byFunctions/IexecAPI/buyForWorkOrder.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ contract('IexecHub', function(accounts) {
264264
});
265265
console.log("aIexecAPIInstance created "+aIexecAPIInstance.address);
266266

267-
txMined = await aIexecAPIInstance.approveIexecHub(200, {
267+
txMined = await aIexecAPIInstance.approveIexecHub(200,aRLCInstance.address, {
268268
from: iExecCloudUser,
269269
gas: constants.AMOUNT_GAS_PROVIDED
270270
});
@@ -284,7 +284,7 @@ contract('IexecHub', function(accounts) {
284284
balance =await aRLCInstance.balanceOf(iExecCloudUser);
285285
assert.strictEqual(balance.toNumber(), 500, "check balanceOf iExecCloudUser");
286286

287-
txMined = await aIexecAPIInstance.withdrawRLCFromIexecAPI(100, {
287+
txMined = await aIexecAPIInstance.withdrawRLCFromIexecAPI(100,aRLCInstance.address, {
288288
from: iExecCloudUser,
289289
gas: constants.AMOUNT_GAS_PROVIDED
290290
});
@@ -316,7 +316,7 @@ contract('IexecHub', function(accounts) {
316316
assert.strictEqual(events[0].args.owner, aIexecAPIInstance.address, "check Deposit owner");
317317
assert.strictEqual(events[0].args.amount.toNumber(), 200, "check Deposit amount");
318318

319-
txMined = await aIexecAPIInstance.withdrawRLCFromIexecHub(100, {
319+
txMined = await aIexecAPIInstance.withdrawRLCFromIexecHub(100,aRLCInstance.address, {
320320
from: iExecCloudUser,
321321
gas: constants.AMOUNT_GAS_PROVIDED
322322
});

test/byFunctions/IexecAPI/workOrderCallback.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ contract('IexecHub', function(accounts) {
309309
});
310310
console.log("aIexecAPIInstance created " + aIexecAPIInstance.address);
311311

312-
txMined = await aIexecAPIInstance.approveIexecHub(200, {
312+
txMined = await aIexecAPIInstance.approveIexecHub(200,aRLCInstance.address, {
313313
from: iExecCloudUser,
314314
gas: constants.AMOUNT_GAS_PROVIDED
315315
});

0 commit comments

Comments
 (0)