gnosis / dex-contracts

Smart contracts for the Gnosis Protocol v1
https://docs.gnosis.io/protocol/
GNU Lesser General Public License v3.0
98 stars 36 forks source link

[Easy] Linking Library to contract deploys contract #80

Closed bh2smith closed 5 years ago

bh2smith commented 5 years ago

In the following migration script, there is no need to keep line 9 (since the linking somehow deploys the contract to the same address as the Library).

https://github.com/gnosis/dex-contracts/blob/40fdaaf32ecb6370f070691340270a040d2523a6/migrations/3_batch_auction.js#L6-L12

This could equivalently be migrated as

module.exports = function (deployer) {
  deployer.deploy(BiMap).then(() => {
    deployer.link(BiMap, SnappAuction)
  })
}
fleupold commented 5 years ago

I wonder if creating a PR that fixes this, would take roughly the same time as creating this issue 😉

bh2smith commented 5 years ago

Actually, it turns out, we need to do something like the following (in order for SnappAuction to be deployed)

module.exports = function (deployer) {
  deployer.deploy(BiMap)
  deployer.link(BiMap, SnappAuction)
  deployer.deploy(SnappAuction) 
}