# Placeholder contract addresses in source code

**URL:** <https://forum.flow.com/t/placeholder-contract-addresses-in-source-code/2139>\
**Category:** 🛠 Developer Tools\
**Created:** [June 29, 2021, 7:57pm UTC](https://forum.flow.com/t/placeholder-contract-addresses-in-source-code/2139 "2021-06-29T19:57:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aphelionz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/aphelionz/32/493_2.png) [@aphelionz](https://forum.flow.com/u/aphelionz)\
**Post date:** [June 29, 2021, 7:57pm UTC](https://forum.flow.com/t/placeholder-contract-addresses-in-source-code/2139/1 "2021-06-29T19:57:50Z")

</div>

This question is about how to represent token addresses in source code.

We’re trying to make sure my project is organized and can be easily used by the Flow CLI, the Go SDK, and Flow FCL. We want our project to be testable on the emulator and testnet with minimal duplicate code.

A main challenge is the contract addresses in the .cdc files themselves, which seem to be handled slightly differently across the tooling.

### Go SDK

Right now, Go has been the focus so we’ve been using templates, as below, and then injecting the right address to e.g. run a script.

```auto
import ExampleToken from 0x{{.ExampleToken}}

```

### Flow FCL

FCL handles this for you provides a very nice feature via config, that automatically transliterates something like `0xEXAMPLETOKEN` into the correct address.

From the config section of the [Flow FCL tutorial](https://docs.onflow.org/flow-js-sdk/flow-app-quickstart/#configuration):

```auto
import {config} from "@onflow/fcl"

config()
  .put("0xProfile", process.env.REACT_APP_CONTRACT_PROFILE)

```

The core contracts also seem to [follow this model](https://github.com/onflow/flow-core-contracts/blob/ab9fccdc7204968fc943db418e145a5a9638faeb/contracts/FlowFees.cdc#L1), with some [helper functions](https://github.com/onflow/flow-core-contracts/blob/ab9fccdc7204968fc943db418e145a5a9638faeb/lib/go/templates/templates.go#L50) around the templates.

### Flow CLI

Finally, the Flow CLI upon deployment and compilation seems to take filesystem paths and then transliterate them based on the contents of the `flow.json` file and its own internal bookkeeping of addresses.

```auto
import FungibleToken from "./FungibleToken.cdc"
import ExampleToken from "./ExampleToken.cdc"

```

So, in the code above, it seems like the flow CLI:

1. Reads the `contracts.FungibleToken.alias` from `flow.json` for the first line
2. Deploys `./ExampleToken.cdc`, stores the address in memory, and then uses that when compiling the final contract.

If there’s something consistent we can do, or even just a planned standard to work _towards_, we can build the extra tooling needed on our end to support it.

Thank you!

---

<div class="post-metadata">

**Author:** ![pete](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/pete/32/191_2.png) [@pete](https://forum.flow.com/u/pete)\
**Post date:** [June 30, 2021, 5:12am UTC](https://forum.flow.com/t/placeholder-contract-addresses-in-source-code/2139/2 "2021-06-30T05:12:00Z")

</div>

Hey @aphelionz, I’m actually really glad you brought this up!

The standard I’d like to work towards is the pattern currently used by the Flow CLI, simply because it allows the developer to write their Cadence source files in a way that feels natural – import your local dependencies by their filesystem path.

However, it’s missing an elegant solution for external dependencies and currently requires you to copy all external contracts (e.g. `FungibleToken.cdc`) into your project. This is also required to get the VS Code editor to parse files correctly, since it also doesn’t support remote file imports.

Would you be interested in helping us bring this functionality to the Go SDK? The core logic is implemented as part of the `flowkit/contracts` package in the CLI: [https://github.com/onflow/flow-cli/blob/master/pkg/flowkit/contracts/resolver.go](https://github.com/onflow/flow-cli/blob/master/pkg/flowkit/contracts/resolver.go)

---

<div class="post-metadata">

**Author:** ![aphelionz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/aphelionz/32/493_2.png) [@aphelionz](https://forum.flow.com/u/aphelionz)\
**Post date:** [June 30, 2021, 2:35pm UTC](https://forum.flow.com/t/placeholder-contract-addresses-in-source-code/2139/3 "2021-06-30T14:35:29Z")

</div>

Definitely would be interested in helping out. Taking a closer look today and then let’s discuss further.
