pragma solidity ^0.4.21;
//This is a simple Contract. Usecase: Lend $1000 to a Friend.
contract PersonalBond {
// Publicly accessible state variable. address type is 160-bit. Stores addresses of the contract
// keyword public, automatically creates a function function minter() returns (address) { return minter; } outside of the code to give access to the outside.
address public minter;
// map the addresses to unsigned int
mapping (address => uint) public balances;
event Sent(address from, address to, uint amount);
function PersonalBond() public {
minter = msg.sender;
}
function mint(address receiver, uint amount) public {
if (msg.sender != minter) return;
balances[receiver] += amount;
}
function send(address receiver, uint amount) public {
if (balances[msg.sender] < amount) return;
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Sent(msg.sender, receiver, amount);
}
}
//This is a simple Contract. Usecase: Lend $1000 to a Friend.
contract PersonalBond {
// Publicly accessible state variable. address type is 160-bit. Stores addresses of the contract
// keyword public, automatically creates a function function minter() returns (address) { return minter; } outside of the code to give access to the outside.
address public minter;
// map the addresses to unsigned int
mapping (address => uint) public balances;
event Sent(address from, address to, uint amount);
function PersonalBond() public {
minter = msg.sender;
}
function mint(address receiver, uint amount) public {
if (msg.sender != minter) return;
balances[receiver] += amount;
}
function send(address receiver, uint amount) public {
if (balances[msg.sender] < amount) return;
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Sent(msg.sender, receiver, amount);
}
}
The information you've provided is quite useful. It's incredibly instructional because it provides some of the most useful information. Thank you for sharing that. Ethereum Scalability Solutions Online
ReplyDelete