forked from sovanpanhavathseng/eth-words
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDapp.sol
26 lines (19 loc) · 707 Bytes
/
Dapp.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
pragma solidity ^0.8.0;
contract DigitalAsset {
address public owner;
mapping(address => uint) public balances;
event Transfer(address indexed from, address indexed to, uint value);
constructor() {
owner = msg.sender;
}
function mint(address recipient, uint value) public {
require(msg.sender == owner, "Only the owner can mint new tokens.");
balances[recipient] += value;
}
function transfer(address recipient, uint value) public {
require(balances[msg.sender] >= value, "Insufficient balance.");
balances[msg.sender] -= value;
balances[recipient] += value;
emit Transfer(msg.sender, recipient, value);
}
}