Skip to content

Commit

Permalink
* feat: add dcl known functions to @radspec helper (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
nachomazzara authored and sohkai committed Jan 23, 2020
1 parent e306a11 commit debb71c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/data/decentraland/knownFunctions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
'setOwnerCutPerMillion(uint256)': 'Set marketplace fees to `$1 / 1000000`%',
'transferMarketplaceOwnership(address)':
'Transfer ownership of the marketplace to `$1`',
'transferOwnership(address)': 'Transfer ownership of the contract to `$1`',
'pause()': 'Pause contract',
'unpause()': 'Unpause Contract`'
}
7 changes: 7 additions & 0 deletions src/data/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import dclKnownFunctions from './decentraland/knownFunctions'
import baseKnownFunctions from './knownFunctions'

export const knownFunctions = {
...dclKnownFunctions,
...baseKnownFunctions
}
2 changes: 1 addition & 1 deletion src/helpers/radspec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ABI from 'web3-eth-abi'
import { keccak256 } from 'web3-utils'
import MethodRegistry from './lib/methodRegistry'
import { evaluateRaw } from '../lib/'
import knownFunctions from '../data/knownFunctions'
import { knownFunctions } from '../data/'

const makeUnknownFunctionNode = (methodId) => ({
type: 'string',
Expand Down
7 changes: 7 additions & 0 deletions test/examples/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ const dataDecodeCases = [
data: bytes('0x6881385b') // payday(), on knownFunctions
}
}, 'Payroll: Get owed Payroll allowance!'],
[{
source: 'Decentraland: `@radspec(addr, data)`',
bindings: {
addr: address(),
data: bytes('0x1206dc5f00000000000000000000000031ab1f92344e3277ce9404e4e097dab7514e6d27') // transferMarketplaceOwnership(), on decentraland's knownFunctions
}
}, 'Decentraland: Transfer ownership of the marketplace to 0x31AB1f92344e3277ce9404E4e097dab7514E6D27'],
[{
source: 'Transfer: `@radspec(addr, data)`',
bindings: {
Expand Down

0 comments on commit debb71c

Please sign in to comment.