smartcontractkit / smartcontractkit/chainlink
[FEAT] Chainlink.sol: add addAddress function
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8.2k
- Forks
- 2k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 202
Description
Description
Hello,
would it make sense to have a function that allows adding an address parameter to the request?
maybe something like
function addAddress(
Request memory self,
string memory key,
address value
) internal pure {
self.buf.encodeString(key);
self.buf.encodeBytes(abi.encode(value));
}
Motivation
Make it easier for users to add addresses (abstract the internal implementation from them). Also to have one unified approach. I found 2 ways of handling addresses (see Justification ) and maybe there are other approaches as well. IMHO, having unified approaches are more maintenable on the long run
Justification
Provide a unified approach for users. I've tried 2 methods of passing addresses:
- Parsing from
addresstostringusing Openzeppelin Strings utils. :req.add('address1',Strings.toHexString(uint256(uint160(msg.sender)), 20)); abi.encode:req.addBytes('address2',abi.encode(msg.sender));
The 1st method doesn't require any work from the node operator (except cbor decoding). The 2nd method requires an extra abi decoding:
decode [type="ethabidecode"
abi="address address"
data="$(decode_cbor.address)"]
IMHO, I would prefer the second method as it clears for everyone that we are handling addresses.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Chainlink.sol and compare the proposed addAddress helper with the existing addBytes usage shown in the issue. Check how request parameters are encoded and confirm that callers can pass an address through one unified helper using the described ABI encoding. Done means the helper is available with the requested signature and its encoded address can be consumed like the existing request values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- blockchain
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100