Resources: Test Contracts
Want to practice your skills? We have the tools for you!
To help test that you're accessing your smart contracts in the correct way, we have created and deployed a number of test contracts to all the major networks to allow you to test against:
​
Mainnet:
Ropsten:
Rinkeby:

Kovan:

Goerli:

xDai:
​
​
GithubGist:
Solidity Code:
1
pragma solidity 0.5.0;
2
​
3
contract DappHeroTest {
4
uint public important = 777;
5
bytes32 public hello = "Howdy";
6
7
address public owner;
8
9
event EventTrigger(address indexed sender, uint value);
10
event ValueSent(address indexed sender);
11
event EmitString(string message);
12
event ValueSentWithMessage(address indexed sender, bytes32 message);
13
​
14
constructor() public {
15
owner = msg.sender;
16
}
17
​
18
function viewNoArgsMultipleReturn() public view returns(uint importantNumber, bytes32 sayHello){
19
return (
20
importantNumber,
21
hello
22
);
23
}
24
25
function viewMultipleArgsSingleReturn(address fromAddress, uint amount) public view returns(uint singleInt){
26
return 89898989;
27
}
28
29
function viewMultipleArgsMultipleReturn(address fromAddress, uint amount) public view returns(uint longInteger, bytes32 sayHello){
30
return (
31
8989898989,
32
hello
33
);
34
}
35
​
36
function triggerEvent(uint anyInputValue) public {
37
emit EventTrigger (msg.sender, 10);
38
}
39
​
40
function sendEthNoArgs() public payable {
41
emit ValueSent(msg.sender);
42
msg.sender.transfer(msg.value);
43
}
44
45
function makeTxNoArgs() public {
46
emit EventTrigger(msg.sender, important);
47
}
48
49
function makeTxWithArgs(string memory myString) public {
50
emit EmitString(myString);
51
}
52
​
53
function sendEthWithArgs(bytes32 simpleMessage) public payable {
54
emit ValueSentWithMessage(msg.sender, "message");
55
msg.sender.transfer(msg.value);
56
}
57
​
58
function sendMinimumTwoEthNoArgs() public payable {
59
require(msg.value >= 2);
60
emit ValueSent(msg.sender);
61
msg.sender.transfer(msg.value);
62
}
63
​
64
function sendMinimumTwoEthWithArgs(bytes32 message) public payable {
65
require(msg.value >= 2);
66
emit ValueSentWithMessage(msg.sender, message);
67
msg.sender.transfer(msg.value);
68
}
69
}
Copied!
ABI:
Last modified 1yr ago
Copy link