Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Commit

Permalink
yarn lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rkalis committed Apr 24, 2023
1 parent 2d6a4ef commit f67b8cc
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 66 deletions.
8 changes: 4 additions & 4 deletions docs/kalis-me-tutorial-code/contracts/Casino.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity ^0.5.8;

import "./Killable.sol";
import './Killable.sol';

contract Casino is Killable {
event Play(address payable indexed player, uint256 betSize, uint8 betNumber, uint8 winningNumber);
Expand All @@ -9,8 +9,8 @@ contract Casino is Killable {
function fund() external payable {}

function bet(uint8 number) external payable {
require(msg.value <= getMaxBet(), "Bet amount can not exceed max bet size");
require(msg.value > 0, "A bet should be placed");
require(msg.value <= getMaxBet(), 'Bet amount can not exceed max bet size');
require(msg.value > 0, 'A bet should be placed');

uint8 winningNumber = generateWinningNumber();
emit Play(msg.sender, msg.value, number, winningNumber);
Expand All @@ -25,7 +25,7 @@ contract Casino is Killable {
}

function generateWinningNumber() internal view returns (uint8) {
return uint8(block.number % 10 + 1); // Don't do this in production
return uint8((block.number % 10) + 1); // Don't do this in production
}

function payout(address payable winner, uint256 amount) internal {
Expand Down
2 changes: 1 addition & 1 deletion docs/kalis-me-tutorial-code/contracts/Killable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ contract Killable {
}

function kill() external {
require(msg.sender == owner, "Only the owner can kill this contract");
require(msg.sender == owner, 'Only the owner can kill this contract');
selfdestruct(owner);
}
}
13 changes: 6 additions & 7 deletions examples/metacoin/contracts/ConvertLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
pragma solidity >=0.4.25 <0.9.0;

library ConvertLib {
struct TestStruct {
uint256 name;
}
struct TestStruct {
uint256 name;
}

function convert(uint amount,uint conversionRate) public pure returns (uint convertedAmount)
{
return amount * conversionRate;
}
function convert(uint amount, uint conversionRate) public pure returns (uint convertedAmount) {
return amount * conversionRate;
}
}
44 changes: 22 additions & 22 deletions examples/metacoin/contracts/MetaCoin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@
pragma experimental ABIEncoderV2;
pragma solidity >=0.4.25 <0.9.0;

import "./ConvertLib.sol";
import './ConvertLib.sol';

// This is just a simple example of a coin-like contract.
// It is not standards compatible and cannot be expected to talk to other
// coin/token contracts. If you want to create a standards-compliant
// token, see: https://github.com/ConsenSys/Tokens. Cheers!

contract MetaCoin {
mapping (address => uint) balances;
mapping(address => uint) balances;

event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Transfer(address indexed _from, address indexed _to, uint256 _value);

constructor() public {
balances[tx.origin] = 10000;
}
constructor() public {
balances[tx.origin] = 10000;
}

function sendCoin(address receiver, uint amount) public returns(bool sufficient) {
if (balances[msg.sender] < amount) return false;
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Transfer(msg.sender, receiver, amount);
return true;
}
function sendCoin(address receiver, uint amount) public returns (bool sufficient) {
if (balances[msg.sender] < amount) return false;
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Transfer(msg.sender, receiver, amount);
return true;
}

function getBalanceInEth(address addr) public view returns(uint){
return ConvertLib.convert(getBalance(addr),2);
}
function getBalanceInEth(address addr) public view returns (uint) {
return ConvertLib.convert(getBalance(addr), 2);
}

function getBalance(address addr) public view returns(uint) {
return balances[addr];
}
function getBalance(address addr) public view returns (uint) {
return balances[addr];
}

function test(ConvertLib.TestStruct memory testObj) public pure {
require(testObj.name > 10);
}
function test(ConvertLib.TestStruct memory testObj) public pure {
require(testObj.name > 10);
}
}
28 changes: 14 additions & 14 deletions examples/metacoin/contracts/WrappedMetaCoin.sol
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25 <0.9.0;

import { MetaCoin as Coin } from "./MetaCoin.sol";
import {MetaCoin as Coin} from './MetaCoin.sol';

contract WrappedMetaCoin {
Coin public underlying;
Coin public underlying;

constructor(Coin _underlying) public {
underlying = _underlying;
}
constructor(Coin _underlying) public {
underlying = _underlying;
}

function sendCoin(address receiver, uint amount) public returns(bool sufficient) {
return underlying.sendCoin(receiver, amount);
}
function sendCoin(address receiver, uint amount) public returns (bool sufficient) {
return underlying.sendCoin(receiver, amount);
}

function getBalanceInEth(address addr) public view returns(uint){
return underlying.getBalanceInEth(addr);
}
function getBalanceInEth(address addr) public view returns (uint) {
return underlying.getBalanceInEth(addr);
}

function getBalance(address addr) public view returns(uint) {
return underlying.getBalance(addr);
}
function getBalance(address addr) public view returns (uint) {
return underlying.getBalance(addr);
}
}
3 changes: 1 addition & 2 deletions examples/openzeppelin-token/contracts/SimpleProxyAdmin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ pragma solidity 0.8.9;

import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol';

contract SimpleProxyAdmin is ProxyAdmin{}

contract SimpleProxyAdmin is ProxyAdmin {}
9 changes: 4 additions & 5 deletions examples/openzeppelin-token/contracts/SimpleToken.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "truffle/console.sol";
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import 'truffle/console.sol';

/**
* @title SimpleToken
Expand All @@ -11,12 +11,11 @@ import "truffle/console.sol";
* `ERC20` functions.
*/
contract SimpleToken is ERC20 {

/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () ERC20("Simple Token", "SIM") {
constructor() ERC20('Simple Token', 'SIM') {
_mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
console.log("Deployer address is %s", msg.sender);
console.log('Deployer address is %s', msg.sender);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import '@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol';

contract SimpleTokenUpgradeable is ERC20Upgradeable {
function __SimpleToken_init() external initializer {
__ERC20_init("Simple Token", "SIM");
__ERC20_init('Simple Token', 'SIM');
_mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import '@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol';

contract SimpleTokenUpgradeable2 is ERC20Upgradeable {
function __SimpleToken_init() external initializer {
__ERC20_init("Simple Token", "SIM");
__ERC20_init('Simple Token', 'SIM');
_mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
}
}
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type TruffleResolver from "@truffle/resolver";
import type TruffleResolver from '@truffle/resolver';

export interface Logger extends Console {
level(level: string): void;
Expand Down
1 change: 0 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fs from 'fs';
import path from 'path';
import { promisify } from 'util';
import { INDENT, NULL_ADDRESS, StorageSlot } from './constants';
Expand Down
6 changes: 3 additions & 3 deletions src/verifier/SourcifyVerifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ export class SourcifyVerifier extends AbstractVerifier implements Verifier {
if (result.storageTimestamp) return VerificationStatus.ALREADY_VERIFIED;
if (result.status === 'partial') return VerificationStatus.PARTIAL;
if (result.status === 'perfect') return VerificationStatus.SUCCESS;
return `${VerificationStatus.FAILED}: ${result?.message}`
return `${VerificationStatus.FAILED}: ${result?.message}`;
} catch (error: any) {
const errorResponse = error?.response?.data;
const errorResponseMessage = errorResponse?.message ?? errorResponse?.error;

this.logger.debug(`Error: ${error?.message}`);
logObject(this.logger, 'debug', error?.response?.data, 2)
logObject(this.logger, 'debug', error?.response?.data, 2);

// If an error message is present in the checked response, this likely indicates a failed verification
if (errorResponseMessage) {
return `${VerificationStatus.FAILED}: ${errorResponseMessage}`
return `${VerificationStatus.FAILED}: ${errorResponseMessage}`;
}

// If no message was passed in the response, this likely indicates a failed connection
Expand Down
1 change: 0 additions & 1 deletion src/verifier/Verifier.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { VerificationStatus } from '../constants';
import { Artifact, Options } from '../types';

export interface Verifier {
Expand Down
2 changes: 1 addition & 1 deletion src/verify.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import TruffleResolver from '@truffle/resolver';
import axios from 'axios';
import tunnel from 'tunnel';
import TruffleResolver from "@truffle/resolver";
import { API_URLS, EXPLORER_URLS, INDENT, SUPPORTED_VERIFIERS, VERSION } from './constants';
import { Logger, Options, TruffleConfig } from './types';
import { enforce, getApiKey, getNetwork } from './util';
Expand Down

0 comments on commit f67b8cc

Please sign in to comment.