This repository has been archived by the owner on Sep 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Redirector.sol
59 lines (46 loc) · 1.76 KB
/
Redirector.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
pragma solidity ^0.4.24;
import "../BearBucks.sol";
import "../CryptoBears.sol";
/**
* When writing truffle tests in node.js, we are able to specify msg.sender when
* calling contract functions. This is important when testing cases that involve
* multiple users interacting with the contract. When writing tests in Solidity,
* however, we lose the ability to specify msg.sender as the test contract is
* always the sender. The purpose of this contract is to allow us to call
* functions from addresses other than the test contract's like we do in node.js.
* THIS CONTRACT IS ONLY USED FOR TESTING PURPOSES AND IS NOT PART OF
* THE DAPP. ONLY EDIT THIS FILE IN THE AREA SPECIFIED BELOW.
*/
contract Redirector {
CryptoBears public cb;
BearBucks public bb;
address public owner;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
constructor(CryptoBears _cb, BearBucks _bb) public {
owner = msg.sender;
cb = _cb;
bb = _bb;
}
function bb_transferFrom(address from, address to, uint256 value) onlyOwner {
bb.transferFrom(from, to, value);
}
function cb_transferFrom(address from, address to, uint256 tokenId) onlyOwner {
cb.transferFrom(from, to, tokenId);
}
function bb_approve(address spender, uint256 value) onlyOwner {
bb.approve(spender, value);
}
function placeBet(uint256 bearID, uint256 opponentID, uint256 amount) onlyOwner {
cb.placeBet(bearID, opponentID, amount);
}
function removeBet(uint256 bearID, uint256 opponentID) onlyOwner {
cb.removeBet(bearID, opponentID);
}
function bb_transfer(address to, uint256 value) onlyOwner {
bb.transfer(to, value);
}
/* TODO: Add forwarding functions like the ones above as needed. */
}