Does code comply with OpenZeppelin license and copyright terms?

Hi @kanedaaaa,

Welcome to the community :wave:

To keep your system secure, you should always use the installed code as-is, and neither copy-paste it from online sources, nor modify it yourself.

_From: https://docs.openzeppelin.com/contracts/3.x/#usage_

You should install OpenZeppelin Contracts (npm install @openzeppelin/contracts) and then import.

Your contract could then look as follows (and you wouldn't need to clone the other contracts from OpenZeppelin Contracts):

Kata.sol

// contracts/Kata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract Kata is ERC20 {
    constructor() public ERC20("Kata", "KATA") {
        _mint(msg.sender, 700 * (10 ** uint256(decimals())));
    }
}

Please note, in the OpenZeppelin Contracts ERC20 implementation, the default decimals is 18, whilst you were doing 10**9. If you want to use a different number of decimals you can call _setupDecimals in your constructor.


As for the OpenZeppelin Contracts license and copyright, as long as you are compliant with the MIT license (e.g. don't try to change to a non-compliant license) and don't remove OpenZeppelin copyright then you should be compliant.

I recommend when you verify your contract on Etherscan, that you do multi-file verification to maintain imports and SPDX License identifiers: How to verify with Hardhat or Truffle a smart contract using OpenZeppelin Contracts

You could add a Built with OpenZeppelin badge: https://docs.openzeppelin.com/openzeppelin/#share_the_love


I recommend creating some tests to ensure that your contract functions as expected. See: https://docs.openzeppelin.com/learn/writing-automated-tests


I also suggest looking at: Points to consider when creating a fungible token (ERC20, ERC777)

1 Like