Skip to content

Commit 08cafe1

Browse files
fulldecenttkstanczak
authored andcommitted
Use solidity/javascript highlighting in various EIPs (ethereum#2372)
1 parent b1fde31 commit 08cafe1

29 files changed

+121
-123
lines changed

EIPS/eip-1062.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ When mapping the IPFS base58 string to ENS resolver, first we convert the Base58
3636
## Rationale
3737
To implement the specification, need two methods from ENS public resolver contract, when we want to store IPFS file fingerprint to contract, convert the Base58 string identifier to the hex format and invoke the `setMultihash` method below :
3838

39-
```
39+
```solidity
4040
function setMultihash(bytes32 node, bytes hash) public only_owner(node);
4141
```
4242

4343
Whenever users need to visit the ENS content, we call the `multihash` method to get the IPFS hex data, transfer to the Base58 format, and return the IPFS resources to use.
4444

45-
```
45+
```solidity
4646
function multihash(bytes32 node) public view returns (bytes);
4747
```
4848

@@ -52,7 +52,7 @@ To implement the way to transfer from base58 to hex format and the reverse one,
5252
The library link : [https://www.npmjs.com/package/multihashes](https://www.npmjs.com/package/multihashes)
5353
To implement the method transfer from IPFS(Base58) to hex format :
5454

55-
```
55+
```javascript
5656
import multihash from 'multihashes'
5757

5858
export const toHex = function(ipfsHash) {
@@ -63,7 +63,7 @@ export const toHex = function(ipfsHash) {
6363

6464
To implement the method transfer from hex format to IPFS(Base58) :
6565

66-
```
66+
```javascript
6767
import multihash from 'multihashes'
6868

6969
export const toBase58 = function(contentHash) {

EIPS/eip-1132.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The intention with this proposal is to enhance the ERC20 standard with token-loc
4343
I’ve extended the ERC20 interface with the following enhancements:
4444

4545
### Locking of tokens
46-
```
46+
```solidity
4747
/**
4848
* @dev Locks a specified amount of tokens against an address,
4949
* for a specified reason and time
@@ -55,7 +55,7 @@ function lock(bytes32 _reason, uint256 _amount, uint256 _time) public returns (b
5555
```
5656

5757
### Fetching number of tokens locked under each utility
58-
```
58+
```solidity
5959
/**
6060
* @dev Returns tokens locked for a specified address for a
6161
* specified reason
@@ -67,7 +67,7 @@ function lock(bytes32 _reason, uint256 _amount, uint256 _time) public returns (b
6767
```
6868

6969
### Fetching number of tokens locked under each utility at a future timestamp
70-
```
70+
```solidity
7171
/**
7272
* @dev Returns tokens locked for a specified address for a
7373
* specified reason at a specific time
@@ -80,7 +80,7 @@ function lock(bytes32 _reason, uint256 _amount, uint256 _time) public returns (b
8080
```
8181

8282
### Fetching number of tokens held by an address
83-
```
83+
```solidity
8484
/**
8585
* @dev @dev Returns total tokens held by an address (locked + transferable)
8686
* @param _of The address to query the total balance of
@@ -89,7 +89,7 @@ function totalBalanceOf(address _of) view returns (uint256 amount)
8989
```
9090

9191
### Extending lock period
92-
```
92+
```solidity
9393
/**
9494
* @dev Extends lock for a specified reason and time
9595
* @param _reason The reason to lock tokens
@@ -99,7 +99,7 @@ function totalBalanceOf(address _of) view returns (uint256 amount)
9999
```
100100

101101
### Increasing number of tokens locked
102-
```
102+
```solidity
103103
/**
104104
* @dev Increase number of tokens locked for a specified reason
105105
* @param _reason The reason to lock tokens
@@ -108,7 +108,7 @@ function totalBalanceOf(address _of) view returns (uint256 amount)
108108
function increaseLockAmount(bytes32 _reason, uint256 _amount) public returns (bool)
109109
```
110110
### Fetching number of unlockable tokens under each utility
111-
```
111+
```solidity
112112
/**
113113
* @dev Returns unlockable tokens for a specified address for a specified reason
114114
* @param _of The address to query the the unlockable token count of
@@ -117,15 +117,15 @@ function totalBalanceOf(address _of) view returns (uint256 amount)
117117
function tokensUnlockable(address _of, bytes32 _reason) public view returns (uint256 amount)
118118
```
119119
### Fetching number of unlockable tokens
120-
```
120+
```solidity
121121
/**
122122
* @dev Gets the unlockable tokens of a specified address
123123
* @param _of The address to query the the unlockable token count of
124124
*/
125125
function getUnlockableTokens(address _of) public view returns (uint256 unlockableTokens)
126126
```
127127
### Unlocking tokens
128-
```
128+
```solidity
129129
/**
130130
* @dev Unlocks the unlockable tokens of a specified address
131131
* @param _of Address of user, claiming back unlockable tokens

EIPS/eip-137.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ Resolving a name in ENS is a two-step process. First, the ENS registry is called
5353

5454
For example, suppose you wish to find the address of the token contract associated with 'beercoin.eth'. First, get the resolver:
5555

56-
```
56+
```javascript
5757
var node = namehash("beercoin.eth");
5858
var resolver = ens.resolver(node);
5959
```
6060

6161
Then, ask the resolver for the address for the contract:
6262

63-
```
63+
```javascript
6464
var address = resolver.addr(node);
6565
```
6666

@@ -112,43 +112,43 @@ Implementations should conform to the following test vectors for namehash:
112112

113113
The ENS registry contract exposes the following functions:
114114

115-
```
115+
```solidity
116116
function owner(bytes32 node) constant returns (address);
117117
```
118118

119119
Returns the owner (registrar) of the specified node.
120120

121-
```
121+
```solidity
122122
function resolver(bytes32 node) constant returns (address);
123123
```
124124

125125
Returns the resolver for the specified node.
126126

127-
```
127+
```solidity
128128
function ttl(bytes32 node) constant returns (uint64);
129129
```
130130

131131
Returns the time-to-live (TTL) of the node; that is, the maximum duration for which a node's information may be cached.
132132

133-
```
133+
```solidity
134134
function setOwner(bytes32 node, address owner);
135135
```
136136

137137
Transfers ownership of a node to another registrar. This function may only be called by the current owner of `node`. A successful call to this function logs the event `Transfer(bytes32 indexed, address)`.
138138

139-
```
139+
```solidity
140140
function setSubnodeOwner(bytes32 node, bytes32 label, address owner);
141141
```
142142

143143
Creates a new node, `sha3(node, label)` and sets its owner to `owner`, or updates the node with a new owner if it already exists. This function may only be called by the current owner of `node`. A successful call to this function logs the event `NewOwner(bytes32 indexed, bytes32 indexed, address)`.
144144

145-
```
145+
```solidity
146146
function setResolver(bytes32 node, address resolver);
147147
```
148148

149149
Sets the resolver address for `node`. This function may only be called by the owner of `node`. A successful call to this function logs the event `NewResolver(bytes32 indexed, address)`.
150150

151-
```
151+
```solidity
152152
function setTTL(bytes32 node, uint64 ttl);
153153
```
154154

@@ -159,7 +159,7 @@ Resolvers may implement any subset of the record types specified here. Where a r
159159

160160
Resolvers have one mandatory function:
161161

162-
```
162+
```solidity
163163
function supportsInterface(bytes4 interfaceID) constant returns (bool)
164164
```
165165

@@ -184,7 +184,7 @@ EIPs may define new interfaces to be added to this registry.
184184

185185
Resolvers wishing to support contract address resources must provide the following function:
186186

187-
```
187+
```solidity
188188
function addr(bytes32 node) constant returns (address);
189189
```
190190

@@ -194,12 +194,12 @@ Clients resolving the `addr` record MUST check for a zero return value, and trea
194194

195195
Changes to an address MUST trigger the following event:
196196

197-
```
197+
```solidity
198198
event AddrChanged(bytes32 indexed node, address a);
199199
```
200200
# Appendix A: Registry Implementation
201201

202-
```
202+
```solidity
203203
contract ENS {
204204
struct Record {
205205
address owner;
@@ -261,7 +261,7 @@ contract ENS {
261261

262262
The simplest possible resolver is a contract that acts as its own name resolver by implementing the contract address resource profile:
263263

264-
```
264+
```solidity
265265
contract DoSomethingUseful {
266266
// Other code
267267
@@ -285,7 +285,7 @@ Such a contract can be inserted directly into the ENS registry, eliminating the
285285

286286
A basic resolver that implements the contract address profile, and allows only its owner to update records:
287287

288-
```
288+
```solidity
289289
contract Resolver {
290290
event AddrChanged(bytes32 indexed node, address a);
291291
@@ -325,7 +325,7 @@ After deploying this contract, use it by updating the ENS registry to reference
325325

326326
Similar to the resolver above, this contract only supports the contract address profile, but uses the ENS registry to determine who should be allowed to update entries:
327327

328-
```
328+
```solidity
329329
contract PublicResolver {
330330
event AddrChanged(bytes32 indexed node, address a);
331331
event ContentChanged(bytes32 indexed node, bytes32 hash);
@@ -364,7 +364,7 @@ contract PublicResolver {
364364

365365
This registrar allows users to register names at no cost if they are the first to request them.
366366

367-
```
367+
```solidity
368368
contract FIFSRegistrar {
369369
ENS ens;
370370
bytes32 rootNode;

EIPS/eip-1386.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The wine vendors smart contract validates the attestation, checks the payment am
4040
When the wine vendor shows up to her apartment with the wine, there is no need to prove her age again.
4141

4242
### Draft interface
43-
```
43+
```solidity
4444
/* each attestation issuer should provide their own verify() for the
4545
* attestations they issued. There are two reasons for this. First, we
4646
* need to leave room for new attestation methods other than the

EIPS/eip-1387.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Unlike previous attempts, we assume that the attestation is signed and issued of
2121
This ERC provides an interface and reference implementation for smart contracts that need users to provide an attestation and validate it.
2222

2323
### Draft implementation
24-
```
24+
```solidity
2525
contract MerkleTreeAttestationInterface {
2626
struct Attestation
2727
{

EIPS/eip-1388.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Anyone can publish a list of issuers. Only the most trusted and carefully mainta
2121
This ERC provides a smart contract interface for anyone to manage a list of attestation issuers. A smart contract would explicitly trust a list, and therefore all attestations issued by the issuers on the list.
2222

2323
### Draft implementation
24-
```
24+
```solidity
2525
/* The purpose of this contract is to manage the list of attestation
2626
* issuer contracts and their capacity to fulfill requirements
2727
*/

EIPS/eip-1450.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ For compliance reasons, the `ERC-1450` constructor must specify the issuer (the
5252
### ERC-20 Extension
5353
`ERC-20` tokens provide the following functionality:
5454

55-
```
55+
```solidity
5656
contract ERC20 {
5757
function totalSupply() public view returns (uint256);
5858
function balanceOf(address who) public view returns (uint256);
@@ -67,7 +67,7 @@ contract ERC20 {
6767

6868
`ERC-20` is extended as follows:
6969

70-
```
70+
```solidity
7171
/**
7272
* ERC-1450 is an ERC-20 compatible token that facilitates compliance with one or more of Securities Act Regulations CF, D and A.
7373
*

EIPS/eip-1485.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ FNV Mix Algorithm Analysis for TEthashV1
132132
You can compile it with simple in terminal.
133133
No additional library needs,
134134

135-
```
135+
```sh
136136
gcc -o fnvtest fnvcltest.c
137137
```
138138

EIPS/eip-1491.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The BDI software model is an attempt to solve a problem of plans and planning ch
4141

4242

4343
#### Main Interface
44-
```
44+
```solidity
4545
pragma solidity ^0.4.25;
4646
pragma experimental ABIEncoderV2;
4747
@@ -327,7 +327,7 @@ interface IERC_HUCAP {
327327

328328
<!--The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Ethereum platforms (go-ethereum, parity, cpp-ethereum, ethereumj, ethereumjs, and [others](https://github.com/ethereum/wiki/wiki/Clients)).-->
329329

330-
```
330+
```solidity
331331
332332
interface IERC_HUCAP_TYPES {
333333
@@ -359,7 +359,7 @@ interface IERC_HUCAP_TYPES {
359359

360360
<!--The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Ethereum platforms (go-ethereum, parity, cpp-ethereum, ethereumj, ethereumjs, and [others](https://github.com/ethereum/wiki/wiki/Clients)).-->
361361

362-
```
362+
```solidity
363363
pragma solidity ^0.4.25;
364364
pragma experimental ABIEncoderV2;
365365
@@ -451,7 +451,7 @@ interface IERC_HUCAP_KEYSIGNING_EXTENSION {
451451
```
452452
#### Human Capital Accounting Extension Interface
453453

454-
```
454+
```solidity
455455
pragma solidity ^0.4.25;
456456
pragma experimental ABIEncoderV2;
457457

EIPS/eip-1504.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Below is the specification of Handler interface. In the Handler interface we def
5151
Developers have to define their business-related functions as well.
5252

5353

54-
```
54+
```solidity
5555
/// Handler interface.
5656
/// Handler defines business related functions.
5757
/// Use the interface to ensure that your external services are always supported.
@@ -105,7 +105,7 @@ Below is the specification of Data contract. There are three parts in the Data c
105105
- **Resource Data**: all other resources that the contract needs to keep and manage.
106106

107107

108-
```
108+
```solidity
109109
/// Data Contract
110110
contract DataContract {
111111
@@ -236,7 +236,7 @@ Note:
236236
- Function status() can be called at any time to show caller status of the upgrader.
237237

238238

239-
```
239+
```solidity
240240
/// Handler upgrader
241241
contract Upgrader {
242242
// Data contract

0 commit comments

Comments
 (0)