update ovm-toolchain

This commit is contained in:
Michele Balistreri 2020-09-29 10:49:52 +02:00
parent 245a4626ee
commit 7cedde3b84
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
4 changed files with 637 additions and 33 deletions

View File

@ -121,14 +121,6 @@ contract StatusPay is BlockConsumer {
keycards[_keycard] = address(0);
}
function topup(address _to, uint256 _amount) public {
Account storage topped = accounts[owners[_to]];
require(topped.exists, "account does not exist");
require(token.transferFrom(msg.sender, address(this), _amount), "transfer failed");
topped.balance += _amount;
}
function topupKeycard(address _keycard, uint256 _amount) public {
_topup(keycards[_keycard], _amount);
}
@ -145,13 +137,13 @@ contract StatusPay is BlockConsumer {
topped.balance += _amount;
}
function withdraw(address _to, uint256 _amount) public {
function withdraw(uint256 _amount) public {
Account storage exiting = accounts[owners[msg.sender]];
require(exiting.exists, "account does not exist");
require(exiting.balance >= _amount, "not enough balance");
exiting.balance -= _amount;
require(token.transfer(_to, _amount), "transfer failed");
require(token.transfer(msg.sender, _amount), "transfer failed");
}
function unlockAccount(Unlock memory _unlock, bytes memory _signature) public {

View File

@ -22,7 +22,7 @@
"ethers": "^5.0.14"
},
"devDependencies": {
"@eth-optimism/ovm-toolchain": "^0.0.1-alpha.2",
"@eth-optimism/ovm-toolchain": "^0.0.1-alpha.4",
"@openzeppelin/truffle-upgrades": "^1.0.2",
"bip39": "^3.0.2",
"ethereumjs-wallet": "^1.0.0"

View File

@ -17,7 +17,7 @@ const hdk = hdkey.fromMasterSeed(seed);
const CHAIN_ID = 1; //for now 1
const NO_PROXIES = false;
const NO_RELAY = false;
const NO_RELAY = true;
const NOW = Math.round(new Date().getTime() / 1000);
const START_TIME = NOW - 1;
@ -212,7 +212,7 @@ contract('StatusPay', (accounts) => {
it('withdraw', async () => {
await statusPay.withdraw(owner, 80, {from: owner});
await statusPay.withdraw(80, {from: owner});
let account = await statusPay.owners.call(owner);
assert.equal((await token.balanceOf.call(owner)).toNumber(), 80);
@ -221,7 +221,7 @@ contract('StatusPay', (accounts) => {
it('withdraw more than balance allows', async () => {
try {
await statusPay.withdraw(owner, 11, {from: owner});
await statusPay.withdraw(11, {from: owner});
assert.fail("withdraw should have failed");
} catch (err) {
assert.equal(err.reason, "not enough balance");
@ -234,7 +234,7 @@ contract('StatusPay', (accounts) => {
it('withdraw non existing account', async () => {
try {
await statusPay.withdraw(network, 10, {from: network});
await statusPay.withdraw(10, {from: network});
assert.fail("withdraw should have failed");
} catch (err) {
assert.equal(err.reason, "account does not exist");

File diff suppressed because it is too large Load Diff