Commit 44e8c095 authored by Will Cory's avatar Will Cory

code golf to one function

parent d5bf9d20
...@@ -50,22 +50,6 @@ contract AttestationStation is Semver { ...@@ -50,22 +50,6 @@ contract AttestationStation is Semver {
constructor() Semver(0, 0, 1) {} constructor() Semver(0, 0, 1) {}
/**
* @notice Attest to the given data.
* @dev Attests to the given data from the sender.
* @param _about The address of the attestation subject.
* @param _key The key of the attestation.
* @param _val The value of the attestation.
*/
function _attest(
address _about,
bytes32 _key,
bytes memory _val
) private {
attestations[msg.sender][_about][_key] = _val;
emit AttestationCreated(msg.sender, _about, _key, _val);
}
/** /**
* @notice Attest to the given data. * @notice Attest to the given data.
* @dev Attests to the given data from the sender. * @dev Attests to the given data from the sender.
...@@ -74,7 +58,14 @@ contract AttestationStation is Semver { ...@@ -74,7 +58,14 @@ contract AttestationStation is Semver {
function attest(AttestationData[] memory _attestations) public { function attest(AttestationData[] memory _attestations) public {
uint256 length = _attestations.length; uint256 length = _attestations.length;
for (uint256 i = 0; i < length; ) { for (uint256 i = 0; i < length; ) {
_attest(_attestations[i].about, _attestations[i].key, _attestations[i].val); AttestationData memory attestation = _attestations[i];
attestations[msg.sender][attestation.about][attestation.key] = attestation.val;
emit AttestationCreated(
msg.sender,
attestation.about,
attestation.key,
attestation.val
);
unchecked { unchecked {
++i; ++i;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment