Skip to content

Commit

Permalink
Merge pull request #186 from JoinColony/fix/minor-loader-changes
Browse files Browse the repository at this point in the history
Minor loader changes
  • Loading branch information
JamesLefrere committed Jun 15, 2018
2 parents cf7f1e1 + 6f3e971 commit fa2f2ec
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs/_API_ColonyClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ Sets the payout given to the MANAGER role when the task is finalized. This Sende
|Argument|Type|Description|
|---|---|---|
|taskId|number|Integer taskId.|
|source|Payable address|ddress to send funds from, e.g. the token's contract address, or empty address (`0x0` for Ether)|
|source|Payable address|Address to send funds from, e.g. the token's contract address, or empty address (`0x0` for Ether)|
|amount|BigNumber|Amount to be paid.|

**Returns**
Expand Down
2 changes: 1 addition & 1 deletion docs/_Docs_GetStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Save the file, and run with `$ node example.js` - You should see your new cool c


## Funding your Colony
Whether you've brought your ERC20 token from an existing token contract or created a new one at the same time as the colony (as shown in the above example), you can use the [tokenClient](/colonyJS/api-tokenclient/) to call and sent transactions relating to your colony's funding. This client handles all the functions in the ERC20 standard interface, as well as `mint` and `burn`. Functions that would ordinarily be performed by the contract owner may be performed by anyone in the colony with ADMIN authority. You can learn more about authority roles in the [authorityClient API](/docs-authorityclient/).
Whether you've brought your ERC20 token from an existing token contract or created a new one at the same time as the colony (as shown in the above example), you can use the [tokenClient](/colonyJS/api-tokenclient/) to call and sent transactions relating to your colony's funding. This client handles all the functions in the ERC20 standard interface, as well as `mint` and `burn`. Functions that would ordinarily be performed by the contract owner may be performed by anyone in the colony with ADMIN authority. You can learn more about authority roles in the [authorityClient API](/colonyJS/api-authorityclient/).

Your colony's token is an important component in the [reputation system](/colonyNetwork/docs-reputation/). Any task payouts in the native token of the colony grant the recipient reputation (proportional to the task rating). Any member of the colony's combined reputation and token holdings determine the amount they can claim from the [rewards pot](/colonyNetwork/docs-pots-and-funding/).

Expand Down
2 changes: 1 addition & 1 deletion packages/colony-js-contract-loader/src/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
// eslint-disable-next-line import/prefer-default-export
export const DEFAULT_REQUIRED_CONTRACT_PROPS = {
abi: true,
address: true,
address: false,
bytecode: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
export type Query = {
contractAddress?: string,
contractName?: string,
networkId?: number,
routerAddress?: string,
routerName?: string,
version?: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* @flow */

import type { Query } from '../interface/ContractLoader';

type TruffleArtifact = {
abi: Array<{}>,
bytecode: string,
Expand All @@ -12,23 +10,15 @@ type TruffleArtifact = {
},
};

export default function truffleTransform(
{ abi = [], bytecode, networks = {} }: TruffleArtifact = {},
{ networkId }: Query = {},
) {
let address;

export default function truffleTransform({
abi = [],
bytecode,
networks = {},
}: TruffleArtifact = {}) {
const networkIds = Object.keys(networks);

if (networkId && networkIds.length) {
if (!networks[networkId])
throw new Error(`Network ID ${networkId} not found in contract`);
({ address } = networks[networkId]);
} else {
// Pick the last network (assumed to be the most recent)
({ address } =
networks[parseInt(networkIds[networkIds.length - 1], 10)] || {});
}
// Pick the last network (assumed to be the most recent)
const { address } =
networks[parseInt(networkIds[networkIds.length - 1], 10)] || {};

return {
abi,
Expand Down

0 comments on commit fa2f2ec

Please sign in to comment.