Add full monorepo: virtual-banker, backend, frontend, docs, scripts, deployment
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
38
src/MockLinkToken.sol
Normal file
38
src/MockLinkToken.sol
Normal file
@@ -0,0 +1,38 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.19;
|
||||
contract MockLinkToken {
|
||||
string public name = "Chainlink Token";
|
||||
string public symbol = "LINK";
|
||||
uint8 public decimals = 18;
|
||||
mapping(address => uint256) public balanceOf;
|
||||
mapping(address => mapping(address => uint256)) public allowance;
|
||||
uint256 public totalSupply;
|
||||
event Transfer(address indexed from, address indexed to, uint256 value);
|
||||
event Approval(address indexed owner, address indexed spender, uint256 value);
|
||||
function mint(address to, uint256 amount) external {
|
||||
balanceOf[to] += amount;
|
||||
totalSupply += amount;
|
||||
emit Transfer(address(0), to, amount);
|
||||
}
|
||||
function transfer(address to, uint256 amount) external returns (bool) {
|
||||
require(balanceOf[msg.sender] >= amount, "insufficient balance");
|
||||
balanceOf[msg.sender] -= amount;
|
||||
balanceOf[to] += amount;
|
||||
emit Transfer(msg.sender, to, amount);
|
||||
return true;
|
||||
}
|
||||
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
|
||||
require(balanceOf[from] >= amount, "insufficient balance");
|
||||
require(allowance[from][msg.sender] >= amount, "insufficient allowance");
|
||||
balanceOf[from] -= amount;
|
||||
balanceOf[to] += amount;
|
||||
allowance[from][msg.sender] -= amount;
|
||||
emit Transfer(from, to, amount);
|
||||
return true;
|
||||
}
|
||||
function approve(address spender, uint256 amount) external returns (bool) {
|
||||
allowance[msg.sender][spender] = amount;
|
||||
emit Approval(msg.sender, spender, amount);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user