Verified contractExactMIT
Rice
Address0x729bfef4367fb89ee0dc9f60c4299ff7d9574192
- Balance
0 ETH
- Transactions
4
- Compiler
solc 0.8.28
- Same code
Only this contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,976,660
- Creation transaction
- 0x861d387c3f…dda001e87d
dojima/Rice.sol
// D O J I M A
// ══════════════════════════════════════════════════════════════════════════
// web dojima.fun
// x @dojimaevm
// ──────────────────────────────────────────────────────────────────────────
// Rice.sol · THE COUPON
// 1 of 7 · Warehouse names the lot · Soroban reckons the price · Wick keeps
// the session · Pit carries the risk · Dojima keeps the book · DojimaHook
// watches the market
// ══════════════════════════════════════════════════════════════════════════
//
// These seven files are written as the articles of an exchange, because that
// is what they are. Rules are numbered, they are short, and the ones that
// take something away from you are not buried at the bottom.
//
// ─────────────────────────────────────────────────────────────────────────
// PREAMBLE. WHAT WAS AT DOJIMA
//
// In 1697 the rice brokers of Osaka were licensed to meet in the Dojima
// ward and trade among themselves. What they traded was not rice. It was
// kome-kitte — warehouse coupons, paper claims on sacks in a godown that
// the holder had no intention of ever collecting.
//
// Beside that market ran a second one, chōaimai, "book-balancing rice".
// That one was settled purely in cash against the official closing price.
// It ran for the better part of two hundred and forty years and never
// delivered a single grain to anybody. Contracts, terms, margin, a
// clearing house, short selling, and a public price — the whole apparatus
// of a derivatives exchange, a century before anyone in Chicago thought
// of it, sitting on top of an asset nobody moved.
//
// Sessions ended when a length of fire-cord burned through. Anything
// unsettled when the cord went out was void, and officials threw water
// at brokers who kept shouting. Candlestick charts were invented in this
// building, which is why the wick in this project means both things.
//
// Every tokenised-real-world-asset on this chain wants you to believe in
// a warehouse. DOJIMA tells you on line one that the warehouse is a hash
// function, and then runs the exchange properly anyway. The rice is
// admitted fiction. The ether is not, the pricing is not, and neither is
// the bound in RULE 6 of Dojima.sol.
//
// ─────────────────────────────────────────────────────────────────────────
// RULE 1. WHAT THIS FILE IS
//
// A token. One billion RICE, minted once in the constructor, eighteen
// decimals, and not one unit more afterwards. It is the coupon: the
// thing the pool trades, the thing the exchange quotes, and the thing a
// seat on the floor is paid for in.
//
// RULE 2. WHAT HOLDING RICE ENTITLES YOU TO
//
// Nothing is paid to you for holding it. Be clear about that before
// anything else.
//
// What RICE does is buy a SEAT. The exchange's writing side — the Pit —
// is shut to anyone without one, and a seat is bought by burning
// 250,000 RICE, permanently, to a maximum of 1,300 seats ever. Dojima
// licensed about thirteen hundred brokers and that is where the number
// comes from. Each seat admits five ether of writing capital.
//
// So the demand for this token is the demand to stand on the writing
// side of an option book, and the supply falls every time somebody
// decides they want to. If nobody wants to write, nothing is burned and
// the token is a token. That is the entire mechanism and it is not
// dressed up as anything else.
//
// RULE 3. WHAT CANNOT BE DONE TO YOU
//
// Minting. There is no mint function in this file. Not disabled, not
// behind an owner, not renounced afterwards — never written, and a
// function that was never written cannot be switched on by anybody.
//
// Administration. There is no owner. The launcher role exists so the
// pool can be seeded before anyone can trade against it, and it deletes
// itself inside the same transaction that uses it.
//
// Taxation. No transfer fee, no rebase, no reflection, no blacklist, no
// maximum wallet, no cooldown, no pause. Moving RICE between two
// addresses is an ordinary ERC-20 transfer and costs what one costs.
// The exchange's duty is taken by the hook, inside the swap, and never
// by this contract.
//
// RULE 4. WHAT COULD MAKE THIS WORTHLESS
//
// Seats are only worth buying if the Pit earns, the Pit only earns if
// contracts are written, and contracts are only written as large as the
// pool can bear — Dojima.sol RULE 6 ties the size of every contract to
// the cost of moving this pool, on purpose, and on a dead pool that cost
// is nothing. A pool nobody trades is an exchange that writes nothing,
// burns nothing, and quotes a price for a warehouse that does not exist.
// Nothing here manufactures demand.
//
// And NO THIRD PARTY HAS AUDITED ANY OF IT. The seven contracts are
// tested against a mainnet fork and the economics were settled in a
// separate model before a line of this was written — that model has
// already thrown away three designs in this repository, including two
// for this project. But a simulation written by the same hand that wrote
// the contract is not an audit and is not offered to you as one.
//
// Every one of the seven files ends on this rule. Read all seven.
//
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
contract Rice {
string public constant name = "Dojima";
string public constant symbol = "RICE";
uint8 public constant decimals = 18;
/// @notice The entire issue, fixed in the constructor. See RULE 3.
uint256 public constant INITIAL_SUPPLY = 1_000_000_000 ether;
uint256 public totalSupply;
/// @notice Cumulative burn, so the seat count and the supply can be reconciled.
uint256 public totalBurned;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
/// @notice Deleted by {openTrading}, in the call that uses it.
address public launcher;
bool public open;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Burned(address indexed from, uint256 value, uint256 supplyAfter);
event Opened(uint64 at);
error NotLauncher();
error AlreadyOpen();
error NotOpen();
error ZeroAddress();
error InsufficientBalance();
error InsufficientAllowance();
constructor(address _launcher) {
if (_launcher == address(0)) revert ZeroAddress();
launcher = _launcher;
totalSupply = INITIAL_SUPPLY;
balanceOf[_launcher] = INITIAL_SUPPLY;
emit Transfer(address(0), _launcher, INITIAL_SUPPLY);
}
/// @notice Open the floor for good, and delete the launcher role in the same call.
function openTrading() external {
if (msg.sender != launcher) revert NotLauncher();
if (open) revert AlreadyOpen();
open = true;
launcher = address(0);
emit Opened(uint64(block.timestamp));
}
function _move(address from, address to, uint256 v) private {
// Until the pool is seeded only the launcher may move, so liquidity can
// be placed before anybody is able to trade against it.
if (!open && from != launcher && from != address(0)) revert NotOpen();
uint256 bal = balanceOf[from];
if (bal < v) revert InsufficientBalance();
unchecked { balanceOf[from] = bal - v; }
balanceOf[to] += v;
emit Transfer(from, to, v);
}
function transfer(address to, uint256 v) external returns (bool) {
_move(msg.sender, to, v);
return true;
}
function transferFrom(address from, address to, uint256 v) external returns (bool) {
uint256 a = allowance[from][msg.sender];
if (a != type(uint256).max) {
if (a < v) revert InsufficientAllowance();
unchecked { allowance[from][msg.sender] = a - v; }
}
_move(from, to, v);
return true;
}
function approve(address spender, uint256 v) external returns (bool) {
allowance[msg.sender][spender] = v;
emit Approval(msg.sender, spender, v);
return true;
}
/// @notice Burn permanently. Anyone, any amount they hold.
function burn(uint256 v) external {
_retire(msg.sender, v);
}
/// @notice The Pit burns through this when a seat is bought, so a buyer approves
/// once and never has to trust a second call to follow.
function burnFrom(address from, uint256 v) external {
uint256 a = allowance[from][msg.sender];
if (a != type(uint256).max) {
if (a < v) revert InsufficientAllowance();
unchecked { allowance[from][msg.sender] = a - v; }
}
_retire(from, v);
}
function _retire(address from, uint256 v) private {
uint256 bal = balanceOf[from];
if (bal < v) revert InsufficientBalance();
unchecked {
balanceOf[from] = bal - v;
totalSupply -= v;
totalBurned += v;
}
emit Transfer(from, address(0), v);
emit Burned(from, v, totalSupply);
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.