Back to Home

DgxSwap

Utility
Part of The Anthony Eufemio Collection
0x943bbeef4146...128ad0ba9cb1
HomesteadSource VerifiedEdit this contract
Deployed May 14, 2016 (10 years ago)Block 1,518,587

A single-lot swap contract selling its whole DGX gold token balance for ether at a price its seller sets.

Homestead EraVerified Source

Historical Significance

A contract that handles a token which charges a fee on transfer, asking the token what the fee will be instead of assuming the amount sent is the amount received. Fee-on-transfer tokens went on breaking integrations for years, and DGX charged such a fee from the start.

Context

Digix issued DGX against physical gold, an early example of an asset backed token on Ethereum. In 2016 there was no automated market maker and no aggregator, so selling a holding meant a centralised exchange or a purpose-built contract like this one.

Key Facts
Deployment Block
1,518,587
Deployment Date
May 14, 2016, 11:48 PM
Code Size
1.8 KB
Transactions by Year
20162

Description

A one-sided swap contract for DGX, the gold-backed token issued by Digix. Its constructor writes the DGX token address into storage along with a seller and a price in wei per token unit; only the seller can change the price afterwards.

There is no buy function. Sending ether to the contract triggers the sale: it refuses if it holds no DGX or if the payment is below the price of everything it holds, asks the token contract what transfer fee the transaction will incur, sends the buyer the whole balance minus that fee, and forwards the payment to the seller. Every trade clears the contract out.

Because the fee is queried from the token rather than assumed, the buyer receives what actually arrives rather than the nominal balance.

Heuristic Analysis

The following characteristics were detected through bytecode analysis and may not be accurate.

Detected Type: Utility

Bytecode Overview

Opcodes1,806
Unique Opcodes131
Jump Instructions85
Storage Operations39

External Links

Related contracts