add TestToken
This commit is contained in:
parent
9db2ef022d
commit
9a3c1d145e
|
@ -0,0 +1,5 @@
|
|||
pragma solidity ^0.5.3;
|
||||
|
||||
contract ApproveAndCallFallBack {
|
||||
function receiveApproval(address from, uint256 _amount, address _token, bytes memory _data) public;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
pragma solidity ^0.5.3;
|
||||
|
||||
import "./StandardToken.sol";
|
||||
import "./ApproveAndCallFallBack.sol";
|
||||
|
||||
/**
|
||||
* @notice ERC20Token for test scripts, can be minted by anyone.
|
||||
*/
|
||||
contract TestToken is StandardToken {
|
||||
|
||||
constructor() public { }
|
||||
|
||||
/**
|
||||
* @notice any caller can mint any `_amount`
|
||||
* @param _amount how much to be minted
|
||||
*/
|
||||
function mint(uint256 _amount) public {
|
||||
mint(msg.sender, _amount);
|
||||
}
|
||||
|
||||
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData)
|
||||
external
|
||||
returns (bool success)
|
||||
{
|
||||
approve(msg.sender, _spender, _value);
|
||||
ApproveAndCallFallBack(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
/*global contract, config, it, assert*/
|
||||
const Subscription = require('Embark/contracts/Subscription');
|
||||
const StandardToken = require('Embark/contracts/StandardToken');
|
||||
const TestToken = require('Embark/contracts/TestToken');
|
||||
|
||||
let accounts;
|
||||
let payor;
|
||||
|
@ -29,7 +29,7 @@ config({
|
|||
"Subscription": {
|
||||
args: []
|
||||
},
|
||||
"StandardToken": {
|
||||
"TestToken": {
|
||||
args: []
|
||||
}
|
||||
}
|
||||
|
@ -47,11 +47,11 @@ contract("subscription", function () {
|
|||
//const salary1 = (new web3.BigNumber(100000)).times(USD_PRECISION).dividedToIntegerBy(SECONDS_IN_A_YEAR)
|
||||
|
||||
let balance = await web3.eth.getBalance(accounts[8])
|
||||
console.log({accounts, balance}, StandardToken.options.address)
|
||||
console.log({accounts, balance}, TestToken.options.address)
|
||||
// Subscription.methods.createAgreement(
|
||||
// receiver,
|
||||
// payor,
|
||||
// StandardToken.address
|
||||
// TestToken.address
|
||||
|
||||
// )
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue