🚀 APIv2 is now available! Make the most of the information-rich responses Learn more →
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract ERC20Token is ERC20, Ownable {
address public bridgeAdmin;
constructor(
string memory name,
string memory symbol,
uint256 initialSupply,
address _bridgeAdmin
) ERC20(name, symbol) Ownable(msg.sender) {
bridgeAdmin = _bridgeAdmin;
// Mint the initial supply of tokens to the deployer of the contract
_mint(msg.sender, initialSupply);
}
function mint(address to, uint256 amount) public returns (bool) {
// require(msg.sender == bridgeAdmin, 'only bridge admin');
_mint(to, amount);
return true;
}
function burn(address from, uint256 amount) public returns (bool) {
// require(msg.sender == bridgeAdmin, 'only bridge admin');
_burn(from, amount);
return true;
}
function updateBridgeAdmin(address newAdmin) external onlyOwner {
require(newAdmin != address(0), "Address cant be zero address");
bridgeAdmin = newAdmin;
}
}
Sourcify is and always will be 100% open source. Github →
Verified contract datasets should be open and easily accessible.
Sourcify's whole database is available for free and open access. Download all verified contracts
# Deploy and verify
$ forge create --rpc-url <rpc-url> --private-key <private-key> src/MyContract.sol:MyContract --verify --verifier sourcify
# Verify an already deployed contract
$ forge verify-contract --verifier sourcify --chain <chain-id> 0xB4239c86440d6C39d518D6457038cB404451529b MyContract
# Check if a contract is verified
$ forge verify-check 0x1F98431c8aD98523631AE4a59f267346ea31F984 --verifier sourcify
Sourcify is open-source and for self-hosting. Here are some public instances we are aware of:
Smart contracts on Ethereum and other EVM blockchains are written in human-readable programming languages like Solidity, compiled into bytecode, and stored in bytes on the chain. Humans can't read bytes so this needs to be brought back to human-readable form.
However, if you see a Solidity/Vyper code on Github etc., and someone claims this to be the code of the contract at 0xabc..def, you wouldn't know. Verification makes sure that, that Solidity code is actually the one deployed on-chain.
In simplified terms, we take the Solidity/Vyper code provided by the developer or anyone, compile it, and compare the compiled bytecode with the onchain bytecode at that address 0xabc..def. If they match, the contract is verified.
Source code verification is crucial for transparency and security in blockchains. You should not interact with contracts that are not source-code verified.
Verification does not mean it's safe to interact with a contract. Verifiers do not check the contents of the contracts. These should be cheked by auditors and the community to be deemed safe.