To submit your bytecode, simply make a PR to this repo with the runtime bytecode[1] of your contract in the file src/bin_runtime
. See other PRs for examples.
After your PR has been submitted, you can track its progress at https://dapp.ci/erc20-golf/
Your bytecode must match the specifications defined here. In particular, notice the following:
-
The
transferFrom
function must ONLY decrease the allowance of the sender if the allowance is not set touint(-1)
(also known as2^256 -1
, or115792089237316195423570985008687907853269984665640564039457584007913129639935
). In the caseallowance == uint(-1)
, you must leave the allowance as is. This optimization saves 5000-20000 gas on mosttransferFrom
invocations. -
The storage variables defining
balances
,supply
andallowance
must be at slots 0, 1, and 2, respectively and either follow the solidity or vyper storage convention. If you use vyper, you must edit thesrc/storage.md
file accordingly. -
For the purposes of this contest, we will not take LOGs into account. You can simply omit logging from your token.
[1] The runtime bytecode of a contract is its code after deployement. Here is how you can extract the runtime bytecode from various source languages:
Using the solidity compiler, run
solc token.sol --bin-runtime > src/bin_runtime
In yul one writes init code and runtime code as different object
blocks. If you want to focus on the runtime code, simply omit writing a constructor object
.
Then compile with the solidity compiler, using:
solc --strict-assembly token.yul
and paste the contents of the binary representation:
in the src/bin_runtime
file of this repository.
Vyper has a different storage convention than Solidity, and our specs assert that the storage layout of the token must follow a Solidity style layout.
If you are writing a Vyper contract, you must also edit src/storage.md
and replace all instances of "Solidity"
with "Vyper"
.
Using the vyper compiler, run
vyper -f bytecode_runtime token.vy > src/bin_runtime