Token Cornichon

 

Overview [ERC-20]

Price
$0.04 @ 0.000024 Eth (-0.01%)
Fully Diluted Market Cap
Max Total Supply:
14,833,765.25605243731764689 CORN

Holders:
357

Transfers:
-

 
Loading
[ Download CSV Export  ] 
Loading
[ Download CSV Export  ] 
Loading

OVERVIEW

CORN distribution is based on pre-hack pDAI Jar snapshot. It has a built in mechanism to burn CORN for DAI. It's up to Pickle community how to top up the contract with DAI.

Market

Volume (24H):$0.00
Market Capitalization:$0.00
Circulating Supply:0.00 CORN
Market Data Source: Coinmarketcap

# Exchange Pair Price  24H Volume % Volume
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.2.7

Optimization Enabled:
N/A

Other Settings:
MIT license

Contract Source Code (Vyper language format)

# @version 0.2.7
from vyper.interfaces import ERC20

implements: ERC20

event Transfer:
    sender: indexed(address)
    receiver: indexed(address)
    value: uint256

event Approval:
    owner: indexed(address)
    spender: indexed(address)
    value: uint256

event Pickled:
    receiver: indexed(address)
    corn: uint256
    dai: uint256

struct Permit:
    owner: address
    spender: address
    amount: uint256
    nonce: uint256
    expiry: uint256


name: public(String[64])
symbol: public(String[32])
decimals: public(uint256)
balanceOf: public(HashMap[address, uint256])
nonces: public(HashMap[address, uint256])
allowances: HashMap[address, HashMap[address, uint256]]
total_supply: uint256
dai: ERC20
DOMAIN_SEPARATOR: public(bytes32)
contract_version: constant(String[32]) = "1"
DOMAIN_TYPE_HASH: constant(bytes32) = keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')
PERMIT_TYPE_HASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 amount,uint256 nonce,uint256 expiry)")


@external
def __init__(_name: String[64], _symbol: String[32], _supply: uint256):
    self.name = _name
    self.symbol = _symbol
    self.decimals = 18
    self.dai = ERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F)
    self.balanceOf[msg.sender] = _supply
    self.total_supply = _supply
    log Transfer(ZERO_ADDRESS, msg.sender, _supply)

    self.DOMAIN_SEPARATOR = keccak256(
        concat(
            DOMAIN_TYPE_HASH,
            keccak256(convert(self.name, Bytes[64])),
            keccak256(convert(contract_version, Bytes[32])),
            convert(chain.id, bytes32),
            convert(self, bytes32)
        )
    )


@view
@external
def totalSupply() -> uint256:
    return self.total_supply


@view
@external
def version() -> String[32]:
    return contract_version


@view
@external
def allowance(owner: address, spender: address) -> uint256:
    return self.allowances[owner][spender]


@internal
def _transfer(sender: address, source: address, receiver: address, amount: uint256) -> bool:
    assert not receiver in [self, ZERO_ADDRESS]
    self.balanceOf[source] -= amount
    self.balanceOf[receiver] += amount
    if source != sender and self.allowances[source][sender] != MAX_UINT256:
        self.allowances[source][sender] -= amount
        log Approval(source, sender, amount)
    log Transfer(source, receiver, amount)
    return True


@external
def transfer(receiver: address, amount: uint256) -> bool:
    return self._transfer(msg.sender, msg.sender, receiver, amount)


@external
def transferFrom(source: address, receiver: address, amount: uint256) -> bool:
    return self._transfer(msg.sender, source, receiver, amount)


@external
def approve(spender: address, amount: uint256) -> bool:
    self.allowances[msg.sender][spender] = amount
    log Approval(msg.sender, spender, amount)
    return True


@view
@internal
def _rate(amount: uint256) -> uint256:
    if self.total_supply == 0:
        return 0
    return amount * self.dai.balanceOf(self) / self.total_supply


@view
@external
def rate() -> uint256:
    return self._rate(10 ** self.decimals)


@internal
def _burn(sender: address, source: address, amount: uint256):
    assert source != ZERO_ADDRESS
    redeemed: uint256 = self._rate(amount)
    self.dai.transfer(source, redeemed)
    log Pickled(source, amount, redeemed)
    self.total_supply -= amount
    self.balanceOf[source] -= amount
    if source != sender and self.allowances[source][sender] != MAX_UINT256:
        self.allowances[source][sender] -= amount
        log Approval(source, sender, amount)
    log Transfer(source, ZERO_ADDRESS, amount)


@external
def burn(_amount: uint256 = MAX_UINT256):
    """
    Burn CORN for DAI at a rate of (DAI in contract / CORN supply)
    """
    amount: uint256 = min(_amount, self.balanceOf[msg.sender])
    self._burn(msg.sender, msg.sender, amount)


@external
def burnFrom(source: address, amount: uint256):
    self._burn(msg.sender, source, amount)


@view
@internal
def message_digest(owner: address, spender: address, amount: uint256, nonce: uint256, expiry: uint256) -> bytes32:
    return keccak256(
        concat(
            b'\x19\x01',
            self.DOMAIN_SEPARATOR,
            keccak256(
                concat(
                    PERMIT_TYPE_HASH,
                    convert(owner, bytes32),
                    convert(spender, bytes32),
                    convert(amount, bytes32),
                    convert(nonce, bytes32),
                    convert(expiry, bytes32),
                )
            )
        )
    )


@external
def permit(owner: address, spender: address, amount: uint256, nonce: uint256, expiry: uint256, signature: Bytes[65]) -> bool:
    assert expiry >= block.timestamp  # dev: permit expired
    assert owner != ZERO_ADDRESS  # dev: invalid owner
    assert nonce == self.nonces[owner]  # dev: invalid nonce
    digest: bytes32 = self.message_digest(owner, spender, amount, nonce, expiry)
    # NOTE: signature is packed as r, s, v
    r: uint256 = convert(slice(signature, 0, 32), uint256)
    s: uint256 = convert(slice(signature, 32, 32), uint256)
    v: uint256 = convert(slice(signature, 64, 1), uint256)
    assert ecrecover(digest, v, r, s) == owner  # dev: invalid signature

    self.allowances[owner][spender] = amount
    self.nonces[owner] += 1
    log Approval(owner, spender, amount)
    return True

Contract Security Audit

Contract ABI

[{"name":"Transfer","inputs":[{"type":"address","name":"sender","indexed":true},{"type":"address","name":"receiver","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false,"type":"event"},{"name":"Approval","inputs":[{"type":"address","name":"owner","indexed":true},{"type":"address","name":"spender","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false,"type":"event"},{"name":"Pickled","inputs":[{"type":"address","name":"receiver","indexed":true},{"type":"uint256","name":"corn","indexed":false},{"type":"uint256","name":"dai","indexed":false}],"anonymous":false,"type":"event"},{"outputs":[],"inputs":[{"type":"string","name":"_name"},{"type":"string","name":"_symbol"},{"type":"uint256","name":"_supply"}],"stateMutability":"nonpayable","type":"constructor"},{"name":"totalSupply","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1061},{"name":"version","outputs":[{"type":"string","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":4519},{"name":"allowance","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"owner"},{"type":"address","name":"spender"}],"stateMutability":"view","type":"function","gas":1551},{"name":"transfer","outputs":[{"type":"bool","name":""}],"inputs":[{"type":"address","name":"receiver"},{"type":"uint256","name":"amount"}],"stateMutability":"nonpayable","type":"function","gas":115661},{"name":"transferFrom","outputs":[{"type":"bool","name":""}],"inputs":[{"type":"address","name":"source"},{"type":"address","name":"receiver"},{"type":"uint256","name":"amount"}],"stateMutability":"nonpayable","type":"function","gas":115795},{"name":"approve","outputs":[{"type":"bool","name":""}],"inputs":[{"type":"address","name":"spender"},{"type":"uint256","name":"amount"}],"stateMutability":"nonpayable","type":"function","gas":37884},{"name":"rate","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":6113},{"name":"burn","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function"},{"name":"burn","outputs":[],"inputs":[{"type":"uint256","name":"_amount"}],"stateMutability":"nonpayable","type":"function"},{"name":"burnFrom","outputs":[],"inputs":[{"type":"address","name":"source"},{"type":"uint256","name":"amount"}],"stateMutability":"nonpayable","type":"function","gas":127210},{"name":"permit","outputs":[{"type":"bool","name":""}],"inputs":[{"type":"address","name":"owner"},{"type":"address","name":"spender"},{"type":"uint256","name":"amount"},{"type":"uint256","name":"nonce"},{"type":"uint256","name":"expiry"},{"type":"bytes","name":"signature"}],"stateMutability":"nonpayable","type":"function","gas":83136},{"name":"name","outputs":[{"type":"string","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":7883},{"name":"symbol","outputs":[{"type":"string","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":6936},{"name":"decimals","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1541},{"name":"balanceOf","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"arg0"}],"stateMutability":"view","type":"function","gas":1786},{"name":"nonces","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"arg0"}],"stateMutability":"view","type":"function","gas":1816},{"name":"DOMAIN_SEPARATOR","outputs":[{"type":"bytes32","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1631}]

606061123a610140396060602061123a60c03960c05161123a016101a0396040602061123a60c03960c05160040135111561003957600080fd5b60406020602061123a0160c03960c05161123a016102203960206020602061123a0160c03960c05160040135111561007057600080fd5b6101a080600060c052602060c020602082510161012060006003818352015b826101205160200211156100a2576100c4565b61012051602002850151610120518501555b815160010180835281141561008f575b50505050505061022080600160c052602060c020602082510161012060006002818352015b826101205160200211156100fc5761011e565b61012051602002850151610120518501555b81516001018083528114156100e9575b5050505050506012600255736b175474e89094c44da98b954eedeac495271d0f6007556101805160033360e05260c052604060c020556101805160065561018051610280523360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6020610280a360007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020826105e00101526020810190506000808060c052602060c0206104a0602082540161012060006003818352015b826101205160200211156101f257610214565b61012051850154610120516020028501525b81516001018083528114156101df575b5050505050508060c052602060c020546104c02090506020826105e00101526020810190506001610580527f31000000000000000000000000000000000000000000000000000000000000006105a0526105808051602082012090506020826105e0010152602081019050466020826105e0010152602081019050306020826105e0010152602081019050806105e0526105e0905080516020820120905060085561122256341561000a57600080fd5b600436101561001857610f62565b600035601c526318160ddd600051141561003a5760065460005260206000f350005b6354fd4d5060005114156100d3576001610140527f3100000000000000000000000000000000000000000000000000000000000000610160526101408051602001806101e08284600060045af161009057600080fd5b50506101e0518061020001818260206001820306601f820103905003368237505060206101c05260406101e0510160206001820306601f82010390506101c0f350005b63dd62ed3e600051141561012b5760043560a01c156100f157600080fd5b60243560a01c1561010157600080fd5b600560043560e05260c052604060c02060243560e05260c052604060c0205460005260206000f350005b600015610324575b6101c0526101405261016052610180526101a052306102005260006102205260006101e0526101e061012060006002818352015b6101205160200261020001516101805114156101865760018352610197565b5b8151600101808352811415610167575b5050506101e051600114156101ab57600080fd5b60036101605160e05260c052604060c02080546101a051808210156101cf57600080fd5b8082039050905081555060036101805160e05260c052604060c02080546101a0518181830110156101ff57600080fd5b8082019050905081555061014051610160511815610260577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60056101605160e05260c052604060c0206101405160e05260c052604060c020541415610263565b60005b156102dd5760056101605160e05260c052604060c0206101405160e05260c052604060c02080546101a0518082101561029b57600080fd5b808203905090508155506101a0516101e05261014051610160517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560206101e0a35b6101a0516101e05261018051610160517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206101e0a360016000526000516101c0515650005b63a9059cbb60005114156103865760043560a01c1561034257600080fd5b33610140523361016052600435610180526024356101a0526101a05161018051610160516101405160065801610133565b610200526102005160005260206000f350005b6323b872dd60005114156103fa5760043560a01c156103a457600080fd5b60243560a01c156103b457600080fd5b336101405260043561016052602435610180526044356101a0526101a05161018051610160516101405160065801610133565b610200526102005160005260206000f350005b63095ea7b360005114156104775760043560a01c1561041857600080fd5b60243560053360e05260c052604060c02060043560e05260c052604060c0205560243561014052600435337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256020610140a3600160005260206000f350005b60001561051a575b6101605261014052600654151561049f5760006000526000516101605156505b61014051602061020060246370a0823161018052306101a05261019c6007545afa6104c957600080fd5b601f3d116104d657600080fd5b6000506102005180820282158284830414176104f157600080fd5b80905090509050600654808061050657600080fd5b820490509050600052600051610160515650005b632c4e722e600051141561056157604e6002541061053757600080fd5b600254600a0a61014052610140516006580161047f565b6101a0526101a05160005260206000f350005b6000156107b0575b6101a0526101405261016052610180526000610160511861058957600080fd5b6101405161016051610180516101a0516101c051610180516101e0526101e0516006580161047f565b610240526101c0526101a052610180526101605261014052610240516101c0526020610280604463a9059cbb6101e05261016051610200526101c051610220526101fc60006007545af161060557600080fd5b601f3d1161061257600080fd5b60005061028050610180516101e0526101c05161020052610160517f6c5f2e7c8fbfb75b99bf8ec98d891a83c467e447ecf60469f6fab18558951af760406101e0a260068054610180518082101561066957600080fd5b8082039050905081555060036101605160e05260c052604060c0208054610180518082101561069757600080fd5b80820390509050815550610140516101605118156106f8577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60056101605160e05260c052604060c0206101405160e05260c052604060c0205414156106fb565b60005b156107755760056101605160e05260c052604060c0206101405160e05260c052604060c0208054610180518082101561073357600080fd5b80820390509050815550610180516101e05261014051610160517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560206101e0a35b610180516101e0526000610160517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206101e0a36101a051565b6344df8e7060005114156107e8577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101405261080e565b6342966c68600051141561080657602060046101403760005061080e565b600015610875575b6101405160033360e05260c052604060c020548082111561082f5780610831565b815b905090506101605261014051610160513361018052336101a052610160516101c0526101c0516101a0516101805160065801610569565b6101605261014052600050005b6379cc679060005114156108c05760043560a01c1561089357600080fd5b3361014052600435610160526024356101805261018051610160516101405160065801610569565b600050005b600015610a15575b6101e0526101405261016052610180526101a0526101c05260006002610500527f19010000000000000000000000000000000000000000000000000000000000006105205261050060028060208461076001018260208501600060045af150508051820191505060085460208261076001015260208101905060007fc64a2ff74451406e9340af1b221bb9a80b307f593bc6630fc8285b950aa0f4a16020826106600101526020810190506101405160208261066001015260208101905061016051602082610660010152602081019050610180516020826106600101526020810190506101a0516020826106600101526020810190506101c05160208261066001015260208101905080610660526106609050805160208201209050602082610760010152602081019050806107605261076090508051602082012090506000526000516101e0515650005b634f6be2b76000511415610d635760043560a01c15610a3357600080fd5b60243560a01c15610a4357600080fd5b606160a43560040161014037604160a435600401351115610a6357600080fd5b426084351015610a7257600080fd5b600060043518610a8157600080fd5b600460043560e05260c052604060c0205460643514610a9f57600080fd5b6101405161016051610180516101a0516101c0516101e05160043561020052602435610220526044356102405260643561026052608435610280526102805161026051610240516102205161020051600658016108c8565b6102e0526101e0526101c0526101a0526101805261016052610140526102e0516101e05260006020602082066102e001610140518284011115610b3957600080fd5b6041806103008260206020880688030161014001600060045af1505081815280905090509050806020015160008251806020901315610b7757600080fd5b8091901215610b8557600080fd5b806020036101000a820490509050905061020052602060206020820661030001610140518284011115610bb757600080fd5b6041806103208260206020880688030161014001600060045af1505081815280905090509050806020015160008251806020901315610bf557600080fd5b8091901215610c0357600080fd5b806020036101000a820490509050905061022052604060016020820661032001610140518284011115610c3557600080fd5b6041806103408260206020880688030161014001600060045af1505081815280905090509050806020015160008251806020901315610c7357600080fd5b8091901215610c8157600080fd5b806020036101000a8204905090509050610240526004356101e051610260526102405161028052610200516102a052610220516102c052602060c0608061026060015afa5060c05114610cd357600080fd5b604435600560043560e05260c052604060c02060243560e05260c052604060c02055600460043560e05260c052604060c02080546001818183011015610d1857600080fd5b80820190509050815550604435610260526024356004357f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256020610260a3600160005260206000f350005b6306fdde036000511415610e0c5760008060c052602060c020610180602082540161012060006003818352015b82610120516020021115610da357610dc5565b61012051850154610120516020028501525b8151600101808352811415610d90575b50505050505061018051806101a001818260206001820306601f82010390500336823750506020610160526040610180510160206001820306601f8201039050610160f350005b6395d89b416000511415610eb55760018060c052602060c020610180602082540161012060006002818352015b82610120516020021115610e4c57610e6e565b61012051850154610120516020028501525b8151600101808352811415610e39575b50505050505061018051806101a001818260206001820306601f82010390500336823750506020610160526040610180510160206001820306601f8201039050610160f350005b63313ce5676000511415610ed15760025460005260206000f350005b6370a082316000511415610f0b5760043560a01c15610eef57600080fd5b600360043560e05260c052604060c0205460005260206000f350005b637ecebe006000511415610f455760043560a01c15610f2957600080fd5b600460043560e05260c052604060c0205460005260206000f350005b633644e5156000511415610f615760085460005260206000f350005b5b60006000fd5b6102ba611222036102ba6000396102ba611222036000f3000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000001058bab3f81eaa02af73ce0000000000000000000000000000000000000000000000000000000000000009436f726e6963686f6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004434f524e00000000000000000000000000000000000000000000000000000000

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000001058bab3f81eaa02af73ce0000000000000000000000000000000000000000000000000000000000000009436f726e6963686f6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004434f524e00000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): Cornichon
Arg [1] : _symbol (string): CORN
Arg [2] : _supply (uint256): 19761825426873148102374350

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 0000000000000000000000000000000000000000001058bab3f81eaa02af73ce
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [4] : 436f726e6963686f6e0000000000000000000000000000000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [6] : 434f524e00000000000000000000000000000000000000000000000000000000


A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.