Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dcl known functions to @radspec helper #87

Merged
merged 2 commits into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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