github.com/ethereum/go-ethereum@v1.16.1/accounts/abi/abigen/testdata/v2/crowdsale.go.txt (about) 1 // Code generated via abigen V2 - DO NOT EDIT. 2 // This file is a generated binding and any manual changes will be lost. 3 4 package bindtests 5 6 import ( 7 "bytes" 8 "errors" 9 "math/big" 10 11 "github.com/ethereum/go-ethereum/accounts/abi" 12 "github.com/ethereum/go-ethereum/accounts/abi/bind/v2" 13 "github.com/ethereum/go-ethereum/common" 14 "github.com/ethereum/go-ethereum/core/types" 15 ) 16 17 // Reference imports to suppress errors if they are not otherwise used. 18 var ( 19 _ = bytes.Equal 20 _ = errors.New 21 _ = big.NewInt 22 _ = common.Big1 23 _ = types.BloomLookup 24 _ = abi.ConvertType 25 ) 26 27 // CrowdsaleMetaData contains all meta data concerning the Crowdsale contract. 28 var CrowdsaleMetaData = bind.MetaData{ 29 ABI: "[{\"constant\":false,\"inputs\":[],\"name\":\"checkGoalReached\",\"outputs\":[],\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"deadline\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"beneficiary\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"tokenReward\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"fundingGoal\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"amountRaised\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"price\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"funders\",\"outputs\":[{\"name\":\"addr\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"}],\"type\":\"function\"},{\"inputs\":[{\"name\":\"ifSuccessfulSendTo\",\"type\":\"address\"},{\"name\":\"fundingGoalInEthers\",\"type\":\"uint256\"},{\"name\":\"durationInMinutes\",\"type\":\"uint256\"},{\"name\":\"etherCostOfEachToken\",\"type\":\"uint256\"},{\"name\":\"addressOfTokenUsedAsReward\",\"type\":\"address\"}],\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"backer\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"isContribution\",\"type\":\"bool\"}],\"name\":\"FundTransfer\",\"type\":\"event\"}]", 30 ID: "84d7e935785c5c648282d326307bb8fa0d", 31 Bin: "0x606060408190526007805460ff1916905560a0806105a883396101006040529051608051915160c05160e05160008054600160a060020a03199081169095178155670de0b6b3a7640000958602600155603c9093024201600355930260045560058054909216909217905561052f90819061007990396000f36060604052361561006c5760e060020a600035046301cb3b20811461008257806329dcb0cf1461014457806338af3eed1461014d5780636e66f6e91461015f5780637a3a0e84146101715780637b3e5e7b1461017a578063a035b1fe14610183578063dc0d3dff1461018c575b61020060075460009060ff161561032357610002565b61020060035460009042106103205760025460015490106103cb576002548154600160a060020a0316908290606082818181858883f150915460025460408051600160a060020a039390931683526020830191909152818101869052517fe842aea7a5f1b01049d752008c53c52890b1a6daf660cf39e8eec506112bbdf6945090819003909201919050a15b60405160008054600160a060020a039081169230909116319082818181858883f150506007805460ff1916600117905550505050565b6103a160035481565b6103ab600054600160a060020a031681565b6103ab600554600160a060020a031681565b6103a160015481565b6103a160025481565b6103a160045481565b6103be60043560068054829081101561000257506000526002027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f8101547ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d409190910154600160a060020a03919091169082565b005b505050815481101561000257906000526020600020906002020160005060008201518160000160006101000a815481600160a060020a030219169083021790555060208201518160010160005055905050806002600082828250540192505081905550600560009054906101000a9004600160a060020a0316600160a060020a031663a9059cbb3360046000505484046040518360e060020a0281526004018083600160a060020a03168152602001828152602001925050506000604051808303816000876161da5a03f11561000257505060408051600160a060020a03331681526020810184905260018183015290517fe842aea7a5f1b01049d752008c53c52890b1a6daf660cf39e8eec506112bbdf692509081900360600190a15b50565b5060a0604052336060908152346080819052600680546001810180835592939282908280158290116102025760020281600202836000526020600020918201910161020291905b8082111561039d57805473ffffffffffffffffffffffffffffffffffffffff19168155600060019190910190815561036a565b5090565b6060908152602090f35b600160a060020a03166060908152602090f35b6060918252608052604090f35b5b60065481101561010e576006805482908110156100025760009182526002027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0190600680549254600160a060020a0316928490811015610002576002027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d40015460405190915082818181858883f19350505050507fe842aea7a5f1b01049d752008c53c52890b1a6daf660cf39e8eec506112bbdf660066000508281548110156100025760008290526002027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f01548154600160a060020a039190911691908490811015610002576002027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d40015460408051600160a060020a0394909416845260208401919091526000838201525191829003606001919050a16001016103cc56", 32 } 33 34 // Crowdsale is an auto generated Go binding around an Ethereum contract. 35 type Crowdsale struct { 36 abi abi.ABI 37 } 38 39 // NewCrowdsale creates a new instance of Crowdsale. 40 func NewCrowdsale() *Crowdsale { 41 parsed, err := CrowdsaleMetaData.ParseABI() 42 if err != nil { 43 panic(errors.New("invalid ABI: " + err.Error())) 44 } 45 return &Crowdsale{abi: *parsed} 46 } 47 48 // Instance creates a wrapper for a deployed contract instance at the given address. 49 // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. 50 func (c *Crowdsale) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { 51 return bind.NewBoundContract(addr, c.abi, backend, backend, backend) 52 } 53 54 // PackConstructor is the Go binding used to pack the parameters required for 55 // contract deployment. 56 // 57 // Solidity: constructor(address ifSuccessfulSendTo, uint256 fundingGoalInEthers, uint256 durationInMinutes, uint256 etherCostOfEachToken, address addressOfTokenUsedAsReward) returns() 58 func (crowdsale *Crowdsale) PackConstructor(ifSuccessfulSendTo common.Address, fundingGoalInEthers *big.Int, durationInMinutes *big.Int, etherCostOfEachToken *big.Int, addressOfTokenUsedAsReward common.Address) []byte { 59 enc, err := crowdsale.abi.Pack("", ifSuccessfulSendTo, fundingGoalInEthers, durationInMinutes, etherCostOfEachToken, addressOfTokenUsedAsReward) 60 if err != nil { 61 panic(err) 62 } 63 return enc 64 } 65 66 // PackAmountRaised is the Go binding used to pack the parameters required for calling 67 // the contract method with ID 0x7b3e5e7b. This method will panic if any 68 // invalid/nil inputs are passed. 69 // 70 // Solidity: function amountRaised() returns(uint256) 71 func (crowdsale *Crowdsale) PackAmountRaised() []byte { 72 enc, err := crowdsale.abi.Pack("amountRaised") 73 if err != nil { 74 panic(err) 75 } 76 return enc 77 } 78 79 // TryPackAmountRaised is the Go binding used to pack the parameters required for calling 80 // the contract method with ID 0x7b3e5e7b. This method will return an error 81 // if any inputs are invalid/nil. 82 // 83 // Solidity: function amountRaised() returns(uint256) 84 func (crowdsale *Crowdsale) TryPackAmountRaised() ([]byte, error) { 85 return crowdsale.abi.Pack("amountRaised") 86 } 87 88 // UnpackAmountRaised is the Go binding that unpacks the parameters returned 89 // from invoking the contract method with ID 0x7b3e5e7b. 90 // 91 // Solidity: function amountRaised() returns(uint256) 92 func (crowdsale *Crowdsale) UnpackAmountRaised(data []byte) (*big.Int, error) { 93 out, err := crowdsale.abi.Unpack("amountRaised", data) 94 if err != nil { 95 return new(big.Int), err 96 } 97 out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) 98 return out0, nil 99 } 100 101 // PackBeneficiary is the Go binding used to pack the parameters required for calling 102 // the contract method with ID 0x38af3eed. This method will panic if any 103 // invalid/nil inputs are passed. 104 // 105 // Solidity: function beneficiary() returns(address) 106 func (crowdsale *Crowdsale) PackBeneficiary() []byte { 107 enc, err := crowdsale.abi.Pack("beneficiary") 108 if err != nil { 109 panic(err) 110 } 111 return enc 112 } 113 114 // TryPackBeneficiary is the Go binding used to pack the parameters required for calling 115 // the contract method with ID 0x38af3eed. This method will return an error 116 // if any inputs are invalid/nil. 117 // 118 // Solidity: function beneficiary() returns(address) 119 func (crowdsale *Crowdsale) TryPackBeneficiary() ([]byte, error) { 120 return crowdsale.abi.Pack("beneficiary") 121 } 122 123 // UnpackBeneficiary is the Go binding that unpacks the parameters returned 124 // from invoking the contract method with ID 0x38af3eed. 125 // 126 // Solidity: function beneficiary() returns(address) 127 func (crowdsale *Crowdsale) UnpackBeneficiary(data []byte) (common.Address, error) { 128 out, err := crowdsale.abi.Unpack("beneficiary", data) 129 if err != nil { 130 return *new(common.Address), err 131 } 132 out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) 133 return out0, nil 134 } 135 136 // PackCheckGoalReached is the Go binding used to pack the parameters required for calling 137 // the contract method with ID 0x01cb3b20. This method will panic if any 138 // invalid/nil inputs are passed. 139 // 140 // Solidity: function checkGoalReached() returns() 141 func (crowdsale *Crowdsale) PackCheckGoalReached() []byte { 142 enc, err := crowdsale.abi.Pack("checkGoalReached") 143 if err != nil { 144 panic(err) 145 } 146 return enc 147 } 148 149 // TryPackCheckGoalReached is the Go binding used to pack the parameters required for calling 150 // the contract method with ID 0x01cb3b20. This method will return an error 151 // if any inputs are invalid/nil. 152 // 153 // Solidity: function checkGoalReached() returns() 154 func (crowdsale *Crowdsale) TryPackCheckGoalReached() ([]byte, error) { 155 return crowdsale.abi.Pack("checkGoalReached") 156 } 157 158 // PackDeadline is the Go binding used to pack the parameters required for calling 159 // the contract method with ID 0x29dcb0cf. This method will panic if any 160 // invalid/nil inputs are passed. 161 // 162 // Solidity: function deadline() returns(uint256) 163 func (crowdsale *Crowdsale) PackDeadline() []byte { 164 enc, err := crowdsale.abi.Pack("deadline") 165 if err != nil { 166 panic(err) 167 } 168 return enc 169 } 170 171 // TryPackDeadline is the Go binding used to pack the parameters required for calling 172 // the contract method with ID 0x29dcb0cf. This method will return an error 173 // if any inputs are invalid/nil. 174 // 175 // Solidity: function deadline() returns(uint256) 176 func (crowdsale *Crowdsale) TryPackDeadline() ([]byte, error) { 177 return crowdsale.abi.Pack("deadline") 178 } 179 180 // UnpackDeadline is the Go binding that unpacks the parameters returned 181 // from invoking the contract method with ID 0x29dcb0cf. 182 // 183 // Solidity: function deadline() returns(uint256) 184 func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) { 185 out, err := crowdsale.abi.Unpack("deadline", data) 186 if err != nil { 187 return new(big.Int), err 188 } 189 out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) 190 return out0, nil 191 } 192 193 // PackFunders is the Go binding used to pack the parameters required for calling 194 // the contract method with ID 0xdc0d3dff. This method will panic if any 195 // invalid/nil inputs are passed. 196 // 197 // Solidity: function funders(uint256 ) returns(address addr, uint256 amount) 198 func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte { 199 enc, err := crowdsale.abi.Pack("funders", arg0) 200 if err != nil { 201 panic(err) 202 } 203 return enc 204 } 205 206 // TryPackFunders is the Go binding used to pack the parameters required for calling 207 // the contract method with ID 0xdc0d3dff. This method will return an error 208 // if any inputs are invalid/nil. 209 // 210 // Solidity: function funders(uint256 ) returns(address addr, uint256 amount) 211 func (crowdsale *Crowdsale) TryPackFunders(arg0 *big.Int) ([]byte, error) { 212 return crowdsale.abi.Pack("funders", arg0) 213 } 214 215 // FundersOutput serves as a container for the return parameters of contract 216 // method Funders. 217 type FundersOutput struct { 218 Addr common.Address 219 Amount *big.Int 220 } 221 222 // UnpackFunders is the Go binding that unpacks the parameters returned 223 // from invoking the contract method with ID 0xdc0d3dff. 224 // 225 // Solidity: function funders(uint256 ) returns(address addr, uint256 amount) 226 func (crowdsale *Crowdsale) UnpackFunders(data []byte) (FundersOutput, error) { 227 out, err := crowdsale.abi.Unpack("funders", data) 228 outstruct := new(FundersOutput) 229 if err != nil { 230 return *outstruct, err 231 } 232 outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) 233 outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int) 234 return *outstruct, nil 235 } 236 237 // PackFundingGoal is the Go binding used to pack the parameters required for calling 238 // the contract method with ID 0x7a3a0e84. This method will panic if any 239 // invalid/nil inputs are passed. 240 // 241 // Solidity: function fundingGoal() returns(uint256) 242 func (crowdsale *Crowdsale) PackFundingGoal() []byte { 243 enc, err := crowdsale.abi.Pack("fundingGoal") 244 if err != nil { 245 panic(err) 246 } 247 return enc 248 } 249 250 // TryPackFundingGoal is the Go binding used to pack the parameters required for calling 251 // the contract method with ID 0x7a3a0e84. This method will return an error 252 // if any inputs are invalid/nil. 253 // 254 // Solidity: function fundingGoal() returns(uint256) 255 func (crowdsale *Crowdsale) TryPackFundingGoal() ([]byte, error) { 256 return crowdsale.abi.Pack("fundingGoal") 257 } 258 259 // UnpackFundingGoal is the Go binding that unpacks the parameters returned 260 // from invoking the contract method with ID 0x7a3a0e84. 261 // 262 // Solidity: function fundingGoal() returns(uint256) 263 func (crowdsale *Crowdsale) UnpackFundingGoal(data []byte) (*big.Int, error) { 264 out, err := crowdsale.abi.Unpack("fundingGoal", data) 265 if err != nil { 266 return new(big.Int), err 267 } 268 out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) 269 return out0, nil 270 } 271 272 // PackPrice is the Go binding used to pack the parameters required for calling 273 // the contract method with ID 0xa035b1fe. This method will panic if any 274 // invalid/nil inputs are passed. 275 // 276 // Solidity: function price() returns(uint256) 277 func (crowdsale *Crowdsale) PackPrice() []byte { 278 enc, err := crowdsale.abi.Pack("price") 279 if err != nil { 280 panic(err) 281 } 282 return enc 283 } 284 285 // TryPackPrice is the Go binding used to pack the parameters required for calling 286 // the contract method with ID 0xa035b1fe. This method will return an error 287 // if any inputs are invalid/nil. 288 // 289 // Solidity: function price() returns(uint256) 290 func (crowdsale *Crowdsale) TryPackPrice() ([]byte, error) { 291 return crowdsale.abi.Pack("price") 292 } 293 294 // UnpackPrice is the Go binding that unpacks the parameters returned 295 // from invoking the contract method with ID 0xa035b1fe. 296 // 297 // Solidity: function price() returns(uint256) 298 func (crowdsale *Crowdsale) UnpackPrice(data []byte) (*big.Int, error) { 299 out, err := crowdsale.abi.Unpack("price", data) 300 if err != nil { 301 return new(big.Int), err 302 } 303 out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) 304 return out0, nil 305 } 306 307 // PackTokenReward is the Go binding used to pack the parameters required for calling 308 // the contract method with ID 0x6e66f6e9. This method will panic if any 309 // invalid/nil inputs are passed. 310 // 311 // Solidity: function tokenReward() returns(address) 312 func (crowdsale *Crowdsale) PackTokenReward() []byte { 313 enc, err := crowdsale.abi.Pack("tokenReward") 314 if err != nil { 315 panic(err) 316 } 317 return enc 318 } 319 320 // TryPackTokenReward is the Go binding used to pack the parameters required for calling 321 // the contract method with ID 0x6e66f6e9. This method will return an error 322 // if any inputs are invalid/nil. 323 // 324 // Solidity: function tokenReward() returns(address) 325 func (crowdsale *Crowdsale) TryPackTokenReward() ([]byte, error) { 326 return crowdsale.abi.Pack("tokenReward") 327 } 328 329 // UnpackTokenReward is the Go binding that unpacks the parameters returned 330 // from invoking the contract method with ID 0x6e66f6e9. 331 // 332 // Solidity: function tokenReward() returns(address) 333 func (crowdsale *Crowdsale) UnpackTokenReward(data []byte) (common.Address, error) { 334 out, err := crowdsale.abi.Unpack("tokenReward", data) 335 if err != nil { 336 return *new(common.Address), err 337 } 338 out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) 339 return out0, nil 340 } 341 342 // CrowdsaleFundTransfer represents a FundTransfer event raised by the Crowdsale contract. 343 type CrowdsaleFundTransfer struct { 344 Backer common.Address 345 Amount *big.Int 346 IsContribution bool 347 Raw *types.Log // Blockchain specific contextual infos 348 } 349 350 const CrowdsaleFundTransferEventName = "FundTransfer" 351 352 // ContractEventName returns the user-defined event name. 353 func (CrowdsaleFundTransfer) ContractEventName() string { 354 return CrowdsaleFundTransferEventName 355 } 356 357 // UnpackFundTransferEvent is the Go binding that unpacks the event data emitted 358 // by contract. 359 // 360 // Solidity: event FundTransfer(address backer, uint256 amount, bool isContribution) 361 func (crowdsale *Crowdsale) UnpackFundTransferEvent(log *types.Log) (*CrowdsaleFundTransfer, error) { 362 event := "FundTransfer" 363 if log.Topics[0] != crowdsale.abi.Events[event].ID { 364 return nil, errors.New("event signature mismatch") 365 } 366 out := new(CrowdsaleFundTransfer) 367 if len(log.Data) > 0 { 368 if err := crowdsale.abi.UnpackIntoInterface(out, event, log.Data); err != nil { 369 return nil, err 370 } 371 } 372 var indexed abi.Arguments 373 for _, arg := range crowdsale.abi.Events[event].Inputs { 374 if arg.Indexed { 375 indexed = append(indexed, arg) 376 } 377 } 378 if err := abi.ParseTopics(out, indexed, log.Topics[1:]); err != nil { 379 return nil, err 380 } 381 out.Raw = log 382 return out, nil 383 }