Skip to content

Commit

Permalink
Some fixes setting osm mom and pip whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
gbalabasquer committed Mar 23, 2020
1 parent 37514e2 commit 4ad52d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
6 changes: 2 additions & 4 deletions libexec/setters/set-ilks-osm-mom
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ for token in $tokens; do
sethSend "$OSM_MOM" 'setOsm(bytes32,address)' "$(seth --to-bytes32 "$(seth --from-ascii "${token}-${ilk}")")" "$(eval echo "\$PIP_${token}")"
done
# Rely OsmMom in OSM only if DEPLOYER has permission to do it
if [[ "$(seth call "$(eval echo "\$PIP_${token}")" 'wards(address)(uint256)' "$ETH_FROM" | sed 's/^0*//')" == 1 ]]; then
for ilk in $ilks; do
sethSend "$(eval echo "\$PIP_${token}")" 'rely(address)' "$OSM_MOM"
done
if [[ "$(seth call "$(eval echo "\$PIP_${token}")" 'wards(address)(uint256)' "$ETH_FROM")" == 1 ]]; then
sethSend "$(eval echo "\$PIP_${token}")" 'rely(address)' "$OSM_MOM"
fi
fi
done
Expand Down
19 changes: 11 additions & 8 deletions libexec/setters/set-ilks-pip-whitelist
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ log "SET ILKS PIP WHITELIST:"

tokens=$(jq -r ".tokens | keys_unsorted[]" "$CONFIG_FILE")
for token in $tokens; do
pipAddr=$(jq -r ".tokens.${token} | .import.pip | values" "$CONFIG_FILE")
type=$(jq -r ".tokens.${token} | .pipDeploy | .type | values" "$CONFIG_FILE")
if [[ "$pipAddr" != "" || "$type" == "median" ]]; then
# Whitelist Spotter in OSM or in Median only if DEPLOYER has permission to do it
if [[ "$(seth call "$(eval echo "\$PIP_${token}")" 'wards(address)(uint256)' "$ETH_FROM" | sed 's/^0*//')" == 1 ]]; then
sethSend "$(eval echo "\$PIP_${token}")" 'kiss(address)' "$MCD_SPOT"
sethSend "$(eval echo "\$PIP_${token}")" 'kiss(address)' "$MCD_END"
fi
# Check if ETH_FROM is relied or $PIP_${token} doesn't have a wards system
set +e; RELIED=$(seth call "$(eval echo "\$PIP_${token}")" 'wards(address)(uint256)' "$ETH_FROM" 2>/dev/null); set -e

# "" : Doesn't have wards system
# "0": Has wards system and ETH_FROM is not relied
# "1": Has wards system and ETH_FROM is relied

if [[ "$RELIED" == "1" ]]; then
# Whitelist Spotter in PIP (OSM or Median)
sethSend "$(eval echo "\$PIP_${token}")" 'kiss(address)' "$MCD_SPOT"
sethSend "$(eval echo "\$PIP_${token}")" 'kiss(address)' "$MCD_END"
fi
done

0 comments on commit 4ad52d4

Please sign in to comment.